swith to the end
This commit is contained in:
@@ -24,6 +24,9 @@ export default {
|
||||
mode: 'GamePlay'
|
||||
});
|
||||
manager = await new GameManager(engine, this.id);
|
||||
manager.addEventListener('the-end', _=>{
|
||||
this.$router.push('/');
|
||||
})
|
||||
window.addEventListener('resize', this.resize);
|
||||
manager.loadScene(manager.scenarioData.scenes[0].data.id)
|
||||
},
|
||||
@@ -39,7 +42,6 @@ export default {
|
||||
},
|
||||
|
||||
methods:{
|
||||
|
||||
targetClick(e){
|
||||
engine.onClick(e, this.$refs.target);
|
||||
},
|
||||
|
||||
@@ -31,7 +31,9 @@ export default {
|
||||
},
|
||||
computed:{
|
||||
scenes(){
|
||||
return this.modelValue.__root.scenes.map(s=>({title: s.data.title, value: s.data.id}))
|
||||
let sc = this.modelValue.__root.scenes.map(s=>({title: s.data.title, value: s.data.id}))
|
||||
sc.push({title: `-- ${this.l.end} --`, value: '__end__'});
|
||||
return sc;
|
||||
},
|
||||
},
|
||||
methods:{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<g @mousedown="$emit('target', {target:vd, attrs:['x1', 'y1'], delta: true})" :class="{gameObject: true, selected}"
|
||||
v-show="showInView">
|
||||
<line :x1="vd.x1" :y1="vd.y1" :x2="parent.vd.x1" :y2="parent.vd.y1"></line>
|
||||
<svg-icon :src="`/asset/thumb/${modelValue.go||0}.webp`" :x="vd.x1" :y="vd.y1" :size="37"></svg-icon>
|
||||
<svg-icon :src="`/asset/thumb/${modelValue.go||modelValue.type}.webp`" :x="vd.x1" :y="vd.y1" :size="37"></svg-icon>
|
||||
<text :x="vd.x1" :y="vd.y1" dy="58">{{ modelValue.title }}</text>
|
||||
<image v-if="modelValue.go" href="/static/svg/play-circle.svg" width="20" class="cursor-pointer"
|
||||
:x="vd.x1 + 37 - 10" :y="vd.y1 + 37 - 10" @click="$emit('preview', modelValue.go)">
|
||||
|
||||
@@ -2,9 +2,10 @@ import { InteractiveObject } from "@/components/InteractiveObjects/InteractiveOb
|
||||
import { VideoPlayer } from '@/components/InteractiveObjects/VideoPlayer';
|
||||
import { Hero } from "./Hero";
|
||||
import { api } from "./Api";
|
||||
|
||||
class GameManager{
|
||||
import { EventManager } from "./EventManager";
|
||||
class GameManager extends EventManager{
|
||||
constructor(engine, gameData, scenarioData, opts = {}){
|
||||
super();
|
||||
this.engine = engine
|
||||
return new Promise(async (resolve, reject)=>{
|
||||
if (typeof gameData != 'object'){
|
||||
@@ -116,7 +117,11 @@ class GameManager{
|
||||
io.addEventListener('sceneSwitch', (e)=>{
|
||||
//this.scenesList = [this.scenes.find(s=>s.data.id == e.scene)]
|
||||
//switch to next scene:
|
||||
if (e.scene == '__end__'){
|
||||
this.dispatchEvent({ type: 'the-end' });
|
||||
}else{
|
||||
this.loadScene(e.scene);
|
||||
}
|
||||
iobjs.forEach(di=>di.io.dispose?.());
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ const lang = {
|
||||
sphere: 'Sphere',
|
||||
sensor: 'Sensor',
|
||||
},
|
||||
end: 'The End',
|
||||
completionPoints: 'Completion points',
|
||||
completionElements: 'Following elements should be completed',
|
||||
minActivationScore: 'Minimum level score for activation',
|
||||
@@ -205,6 +206,7 @@ const lang = {
|
||||
sphere: 'Сфера',
|
||||
sensor: 'Преминаване',
|
||||
},
|
||||
end: 'Край',
|
||||
completionPoints: 'Брой точки',
|
||||
completionElements: 'Изпълнени елементи преди активиране',
|
||||
minActivationScore: 'Минимален брой точки за активиране',
|
||||
|
||||
Reference in New Issue
Block a user