mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
update: hint reassign, UI
This commit is contained in:
1 parent
764f558307
commit
2fc9784477
4 files changed
+46
-77
No files matched your search
@@ -1,15 +1,20 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import sessionManager from '../utils/session'
|
import sessionManager from '../utils/session'
|
||||||
|
|
||||||
const current = ref(1)
|
const current = ref(-1)
|
||||||
|
watch(sessionManager.hints, (hints) => {
|
||||||
|
current.value = hints.length - 1
|
||||||
|
})
|
||||||
|
|
||||||
const left = () => {
|
const left = () => {
|
||||||
if (current.value > 1) {
|
if (current.value > 0) {
|
||||||
current.value -= 1
|
current.value -= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const right = () => {
|
const right = () => {
|
||||||
if (current.value < sessionManager.hints.value.length) {
|
if (current.value < sessionManager.hints.value.length - 1) {
|
||||||
current.value += 1
|
current.value += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,29 +27,41 @@ const right = () => {
|
|||||||
class="text-yellow-200 p-2"
|
class="text-yellow-200 p-2"
|
||||||
/>
|
/>
|
||||||
<h1 class="inline text-text font-xl w-7/12 p-2 m-1">Hint</h1>
|
<h1 class="inline text-text font-xl w-7/12 p-2 m-1">Hint</h1>
|
||||||
<button class="p-2 m-1 w-1/7" id="Lbutton" @click="left">
|
<div v-if="current !== -1">
|
||||||
<font-awesome-icon
|
<button
|
||||||
:icon="['fas', 'arrow-right']"
|
class="p-2 m-1 w-1/8"
|
||||||
style="color: #deddda"
|
id="Lbutton"
|
||||||
rotation="180"
|
@click="left"
|
||||||
/>
|
:disabled="current <= 0"
|
||||||
</button>
|
>
|
||||||
<p class="inline text-text font-xl w-1/14 p-2 m-1">{{ current }}</p>
|
<font-awesome-icon
|
||||||
<p class="inline text-text font-xl w-1/14 p-2 m-1">/</p>
|
:icon="['fas', 'arrow-right']"
|
||||||
<p class="inline text-text font-xl w-1/14 p-2 m-1">
|
style="color: #deddda"
|
||||||
{{ sessionManager.hints.value.length }}
|
rotation="180"
|
||||||
</p>
|
/>
|
||||||
<button class="p-2 m-1 w-1/7" id="Rbutton" @click="right">
|
</button>
|
||||||
<font-awesome-icon
|
<p class="inline text-text font-xl w-1/14 p-2 m-1">{{ current + 1 }}</p>
|
||||||
:icon="['fas', 'arrow-right']"
|
<p class="inline text-text font-xl w-1/14 p-2 m-1">/</p>
|
||||||
style="color: #deddda"
|
<p class="inline text-text font-xl w-1/14 p-2 m-1">
|
||||||
/>
|
{{ sessionManager.hints.value.length }}
|
||||||
</button>
|
</p>
|
||||||
|
<button
|
||||||
|
class="p-2 m-1 w-1/8"
|
||||||
|
id="Rbutton"
|
||||||
|
@click="right"
|
||||||
|
:disabled="current === sessionManager.hints.value.length - 1"
|
||||||
|
>
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'arrow-right']"
|
||||||
|
style="color: #deddda"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="hint" class="bg-background flex flex-wrap">
|
<div id="hint" class="bg-background flex flex-wrap">
|
||||||
<div class="bg-background h-full rounded-lg p-8 m-1">
|
<div class="bg-background h-full rounded-lg p-8 m-1">
|
||||||
<p class="inline text-text font-xl font-xl">
|
<p class="inline text-text font-xl font-xl">
|
||||||
{{ sessionManager.hints.value[current - 1] }}
|
{{ sessionManager.hints.value[current] }}
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-1
@@ -12,6 +12,7 @@ import {
|
|||||||
faTerminal,
|
faTerminal,
|
||||||
faArrowRotateLeft,
|
faArrowRotateLeft,
|
||||||
faArrowRightFromBracket,
|
faArrowRightFromBracket,
|
||||||
|
faArrowRight,
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -33,5 +34,6 @@ library.add(
|
|||||||
faArrowRotateLeft,
|
faArrowRotateLeft,
|
||||||
faCircleRight,
|
faCircleRight,
|
||||||
faTerminal,
|
faTerminal,
|
||||||
faArrowRightFromBracket
|
faArrowRightFromBracket,
|
||||||
|
faArrowRight
|
||||||
)
|
)
|
||||||
+2
-52
@@ -1,61 +1,11 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
|
||||||
import './style.css'
|
import './style.css'
|
||||||
|
|
||||||
/* import the fontawesome core */
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
||||||
|
|
||||||
/* import font awesome icon component */
|
/* import font awesome icon component */
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
||||||
|
import './library'
|
||||||
/* import specific icons */
|
|
||||||
import {
|
|
||||||
faBars,
|
|
||||||
faArrowLeft,
|
|
||||||
faList,
|
|
||||||
faGear,
|
|
||||||
faTriangleExclamation,
|
|
||||||
faExpand,
|
|
||||||
faTerminal,
|
|
||||||
faArrowRotateLeft,
|
|
||||||
faArrowRight,
|
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
|
||||||
|
|
||||||
import {
|
|
||||||
faLightbulb,
|
|
||||||
faCircleQuestion,
|
|
||||||
faCircleRight,
|
|
||||||
} from '@fortawesome/free-regular-svg-icons'
|
|
||||||
|
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import GamePage from './views/GamePage.vue'
|
import router from './router'
|
||||||
import AuthPage from './views/AuthPage.vue'
|
|
||||||
|
|
||||||
/* add icons to the library */
|
|
||||||
library.add(
|
|
||||||
faBars,
|
|
||||||
faArrowLeft,
|
|
||||||
faTriangleExclamation,
|
|
||||||
faGear,
|
|
||||||
faExpand,
|
|
||||||
faList,
|
|
||||||
faLightbulb,
|
|
||||||
faCircleQuestion,
|
|
||||||
faArrowRotateLeft,
|
|
||||||
faCircleRight,
|
|
||||||
faTerminal,
|
|
||||||
faArrowRight
|
|
||||||
)
|
|
||||||
|
|
||||||
const routes = [
|
|
||||||
{ path: '/', name: 'Home', component: AuthPage },
|
|
||||||
{ path: '/game', name: 'Game', component: GamePage },
|
|
||||||
]
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: createWebHistory(),
|
|
||||||
routes,
|
|
||||||
})
|
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class SessionManager {
|
|||||||
|
|
||||||
handleHintUpdate(event) {
|
handleHintUpdate(event) {
|
||||||
console.log(event)
|
console.log(event)
|
||||||
this.hints.value.push(...event)
|
this.hints.value = [...this.hints.value, ...event]
|
||||||
}
|
}
|
||||||
|
|
||||||
setTasks(tasks) {
|
setTasks(tasks) {
|
||||||
|
|||||||
Reference in new issue
Block a user