Introduce LocalGame logic and integrate with LocalMode rendering.
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import Field from '@/components/game/Field.vue'
|
||||
import { ref } from 'vue'
|
||||
import type { FieldSize } from '@/scripts/interfaces/FieldSize.ts'
|
||||
import LocalGame from '@/scripts/logic/localMode/LocalGame.ts'
|
||||
|
||||
let gameField = [
|
||||
[0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 2, 1],
|
||||
[1, 0, 1, 0, 0, 1, 1],
|
||||
[1, 0, 2, 0, 1, 2, 2],
|
||||
[1, 1, 2, 1, 2, 1, 2],
|
||||
]
|
||||
const gameFieldSize: FieldSize = {
|
||||
x: 7,
|
||||
y: 6,
|
||||
}
|
||||
|
||||
let currentSelection = ref(null)
|
||||
|
||||
setInterval(() => {
|
||||
console.log(currentSelection.value)
|
||||
}, 1000)
|
||||
const game = ref(new LocalGame(gameFieldSize))
|
||||
const currentSelection = ref(null)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Field :game-state="gameField" v-model:current-selection-index="currentSelection" ></Field>
|
||||
<Field
|
||||
v-model:current-selection-index="currentSelection"
|
||||
:gameState="game.field"
|
||||
@clickOnGameField="game.place(currentSelection)"
|
||||
></Field>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user