Commit 22e0cbad authored by 任建锋's avatar 任建锋

rjf

parent d6f02c6e
{
"name": "sl",
"version": "1.0.7",
"description": "基于babylonjs的活动组件",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"scripts": {
},
"author": "",
"license": "ISC",
"dependencies": {
"duiba-yt": "git+ssh://git@gitlab2.dui88.com:renjianfeng/yt.git",
"duiba-tw": "git+ssh://git@gitlab2.dui88.com:clq/tw.git#1.0",
"duiba-tc": "git+ssh://git@gitlab2.dui88.com:clq/tc.git#1.0"
}
}
\ No newline at end of file
import {YtModule} from "duiba-yt";
import {YtSceneManager} from "duiba-yt";
import {YtModuleManager} from "duiba-yt";
import {YtModuleName} from "duiba-yt";
import {YtLang} from "duiba-yt";
import {SlModuleName} from "../../enum/SlModuleName";
import { GamePlayModel } from "duiba-tw";
export class SlGameSceneModule extends YtModule{
/**
* 是否校验积分
*/
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()
YtSceneManager.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 = SlModuleName.GAME_WIN_PANEL;
} else {
moduleName = SlModuleName.GAME_LOSE_PANEL;
}
YtModuleManager.ins.openModule(moduleName);
this.enableMouseEvt(true);
}
/**
* 导入外部网格
* @param importMeshes 网格资源列表
* @param onSuccess 成功回调
*/
protected ImportMeshes(importMeshes,onSuccess){
var _length=importMeshes.length;
var _meshes=[]
var _skeletons=[]
var _loadCount=0;
importMeshes.forEach((list)=>{
BABYLON.SceneLoader.ImportMesh(
"",
list.rootUrl,
list.sceneFilename,
YtSceneManager.ins.scene,
(_mesh,_skeleton)=> {
try {
_meshes.push(_mesh)
_skeletons.push(_skeleton)
_loadCount++
if(_loadCount==_length){
onSuccess(_meshes,_skeletons)
}
} catch (e) {
console.error(e)
}
}
);
})
}
}
\ No newline at end of file
...@@ -13,8 +13,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); ...@@ -13,8 +13,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
var duiba_yt_1 = require("duiba-yt"); var duiba_yt_1 = require("duiba-yt");
var duiba_yt_2 = require("duiba-yt"); var duiba_yt_2 = require("duiba-yt");
var duiba_yt_3 = require("duiba-yt"); var duiba_yt_3 = require("duiba-yt");
var duiba_yt_4 = require("duiba-yt");
var duiba_yt_5 = require("duiba-yt");
var SlModuleName_1 = require("../../enum/SlModuleName"); var SlModuleName_1 = require("../../enum/SlModuleName");
var duiba_tw_1 = require("duiba-tw"); var duiba_tw_1 = require("duiba-tw");
var SlGameSceneModule = /** @class */ (function (_super) { var SlGameSceneModule = /** @class */ (function (_super) {
...@@ -95,7 +93,6 @@ var SlGameSceneModule = /** @class */ (function (_super) { ...@@ -95,7 +93,6 @@ var SlGameSceneModule = /** @class */ (function (_super) {
* @param onSuccess 成功回调 * @param onSuccess 成功回调
*/ */
SlGameSceneModule.prototype.ImportMeshes = function (importMeshes, onSuccess) { SlGameSceneModule.prototype.ImportMeshes = function (importMeshes, onSuccess) {
duiba_yt_3.YtModuleManager.ins.openModule(duiba_yt_4.YtModuleName.WAITING_PANEL, duiba_yt_5.YtLang.lang_004);
var _length = importMeshes.length; var _length = importMeshes.length;
var _meshes = []; var _meshes = [];
var _skeletons = []; var _skeletons = [];
...@@ -107,10 +104,6 @@ var SlGameSceneModule = /** @class */ (function (_super) { ...@@ -107,10 +104,6 @@ var SlGameSceneModule = /** @class */ (function (_super) {
_skeletons.push(_skeleton); _skeletons.push(_skeleton);
_loadCount++; _loadCount++;
if (_loadCount == _length) { if (_loadCount == _length) {
setTimeout(function () {
duiba_yt_3.YtModuleManager.ins.closeModule(duiba_yt_4.YtModuleName.WAITING_PANEL);
}, 100);
//ModuleManager.ins.openModule(ModuleName.GAME_PLAY_GUI);
onSuccess(_meshes, _skeletons); onSuccess(_meshes, _skeletons);
} }
} }
......
{"version":3,"file":"SlGameSceneModule.js","sourceRoot":"","sources":["../../../src/module/game/SlGameSceneModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkC;AAClC,qCAAwC;AACxC,qCAAyC;AACzC,qCAAsC;AACtC,qCAAgC;AAChC,wDAAqD;AACrD,qCAAyC;AAEzC;IAAuC,qCAAQ;IAA/C;QAAA,qEA+HC;QA1Ga,WAAK,GAAC,CAAC,CAAC;;IA0GtB,CAAC;IApHa,qCAAS,GAAnB;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,wBAAa,EAAE,CAAC;IACrC,CAAC;IAUD,IAAI;IACG,mCAAO,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,gCAAI,GAAX;QACI,IAAI,CAAC,SAAS,EAAE,CAAA;QAChB,yBAAc,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,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O,CAAC,UAAC,IAAI;YACtB,OAAO,CAAC,WAAW,CAAC,UAAU,CAC1B,EAAE,EACF,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,aAAa,EAClB,yBAAc,CAAC,GAAG,CAAC,KAAK,EACxB,UAAC,KAAK,EAAC,SAAS;gBACZ,IAAI;oBACA,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;oBACnB,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;oBAC1B,UAAU,EAAE,CAAA;oBACZ,IAAG,UAAU,IAAE,OAAO,EAAC;wBACnB,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,wBAAC;AAAD,CAAC,AA1HD,CAAuC,mBAAQ,GA0H9C;AA1HY,8CAAiB"}
\ No newline at end of file \ No newline at end of file
{ {
"name": "sl", "name": "sl",
"version": "1.0.6", "version": "1.0.7",
"description": "基于babylonjs的活动组件", "description": "基于babylonjs的活动组件",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",
......
...@@ -102,7 +102,6 @@ export class SlGameSceneModule extends YtModule{ ...@@ -102,7 +102,6 @@ export class SlGameSceneModule extends YtModule{
* @param onSuccess 成功回调 * @param onSuccess 成功回调
*/ */
protected ImportMeshes(importMeshes,onSuccess){ protected ImportMeshes(importMeshes,onSuccess){
YtModuleManager.ins.openModule(YtModuleName.WAITING_PANEL,YtLang.lang_004);
var _length=importMeshes.length; var _length=importMeshes.length;
var _meshes=[] var _meshes=[]
var _skeletons=[] var _skeletons=[]
...@@ -119,10 +118,6 @@ export class SlGameSceneModule extends YtModule{ ...@@ -119,10 +118,6 @@ export class SlGameSceneModule extends YtModule{
_skeletons.push(_skeleton) _skeletons.push(_skeleton)
_loadCount++ _loadCount++
if(_loadCount==_length){ if(_loadCount==_length){
setTimeout(()=>{
YtModuleManager.ins.closeModule(YtModuleName.WAITING_PANEL);
},100)
//ModuleManager.ins.openModule(ModuleName.GAME_PLAY_GUI);
onSuccess(_meshes,_skeletons) onSuccess(_meshes,_skeletons)
} }
} catch (e) { } 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