Commit 9de15aad authored by 任建锋's avatar 任建锋

change scene module

parent 64f4746d
{
"name": "sl",
"version": "1.0.3",
"description": "基于babylonjs的活动组件",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"scripts": {
},
"author": "",
"license": "ISC",
"dependencies": {
"yt": "git+ssh://git@gitlab2.dui88.com:renjianfeng/yt.git",
"tw": "git+ssh://git@gitlab2.dui88.com:clq/tw.git#1.0"
}
}
\ No newline at end of file
import {Module} from "yt";
import {SceneManager} from "yt";
import {ModuleManager} from "yt";
import {YtModuleName} from "yt";
import {YtLang} from "yt";
import {ModuleName} from "../../enum/ModuleName";
import { GamePlayModel } from "tw";
export class GameSceneModule extends Module{
/**
* 是否校验积分
*/
protected checkScore: boolean;
/**
* 数据
*/
protected model: GamePlayModel;
protected initModel(): void {
this.model = new GamePlayModel();
}
/**
* 扩展数据
* */
protected other: any;
protected score=0;
//销毁
public dispose(){
var j;
for(j in this.display){
console.log(this.display[j])
if( this.display[j]){
this.display[j].dispose()
}
}
}
public show(){
this.resetGame()
SceneManager.ins.change(this.display);
}
protected resetGame(){
this.model.update();
}
protected gameOver(): void {
this.removeEvent();
//将最高纪录缓存
this.enableMouseEvt(false);
this.removeEvent();
this.model.cacheMaxScore(this.score);
this.model.submit(this.submit_result.bind(this), this.score);
}
/**
* 更新游戏积分
* @param type 1 增加, 2 简少, 3重置
* @param score 分值
*/
protected updateScore(type: number, score: number): void {
if (type == 1) {
this.score += score;
} else if (type == 2) {
this.score -= score;
this.score = Math.max(0, this.score);
} else {
this.score = score;
}
this.datapash();
}
/**
* 阶段性提交
*/
protected datapash(): void {
if (this.model.checkDatapash(this.score)) {
this.model.datapash();
}
}
protected submit_result(): void {
let moduleName: string;
if (this.model.gameIsWinning) {
moduleName = ModuleName.GAME_WIN_PANEL;
} else {
moduleName = ModuleName.GAME_LOSE_PANEL;
}
ModuleManager.ins.openModule(moduleName);
this.enableMouseEvt(true);
}
/**
* 导入外部网格
* @param importMeshes 网格资源列表
* @param onSuccess 成功回调
*/
protected ImportMeshes(importMeshes,onSuccess){
ModuleManager.ins.openModule(YtModuleName.WAITING_PANEL,YtLang.lang_004);
var _length=importMeshes.length;
var _meshes=[]
var _skeletons=[]
var _loadCount=0;
importMeshes.forEach((list)=>{
BABYLON.SceneLoader.ImportMesh(
"",
list.rootUrl,
list.sceneFilename,
SceneManager.ins.scene,
(_mesh,_skeleton)=> {
try {
_meshes.push(_mesh)
_skeletons.push(_skeleton)
_loadCount++
if(_loadCount==_length){
setTimeout(()=>{
ModuleManager.ins.closeModule(YtModuleName.WAITING_PANEL);
},100)
//ModuleManager.ins.openModule(ModuleName.GAME_PLAY_GUI);
onSuccess(_meshes,_skeletons)
}
} catch (e) {
console.error(e)
}
}
);
})
}
}
\ No newline at end of file
......@@ -107,8 +107,10 @@ var GameSceneModule = /** @class */ (function (_super) {
_skeletons.push(_skeleton);
_loadCount++;
if (_loadCount == _length) {
yt_3.ModuleManager.ins.closeModule(yt_4.YtModuleName.WAITING_PANEL);
yt_3.ModuleManager.ins.openModule(ModuleName_1.ModuleName.GAME_PLAY_GUI);
setTimeout(function () {
yt_3.ModuleManager.ins.closeModule(yt_4.YtModuleName.WAITING_PANEL);
}, 100);
//ModuleManager.ins.openModule(ModuleName.GAME_PLAY_GUI);
onSuccess(_meshes, _skeletons);
}
}
......
{"version":3,"file":"GameSceneModule.js","sourceRoot":"","sources":["../../../src/module/game/GameSceneModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAA0B;AAC1B,yBAAgC;AAChC,yBAAiC;AACjC,yBAAgC;AAChC,yBAA0B;AAC1B,oDAAiD;AACjD,yBAAmC;AAEnC;IAAqC,mCAAM;IAA3C;QAAA,qEA6HC;QAxGa,WAAK,GAAC,CAAC,CAAC;;IAwGtB,CAAC;IAlHa,mCAAS,GAAnB;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,kBAAa,EAAE,CAAC;IACrC,CAAC;IAUD,IAAI;IACG,iCAAO,GAAd;QACI,IAAI,C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E,OAAO,EAAC;wBACnB,kBAAa,CAAC,GAAG,CAAC,WAAW,CAAC,iBAAY,CAAC,aAAa,CAAC,CAAC;wBAC1D,kBAAa,CAAC,GAAG,CAAC,UAAU,CAAC,uBAAU,CAAC,aAAa,CAAC,CAAC;wBACvD,SAAS,CAAC,OAAO,EAAC,UAAU,CAAC,CAAA;qBAChC;iBACJ;gBAAC,OAAO,CAAC,EAAE;oBACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;iBACnB;YACL,CAAC,CACJ,CAAC;QACN,CAAC,CAAC,CAAA;IACN,CAAC;IAEL,sBAAC;AAAD,CAAC,AA7HD,CAAqC,WAAM,GA6H1C;AA7HY,0CAAe"}
\ No newline at end of file
{"version":3,"file":"GameSceneModule.js","sourceRoot":"","sources":["../../../src/module/game/GameSceneModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAA0B;AAC1B,yBAAgC;AAChC,yBAAiC;AACjC,yBAAgC;AAChC,yBAA0B;AAC1B,oDAAiD;AACjD,yBAAmC;AAEnC;IAAqC,mCAAM;IAA3C;QAAA,qEA+HC;QA1Ga,WAAK,GAAC,CAAC,CAAC;;IA0GtB,CAAC;IApHa,mCAAS,GAAnB;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,kBAAa,EAAE,CAAC;IACrC,CAAC;IAUD,IAAI;IACG,iCAAO,GAAd;QACI,IAAI,CAAC,CAAC;QACN,KAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAC;YAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;YAC5B,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC;gBAChB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;aAC5B;SACJ;IACL,CAAC;IAEM,8BAAI,GAAX;QACI,IAAI,CAAC,SAAS,EAAE,CAAA;QAChB,iBAAY,CAAC,GAAG,CAA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L,sBAAC;AAAD,CAAC,AA/HD,CAAqC,WAAM,GA+H1C;AA/HY,0CAAe"}
\ No newline at end of file
{
"name": "sl",
"version": "1.0.2",
"version": "1.0.3",
"description": "基于babylonjs的活动组件",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
......
......@@ -119,8 +119,10 @@ export class GameSceneModule extends Module{
_skeletons.push(_skeleton)
_loadCount++
if(_loadCount==_length){
ModuleManager.ins.closeModule(YtModuleName.WAITING_PANEL);
ModuleManager.ins.openModule(ModuleName.GAME_PLAY_GUI);
setTimeout(()=>{
ModuleManager.ins.closeModule(YtModuleName.WAITING_PANEL);
},100)
//ModuleManager.ins.openModule(ModuleName.GAME_PLAY_GUI);
onSuccess(_meshes,_skeletons)
}
} catch (e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment