mirror of
https://github.com/Kugelschieber/breach.git
synced 2026-01-18 12:00:25 +00:00
Added game state to all components, renamed timeout to timeoutMilliseconds, removed score from savegame.
This commit is contained in:
60
src/App.vue
60
src/App.vue
@@ -1,18 +1,19 @@
|
||||
<template>
|
||||
<main>
|
||||
<Level :level="level" />
|
||||
<Timer :time="time" />
|
||||
<Buffer :slots="slots" :codes="codes" />
|
||||
<Matrix :size="size" :matrix="matrix" />
|
||||
<Timer />
|
||||
<Buffer />
|
||||
<Matrix />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent} from "vue";
|
||||
import {defineComponent, provide, ref, readonly} from "vue";
|
||||
import Level from "./components/Level.vue";
|
||||
import Timer from "./components/Timer.vue";
|
||||
import Buffer from "./components/Buffer.vue";
|
||||
import Matrix from "./components/Matrix.vue";
|
||||
import { Game } from "./game/Game";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -22,31 +23,36 @@
|
||||
Matrix
|
||||
},
|
||||
setup() {
|
||||
const time = new Date();
|
||||
time.setSeconds(time.getSeconds()+60);
|
||||
const game = new Game({
|
||||
matrix: [
|
||||
"AA", "BB", "CC",
|
||||
"DD", "AA", "BB",
|
||||
"CC", "DD", "AA",
|
||||
],
|
||||
sequences: [
|
||||
["AA", "CC", "DD"],
|
||||
],
|
||||
maxBufferLength: 3,
|
||||
timeoutMilliseconds: 60_000,
|
||||
});
|
||||
const level = ref(1);
|
||||
const remainingMilliseconds = ref(game.remainingMilliseconds);
|
||||
const timeoutMilliseconds = ref(game.timeoutMilliseconds);
|
||||
const maxBufferLength = ref(game.maxBufferLength);
|
||||
const buffer = ref(game.buffer);
|
||||
const sequences = ref(game.sequences);
|
||||
const size = ref(game.size);
|
||||
const matrix = ref(game.matrix);
|
||||
provide("remainingMilliseconds", readonly(remainingMilliseconds));
|
||||
provide("timeoutMilliseconds", readonly(timeoutMilliseconds));
|
||||
provide("maxBufferLength", readonly(maxBufferLength));
|
||||
provide("buffer", readonly(buffer));
|
||||
provide("sequences", readonly(sequences));
|
||||
provide("size", readonly(size));
|
||||
provide("matrix", readonly(matrix));
|
||||
|
||||
return {
|
||||
level: 5,
|
||||
time,
|
||||
slots: ["99", "E7", "AD", ""],
|
||||
codes: [
|
||||
{
|
||||
code: ["", "E7", "AD", "BD"],
|
||||
points: 100
|
||||
},
|
||||
{
|
||||
code: ["99", "E7", "AD"],
|
||||
points: 50
|
||||
}
|
||||
],
|
||||
size: 5,
|
||||
matrix: [
|
||||
"99", "E7", "AD", "99", "BD",
|
||||
"99", "BD", "99", "E7", "AD",
|
||||
"AD", "E7", "BD", "AD", "99",
|
||||
"99", "99", "BD", "E7", "AD",
|
||||
"E7", "AD", "99", "BD", "99"
|
||||
]
|
||||
level
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user