diff --git a/components/CardPreview.vue b/components/CardPreview.vue index 3155e5a..7f9cf39 100644 --- a/components/CardPreview.vue +++ b/components/CardPreview.vue @@ -8,32 +8,71 @@ const props = defineProps() const cards = useState<{ [key: string]: any }>('cards') +const buttonsElement = ref(null) +const rightClicked = ref(false) + function cardClick() { if (!props.data) return console.log(JSON.parse(JSON.stringify(cards.value[props.data].effects))) } + +function contextmenu(e: MouseEvent) { + if (buttonsElement.value?.childElementCount === 0) { return } + buttonsElement.value?.setAttribute("style", `top:${e.clientY + 10}px;left:${e.clientX + 10}px`) + rightClicked.value = true +} \ No newline at end of file + +.card_image.outlined { + outline: 2px solid red; + outline-offset: -2px; +} + +.card_image { + max-height: 150px; +} + +.hidden { + display: none; +} + +#contextMenu { + position: fixed; + height: 100%; + width: 100%; + top: 0; + left: 0; + /* background: rgba(0, 0, 0, .5); */ +} + +#contextMenuButtons { + position: absolute; + display: flex; + flex-direction: column; +} + diff --git a/components/CardSlot.vue b/components/CardSlot.vue index ac388bb..d338add 100644 --- a/components/CardSlot.vue +++ b/components/CardSlot.vue @@ -7,14 +7,23 @@ const props = withDefaults(defineProps(), { stack: () => [], }) +const wrapped = ref(false) + \ No newline at end of file diff --git a/components/GameBoard.vue b/components/GameBoard.vue index 577cde6..359e46f 100644 --- a/components/GameBoard.vue +++ b/components/GameBoard.vue @@ -10,7 +10,23 @@ async function buy(cardId: string) { socket.value.send(JSON.stringify({ type: "action", data_type: "buy", - data: [cardId] + data: cardId + })) +} + +async function buy_in_hand(cardId: string) { + socket.value.send(JSON.stringify({ + type: "temp_action", + data_type: "buy_in_hand", + data: cardId + })) +} + +async function buy_on_stack(cardId: string) { + socket.value.send(JSON.stringify({ + type: "temp_action", + data_type: "buy_on_stack", + data: cardId })) } @@ -33,22 +49,46 @@ async function endTurn() { market_amount = {{ props.game.market_stack?.length }}
market = - + + + +
gems = - +
- \ No newline at end of file + + + \ No newline at end of file diff --git a/components/PlayerSlot.vue b/components/PlayerSlot.vue index 9057a0c..c16ac17 100644 --- a/components/PlayerSlot.vue +++ b/components/PlayerSlot.vue @@ -6,24 +6,25 @@ const socket = useState('socket') const isTurn = computed(() => props.player.team == props.current_team) const isSelf = computed(() => props.player.uuid == self.value) +const discard_wrapped = ref(false) -async function playAllCards() { + +function playAllCards() { + props.player.hand.forEach((c: any) => { + playCard(c) + }); + +} + +function playCard(cardId: string) { socket.value.send(JSON.stringify({ type: "action", data_type: "play_cards", - data: props.player.hand + data: cardId })) } -async function playCard(cardId: string) { - socket.value.send(JSON.stringify({ - type: "action", - data_type: "play_cards", - data: [cardId] - })) -} - -async function draw() { +function draw() { socket.value.send(JSON.stringify({ type: "action", data_type: "draw", @@ -31,11 +32,42 @@ async function draw() { })) } -async function discard(cardId: string) { +function play_from_discard(cardId: string) { + socket.value.send(JSON.stringify({ + type: "temp_action", + data_type: "play_from_discard", + data: cardId + })) +} + +function discard(cardId: string) { socket.value.send(JSON.stringify({ type: "action", data_type: "discard", - data: [cardId] + data: cardId + })) +} + +function sacrifice(cardId: any) { + socket.value.send(JSON.stringify({ + type: "action", + data_type: "sacrifice", + data: cardId + })) +} + +function put_on_stack_from_discard(cardId: any) { + socket.value.send(JSON.stringify({ + type: "temp_action", + data_type: "put_on_stack_from_discard", + data: cardId + })) +} +function setHealth(event: Event) { + socket.value.send(JSON.stringify({ + type: "temp_action", + data_type: "set_health", + data: (event.target as HTMLInputElement).value })) } @@ -45,24 +77,27 @@ async function discard(cardId: string) {
YOU
username = {{ props.player.username }}
- health = {{ teams[player.team].health }} + health = + +
hand = - + +
board = - + + +
stack = @@ -70,7 +105,26 @@ async function discard(cardId: string) {
discard = - + + {{ props.player.discard_pile.length }} + + + + + + + + + + +