Commit 5ab4faf9 authored by 任建锋's avatar 任建锋

rjf

parent 11660e37
{
"name": "yt",
"version": "1.0.14",
"description": "基于Babylonjs的3D框架",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"scripts": {
},
"author": "",
"license": "ISC",
"dependencies": {
"tc": "git+ssh://git@gitlab2.dui88.com:clq/tc.git#1.0"
}
}
\ No newline at end of file
import {ResourceData} from "./interface/ResourceData";
import {fileData} from "./interface/fileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {AssetsManager} from "./manager/AssetsManager";
import {GuiManager} from "./manager/GuiManager";
import {SceneManager} from "./manager/SceneManager";
import {ModuleManager} from "./manager/ModuleManager";
import {AnimationCon} from "./others/AnimationCon";
import {AnimationGui} from "./others/AnimationGui";
import {particleCon} from "./others/particleCon";
import {GuiCreate} from "./others/GuiCreate";
import {Module} from "./module/Module";
import {DisplayPool} from "./others/DisplayPool";
import {MsgModule} from "./module/MsgModule"
import {LoadingModule} from "./module/LoadingModule";
import {WaitingModule} from "./module/WaitingModule";
import {PanelModule} from "./module/PanelModule";
export {
//UI创建和scene创建
Module,DisplayPool,MsgModule,LoadingModule,WaitingModule,PanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
AssetsManager,GuiManager,SceneManager,ModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/ResourceData";
import {fileData} from "./interface/fileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {AssetsManager} from "./manager/AssetsManager";
import {GuiManager} from "./manager/GuiManager";
import {SceneManager} from "./manager/YtSceneManager";
import {ModuleManager} from "./manager/YtModuleManager";
import {AnimationCon} from "./others/AnimationCon";
import {AnimationGui} from "./others/AnimationGui";
import {particleCon} from "./others/particleCon";
import {GuiCreate} from "./others/GuiCreate";
import {Module} from "./module/Module";
import {DisplayPool} from "./others/DisplayPool";
import {MsgModule} from "./module/MsgModule"
import {LoadingModule} from "./module/LoadingModule";
import {WaitingModule} from "./module/WaitingModule";
import {PanelModule} from "./module/PanelModule";
export {
//UI创建和scene创建
Module,DisplayPool,MsgModule,LoadingModule,WaitingModule,PanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
AssetsManager,GuiManager,SceneManager,ModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/ResourceData";
import {fileData} from "./interface/fileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {AssetsManager} from "./manager/YtAssetsManager";
import {GuiManager} from "./manager/YtGuiManager";
import {SceneManager} from "./manager/YtSceneManager";
import {ModuleManager} from "./manager/YtModuleManager";
import {AnimationCon} from "./others/AnimationCon";
import {AnimationGui} from "./others/AnimationGui";
import {particleCon} from "./others/particleCon";
import {GuiCreate} from "./others/GuiCreate";
import {Module} from "./module/Module";
import {DisplayPool} from "./others/DisplayPool";
import {MsgModule} from "./module/MsgModule"
import {LoadingModule} from "./module/LoadingModule";
import {WaitingModule} from "./module/WaitingModule";
import {PanelModule} from "./module/PanelModule";
export {
//UI创建和scene创建
Module,DisplayPool,MsgModule,LoadingModule,WaitingModule,PanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
AssetsManager,GuiManager,SceneManager,ModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/ResourceData";
import {fileData} from "./interface/fileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {AssetsManager} from "./manager/YtAssetsManager";
import {GuiManager} from "./manager/YtGuiManager";
import {SceneManager} from "./manager/YtSceneManager";
import {ModuleManager} from "./manager/YtModuleManager";
import {AnimationCon} from "./others/AnimationCon";
import {AnimationGui} from "./others/AnimationGui";
import {particleCon} from "./others/particleCon";
import {GuiCreate} from "./others/GuiCreate";
import {Module} from "./module/YtModule";
import {DisplayPool} from "./others/DisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {LoadingModule} from "./module/YtLoadingModule";
import {WaitingModule} from "./module/YtWaitingModule";
import {PanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
Module,DisplayPool,MsgModule,LoadingModule,WaitingModule,PanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
AssetsManager,GuiManager,SceneManager,ModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/ResourceData";
import {fileData} from "./interface/fileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {AnimationCon} from "./others/AnimationCon";
import {AnimationGui} from "./others/AnimationGui";
import {particleCon} from "./others/particleCon";
import {GuiCreate} from "./others/GuiCreate";
import {YtModule} from "./module/YtModule";
import {DisplayPool} from "./others/DisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,DisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/YtResourceData";
import {fileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {AnimationCon} from "./others/YtAnimationCon";
import {AnimationGui} from "./others/YtAnimationGui";
import {particleCon} from "./others/YtParticleCon";
import {GuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {DisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,DisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/YtResourceData";
import {fileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {YtAnimationCon} from "./others/YtAnimationCon";
import {YtAnimationGui} from "./others/YtAnimationGui";
import {YtParticleCon} from "./others/YtParticleCon";
import {YtGuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,DisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/YtResourceData";
import {YtFileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {YtAnimationCon} from "./others/YtAnimationCon";
import {YtAnimationGui} from "./others/YtAnimationGui";
import {YtParticleCon} from "./others/YtParticleCon";
import {YtGuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,DisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
AnimationCon,AnimationGui,particleCon,GuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/YtResourceData";
import {YtFileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {YtAnimationCon} from "./others/YtAnimationCon";
import {YtAnimationGui} from "./others/YtAnimationGui";
import {YtParticleCon} from "./others/YtParticleCon";
import {YtGuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,YtDisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
YtAnimationCon,YtAnimationGui,YtParticleCon,YtGuiCreate,
//接口
ResourceData,fileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {ResourceData} from "./interface/YtResourceData";
import {YtFileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {YtAnimationCon} from "./others/YtAnimationCon";
import {YtAnimationGui} from "./others/YtAnimationGui";
import {YtParticleCon} from "./others/YtParticleCon";
import {YtGuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,YtDisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
YtAnimationCon,YtAnimationGui,YtParticleCon,YtGuiCreate,
//接口
ResourceData,YtFileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {YtResourceData} from "./interface/YtResourceData";
import {YtFileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {YtAnimationCon} from "./others/YtAnimationCon";
import {YtAnimationGui} from "./others/YtAnimationGui";
import {YtParticleCon} from "./others/YtParticleCon";
import {YtGuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,YtDisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
YtAnimationCon,YtAnimationGui,YtParticleCon,YtGuiCreate,
//接口
ResourceData,YtFileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
import {YtResourceData} from "./interface/YtResourceData";
import {YtFileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang";
import {YtAssetsManager} from "./manager/YtAssetsManager";
import {YtGuiManager} from "./manager/YtGuiManager";
import {YtSceneManager} from "./manager/YtSceneManager";
import {YtModuleManager} from "./manager/YtModuleManager";
import {YtAnimationCon} from "./others/YtAnimationCon";
import {YtAnimationGui} from "./others/YtAnimationGui";
import {YtParticleCon} from "./others/YtParticleCon";
import {YtGuiCreate} from "./others/YtGuiCreate";
import {YtModule} from "./module/YtModule";
import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/YtMsgModule"
import {YtLoadingModule} from "./module/YtLoadingModule";
import {YtWaitingModule} from "./module/YtWaitingModule";
import {YtPanelModule} from "./module/YtPanelModule";
export {
//UI创建和scene创建
YtModule,YtDisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other
YtAnimationCon,YtAnimationGui,YtParticleCon,YtGuiCreate,
//接口
YtResourceData,YtFileData,
//枚举
YtModuleName,
//工具
YtLang,
//管理器
YtAssetsManager,YtGuiManager,YtSceneManager,YtModuleManager,
}
\ No newline at end of file
export interface YtFileData {
/**
* name
*/
name:string;
/**
* 文件路径
*/
filePath: string;
/**
* 文件名
*/
fileName: string;
}
\ No newline at end of file
export interface YtIMsgData {
/**
* 展示文案
*/
msg?: string;
/**
* 确定文案
*/
sureBtnTxt?: string;
/**
* 取消文案
*/
cancelBtnTxt?: string;
}
\ No newline at end of file
import {fileData} from "./YtFileData";
export interface ResourceData {
/**
* 二进制文件
*/
binarys:Array<fileData>;
/**
* 图片文件
*/
images: Array<fileData>;
/**
* 模型文件
*/
models: Array<fileData>;
/**
* 贴图文件
*/
textures: Array<fileData>;
/**
* 环境天空盒子
*/
cubeTextures: Array<fileData>;
}
\ No newline at end of file
import {YtFileData} from "./YtFileData";
export interface ResourceData {
/**
* 二进制文件
*/
binarys:Array<YtFileData>;
/**
* 图片文件
*/
images: Array<YtFileData>;
/**
* 模型文件
*/
models: Array<YtFileData>;
/**
* 贴图文件
*/
textures: Array<YtFileData>;
/**
* 环境天空盒子
*/
cubeTextures: Array<YtFileData>;
}
\ No newline at end of file
import {YtFileData} from "./YtFileData";
export interface YtResourceData {
/**
* 二进制文件
*/
binarys:Array<YtFileData>;
/**
* 图片文件
*/
images: Array<YtFileData>;
/**
* 模型文件
*/
models: Array<YtFileData>;
/**
* 贴图文件
*/
textures: Array<YtFileData>;
/**
* 环境天空盒子
*/
cubeTextures: Array<YtFileData>;
}
\ No newline at end of file
//import {ResourceCon} from "../resource/resource";
export class YtAssetsManager {
private _resourceData;
private _resourceObject:object;
private static instance: YtAssetsManager;
public static get ins(): YtAssetsManager {
if (!this.instance) {
this.instance = new YtAssetsManager();
}
return this.instance;
}
constructor(){
//this._resourceData=ResourceCon.ins.resource;
this._resourceObject={
binarys:{},
images:{},
models:{},
textures:{},
cubeTextures:{}
}
}
public set resourceData(resource){
this._resourceData=resource;
}
public loadFile(sceneNames:Array<string>,scene,callback,progress){
let assetsManager = new BABYLON.AssetsManager(scene);
assetsManager.useDefaultLoadingScreen = false;
sceneNames.forEach(function(sceneName){
//加载模型
var _thisModel={}
this._resourceData[sceneName].models.forEach(function(model){
let meshTask = assetsManager.addMeshTask(
"skull task",
"",
model.filePath,
model.fileName
);
meshTask.onSuccess = function (task) {
console.log("meshTask")
console.log(task)
task.loadedMeshes.forEach(function(mesh){
mesh.isVisible=false;
mesh.name="noneisVisible_"+mesh;
})
let _thisMesh=task;
_thisModel[model.name]=_thisMesh
this._resourceObject.models[sceneName]=_thisModel;
}.bind(this)
}.bind(this))
//加载图片
var _thisImage={}
this._resourceData[sceneName].images.forEach(function(image){
let imageTask = assetsManager.addImageTask(
"image task",
image.filePath+image.fileName,
);
imageTask.onSuccess = function (task) {
_thisImage[image.name]=task.image
this._resourceObject.images[sceneName]=_thisImage;
}.bind(this)
}.bind(this))
//加载贴图
var _thisTexture={}
this._resourceData[sceneName].textures.forEach(function(texture){
let textureTask = assetsManager.addTextureTask(
"texture task",
texture.filePath+texture.fileName,
);
textureTask.onSuccess = function (task) {
_thisTexture[texture.name]=task.texture
this._resourceObject.textures[sceneName]=_thisTexture;
}.bind(this)
}.bind(this))
//加载二进制文件
var _thisBinary={}
this._resourceData[sceneName].binarys.forEach(function(binary){
let binaryTask = assetsManager.addBinaryFileTask(
"binary task",
binary.filePath+binary.fileName,
);
binaryTask.onSuccess = function (task) {
console.log(6666677)
console.log(task.data)
_thisBinary[binary.name]=task.data
_thisBinary[binary.name]["url"]=task.url
this._resourceObject.binarys[sceneName]=_thisBinary;
}.bind(this)
}.bind(this))
//加载天空盒子/环境贴图
var _thisCubeTexture={}
this._resourceData[sceneName].cubeTextures.forEach(function(cubeTexture){
let cubeTextureTask = assetsManager.addCubeTextureTask(
"cubeTexture task",
cubeTexture.filePath+cubeTexture.fileName,
);
cubeTextureTask.onSuccess = function (task) {
_thisCubeTexture[cubeTexture.name]=task.texture
this._resourceObject.cubeTextures[sceneName]=_thisCubeTexture;
}.bind(this)
}.bind(this))
}.bind(this))
assetsManager.load();
//加载成功一个子元素调用
assetsManager.onProgress=function(task) {
var _this={
totalTasksCount:assetsManager._totalTasksCount,
waitingTasksCount:assetsManager._waitingTasksCount,
loadCount:(assetsManager._totalTasksCount-assetsManager._waitingTasksCount)/assetsManager._totalTasksCount
}
progress(_this)
}.bind(this);
//全部加载成功调用
assetsManager.onFinish=function(task) {
callback()
}.bind(this);
}
public get resourceObject(){
return this._resourceObject;
}
}
\ No newline at end of file
// GUI
export class YtGuiManager {
private _fullscreenUI:any;
private _lastGui:any;
private guiPoll:any={};
private static instance: YtGuiManager;
public static get ins(): YtGuiManager {
if (!this.instance) {
this.instance = new YtGuiManager();
}
return this.instance;
}
constructor(){
this._lastGui=null;
this._fullscreenUI=BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("GUI");
this._fullscreenUI.idealWidth=750;
}
public changeGui(gui,...args){
var _length=this._fullscreenUI.rootContainer.children.length
for(var i=0;i<_length;i++){
this._fullscreenUI.removeControl(this._fullscreenUI.rootContainer.children[0])
}
this._fullscreenUI.addControl(gui)
this._lastGui=gui
}
public appendGui(gui,...args){
this._fullscreenUI.addControl(gui)
this._lastGui=gui
}
public removeGui(gui,...args){
this._fullscreenUI.removeControl(this._lastGui)
}
public removeAll(gui,...args){
var _length=this._fullscreenUI.rootContainer.children.length
for(var i=0;i<_length;i++){
this._fullscreenUI.removeControl(this._fullscreenUI.rootContainer.children[0])
}
}
public openPanel(gui){
}
public closePanel(gui){
}
public get fullscreenUI(){
return this._fullscreenUI;
}
public get lastGui(){
return this._lastGui;
}
}
/**
*Created by renjianfeng on 2018/2/28
*/
import {DisplayPool} from "../others/DisplayPool";
import {YtLang} from "../util/YtLang";
import { IMsgData } from './../interface/IMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(DisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: IMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: IMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
/**
*Created by renjianfeng on 2018/2/28
*/
import {DisplayPool} from "../others/YtDisplayPool";
import {YtLang} from "../util/YtLang";
import { IMsgData } from '../interface/YtIMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(DisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: IMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: IMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
/**
*Created by renjianfeng on 2018/2/28
*/
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtLang} from "../util/YtLang";
import { YtIMsgData } from '../interface/YtIMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(DisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: IMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: IMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
/**
*Created by renjianfeng on 2018/2/28
*/
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtLang} from "../util/YtLang";
import { YtIMsgData } from '../interface/YtIMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( YtDisplayPool.ins.displayPool[moduleName])
YtDisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(DisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: IMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: IMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
/**
*Created by renjianfeng on 2018/2/28
*/
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtLang} from "../util/YtLang";
import { YtIMsgData } from '../interface/YtIMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( YtDisplayPool.ins.displayPool[moduleName])
YtDisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(YtDisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( DisplayPool.ins.displayPool[moduleName])
DisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: IMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: IMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
/**
*Created by renjianfeng on 2018/2/28
*/
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtLang} from "../util/YtLang";
import { YtIMsgData } from '../interface/YtIMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( YtDisplayPool.ins.displayPool[moduleName])
YtDisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(YtDisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( YtDisplayPool.ins.displayPool[moduleName])
YtDisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: IMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: IMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
/**
*Created by renjianfeng on 2018/2/28
*/
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtLang} from "../util/YtLang";
import { YtIMsgData } from '../interface/YtIMsgData';
import { IModuleData, GConsole, ModuleType, GFun, GDispatcher, ABNetManager } from "tc";
import {YtModuleName} from "../enum/YtModuleName";
export class YtModuleManager {
//管理器单例
private static instance: YtModuleManager;
public static get ins(): YtModuleManager {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
}
/**
* 模块列表
*/
private moduleList: IModuleData[] = [];
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
public openModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( YtDisplayPool.ins.displayPool[moduleName])
YtDisplayPool.ins.displayPool[moduleName].show(...args)
}
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public getModule(moduleName: string) {
if(YtDisplayPool.ins.displayPool[moduleName]){
return moduleName
}else{
return false;
}
//return this.moduleList[moduleName];
}
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
public closeModule(moduleName:string, ...args): void {
console.log(moduleName)
console.log( YtDisplayPool.ins.displayPool[moduleName])
YtDisplayPool.ins.displayPool[moduleName].hide(...args)
}
/**
* 提示模块
*/
private msgModule: IModuleData;
/**
* 初始化
*/
public init(): void {
GDispatcher.addEvent(ABNetManager.ERROR, (msg: string) => {
// alert()
console.log("msg")
const msgData: YtIMsgData = {
msg: msg,
sureBtnTxt: YtLang.lang_011,
cancelBtnTxt: YtLang.lang_012
};
console.log(msgData)
this.openMsgModule(msgData);
}, this);
}
/**
* 打开提示模块
* @param msgData
*/
public openMsgModule(msgData: YtIMsgData): void {
this.openModule(YtModuleName.MSG_PANEL,msgData);
}
}
\ No newline at end of file
export class YtSceneManager{
public stage;
public scene:BABYLON.Scene;
public canvas;
public engine;
private static instance: YtSceneManager;
public static get ins(): YtSceneManager {
if (!this.instance) {
this.instance = new YtSceneManager();
}
return this.instance;
}
constructor(){
this.canvas = document.querySelector("#renderCanvas");
// this.engine = new BABYLON.Engine(this.canvas, true);
this.engine = new BABYLON.Engine(this.canvas, true, {
deterministicLockstep: true,
lockstepMaxSteps: 2
});
var createScene=function(){
{
var scene = new BABYLON.Scene(this.engine);
//下面的代码是为了设置微信上面的touch事件兼容
var n = scene._onPointerUp
, o = scene._onPointerDown
, r = scene._onPointerMove
, a = BABYLON.Tools.GetPointerPrefix();
this.canvas.removeEventListener(a + "move", r),
this.canvas.removeEventListener(a + "down", o),
window.removeEventListener(a + "up", n),
scene._onPointerUp = function(e) {
void 0 !== e.pointerId && n(e)
}
,
scene._onPointerDown = function(e) {
void 0 !== e.pointerId && o(e)
}
,
scene._onPointerMove = function(e) {
void 0 !== e.pointerId && r(e)
}
,
this.canvas.addEventListener(a + "move", scene._onPointerMove, !1),
this.canvas.addEventListener(a + "down", scene._onPointerDown, !1),
window.addEventListener(a + "up", scene._onPointerUp, !1);
//下面的代码是为了设置微信上面的touch事件兼容
var camera = new BABYLON.FreeCamera("baseCamera", new BABYLON.Vector3(0, 0, 0), scene);
return scene;
}
}.bind(this)
this.scene = createScene();
this.engine.runRenderLoop(function () {
this.scene.render();
TWEEN.update();
}.bind(this));
window.addEventListener("resize", function() {
this.engine.resize();
}.bind(this));
}
/* public get stage(): any {
return this._stage;
}*/
/* public get scene(): BABYLON.Scene {
return this._scene;
}
public get canvas(): any {
return this._canvas;
}
public get engine(): any {
return this._engine;
} */
public change(display){
/* console.log(display)
var i;
for(i in display){
console.log(display[i])
}*/
/* for(var l of SceneManager.ins.scene.meshes){
l.dispose()
} */
YtSceneManager.ins.scene.meshes=[]
/*var j;
for(j in SceneManager.ins.stage){
console.log(SceneManager.ins.stage[j])
if( SceneManager.ins.stage[j]){
if(SceneManager.ins.stage[j].getChildMeshes){
SceneManager.ins.stage[j].getChildMeshes(false,(child)=>{
child.dispose();
});
}
if( SceneManager.ins.stage[j].dispose){
SceneManager.ins.stage[j].dispose()
}
}
}*/
YtSceneManager.ins.stage=display;
}
/* public change(module){
// console.log(this._stage._children)
if(this.stage._children){
this.stage._children.forEach(function (child) {
this.stage.removeChild(child)
child.dispose()
}.bind(this))
}
this.stage.addChild(module)
// console.log( this._scene)
}*/
}
\ No newline at end of file
import {Module} from "./Module";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends Module {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {AnimationGui} from "../others/AnimationGui"; import {AnimationGui} from "../others/AnimationGui";
import {SceneManager} from "../manager/SceneManager"; import {SceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/GuiCreate"; import {GuiCreate} from "../others/GuiCreate";
import { YtLang } from '../util/YtLang'; import { YtLang } from '../util/YtLang';
/** /**
......
import {AnimationGui} from "../others/AnimationGui";
import {SceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/GuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {GuiManager} from "../manager/YtGuiManager";
export class Module {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(SceneManager.ins.scene,GuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
GuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
GuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {AnimationGui} from "../others/AnimationGui";
import {SceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/GuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {GuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(SceneManager.ins.scene,GuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
GuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
GuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {AnimationGui} from "../others/AnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/GuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(SceneManager.ins.scene,GuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
GuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
GuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import { GDispatcher } from "tc";
import { Module } from "./Module";
import {GuiManager} from "../manager/YtGuiManager";
export class PanelModule extends Module {
/**
* 点击关闭按钮
*/
public static CLOSE_BTN_CLICK = 'closeBtnClick';
/**
* 点击确定按钮
*/
public static SURE_BTN_CLICK = 'sureBtnClick';
/**
* 点击取消按钮
*/
public static CANCEL_BTN_CLICK = 'cancelBtnClick';
public updateData(...args): void {
}
protected addEvent(): void {
super.addEvent();
if (this.view.closeBtn) {
this.addClick(this.view.closeBtn, this.onClick_closeBtn);
}
}
/**
* 显示
*/
protected show(...args): void {
this.addEvent();
this.updateData(...args)
this.panelsAn.show(this.view.view,()=>{
this.onOpen()
},()=>{
this.onOpened()
})
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
this.panelsAn.hide(this.view.view,()=>{
this.onClose()
},()=>{
this.onClosed()
})
}
/**
* 打开前
* */
protected onOpen(...args): void{
GuiManager.ins.appendGui(this.parent);
}
/**
* 打开后
* */
protected onOpened(...args): void{
}
/**
* 关闭前
* */
protected onClose(){
}
/**
* 关闭后
* */
protected onClosed(){
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected onClick_closeBtn(e): void {
GDispatcher.dispatchEvent(PanelModule.CLOSE_BTN_CLICK, "closeBtn");
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected removeEvent(): void {
super.removeEvent();
if (this.view.closeBtn) {
// this.removeClick(this.view.closeBtn);
}
}
}
\ No newline at end of file
import {Module} from "./Module";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends Module {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {Module} from "./YtModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends Module {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends Module {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {DisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
export class YtLoadingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
public init(){
YtDisplayPool.ins.displayPool[YtModuleName.LOADING_GUI]=this;
}
/**
* 更新页面
* @param {number} max 最大进度值
*/
public updateData(max: number): void {
this.maxProgress = max;
}
public onProgress(curr: number): void {
const pre: number = parseInt((curr*100).toString()) ;
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
}
}
\ No newline at end of file
import {AnimationGui} from "../others/AnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/GuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(SceneManager.ins.scene,GuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
GuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
GuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {AnimationGui} from "../others/AnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/GuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(YtSceneManager.ins.scene,YtGuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
YtGuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
YtGuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {AnimationGui} from "../others/YtAnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {GuiCreate} from "../others/YtGuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(YtSceneManager.ins.scene,YtGuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
YtGuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
YtGuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {YtAnimationGui} from "../others/YtAnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {YtGuiCreate} from "../others/YtGuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new AnimationGui(YtSceneManager.ins.scene,YtGuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
YtGuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
YtGuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {YtAnimationGui} from "../others/YtAnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {YtGuiCreate} from "../others/YtGuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new YtAnimationGui(YtSceneManager.ins.scene,YtGuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
YtGuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
YtGuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
GuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {YtAnimationGui} from "../others/YtAnimationGui";
import {YtSceneManager} from "../manager/YtSceneManager";
import {YtGuiCreate} from "../others/YtGuiCreate";
import { YtLang } from '../util/YtLang';
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtModule {
private timeoutId;
protected view:any;
protected parent:any;
//事件
protected doEvents=[];
//面板隐藏显示实例
protected panelsAn=new YtAnimationGui(YtSceneManager.ins.scene,YtGuiManager.ins.fullscreenUI)
//规则元素
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool: any;
constructor() {
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
protected initModel(): void {
}
/**
* 初始化UI
*/
protected initUI(): void {
}
/**
* 显示
*/
protected show(...args): void {
this.removeEvent();
this.updateData(...args)
this.addEvent();
YtGuiManager.ins.changeGui(this.parent);
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
YtGuiManager.ins.removeGui(this.parent);
}
/**
* 添加事件
*/
protected addEvent(): void {
}
/**
* 移除事件
*/
protected removeEvent(): void {
}
/**
* 更新页面
* @param args
*/
public updateData(...args): void {
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
}
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
}
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
}
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void {
display.mouseEnable = display.mouseChildren = false;
//如果已经禁用事件重新计算
if (this.timeoutId) {
clearTimeout(this.timeoutId);
}
this.timeoutId = setTimeout(function () {
this.timeoutId = 0;
display.mouseEnable = display.mouseChildren = true;
}, delay ? delay : 500);
}
//dom模板
protected viewNode;
//页面HTML模板
protected listTemplateHtml(data,config){
}
//html页面对象
protected htmlView;
protected htmlCreate(config,data){
this.listTemplateHtml(data,config)
document.body.appendChild(this.viewNode);
YtGuiCreate.ins.preventDefault(this.viewNode)
}
public dispose(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
let viewList
for(viewList in this.view){
// console.log(viewList)
if(this.view[viewList]["mouseEnable"]==1||this.view[viewList]["mouseEnable"]==undefined){
this.view[viewList].isHitTestVisible=enable;
}
}
}
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view:BABYLON.GUI.Control,enable: boolean): void {
view.isHitTestVisible=enable;
if(enable==true){
view["mouseEnable"]=1;
}else{
view["mouseEnable"]=2;
}
}
}
\ No newline at end of file
import {PanelModule} from "./YtPanelModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
import { IMsgData } from '../interface/IMsgData';
export class MsgModule extends PanelModule {
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.MSG_PANEL]=this;
}
/**
* 添加事件
* */
protected addEvent(){
if(this.view.closeBtn){
this.doEvents["closeBtn"]=this.addClick(this.view.closeBtn,this.onClick_closeBtn.bind(this))
}
}
protected onClick_closeBtn():void{
this.enableMouseEvt(false)
this.hide();
}
protected removeEvent(){
this.enableMouseEvt(true)
if(this.view.closeBtn){
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"])
}
}
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
}
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
}
/**
* 更新页面
* @param args
*/
public updateData(msgData: IMsgData, ...args): void {
if(msgData.msg){
this.updateMsgTxt(msgData.msg);
}
if(msgData.sureBtnTxt){
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if(msgData.cancelBtnTxt){
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
}
}
\ No newline at end of file
import {YtPanelModule} from "./YtPanelModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
import { IMsgData } from '../interface/IMsgData';
export class MsgModule extends YtPanelModule {
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.MSG_PANEL]=this;
}
/**
* 添加事件
* */
protected addEvent(){
if(this.view.closeBtn){
this.doEvents["closeBtn"]=this.addClick(this.view.closeBtn,this.onClick_closeBtn.bind(this))
}
}
protected onClick_closeBtn():void{
this.enableMouseEvt(false)
this.hide();
}
protected removeEvent(){
this.enableMouseEvt(true)
if(this.view.closeBtn){
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"])
}
}
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
}
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
}
/**
* 更新页面
* @param args
*/
public updateData(msgData: IMsgData, ...args): void {
if(msgData.msg){
this.updateMsgTxt(msgData.msg);
}
if(msgData.sureBtnTxt){
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if(msgData.cancelBtnTxt){
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
}
}
\ No newline at end of file
import {YtPanelModule} from "./YtPanelModule";
import {DisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
import { IMsgData } from '../interface/YtIMsgData';
export class MsgModule extends YtPanelModule {
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.MSG_PANEL]=this;
}
/**
* 添加事件
* */
protected addEvent(){
if(this.view.closeBtn){
this.doEvents["closeBtn"]=this.addClick(this.view.closeBtn,this.onClick_closeBtn.bind(this))
}
}
protected onClick_closeBtn():void{
this.enableMouseEvt(false)
this.hide();
}
protected removeEvent(){
this.enableMouseEvt(true)
if(this.view.closeBtn){
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"])
}
}
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
}
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
}
/**
* 更新页面
* @param args
*/
public updateData(msgData: IMsgData, ...args): void {
if(msgData.msg){
this.updateMsgTxt(msgData.msg);
}
if(msgData.sureBtnTxt){
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if(msgData.cancelBtnTxt){
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
}
}
\ No newline at end of file
import {YtPanelModule} from "./YtPanelModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
import { YtIMsgData } from '../interface/YtIMsgData';
export class MsgModule extends YtPanelModule {
constructor(){
super()
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.MSG_PANEL]=this;
}
/**
* 添加事件
* */
protected addEvent(){
if(this.view.closeBtn){
this.doEvents["closeBtn"]=this.addClick(this.view.closeBtn,this.onClick_closeBtn.bind(this))
}
}
protected onClick_closeBtn():void{
this.enableMouseEvt(false)
this.hide();
}
protected removeEvent(){
this.enableMouseEvt(true)
if(this.view.closeBtn){
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"])
}
}
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
}
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
}
/**
* 更新页面
* @param args
*/
public updateData(msgData: IMsgData, ...args): void {
if(msgData.msg){
this.updateMsgTxt(msgData.msg);
}
if(msgData.sureBtnTxt){
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if(msgData.cancelBtnTxt){
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
}
}
\ No newline at end of file
import {YtPanelModule} from "./YtPanelModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
import { YtIMsgData } from '../interface/YtIMsgData';
export class MsgModule extends YtPanelModule {
constructor(){
super()
}
public init(){
YtDisplayPool.ins.displayPool[YtModuleName.MSG_PANEL]=this;
}
/**
* 添加事件
* */
protected addEvent(){
if(this.view.closeBtn){
this.doEvents["closeBtn"]=this.addClick(this.view.closeBtn,this.onClick_closeBtn.bind(this))
}
}
protected onClick_closeBtn():void{
this.enableMouseEvt(false)
this.hide();
}
protected removeEvent(){
this.enableMouseEvt(true)
if(this.view.closeBtn){
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"])
}
}
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
}
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
}
/**
* 更新页面
* @param args
*/
public updateData(msgData: IMsgData, ...args): void {
if(msgData.msg){
this.updateMsgTxt(msgData.msg);
}
if(msgData.sureBtnTxt){
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if(msgData.cancelBtnTxt){
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
}
}
\ No newline at end of file
import {YtPanelModule} from "./YtPanelModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
import { YtIMsgData } from '../interface/YtIMsgData';
export class MsgModule extends YtPanelModule {
constructor(){
super()
}
public init(){
YtDisplayPool.ins.displayPool[YtModuleName.MSG_PANEL]=this;
}
/**
* 添加事件
* */
protected addEvent(){
if(this.view.closeBtn){
this.doEvents["closeBtn"]=this.addClick(this.view.closeBtn,this.onClick_closeBtn.bind(this))
}
}
protected onClick_closeBtn():void{
this.enableMouseEvt(false)
this.hide();
}
protected removeEvent(){
this.enableMouseEvt(true)
if(this.view.closeBtn){
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"])
}
}
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
}
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
}
/**
* 更新页面
* @param args
*/
public updateData(msgData: YtIMsgData, ...args): void {
if(msgData.msg){
this.updateMsgTxt(msgData.msg);
}
if(msgData.sureBtnTxt){
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if(msgData.cancelBtnTxt){
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
}
}
\ No newline at end of file
import { GDispatcher } from "tc";
import { Module } from "./Module";
import {GuiManager} from "../manager/YtGuiManager";
export class PanelModule extends Module {
/**
* 点击关闭按钮
*/
public static CLOSE_BTN_CLICK = 'closeBtnClick';
/**
* 点击确定按钮
*/
public static SURE_BTN_CLICK = 'sureBtnClick';
/**
* 点击取消按钮
*/
public static CANCEL_BTN_CLICK = 'cancelBtnClick';
public updateData(...args): void {
}
protected addEvent(): void {
super.addEvent();
if (this.view.closeBtn) {
this.addClick(this.view.closeBtn, this.onClick_closeBtn);
}
}
/**
* 显示
*/
protected show(...args): void {
this.addEvent();
this.updateData(...args)
this.panelsAn.show(this.view.view,()=>{
this.onOpen()
},()=>{
this.onOpened()
})
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
this.panelsAn.hide(this.view.view,()=>{
this.onClose()
},()=>{
this.onClosed()
})
}
/**
* 打开前
* */
protected onOpen(...args): void{
GuiManager.ins.appendGui(this.parent);
}
/**
* 打开后
* */
protected onOpened(...args): void{
}
/**
* 关闭前
* */
protected onClose(){
}
/**
* 关闭后
* */
protected onClosed(){
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected onClick_closeBtn(e): void {
GDispatcher.dispatchEvent(PanelModule.CLOSE_BTN_CLICK, "closeBtn");
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected removeEvent(): void {
super.removeEvent();
if (this.view.closeBtn) {
// this.removeClick(this.view.closeBtn);
}
}
}
\ No newline at end of file
import { GDispatcher } from "tc";
import { YtModule } from "./YtModule";
import {YtGuiManager} from "../manager/YtGuiManager";
export class PanelModule extends YtModule {
/**
* 点击关闭按钮
*/
public static CLOSE_BTN_CLICK = 'closeBtnClick';
/**
* 点击确定按钮
*/
public static SURE_BTN_CLICK = 'sureBtnClick';
/**
* 点击取消按钮
*/
public static CANCEL_BTN_CLICK = 'cancelBtnClick';
public updateData(...args): void {
}
protected addEvent(): void {
super.addEvent();
if (this.view.closeBtn) {
this.addClick(this.view.closeBtn, this.onClick_closeBtn);
}
}
/**
* 显示
*/
protected show(...args): void {
this.addEvent();
this.updateData(...args)
this.panelsAn.show(this.view.view,()=>{
this.onOpen()
},()=>{
this.onOpened()
})
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
this.panelsAn.hide(this.view.view,()=>{
this.onClose()
},()=>{
this.onClosed()
})
}
/**
* 打开前
* */
protected onOpen(...args): void{
GuiManager.ins.appendGui(this.parent);
}
/**
* 打开后
* */
protected onOpened(...args): void{
}
/**
* 关闭前
* */
protected onClose(){
}
/**
* 关闭后
* */
protected onClosed(){
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected onClick_closeBtn(e): void {
GDispatcher.dispatchEvent(PanelModule.CLOSE_BTN_CLICK, "closeBtn");
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected removeEvent(): void {
super.removeEvent();
if (this.view.closeBtn) {
// this.removeClick(this.view.closeBtn);
}
}
}
\ No newline at end of file
import { GDispatcher } from "tc";
import { YtModule } from "./YtModule";
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtPanelModule extends YtModule {
/**
* 点击关闭按钮
*/
public static CLOSE_BTN_CLICK = 'closeBtnClick';
/**
* 点击确定按钮
*/
public static SURE_BTN_CLICK = 'sureBtnClick';
/**
* 点击取消按钮
*/
public static CANCEL_BTN_CLICK = 'cancelBtnClick';
public updateData(...args): void {
}
protected addEvent(): void {
super.addEvent();
if (this.view.closeBtn) {
this.addClick(this.view.closeBtn, this.onClick_closeBtn);
}
}
/**
* 显示
*/
protected show(...args): void {
this.addEvent();
this.updateData(...args)
this.panelsAn.show(this.view.view,()=>{
this.onOpen()
},()=>{
this.onOpened()
})
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
this.panelsAn.hide(this.view.view,()=>{
this.onClose()
},()=>{
this.onClosed()
})
}
/**
* 打开前
* */
protected onOpen(...args): void{
GuiManager.ins.appendGui(this.parent);
}
/**
* 打开后
* */
protected onOpened(...args): void{
}
/**
* 关闭前
* */
protected onClose(){
}
/**
* 关闭后
* */
protected onClosed(){
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected onClick_closeBtn(e): void {
GDispatcher.dispatchEvent(PanelModule.CLOSE_BTN_CLICK, "closeBtn");
this.removeEvent()
GuiManager.ins.removeGui(this.parent);
}
protected removeEvent(): void {
super.removeEvent();
if (this.view.closeBtn) {
// this.removeClick(this.view.closeBtn);
}
}
}
\ No newline at end of file
import { GDispatcher } from "tc";
import { YtModule } from "./YtModule";
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtPanelModule extends YtModule {
/**
* 点击关闭按钮
*/
public static CLOSE_BTN_CLICK = 'closeBtnClick';
/**
* 点击确定按钮
*/
public static SURE_BTN_CLICK = 'sureBtnClick';
/**
* 点击取消按钮
*/
public static CANCEL_BTN_CLICK = 'cancelBtnClick';
public updateData(...args): void {
}
protected addEvent(): void {
super.addEvent();
if (this.view.closeBtn) {
this.addClick(this.view.closeBtn, this.onClick_closeBtn);
}
}
/**
* 显示
*/
protected show(...args): void {
this.addEvent();
this.updateData(...args)
this.panelsAn.show(this.view.view,()=>{
this.onOpen()
},()=>{
this.onOpened()
})
}
/**
* 隐藏
*/
protected hide(): void {
this.removeEvent();
this.panelsAn.hide(this.view.view,()=>{
this.onClose()
},()=>{
this.onClosed()
})
}
/**
* 打开前
* */
protected onOpen(...args): void{
YtGuiManager.ins.appendGui(this.parent);
}
/**
* 打开后
* */
protected onOpened(...args): void{
}
/**
* 关闭前
* */
protected onClose(){
}
/**
* 关闭后
* */
protected onClosed(){
this.removeEvent()
YtGuiManager.ins.removeGui(this.parent);
}
protected onClick_closeBtn(e): void {
GDispatcher.dispatchEvent(YtPanelModule.CLOSE_BTN_CLICK, "closeBtn");
this.removeEvent()
YtGuiManager.ins.removeGui(this.parent);
}
protected removeEvent(): void {
super.removeEvent();
if (this.view.closeBtn) {
// this.removeClick(this.view.closeBtn);
}
}
}
\ No newline at end of file
import {Module} from "./YtModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
export class WaitingModule extends Module {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
public updateData(msgTxt: string, ...args): void {
this.updateMsgTxt(msgTxt);
}
/**
* 更新提示文案
* @param desc
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.WAITING_PANEL]=this;
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {DisplayPool} from "../others/DisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
export class YtWaitingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
public updateData(msgTxt: string, ...args): void {
this.updateMsgTxt(msgTxt);
}
/**
* 更新提示文案
* @param desc
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.WAITING_PANEL]=this;
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {DisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
export class YtWaitingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
public updateData(msgTxt: string, ...args): void {
this.updateMsgTxt(msgTxt);
}
/**
* 更新提示文案
* @param desc
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.WAITING_PANEL]=this;
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
export class YtWaitingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
public updateData(msgTxt: string, ...args): void {
this.updateMsgTxt(msgTxt);
}
/**
* 更新提示文案
* @param desc
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
public init(){
DisplayPool.ins.displayPool[YtModuleName.WAITING_PANEL]=this;
}
}
\ No newline at end of file
import {YtModule} from "./YtModule";
import {YtDisplayPool} from "../others/YtDisplayPool";
import {YtModuleName} from "../enum/YtModuleName";
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
export class YtWaitingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor(){
super()
}
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
public updateData(msgTxt: string, ...args): void {
this.updateMsgTxt(msgTxt);
}
/**
* 更新提示文案
* @param desc
*/
protected updateMsgTxt(msgTxt: string): void {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
}
public init(){
YtDisplayPool.ins.displayPool[YtModuleName.WAITING_PANEL]=this;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
export class YtDisplayPool{
private static instance: DisplayPool;
public static get ins(): DisplayPool {
if (!this.instance) {
this.instance = new DisplayPool();
}
return this.instance;
}
//场景名称
public displayPool: any = {};
}
\ No newline at end of file
export class YtDisplayPool{
private static instance: YtDisplayPool;
public static get ins(): YtDisplayPool {
if (!this.instance) {
this.instance = new YtDisplayPool();
}
return this.instance;
}
//场景名称
public displayPool: any = {};
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/**
* Created by rjf on 2017/10/10.
* 粒子控制器
*/
export class YtParticleCon {
private static instance: YtParticleCon;
constructor(position,scene,particle){
this.fountain = BABYLON.Mesh.CreateBox("fountain", 1.0, scene);
this.fountain.isPickable=false
this.fountain.visibility=0;
this.fountain.rotation.x=Math.PI*0.9;
this.particleSystem=particle;
//定义发射器
this.particleSystem.emitter = this.fountain; // the starting object, the emitter, a box in this case.
this.particleSystem.stop();
this.fountain.position=position;
}
private particleSystem;
private fountain;
public start(){
this.particleSystem.start();
}
public stop(){
this.particleSystem.stop();
}
public Position(position){
this.fountain.position=position;
}
public Parent(parent){
this.fountain.parent=parent;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{"version":3,"file":"YtFileData.js","sourceRoot":"","sources":["../../src/interface/YtFileData.ts"],"names":[],"mappings":""}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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