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