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
/**
* GUI控制器
* */
import {GuiManager} from "../manager/YtGuiManager";
export class GuiCreate{
private panelOut=new BABYLON.GUI.StackPanel();
private static instance: GuiCreate;
public static get ins():GuiCreate{
if(!this.instance){
this.instance=new GuiCreate()
}
return this.instance;
}
constructor(){}
public createList(name,options,scaleUi){
var rectOut=new BABYLON.GUI.Rectangle();
rectOut.thickness=0;
rectOut.isPointerBlocker=true;
rectOut.verticalAlignment=BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment=BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if(rectOut[key]){
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if(options&&options.isVertical){
this.panelOut.horizontalAlignment=2;
this.panelOut.verticalAlignment=0;
this.panelOut.isVertical =true;
var mouse={
up:0,
down:0,
};
mouse.up=parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function(e){
mouse.down= e.y;
});
rectOut.onPointerUpObservable.add((e)=>{
var topY=parseInt(this.panelOut.top.toString());
mouse.up=topY;
if(topY>0){
this.panelOut.top="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.top.toString())<parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString())){
var l=(parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString()))*scaleUi;
this.panelOut.top=l.toString()+"px";
mouse.up= parseInt(this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add((e)=>{
var m=e.y-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.top= mul.toString()+"px";
});
}else {
this.panelOut.horizontalAlignment=0;
this.panelOut.verticalAlignment=2;
this.panelOut.isVertical =false;
var mouse={
up:0,
down:0
};
mouse.up=parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add((e)=>{
mouse.down= e.x;
});
rectOut.onPointerUpObservable.add((e)=>{
var leftY=parseInt(this.panelOut.left.toString());
mouse.up=leftY;
if(leftY>0){
this.panelOut.left="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.left.toString())<parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString())){
var l=(parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString()))*scaleUi;
this.panelOut.left=l.toString()+"px";
mouse.up= parseInt(this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function(e){
var m=e.x-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.left= mul.toString()+"px";
});
}
rectOut.addControl(this.panelOut);
return rectOut
}
public optionsListCon(config,data,listTemplate){
var scaleUi=GuiManager.ins.fullscreenUI.idealWidth/document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist=this.createList("list",{width:config.bodyWidth,height:config.bodyHeight,top:config.bodyTop,left:config.bodyLeft,isVertical:config.isVertical},scaleUi);
var _length=this.panelOut.children.length
if(_length>0){
for(var i=0;i<_length;i++){
this.panelOut.removeControl(this.panelOut.children[0])
}
}
data.forEach((_list)=>{
var list=listTemplate(config,_list)
this.panelOut.addControl(list)
})
return prizeDatalist
}
public preventDefault(Node){
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', (event)=> {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', (event)=> {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = "+st);
console.log(y)
console.log(lastY)
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
}
}
\ No newline at end of file
/**
* GUI控制器
* */
import {YtGuiManager} from "../manager/YtGuiManager";
export class GuiCreate{
private panelOut=new BABYLON.GUI.StackPanel();
private static instance: GuiCreate;
public static get ins():GuiCreate{
if(!this.instance){
this.instance=new GuiCreate()
}
return this.instance;
}
constructor(){}
public createList(name,options,scaleUi){
var rectOut=new BABYLON.GUI.Rectangle();
rectOut.thickness=0;
rectOut.isPointerBlocker=true;
rectOut.verticalAlignment=BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment=BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if(rectOut[key]){
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if(options&&options.isVertical){
this.panelOut.horizontalAlignment=2;
this.panelOut.verticalAlignment=0;
this.panelOut.isVertical =true;
var mouse={
up:0,
down:0,
};
mouse.up=parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function(e){
mouse.down= e.y;
});
rectOut.onPointerUpObservable.add((e)=>{
var topY=parseInt(this.panelOut.top.toString());
mouse.up=topY;
if(topY>0){
this.panelOut.top="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.top.toString())<parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString())){
var l=(parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString()))*scaleUi;
this.panelOut.top=l.toString()+"px";
mouse.up= parseInt(this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add((e)=>{
var m=e.y-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.top= mul.toString()+"px";
});
}else {
this.panelOut.horizontalAlignment=0;
this.panelOut.verticalAlignment=2;
this.panelOut.isVertical =false;
var mouse={
up:0,
down:0
};
mouse.up=parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add((e)=>{
mouse.down= e.x;
});
rectOut.onPointerUpObservable.add((e)=>{
var leftY=parseInt(this.panelOut.left.toString());
mouse.up=leftY;
if(leftY>0){
this.panelOut.left="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.left.toString())<parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString())){
var l=(parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString()))*scaleUi;
this.panelOut.left=l.toString()+"px";
mouse.up= parseInt(this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function(e){
var m=e.x-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.left= mul.toString()+"px";
});
}
rectOut.addControl(this.panelOut);
return rectOut
}
public optionsListCon(config,data,listTemplate){
var scaleUi=GuiManager.ins.fullscreenUI.idealWidth/document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist=this.createList("list",{width:config.bodyWidth,height:config.bodyHeight,top:config.bodyTop,left:config.bodyLeft,isVertical:config.isVertical},scaleUi);
var _length=this.panelOut.children.length
if(_length>0){
for(var i=0;i<_length;i++){
this.panelOut.removeControl(this.panelOut.children[0])
}
}
data.forEach((_list)=>{
var list=listTemplate(config,_list)
this.panelOut.addControl(list)
})
return prizeDatalist
}
public preventDefault(Node){
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', (event)=> {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', (event)=> {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = "+st);
console.log(y)
console.log(lastY)
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
}
}
\ No newline at end of file
/**
* GUI控制器
* */
import {YtGuiManager} from "../manager/YtGuiManager";
export class GuiCreate{
private panelOut=new BABYLON.GUI.StackPanel();
private static instance: GuiCreate;
public static get ins():GuiCreate{
if(!this.instance){
this.instance=new GuiCreate()
}
return this.instance;
}
constructor(){}
public createList(name,options,scaleUi){
var rectOut=new BABYLON.GUI.Rectangle();
rectOut.thickness=0;
rectOut.isPointerBlocker=true;
rectOut.verticalAlignment=BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment=BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if(rectOut[key]){
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if(options&&options.isVertical){
this.panelOut.horizontalAlignment=2;
this.panelOut.verticalAlignment=0;
this.panelOut.isVertical =true;
var mouse={
up:0,
down:0,
};
mouse.up=parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function(e){
mouse.down= e.y;
});
rectOut.onPointerUpObservable.add((e)=>{
var topY=parseInt(this.panelOut.top.toString());
mouse.up=topY;
if(topY>0){
this.panelOut.top="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.top.toString())<parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString())){
var l=(parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString()))*scaleUi;
this.panelOut.top=l.toString()+"px";
mouse.up= parseInt(this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add((e)=>{
var m=e.y-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.top= mul.toString()+"px";
});
}else {
this.panelOut.horizontalAlignment=0;
this.panelOut.verticalAlignment=2;
this.panelOut.isVertical =false;
var mouse={
up:0,
down:0
};
mouse.up=parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add((e)=>{
mouse.down= e.x;
});
rectOut.onPointerUpObservable.add((e)=>{
var leftY=parseInt(this.panelOut.left.toString());
mouse.up=leftY;
if(leftY>0){
this.panelOut.left="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.left.toString())<parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString())){
var l=(parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString()))*scaleUi;
this.panelOut.left=l.toString()+"px";
mouse.up= parseInt(this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function(e){
var m=e.x-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.left= mul.toString()+"px";
});
}
rectOut.addControl(this.panelOut);
return rectOut
}
public optionsListCon(config,data,listTemplate){
var scaleUi=YtGuiManager.ins.fullscreenUI.idealWidth/document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist=this.createList("list",{width:config.bodyWidth,height:config.bodyHeight,top:config.bodyTop,left:config.bodyLeft,isVertical:config.isVertical},scaleUi);
var _length=this.panelOut.children.length
if(_length>0){
for(var i=0;i<_length;i++){
this.panelOut.removeControl(this.panelOut.children[0])
}
}
data.forEach((_list)=>{
var list=listTemplate(config,_list)
this.panelOut.addControl(list)
})
return prizeDatalist
}
public preventDefault(Node){
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', (event)=> {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', (event)=> {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = "+st);
console.log(y)
console.log(lastY)
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
}
}
\ No newline at end of file
import {GuiCreate} from "./YtGuiCreate";
/**
* Created by clq on 2017/10/10.
*动画控制器
*/
export class AnimationCon {
private static instance: AnimationCon;
private setbeginAnimation;
public static get ins():AnimationCon{
if(!this.instance){
this.instance=new AnimationCon()
}
return this.instance;
}
constructor(){}
public animationBody(object,scene){
//动画模式
var _endattr;
//动画对象
var _mesh;
//动画属性
var _attr;
//动画速度
var _speed;
//动画帧
var _keys;
//动画结束回调函数
var _endCall;
//动画数据类型
var _typeData
//动画数据类型
var _loop;
if(object.endattr!=null){
_endattr=object.endattr;
}else{
_endattr=BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE;
}
if(object.mesh!=null){
_mesh=object.mesh;
}else {
_mesh=null;
console.error("动画对象不能为空!")
}
if(object.attr!=null){
_attr=object.attr;
}else {
_attr=null;
console.error("动画对象属性不能为空!")
}
if(object.speed!=null){
_speed=object.speed;
}else {
_speed=10;
}
if(object.keys!=null){
_keys=object.keys;
}else {
_keys=[];
}
if(object.endCall!=null){
_endCall=object.endCall
}else{
_endCall=function(){}
}
if(object.typeData!=null){
_typeData=object.typedata
}else{
_typeData=BABYLON.Animation.ANIMATIONTYPE_FLOAT
}
if(object.loop!=null){
_loop=object.loop
}else{
_loop=false;
}
var animationBox = new BABYLON.Animation("myAnimation", _attr, _speed, _typeData, _endattr);
var keys = [];
keys=_keys
animationBox.setKeys(keys);
_mesh.animations.push(animationBox);
this.setbeginAnimation=scene.beginAnimation(_mesh, 0, _keys[_keys.length-1].frame, _loop);
this.setbeginAnimation.onAnimationEnd=function(){
_endCall()
}
}
public Pause(){
this.setbeginAnimation.pause()
}
public Reset(){
this.setbeginAnimation.reset()
}
public Speed(i){
this.setbeginAnimation.speedRatio=i
}
}
import {GuiCreate} from "./YtGuiCreate";
/**
* Created by clq on 2017/10/10.
*动画控制器
*/
export class YtAnimationCon {
private static instance: YtAnimationCon;
private setbeginAnimation;
public static get ins():YtAnimationCon{
if(!this.instance){
this.instance=new YtAnimationCon()
}
return this.instance;
}
constructor(){}
public animationBody(object,scene){
//动画模式
var _endattr;
//动画对象
var _mesh;
//动画属性
var _attr;
//动画速度
var _speed;
//动画帧
var _keys;
//动画结束回调函数
var _endCall;
//动画数据类型
var _typeData
//动画数据类型
var _loop;
if(object.endattr!=null){
_endattr=object.endattr;
}else{
_endattr=BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE;
}
if(object.mesh!=null){
_mesh=object.mesh;
}else {
_mesh=null;
console.error("动画对象不能为空!")
}
if(object.attr!=null){
_attr=object.attr;
}else {
_attr=null;
console.error("动画对象属性不能为空!")
}
if(object.speed!=null){
_speed=object.speed;
}else {
_speed=10;
}
if(object.keys!=null){
_keys=object.keys;
}else {
_keys=[];
}
if(object.endCall!=null){
_endCall=object.endCall
}else{
_endCall=function(){}
}
if(object.typeData!=null){
_typeData=object.typedata
}else{
_typeData=BABYLON.Animation.ANIMATIONTYPE_FLOAT
}
if(object.loop!=null){
_loop=object.loop
}else{
_loop=false;
}
var animationBox = new BABYLON.Animation("myAnimation", _attr, _speed, _typeData, _endattr);
var keys = [];
keys=_keys
animationBox.setKeys(keys);
_mesh.animations.push(animationBox);
this.setbeginAnimation=scene.beginAnimation(_mesh, 0, _keys[_keys.length-1].frame, _loop);
this.setbeginAnimation.onAnimationEnd=function(){
_endCall()
}
}
public Pause(){
this.setbeginAnimation.pause()
}
public Reset(){
this.setbeginAnimation.reset()
}
public Speed(i){
this.setbeginAnimation.speedRatio=i
}
}
import {YtGuiCreate} from "./YtGuiCreate";
/**
* Created by clq on 2017/10/10.
*动画控制器
*/
export class YtAnimationCon {
private static instance: YtAnimationCon;
private setbeginAnimation;
public static get ins():YtAnimationCon{
if(!this.instance){
this.instance=new YtAnimationCon()
}
return this.instance;
}
constructor(){}
public animationBody(object,scene){
//动画模式
var _endattr;
//动画对象
var _mesh;
//动画属性
var _attr;
//动画速度
var _speed;
//动画帧
var _keys;
//动画结束回调函数
var _endCall;
//动画数据类型
var _typeData
//动画数据类型
var _loop;
if(object.endattr!=null){
_endattr=object.endattr;
}else{
_endattr=BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE;
}
if(object.mesh!=null){
_mesh=object.mesh;
}else {
_mesh=null;
console.error("动画对象不能为空!")
}
if(object.attr!=null){
_attr=object.attr;
}else {
_attr=null;
console.error("动画对象属性不能为空!")
}
if(object.speed!=null){
_speed=object.speed;
}else {
_speed=10;
}
if(object.keys!=null){
_keys=object.keys;
}else {
_keys=[];
}
if(object.endCall!=null){
_endCall=object.endCall
}else{
_endCall=function(){}
}
if(object.typeData!=null){
_typeData=object.typedata
}else{
_typeData=BABYLON.Animation.ANIMATIONTYPE_FLOAT
}
if(object.loop!=null){
_loop=object.loop
}else{
_loop=false;
}
var animationBox = new BABYLON.Animation("myAnimation", _attr, _speed, _typeData, _endattr);
var keys = [];
keys=_keys
animationBox.setKeys(keys);
_mesh.animations.push(animationBox);
this.setbeginAnimation=scene.beginAnimation(_mesh, 0, _keys[_keys.length-1].frame, _loop);
this.setbeginAnimation.onAnimationEnd=function(){
_endCall()
}
}
public Pause(){
this.setbeginAnimation.pause()
}
public Reset(){
this.setbeginAnimation.reset()
}
public Speed(i){
this.setbeginAnimation.speedRatio=i
}
}
/**
* Created by clq on 2017/10/10.
* 弹框动画UI控制器
*/
export class YtAnimationGui {
private static instance: YtAnimationGui;
protected scene;
protected advancedTexture;
constructor(scene,advancedTexture){
this.scene=scene;
this.advancedTexture=advancedTexture
}
public show = function (gui,open?,opened?) {
var keys = [];
keys.push({
frame: 0,
value: 0.1
});
keys.push({
frame: 10,
value: 1
});
var animationX = new BABYLON.Animation("", "scaleX", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationX.setKeys(keys);
var animationY = new BABYLON.Animation("", "scaleY", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationY.setKeys(keys);
gui.animations = [];
gui.animations.push(animationX,animationY);
this.advancedTexture.addControl(gui);
if(open){
open()
}
this.scene.beginAnimation(gui, 0, 10, false,2,()=>{
if(opened){
opened()
}
});
};
public hide = function(gui,close?,closed?){
var keys = [];
keys.push({
frame: 0,
value: 1
});
keys.push({
frame: 10,
value: 0.1
});
var animationX = new BABYLON.Animation("", "scaleX", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationX.setKeys(keys);
var animationY = new BABYLON.Animation("", "scaleY", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationY.setKeys(keys);
gui.animations = [];
gui.animations.push(animationX,animationY);
if(close){
close()
}
this.scene.beginAnimation(gui, 0, 10, false,2,()=>{
this.advancedTexture.removeControl(gui);
//this.advancedTexture.dispose();
if(closed){
closed()
}
});
};
}
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
/**
* GUI控制器
* */
import {YtGuiManager} from "../manager/YtGuiManager";
export class GuiCreate{
private panelOut=new BABYLON.GUI.StackPanel();
private static instance: GuiCreate;
public static get ins():GuiCreate{
if(!this.instance){
this.instance=new GuiCreate()
}
return this.instance;
}
constructor(){}
public createList(name,options,scaleUi){
var rectOut=new BABYLON.GUI.Rectangle();
rectOut.thickness=0;
rectOut.isPointerBlocker=true;
rectOut.verticalAlignment=BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment=BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if(rectOut[key]){
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if(options&&options.isVertical){
this.panelOut.horizontalAlignment=2;
this.panelOut.verticalAlignment=0;
this.panelOut.isVertical =true;
var mouse={
up:0,
down:0,
};
mouse.up=parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function(e){
mouse.down= e.y;
});
rectOut.onPointerUpObservable.add((e)=>{
var topY=parseInt(this.panelOut.top.toString());
mouse.up=topY;
if(topY>0){
this.panelOut.top="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.top.toString())<parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString())){
var l=(parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString()))*scaleUi;
this.panelOut.top=l.toString()+"px";
mouse.up= parseInt(this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add((e)=>{
var m=e.y-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.top= mul.toString()+"px";
});
}else {
this.panelOut.horizontalAlignment=0;
this.panelOut.verticalAlignment=2;
this.panelOut.isVertical =false;
var mouse={
up:0,
down:0
};
mouse.up=parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add((e)=>{
mouse.down= e.x;
});
rectOut.onPointerUpObservable.add((e)=>{
var leftY=parseInt(this.panelOut.left.toString());
mouse.up=leftY;
if(leftY>0){
this.panelOut.left="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.left.toString())<parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString())){
var l=(parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString()))*scaleUi;
this.panelOut.left=l.toString()+"px";
mouse.up= parseInt(this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function(e){
var m=e.x-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.left= mul.toString()+"px";
});
}
rectOut.addControl(this.panelOut);
return rectOut
}
public optionsListCon(config,data,listTemplate){
var scaleUi=YtGuiManager.ins.fullscreenUI.idealWidth/document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist=this.createList("list",{width:config.bodyWidth,height:config.bodyHeight,top:config.bodyTop,left:config.bodyLeft,isVertical:config.isVertical},scaleUi);
var _length=this.panelOut.children.length
if(_length>0){
for(var i=0;i<_length;i++){
this.panelOut.removeControl(this.panelOut.children[0])
}
}
data.forEach((_list)=>{
var list=listTemplate(config,_list)
this.panelOut.addControl(list)
})
return prizeDatalist
}
public preventDefault(Node){
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', (event)=> {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', (event)=> {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = "+st);
console.log(y)
console.log(lastY)
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
}
}
\ No newline at end of file
/**
* GUI控制器
* */
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtGuiCreate{
private panelOut=new BABYLON.GUI.StackPanel();
private static instance: YtGuiCreate;
public static get ins():YtGuiCreate{
if(!this.instance){
this.instance=new YtGuiCreate()
}
return this.instance;
}
constructor(){}
public createList(name,options,scaleUi){
var rectOut=new BABYLON.GUI.Rectangle();
rectOut.thickness=0;
rectOut.isPointerBlocker=true;
rectOut.verticalAlignment=BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment=BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if(rectOut[key]){
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if(options&&options.isVertical){
this.panelOut.horizontalAlignment=2;
this.panelOut.verticalAlignment=0;
this.panelOut.isVertical =true;
var mouse={
up:0,
down:0,
};
mouse.up=parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function(e){
mouse.down= e.y;
});
rectOut.onPointerUpObservable.add((e)=>{
var topY=parseInt(this.panelOut.top.toString());
mouse.up=topY;
if(topY>0){
this.panelOut.top="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.top.toString())<parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString())){
var l=(parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString()))*scaleUi;
this.panelOut.top=l.toString()+"px";
mouse.up= parseInt(this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add((e)=>{
var m=e.y-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.top= mul.toString()+"px";
});
}else {
this.panelOut.horizontalAlignment=0;
this.panelOut.verticalAlignment=2;
this.panelOut.isVertical =false;
var mouse={
up:0,
down:0
};
mouse.up=parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add((e)=>{
mouse.down= e.x;
});
rectOut.onPointerUpObservable.add((e)=>{
var leftY=parseInt(this.panelOut.left.toString());
mouse.up=leftY;
if(leftY>0){
this.panelOut.left="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.left.toString())<parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString())){
var l=(parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString()))*scaleUi;
this.panelOut.left=l.toString()+"px";
mouse.up= parseInt(this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function(e){
var m=e.x-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.left= mul.toString()+"px";
});
}
rectOut.addControl(this.panelOut);
return rectOut
}
public optionsListCon(config,data,listTemplate){
var scaleUi=YtGuiManager.ins.fullscreenUI.idealWidth/document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist=this.createList("list",{width:config.bodyWidth,height:config.bodyHeight,top:config.bodyTop,left:config.bodyLeft,isVertical:config.isVertical},scaleUi);
var _length=this.panelOut.children.length
if(_length>0){
for(var i=0;i<_length;i++){
this.panelOut.removeControl(this.panelOut.children[0])
}
}
data.forEach((_list)=>{
var list=listTemplate(config,_list)
this.panelOut.addControl(list)
})
return prizeDatalist
}
public preventDefault(Node){
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', (event)=> {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', (event)=> {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = "+st);
console.log(y)
console.log(lastY)
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
}
}
\ No newline at end of file
/**
* 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;
}
}
...@@ -4,32 +4,32 @@ var YtModuleName_1 = require("./enum/YtModuleName"); ...@@ -4,32 +4,32 @@ var YtModuleName_1 = require("./enum/YtModuleName");
exports.YtModuleName = YtModuleName_1.YtModuleName; exports.YtModuleName = YtModuleName_1.YtModuleName;
var YtLang_1 = require("./util/YtLang"); var YtLang_1 = require("./util/YtLang");
exports.YtLang = YtLang_1.YtLang; exports.YtLang = YtLang_1.YtLang;
var AssetsManager_1 = require("./manager/AssetsManager"); var YtAssetsManager_1 = require("./manager/YtAssetsManager");
exports.AssetsManager = AssetsManager_1.AssetsManager; exports.YtAssetsManager = YtAssetsManager_1.YtAssetsManager;
var GuiManager_1 = require("./manager/GuiManager"); var YtGuiManager_1 = require("./manager/YtGuiManager");
exports.GuiManager = GuiManager_1.GuiManager; exports.YtGuiManager = YtGuiManager_1.YtGuiManager;
var SceneManager_1 = require("./manager/SceneManager"); var YtSceneManager_1 = require("./manager/YtSceneManager");
exports.SceneManager = SceneManager_1.SceneManager; exports.YtSceneManager = YtSceneManager_1.YtSceneManager;
var ModuleManager_1 = require("./manager/ModuleManager"); var YtModuleManager_1 = require("./manager/YtModuleManager");
exports.ModuleManager = ModuleManager_1.ModuleManager; exports.YtModuleManager = YtModuleManager_1.YtModuleManager;
var AnimationCon_1 = require("./others/AnimationCon"); var YtAnimationCon_1 = require("./others/YtAnimationCon");
exports.AnimationCon = AnimationCon_1.AnimationCon; exports.YtAnimationCon = YtAnimationCon_1.YtAnimationCon;
var AnimationGui_1 = require("./others/AnimationGui"); var YtAnimationGui_1 = require("./others/YtAnimationGui");
exports.AnimationGui = AnimationGui_1.AnimationGui; exports.YtAnimationGui = YtAnimationGui_1.YtAnimationGui;
var particleCon_1 = require("./others/particleCon"); var YtParticleCon_1 = require("./others/YtParticleCon");
exports.particleCon = particleCon_1.particleCon; exports.YtParticleCon = YtParticleCon_1.YtParticleCon;
var GuiCreate_1 = require("./others/GuiCreate"); var YtGuiCreate_1 = require("./others/YtGuiCreate");
exports.GuiCreate = GuiCreate_1.GuiCreate; exports.YtGuiCreate = YtGuiCreate_1.YtGuiCreate;
var Module_1 = require("./module/Module"); var YtModule_1 = require("./module/YtModule");
exports.Module = Module_1.Module; exports.YtModule = YtModule_1.YtModule;
var DisplayPool_1 = require("./others/DisplayPool"); var YtDisplayPool_1 = require("./others/YtDisplayPool");
exports.DisplayPool = DisplayPool_1.DisplayPool; exports.YtDisplayPool = YtDisplayPool_1.YtDisplayPool;
var MsgModule_1 = require("./module/MsgModule"); var YtMsgModule_1 = require("./module/YtMsgModule");
exports.MsgModule = MsgModule_1.MsgModule; exports.MsgModule = YtMsgModule_1.MsgModule;
var LoadingModule_1 = require("./module/LoadingModule"); var YtLoadingModule_1 = require("./module/YtLoadingModule");
exports.LoadingModule = LoadingModule_1.LoadingModule; exports.YtLoadingModule = YtLoadingModule_1.YtLoadingModule;
var WaitingModule_1 = require("./module/WaitingModule"); var YtWaitingModule_1 = require("./module/YtWaitingModule");
exports.WaitingModule = WaitingModule_1.WaitingModule; exports.YtWaitingModule = YtWaitingModule_1.YtWaitingModule;
var PanelModule_1 = require("./module/PanelModule"); var YtPanelModule_1 = require("./module/YtPanelModule");
exports.PanelModule = PanelModule_1.PanelModule; exports.YtPanelModule = YtPanelModule_1.YtPanelModule;
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,oDAAiD;AA4B7C,uBA5BI,2BAAY,CA4BJ;AA3BhB,wCAAqC;AA8BjC,iBA9BI,eAAM,CA8BJ;AA7BV,yDAAsD;AAgClD,wBAhCI,6BAAa,CAgCJ;AA/BjB,mDAAgD;AA+B9B,qBA/BV,uBAAU,CA+BU;AA9B5B,uDAAoD;AA8BvB,uBA9BrB,2BAAY,CA8BqB;AA7BzC,yDAAsD;AA6BZ,wBA7BlC,6BAAa,CA6BkC;AA5BvD,sDAAmD;AAgB/C,uBAhBI,2BAAY,CAgBJ;AAfhB,sDAAmD;AAelC,uBAfT,2BAAY,CAeS;AAd7B,oDAAiD;AAcnB,sBAdtB,yBAAW,CAcsB;AAbzC,gDAA6C;AAaH,oBAblC,qBAAS,CAakC;AAZnD,0CAAuC;AASnC,iBATI,eAAM,CASJ;AARV,oDAAiD;AAQtC,sBARH,yBAAW,CAQG;AAPtB,gDAA4C;AAOrB,oBAPf,qBAAS,CAOe;AANhC,wDAAqD;AAMpB,wBANzB,6BAAa,CAMyB;AAL9C,wDAAqD;AAKN,wBALvC,6BAAa,CAKuC;AAJ5D,oDAAiD;AAIY,sBAJrD,yBAAW,CAIqD"} {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,oDAAiD;AA4B7C,uBA5BI,2BAAY,CA4BJ;AA3BhB,wCAAqC;AA8BjC,iBA9BI,eAAM,CA8BJ;AA7BV,6DAA0D;AAgCtD,0BAhCI,iCAAe,CAgCJ;AA/BnB,uDAAoD;AA+BhC,uBA/BZ,2BAAY,CA+BY;AA9BhC,2DAAwD;AA8BvB,yBA9BzB,+BAAc,CA8ByB;AA7B/C,6DAA0D;AA6BV,0BA7BxC,iCAAe,CA6BwC;AA5B/D,0DAAuD;AAgBnD,yBAhBI,+BAAc,CAgBJ;AAflB,0DAAuD;AAepC,yBAfX,+BAAc,CAeW;AAdjC,wDAAqD;AAcnB,wBAd1B,6BAAa,CAc0B;AAb/C,oDAAiD;AAaD,sBAbxC,yBAAW,CAawC;AAZ3D,8CAA2C;AASvC,mBATI,mBAAQ,CASJ;AARZ,wDAAqD;AAQxC,wBARL,6BAAa,CAQK;AAP1B,oDAA8C;AAOnB,oBAPnB,uBAAS,CAOmB;AANpC,4DAAyD;AAMpB,0BAN7B,iCAAe,CAM6B;AALpD,4DAAyD;AAKJ,0BAL7C,iCAAe,CAK6C;AAJpE,wDAAqD;AAIgB,wBAJ7D,6BAAa,CAI6D"}
\ No newline at end of file \ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=YtFileData.js.map
\ No newline at end of file
{"version":3,"file":"YtFileData.js","sourceRoot":"","sources":["../../src/interface/YtFileData.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=YtIMsgData.js.map
\ No newline at end of file
{"version":3,"file":"YtIMsgData.js","sourceRoot":"","sources":["../../src/interface/YtIMsgData.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=YtResourceData.js.map
\ No newline at end of file
{"version":3,"file":"YtResourceData.js","sourceRoot":"","sources":["../../src/interface/YtResourceData.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
//import {ResourceCon} from "../resource/resource";
Object.defineProperty(exports, "__esModule", { value: true });
var YtAssetsManager = /** @class */ (function () {
function YtAssetsManager() {
//this._resourceData=ResourceCon.ins.resource;
this._resourceObject = {
binarys: {},
images: {},
models: {},
textures: {},
cubeTextures: {}
};
}
Object.defineProperty(YtAssetsManager, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtAssetsManager();
}
return this.instance;
},
enumerable: true,
configurable: true
});
Object.defineProperty(YtAssetsManager.prototype, "resourceData", {
set: function (resource) {
this._resourceData = resource;
},
enumerable: true,
configurable: true
});
YtAssetsManager.prototype.loadFile = function (sceneNames, scene, callback, progress) {
var assetsManager = new BABYLON.AssetsManager(scene);
assetsManager.useDefaultLoadingScreen = false;
sceneNames.forEach(function (sceneName) {
//加载模型
var _thisModel = {};
this._resourceData[sceneName].models.forEach(function (model) {
var 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;
});
var _thisMesh = task;
_thisModel[model.name] = _thisMesh;
this._resourceObject.models[sceneName] = _thisModel;
}.bind(this);
}.bind(this));
//加载图片
var _thisImage = {};
this._resourceData[sceneName].images.forEach(function (image) {
var 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) {
var 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) {
var 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) {
var 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);
};
Object.defineProperty(YtAssetsManager.prototype, "resourceObject", {
get: function () {
return this._resourceObject;
},
enumerable: true,
configurable: true
});
return YtAssetsManager;
}());
exports.YtAssetsManager = YtAssetsManager;
//# sourceMappingURL=YtAssetsManager.js.map
\ No newline at end of file
{"version":3,"file":"YtAssetsManager.js","sourceRoot":"","sources":["../../src/manager/YtAssetsManager.ts"],"names":[],"mappings":";AAAA,mDAAmD;;AAEnD;IAcI;QACI,8CAA8C;QAC9C,IAAI,CAAC,eAAe,GAAC;YACjB,OAAO,EAAC,EAAE;YACV,MAAM,EAAC,EAAE;YACT,MAAM,EAAC,EAAE;YACT,QAAQ,EAAC,EAAE;YACX,YAAY,EAAC,EAAE;SAClB,CAAA;IACL,CAAC;IAhBD,sBAAkB,sBAAG;aAArB;YACI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;aACzC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IAaD,sBAAW,yCAAY;aAAvB,UAAwB,QAAQ;YAC5B,IAAI,CAAC,aAAa,GAAC,QAAQ,CAAC;QAChC,CAAC;;;OAAA;IAEM,kCAAQ,GAAf,UAAgB,UAAwB,EAAC,KAAK,EAAC,QAAQ,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AAC,aAAa,CAAC,gBAAgB,GAAC,aAAa,CAAC,kBAAkB,CAAC,GAAC,aAAa,CAAC,gBAAgB;aAC7G,CAAA;YACD,QAAQ,CAAC,KAAK,CAAC,CAAA;QAEnB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,UAAU;QACV,aAAa,CAAC,QAAQ,GAAC,UAAS,IAAI;YAChC,QAAQ,EAAE,CAAA;QACd,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjB,CAAC;IAED,sBAAW,2CAAc;aAAzB;YACI,OAAO,IAAI,CAAC,eAAe,CAAC;QAChC,CAAC;;;OAAA;IAEL,sBAAC;AAAD,CAAC,AAlJD,IAkJC;AAlJY,0CAAe"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// GUI
var YtGuiManager = /** @class */ (function () {
function YtGuiManager() {
this.guiPoll = {};
this._lastGui = null;
this._fullscreenUI = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("GUI");
this._fullscreenUI.idealWidth = 750;
}
Object.defineProperty(YtGuiManager, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtGuiManager();
}
return this.instance;
},
enumerable: true,
configurable: true
});
YtGuiManager.prototype.changeGui = function (gui) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
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;
};
YtGuiManager.prototype.appendGui = function (gui) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this._fullscreenUI.addControl(gui);
this._lastGui = gui;
};
YtGuiManager.prototype.removeGui = function (gui) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this._fullscreenUI.removeControl(this._lastGui);
};
YtGuiManager.prototype.removeAll = function (gui) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var _length = this._fullscreenUI.rootContainer.children.length;
for (var i = 0; i < _length; i++) {
this._fullscreenUI.removeControl(this._fullscreenUI.rootContainer.children[0]);
}
};
YtGuiManager.prototype.openPanel = function (gui) {
};
YtGuiManager.prototype.closePanel = function (gui) {
};
Object.defineProperty(YtGuiManager.prototype, "fullscreenUI", {
get: function () {
return this._fullscreenUI;
},
enumerable: true,
configurable: true
});
Object.defineProperty(YtGuiManager.prototype, "lastGui", {
get: function () {
return this._lastGui;
},
enumerable: true,
configurable: true
});
return YtGuiManager;
}());
exports.YtGuiManager = YtGuiManager;
//# sourceMappingURL=YtGuiManager.js.map
\ No newline at end of file
{"version":3,"file":"YtGuiManager.js","sourceRoot":"","sources":["../../src/manager/YtGuiManager.ts"],"names":[],"mappings":";;AAAA,MAAM;AACN;IAkBI;QAXQ,YAAO,GAAK,EAAE,CAAC;QAYnB,IAAI,CAAC,QAAQ,GAAC,IAAI,CAAC;QACnB,IAAI,CAAC,aAAa,GAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,UAAU,GAAC,GAAG,CAAC;IACtC,CAAC;IAZD,sBAAkB,mBAAG;aAArB;YACI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;aACtC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IASM,gCAAS,GAAhB,UAAiB,GAAG;QAAC,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QACxB,IAAI,OAAO,GAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAA;QAC5D,KAAI,IAAI,CAAC,GAAC,CAA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AAC;QAC9B,CAAC;;;OAAA;IAED,sBAAW,iCAAO;aAAlB;YACI,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IACL,mBAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,oCAAY"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by renjianfeng on 2018/2/28
*/
var YtDisplayPool_1 = require("../others/YtDisplayPool");
var YtLang_1 = require("../util/YtLang");
var tc_1 = require("tc");
var YtModuleName_1 = require("../enum/YtModuleName");
var YtModuleManager = /** @class */ (function () {
function YtModuleManager() {
/**
* 模块列表
*/
this.moduleList = [];
}
Object.defineProperty(YtModuleManager, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtModuleManager();
}
return this.instance;
},
enumerable: true,
configurable: true
});
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
YtModuleManager.prototype.openModule = function (moduleName) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
console.log(moduleName);
console.log(YtDisplayPool_1.YtDisplayPool.ins.displayPool[moduleName]);
(_a = YtDisplayPool_1.YtDisplayPool.ins.displayPool[moduleName]).show.apply(_a, args);
var _a;
};
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
YtModuleManager.prototype.getModule = function (moduleName) {
if (YtDisplayPool_1.YtDisplayPool.ins.displayPool[moduleName]) {
return moduleName;
}
else {
return false;
}
//return this.moduleList[moduleName];
};
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
YtModuleManager.prototype.closeModule = function (moduleName) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
console.log(moduleName);
console.log(YtDisplayPool_1.YtDisplayPool.ins.displayPool[moduleName]);
(_a = YtDisplayPool_1.YtDisplayPool.ins.displayPool[moduleName]).hide.apply(_a, args);
var _a;
};
/**
* 初始化
*/
YtModuleManager.prototype.init = function () {
var _this = this;
tc_1.GDispatcher.addEvent(tc_1.ABNetManager.ERROR, function (msg) {
// alert()
console.log("msg");
var msgData = {
msg: msg,
sureBtnTxt: YtLang_1.YtLang.lang_011,
cancelBtnTxt: YtLang_1.YtLang.lang_012
};
console.log(msgData);
_this.openMsgModule(msgData);
}, this);
};
/**
* 打开提示模块
* @param msgData
*/
YtModuleManager.prototype.openMsgModule = function (msgData) {
this.openModule(YtModuleName_1.YtModuleName.MSG_PANEL, msgData);
};
return YtModuleManager;
}());
exports.YtModuleManager = YtModuleManager;
//# sourceMappingURL=YtModuleManager.js.map
\ No newline at end of file
{"version":3,"file":"YtModuleManager.js","sourceRoot":"","sources":["../../src/manager/YtModuleManager.ts"],"names":[],"mappings":";;AACA;;GAEG;AACH,yDAAsD;AACtD,yCAAsC;AAEtC,yBAAwF;AACxF,qDAAkD;AAElD;IAAA;QAYI;;WAEG;QACK,eAAU,GAAkB,EAAE,CAAC;IAoE3C,CAAC;IA9EG,sBAAkB,sBAAG;aAArB;YACI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;aACzC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IAOD;;;OAGG;IACI,oCAAU,GAAjB,UAAkB,UAAiB;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QACxC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QACvB,OAAO,CAAC,GAAG,CAAE,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;QACvD,CAAA,KAAA,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA,CAAC,IAAI,WAAI,IAAI,EAAC;;IAC3D,CAAC;IAGD;;;;OAIG;IACI,mCAAS,GAAhB,UAAiB,UAAkB;QAC/B,IAAG,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,EAAC;YACzC,OAAO,UAAU,CAAA;SACpB;aAAI;YACD,OAAO,KAAK,CAAC;SAChB;QACD,qCAAqC;IACzC,CAAC;IAEA;;;MAGE;IACI,qCAAW,GAAlB,UAAmB,UAAiB;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QACzC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QACvB,OAAO,CAAC,GAAG,CAAE,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;QACvD,CAAA,KAAA,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA,CAAC,IAAI,WAAI,IAAI,EAAC;;IAC3D,CAAC;IASD;;OAEG;IACI,8BAAI,GAAX;QAAA,iBAYC;QAXG,gBAAW,CAAC,QAAQ,CAAC,iBAAY,CAAC,KAAK,EAAE,UAAC,GAAW;YAClD,UAAU;YACV,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YACjB,IAAM,OAAO,GAAe;gBACxB,GAAG,EAAE,GAAG;gBACR,UAAU,EAAE,eAAM,CAAC,QAAQ;gBAC3B,YAAY,EAAE,eAAM,CAAC,QAAQ;aAChC,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACpB,KAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC,EAAE,IAAI,CAAC,CAAC;IACb,CAAC;IAEA;;;MAGE;IACI,uCAAa,GAApB,UAAqB,OAAmB;QACpC,IAAI,CAAC,UAAU,CAAC,2BAAY,CAAC,SAAS,EAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IACL,sBAAC;AAAD,CAAC,AAnFD,IAmFC;AAnFY,0CAAe"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var YtSceneManager = /** @class */ (function () {
function YtSceneManager() {
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));
}
Object.defineProperty(YtSceneManager, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtSceneManager();
}
return this.instance;
},
enumerable: true,
configurable: true
});
/* 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;
} */
YtSceneManager.prototype.change = function (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;
};
return YtSceneManager;
}());
exports.YtSceneManager = YtSceneManager;
//# sourceMappingURL=YtSceneManager.js.map
\ No newline at end of file
{"version":3,"file":"YtSceneManager.js","sourceRoot":"","sources":["../../src/manager/YtSceneManager.ts"],"names":[],"mappings":";;AACA;IAgBI;QAEA,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACvD,uDAAuD;QACtD,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE;YAChD,qBAAqB,EAAE,IAAI;YAC3B,gBAAgB,EAAE,CAAC;SACtB,CAAC,CAAC;QACC,IAAI,WAAW,GAAC;YACZ;gBAGI,IAAI,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAE3C,0BAA0B;gBAE1B,IAAI,CAAC,GAAG,KAAK,CAAC,YAAY,EACpB,CAAC,GAAG,KAAK,CAAC,cAAc,EACxB,CAAC,GAAG,KAAK,CAAC,cAAc,EACxB,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;gBACvC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;oBAC9C,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;oBAC9C,MAAM,CAAC,mBAAmB,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;oBACvC,KAAK,CAAC,YAAY,GAAG,UAAS,CAAC;wBAC3B,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;oBAClC,CAAC;;wBAED,KAAK,C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AAC;IAhED,sBAAkB,qBAAG;aAArB;YACI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;aACxC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IA6DF;;QAEI;IAEL;;;;;;;;;;UAUM;IAEG,+BAAM,GAAb,UAAc,OAAO;QAClB;;;;YAII;QAEJ;;aAEK;QAEJ,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAC,EAAE,CAAA;QAElC;;;;;;;;;;;;;WAaG;QACH,cAAc,CAAC,GAAG,CAAC,KAAK,GAAC,OAAO,CAAC;IACrC,CAAC;IAaL,qBAAC;AAAD,CAAC,AApID,IAoIC;AApIY,wCAAc"}
\ No newline at end of file
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var YtModule_1 = require("./YtModule");
var YtDisplayPool_1 = require("../others/YtDisplayPool");
var YtModuleName_1 = require("../enum/YtModuleName");
var YtLoadingModule = /** @class */ (function (_super) {
__extends(YtLoadingModule, _super);
function YtLoadingModule() {
return _super.call(this) || this;
}
YtLoadingModule.prototype.init = function () {
YtDisplayPool_1.YtDisplayPool.ins.displayPool[YtModuleName_1.YtModuleName.LOADING_GUI] = this;
};
/**
* 更新页面
* @param {number} max 最大进度值
*/
YtLoadingModule.prototype.updateData = function (max) {
this.maxProgress = max;
};
YtLoadingModule.prototype.onProgress = function (curr) {
var pre = parseInt((curr * 100).toString());
if (this.view.progressTxt) {
this.view.progressTxt.text = pre + '%';
}
};
return YtLoadingModule;
}(YtModule_1.YtModule));
exports.YtLoadingModule = YtLoadingModule;
//# sourceMappingURL=YtLoadingModule.js.map
\ No newline at end of file
{"version":3,"file":"YtLoadingModule.js","sourceRoot":"","sources":["../../src/module/YtLoadingModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uCAAoC;AACpC,yDAAsD;AACtD,qDAAkD;AAGlD;IAAqC,mCAAQ;IAOzC;eACI,iBAAO;IACX,CAAC;IAEM,8BAAI,GAAX;QACI,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,2BAAY,CAAC,WAAW,CAAC,GAAC,IAAI,CAAC;IACjE,CAAC;IAGD;;;OAGG;IACI,oCAAU,GAAjB,UAAkB,GAAW;QACzB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;IAC3B,CAAC;IAEM,oCAAU,GAAjB,UAAkB,IAAY;QAC1B,IAAM,GAAG,GAAW,QAAQ,CAAC,CAAC,IAAI,GAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAE;QACrD,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;SAC1C;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AA9BD,CAAqC,mBAAQ,GA8B5C;AA9BY,0CAAe"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var YtAnimationGui_1 = require("../others/YtAnimationGui");
var YtSceneManager_1 = require("../manager/YtSceneManager");
var YtGuiCreate_1 = require("../others/YtGuiCreate");
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
var YtGuiManager_1 = require("../manager/YtGuiManager");
var YtModule = /** @class */ (function () {
function YtModule() {
//事件
this.doEvents = [];
//面板隐藏显示实例
this.panelsAn = new YtAnimationGui_1.YtAnimationGui(YtSceneManager_1.YtSceneManager.ins.scene, YtGuiManager_1.YtGuiManager.ins.fullscreenUI);
this.initModel();
this.clickCallbackBindPool = {};
// var skinClass: any = eval(this.module.skinName);
// this.display = new skinClass();
// this.clickCallbackPool = {};
}
/**
* 初始化数据
*/
YtModule.prototype.initModel = function () {
};
/**
* 初始化UI
*/
YtModule.prototype.initUI = function () {
};
/**
* 显示
*/
YtModule.prototype.show = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.removeEvent();
this.updateData.apply(this, args);
this.addEvent();
YtGuiManager_1.YtGuiManager.ins.changeGui(this.parent);
};
/**
* 隐藏
*/
YtModule.prototype.hide = function () {
this.removeEvent();
YtGuiManager_1.YtGuiManager.ins.removeGui(this.parent);
};
/**
* 添加事件
*/
YtModule.prototype.addEvent = function () {
};
/**
* 移除事件
*/
YtModule.prototype.removeEvent = function () {
};
/**
* 更新页面
* @param args
*/
YtModule.prototype.updateData = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!this.isInit) {
this.initUI();
this.isInit = true;
}
};
/**
* 添加点击事件
* @param display
*
* @param callback
*/
YtModule.prototype.addClick = function (display, callback) {
this.doEvents[display.name] = display.onPointerUpObservable.add(callback);
};
/**
* 移除点击事件
* @param display
* @param callback
*/
YtModule.prototype.removeClick = function (display) {
display.onPointerUpObservable.remove(this.doEvents[display.name]);
};
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
YtModule.prototype.delayEnable = function (display, delay) {
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);
};
//页面HTML模板
YtModule.prototype.listTemplateHtml = function (data, config) {
};
YtModule.prototype.htmlCreate = function (config, data) {
this.listTemplateHtml(data, config);
document.body.appendChild(this.viewNode);
YtGuiCreate_1.YtGuiCreate.ins.preventDefault(this.viewNode);
};
YtModule.prototype.dispose = function () {
};
/**
* 鼠标事件
* @param enable
*/
YtModule.prototype.enableMouseEvt = function (enable) {
var 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
*/
YtModule.prototype.enableMouseEvtView = function (view, enable) {
view.isHitTestVisible = enable;
if (enable == true) {
view["mouseEnable"] = 1;
}
else {
view["mouseEnable"] = 2;
}
};
return YtModule;
}());
exports.YtModule = YtModule;
//# sourceMappingURL=YtModule.js.map
\ No newline at end of file
{"version":3,"file":"YtModule.js","sourceRoot":"","sources":["../../src/module/YtModule.ts"],"names":[],"mappings":";;AACA,2DAAwD;AACxD,4DAAyD;AACzD,qDAAkD;AAElD;;;GAGG;AACH,wDAAqD;AAErD;IAgCI;QAtBC,IAAI;QACM,aAAQ,GAAC,EAAE,CAAC;QAEpB,UAAU;QACH,aAAQ,GAAC,IAAI,+BAAc,CAAC,+BAAc,CAAC,GAAG,CAAC,KAAK,EAAC,2BAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAmBzF,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAClC,oDAAoD;QACnD,kCAAkC;QAClC,+BAA+B;IAClC,CAAC;IAEC;;KAEC;IACO,4BAAS,GAAnB;IAEA,CAAC;IAED;;OAEG;IACO,yBAAM,GAAhB;IAEA,CAAC;IAEJ;;aAES;IACI,uBAAI,GAAd;QAAe,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QAClB,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,UAAU,OAAf,IAAI,EAAe,IAAI,EAAC;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,2BAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CA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= Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var YtPanelModule_1 = require("./YtPanelModule");
var YtDisplayPool_1 = require("../others/YtDisplayPool");
var YtModuleName_1 = require("../enum/YtModuleName");
var MsgModule = /** @class */ (function (_super) {
__extends(MsgModule, _super);
function MsgModule() {
return _super.call(this) || this;
}
MsgModule.prototype.init = function () {
YtDisplayPool_1.YtDisplayPool.ins.displayPool[YtModuleName_1.YtModuleName.MSG_PANEL] = this;
};
/**
* 添加事件
* */
MsgModule.prototype.addEvent = function () {
if (this.view.closeBtn) {
this.doEvents["closeBtn"] = this.addClick(this.view.closeBtn, this.onClick_closeBtn.bind(this));
}
};
MsgModule.prototype.onClick_closeBtn = function () {
this.enableMouseEvt(false);
this.hide();
};
MsgModule.prototype.removeEvent = function () {
this.enableMouseEvt(true);
if (this.view.closeBtn) {
this.view.closeBtn.onPointerUpObservable.remove(this.doEvents["closeBtn"]);
}
};
/**
* 更新提示文案
*/
MsgModule.prototype.updateMsgTxt = function (msgTxt) {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
};
/**
* 更新确定按钮文案
*/
MsgModule.prototype.updateSureBtnTxt = function (btnTxt) {
if (this.view.sureBtn) {
this.view.sureBtn.children[0].text = btnTxt;
}
};
/**
* 更新取消按钮文案
*/
MsgModule.prototype.updateCancelBtnTxt = function (btnTxt) {
if (this.view.cancelBtn) {
this.view.cancelBtn.children[0].text = btnTxt;
}
};
/**
* 更新页面
* @param args
*/
MsgModule.prototype.updateData = function (msgData) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
if (msgData.msg) {
this.updateMsgTxt(msgData.msg);
}
if (msgData.sureBtnTxt) {
this.updateSureBtnTxt(msgData.sureBtnTxt);
}
if (msgData.cancelBtnTxt) {
this.updateCancelBtnTxt(msgData.cancelBtnTxt);
}
};
return MsgModule;
}(YtPanelModule_1.YtPanelModule));
exports.MsgModule = MsgModule;
//# sourceMappingURL=YtMsgModule.js.map
\ No newline at end of file
{"version":3,"file":"YtMsgModule.js","sourceRoot":"","sources":["../../src/module/YtMsgModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8C;AAC9C,yDAAsD;AACtD,qDAAkD;AAGlD;IAA+B,6BAAa;IAExC;eACI,iBAAO;IACX,CAAC;IAEM,wBAAI,GAAX;QACI,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,2BAAY,CAAC,SAAS,CAAC,GAAC,IAAI,CAAC;IAC/D,CAAC;IAED;;SAEK;IACK,4BAAQ,GAAlB;QACI,IAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;SAC/F;IACL,CAAC;IAGS,oCAAgB,GAA1B;QACI,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAGS,+BAAW,GAArB;QACI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QACzB,IAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAC;YAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;SAC7E;IACL,CAAC;IAGA;;MAEE;IACO,gCAAY,GAAtB,UAAuB,MAAc;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;SAClC;IACL,CAAC;IAED;;OAEG;IACO,oCAAgB,GAA1B,UAA2B,MAAc;QACrC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;SAC/C;IACL,CAAC;IAED;;OAEG;IACO,sCAAkB,GAA5B,UAA6B,MAAc;QACvC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC;SACjD;IACL,CAAC;IAED;;;OAGG;IACI,8BAAU,GAAjB,UAAkB,OAAmB;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QAC1C,IAAG,OAAO,CAAC,GAAG,EAAC;YACX,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAClC;QACD,IAAG,OAAO,CAAC,UAAU,EAAC;YAClB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SAC7C;QACD,IAAG,OAAO,CAAC,YAAY,EAAC;YACpB,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;SACjD;IACL,CAAC;IACL,gBAAC;AAAD,CAAC,AA5ED,CAA+B,6BAAa,GA4E3C;AA5EY,8BAAS"}
\ No newline at end of file
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tc_1 = require("tc");
var YtModule_1 = require("./YtModule");
var YtGuiManager_1 = require("../manager/YtGuiManager");
var YtPanelModule = /** @class */ (function (_super) {
__extends(YtPanelModule, _super);
function YtPanelModule() {
return _super !== null && _super.apply(this, arguments) || this;
}
YtPanelModule.prototype.updateData = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
};
YtPanelModule.prototype.addEvent = function () {
_super.prototype.addEvent.call(this);
if (this.view.closeBtn) {
this.addClick(this.view.closeBtn, this.onClick_closeBtn);
}
};
/**
* 显示
*/
YtPanelModule.prototype.show = function () {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.addEvent();
this.updateData.apply(this, args);
this.panelsAn.show(this.view.view, function () {
_this.onOpen();
}, function () {
_this.onOpened();
});
};
/**
* 隐藏
*/
YtPanelModule.prototype.hide = function () {
var _this = this;
this.removeEvent();
this.panelsAn.hide(this.view.view, function () {
_this.onClose();
}, function () {
_this.onClosed();
});
};
/**
* 打开前
* */
YtPanelModule.prototype.onOpen = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
YtGuiManager_1.YtGuiManager.ins.appendGui(this.parent);
};
/**
* 打开后
* */
YtPanelModule.prototype.onOpened = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
};
/**
* 关闭前
* */
YtPanelModule.prototype.onClose = function () {
};
/**
* 关闭后
* */
YtPanelModule.prototype.onClosed = function () {
this.removeEvent();
YtGuiManager_1.YtGuiManager.ins.removeGui(this.parent);
};
YtPanelModule.prototype.onClick_closeBtn = function (e) {
tc_1.GDispatcher.dispatchEvent(YtPanelModule.CLOSE_BTN_CLICK, "closeBtn");
this.removeEvent();
YtGuiManager_1.YtGuiManager.ins.removeGui(this.parent);
};
YtPanelModule.prototype.removeEvent = function () {
_super.prototype.removeEvent.call(this);
if (this.view.closeBtn) {
// this.removeClick(this.view.closeBtn);
}
};
/**
* 点击关闭按钮
*/
YtPanelModule.CLOSE_BTN_CLICK = 'closeBtnClick';
/**
* 点击确定按钮
*/
YtPanelModule.SURE_BTN_CLICK = 'sureBtnClick';
/**
* 点击取消按钮
*/
YtPanelModule.CANCEL_BTN_CLICK = 'cancelBtnClick';
return YtPanelModule;
}(YtModule_1.YtModule));
exports.YtPanelModule = YtPanelModule;
//# sourceMappingURL=YtPanelModule.js.map
\ No newline at end of file
{"version":3,"file":"YtPanelModule.js","sourceRoot":"","sources":["../../src/module/YtPanelModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAiC;AACjC,uCAAsC;AACtC,wDAAqD;AAErD;IAAmC,iCAAQ;IAA3C;;IA+FA,CAAC;IA/EU,kCAAU,GAAjB;QAAkB,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;IAEzB,CAAC;IAES,gCAAQ,GAAlB;QACI,iBAAM,QAAQ,WAAE,CAAC;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC5D;IACL,CAAC;IAEA;;MAEE;IACO,4BAAI,GAAd;QAAA,iBAQC;QARc,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QAClB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,UAAU,OAAf,IAAI,EAAe,IAAI,EAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAC;YAC9B,KAAI,CAAC,MAAM,EAAE,CAAA;QACjB,CAAC,EAAC;YACE,KAAI,CAAC,QAAQ,EAAE,CAAA;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IACW,4BAAc,GAAG,cAAc,CAAC;IAE9C;;OAEG;IACW,8BAAgB,GAAG,gBAAgB,CAAC;IAiFtD,oBAAC;CAAA,AA/FD,CAAmC,mBAAQ,GA+F1C;AA/FY,sCAAa"}
\ No newline at end of file
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var YtModule_1 = require("./YtModule");
var YtDisplayPool_1 = require("../others/YtDisplayPool");
var YtModuleName_1 = require("../enum/YtModuleName");
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
var YtWaitingModule = /** @class */ (function (_super) {
__extends(YtWaitingModule, _super);
function YtWaitingModule() {
return _super.call(this) || this;
}
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
YtWaitingModule.prototype.updateData = function (msgTxt) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
this.updateMsgTxt(msgTxt);
};
/**
* 更新提示文案
* @param desc
*/
YtWaitingModule.prototype.updateMsgTxt = function (msgTxt) {
if (this.view.msgTxt) {
this.view.msgTxt.text = msgTxt;
}
};
YtWaitingModule.prototype.init = function () {
YtDisplayPool_1.YtDisplayPool.ins.displayPool[YtModuleName_1.YtModuleName.WAITING_PANEL] = this;
};
return YtWaitingModule;
}(YtModule_1.YtModule));
exports.YtWaitingModule = YtWaitingModule;
//# sourceMappingURL=YtWaitingModule.js.map
\ No newline at end of file
{"version":3,"file":"YtWaitingModule.js","sourceRoot":"","sources":["../../src/module/YtWaitingModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoC;AACpC,yDAAsD;AACtD,qDAAkD;AAClD;;;GAGG;AACH;IAAqC,mCAAQ;IAMtC;eACI,iBAAO;IACX,CAAC;IAEA;;;OAGG;IACI,oCAAU,GAAjB,UAAkB,MAAc;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QACrC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACO,sCAAY,GAAtB,UAAuB,MAAc;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;SAClC;IACL,CAAC;IAGK,8BAAI,GAAX;QACK,6BAAa,CAAC,GAAG,CAAC,WAAW,CAAC,2BAAY,CAAC,aAAa,CAAC,GAAC,IAAI,CAAC;IACpE,CAAC;IACR,sBAAC;AAAD,CAAC,AAhCD,CAAqC,mBAAQ,GAgC5C;AAhCY,0CAAe"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Created by clq on 2017/10/10.
*动画控制器
*/
var YtAnimationCon = /** @class */ (function () {
function YtAnimationCon() {
}
Object.defineProperty(YtAnimationCon, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtAnimationCon();
}
return this.instance;
},
enumerable: true,
configurable: true
});
YtAnimationCon.prototype.animationBody = function (object, scene) {
//动画模式
var _endattr;
//动画对象
var _mesh;
//动画属性
var _attr;
//动画速度
var _speed;
//动画帧
var _keys;
//动画结束回调函数
var _endCall;
//动画数据类型
var _typeData;
//动画数据类型
var _loop;
if (object.endattr != null) {
_endattr = object.endattr;
}
else {
_endattr = BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE;
}
if (object.mesh != null) {
_mesh = object.mesh;
}
else {
_mesh = null;
console.error("动画对象不能为空!");
}
if (object.attr != null) {
_attr = object.attr;
}
else {
_attr = null;
console.error("动画对象属性不能为空!");
}
if (object.speed != null) {
_speed = object.speed;
}
else {
_speed = 10;
}
if (object.keys != null) {
_keys = object.keys;
}
else {
_keys = [];
}
if (object.endCall != null) {
_endCall = object.endCall;
}
else {
_endCall = function () { };
}
if (object.typeData != null) {
_typeData = object.typedata;
}
else {
_typeData = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
}
if (object.loop != null) {
_loop = object.loop;
}
else {
_loop = false;
}
var animationBox = new BABYLON.Animation("myAnimation", _attr, _speed, _typeData, _endattr);
var keys = [];
keys = _keys;
animationBox.setKeys(keys);
_mesh.animations.push(animationBox);
this.setbeginAnimation = scene.beginAnimation(_mesh, 0, _keys[_keys.length - 1].frame, _loop);
this.setbeginAnimation.onAnimationEnd = function () {
_endCall();
};
};
YtAnimationCon.prototype.Pause = function () {
this.setbeginAnimation.pause();
};
YtAnimationCon.prototype.Reset = function () {
this.setbeginAnimation.reset();
};
YtAnimationCon.prototype.Speed = function (i) {
this.setbeginAnimation.speedRatio = i;
};
return YtAnimationCon;
}());
exports.YtAnimationCon = YtAnimationCon;
//# sourceMappingURL=YtAnimationCon.js.map
\ No newline at end of file
{"version":3,"file":"YtAnimationCon.js","sourceRoot":"","sources":["../../src/others/YtAnimationCon.ts"],"names":[],"mappings":";;AAEA;;;GAGG;AACH;IAWI;IAAc,CAAC;IAPf,sBAAoB,qBAAG;aAAvB;YACI,IAAG,CAAC,IAAI,CAAC,QAAQ,EAAC;gBACd,IAAI,CAAC,QAAQ,GAAC,IAAI,cAAc,EAAE,CAAA;aACrC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IAIM,sCAAa,GAApB,UAAqB,MAAM,EAAC,KAAK;QAC7B,MAAM;QACN,IAAI,QAAQ,CAAC;QAEb,MAAM;QACN,IAAI,KAAK,CAAC;QAEV,MAAM;QACN,IAAI,KAAK,CAAC;QAEV,MAAM;QACN,IAAI,MAAM,CAAC;QAEX,KAAK;QACL,IAAI,KAAK,CAAC;QAEV,UAAU;QACV,IAAI,QAAQ,CAAC;QAEb,QAAQ;QACR,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,GAAC,MAAM,CAAC,IAAI,CAAA;SACpB;aAAI;YACD,KAAK,GAAC,KAAK,CAAC;SACf;QAED,IAAI,YAAY,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC5F,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,GAAC,KAAK,CAAA;QACV,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAC,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1F,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAC;YAClC,QAAQ,EAAE,CAAA;QACd,CAAC,CAAA;IACL,CAAC;IAEM,8BAAK,GAAZ;QACI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAA;IAClC,CAAC;IACM,8BAAK,GAAZ;QACI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAA;IAClC,CAAC;IACM,8BAAK,GAAZ,UAAa,CAAC;QACV,IAAI,CAAC,iBAAiB,CAAC,UAAU,GAAC,CAAC,CAAA;IACvC,CAAC;IAEL,qBAAC;AAAD,CAAC,AA/GD,IA+GC;AA/GY,wCAAc"}
\ No newline at end of file
"use strict";
/**
* Created by clq on 2017/10/10.
* 弹框动画UI控制器
*/
Object.defineProperty(exports, "__esModule", { value: true });
var YtAnimationGui = /** @class */ (function () {
function YtAnimationGui(scene, advancedTexture) {
this.show = function (gui, open, opened) {
var keys = [];
keys.push({
frame: 0,
value: 0.1
});
keys.push({
frame: 10,
value: 1
});
var animationX = new BABYLON.Animation("", "scaleX", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationX.setKeys(keys);
var animationY = new BABYLON.Animation("", "scaleY", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationY.setKeys(keys);
gui.animations = [];
gui.animations.push(animationX, animationY);
this.advancedTexture.addControl(gui);
if (open) {
open();
}
this.scene.beginAnimation(gui, 0, 10, false, 2, function () {
if (opened) {
opened();
}
});
};
this.hide = function (gui, close, closed) {
var _this = this;
var keys = [];
keys.push({
frame: 0,
value: 1
});
keys.push({
frame: 10,
value: 0.1
});
var animationX = new BABYLON.Animation("", "scaleX", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationX.setKeys(keys);
var animationY = new BABYLON.Animation("", "scaleY", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationY.setKeys(keys);
gui.animations = [];
gui.animations.push(animationX, animationY);
if (close) {
close();
}
this.scene.beginAnimation(gui, 0, 10, false, 2, function () {
_this.advancedTexture.removeControl(gui);
//this.advancedTexture.dispose();
if (closed) {
closed();
}
});
};
this.scene = scene;
this.advancedTexture = advancedTexture;
}
return YtAnimationGui;
}());
exports.YtAnimationGui = YtAnimationGui;
//# sourceMappingURL=YtAnimationGui.js.map
\ No newline at end of file
{"version":3,"file":"YtAnimationGui.js","sourceRoot":"","sources":["../../src/others/YtAnimationGui.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH;IAMI,wBAAY,KAAK,EAAC,eAAe;QAK1B,SAAI,GAAG,UAAU,GAAG,EAAC,IAAK,EAAC,MAAO;YACrC,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,IAAI,CAAC;gBACN,KAAK,EAAE,CAAC;gBACR,KAAK,EAAE,GAAG;aACb,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,CAAC;g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;YACH,IAAI,UAAU,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;YAC3I,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,UAAU,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;YAC3I,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACzB,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC;YACpB,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAC,UAAU,CAAC,CAAC;YAC3C,IAAG,KAAK,EAAC;gBACL,KAAK,EAAE,CAAA;aACV;YACD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAC,CAAC,EAAC;gBAC1C,KAAI,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;gBACxC,iCAAiC;gBACjC,IAAG,MAAM,EAAC;oBACN,MAAM,EAAE,CAAA;iBACX;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAzDE,IAAI,CAAC,KAAK,GAAC,KAAK,CAAC;QACjB,IAAI,CAAC,eAAe,GAAC,eAAe,CAAA;IACxC,CAAC;IAyDL,qBAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,wCAAc"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var YtDisplayPool = /** @class */ (function () {
function YtDisplayPool() {
//场景名称
this.displayPool = {};
}
Object.defineProperty(YtDisplayPool, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtDisplayPool();
}
return this.instance;
},
enumerable: true,
configurable: true
});
return YtDisplayPool;
}());
exports.YtDisplayPool = YtDisplayPool;
//# sourceMappingURL=YtDisplayPool.js.map
\ No newline at end of file
{"version":3,"file":"YtDisplayPool.js","sourceRoot":"","sources":["../../src/others/YtDisplayPool.ts"],"names":[],"mappings":";;AAAA;IAAA;QASI,MAAM;QACC,gBAAW,GAAQ,EAAE,CAAC;IACjC,CAAC;IARG,sBAAkB,oBAAG;aAArB;YACI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;aACvC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IAGL,oBAAC;AAAD,CAAC,AAXD,IAWC;AAXY,sCAAa"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* GUI控制器
* */
var YtGuiManager_1 = require("../manager/YtGuiManager");
var YtGuiCreate = /** @class */ (function () {
function YtGuiCreate() {
this.panelOut = new BABYLON.GUI.StackPanel();
}
Object.defineProperty(YtGuiCreate, "ins", {
get: function () {
if (!this.instance) {
this.instance = new YtGuiCreate();
}
return this.instance;
},
enumerable: true,
configurable: true
});
YtGuiCreate.prototype.createList = function (name, options, scaleUi) {
var _this = this;
var rectOut = new BABYLON.GUI.Rectangle();
rectOut.thickness = 0;
rectOut.isPointerBlocker = true;
rectOut.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if (rectOut[key]) {
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if (options && options.isVertical) {
this.panelOut.horizontalAlignment = 2;
this.panelOut.verticalAlignment = 0;
this.panelOut.isVertical = true;
var mouse = {
up: 0,
down: 0,
};
mouse.up = parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function (e) {
mouse.down = e.y;
});
rectOut.onPointerUpObservable.add(function (e) {
var topY = parseInt(_this.panelOut.top.toString());
mouse.up = topY;
if (topY > 0) {
_this.panelOut.top = "0px";
mouse.up = 0;
}
else if (parseInt(_this.panelOut.top.toString()) < parseInt(rectOut.height.toString()) - parseInt(_this.panelOut.height.toString())) {
var l = (parseInt(rectOut.height.toString()) - parseInt(_this.panelOut.height.toString())) * scaleUi;
_this.panelOut.top = l.toString() + "px";
mouse.up = parseInt(_this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add(function (e) {
var m = e.y - mouse.down;
var mul = (mouse.up + m) * scaleUi;
_this.panelOut.top = mul.toString() + "px";
});
}
else {
this.panelOut.horizontalAlignment = 0;
this.panelOut.verticalAlignment = 2;
this.panelOut.isVertical = false;
var mouse = {
up: 0,
down: 0
};
mouse.up = parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add(function (e) {
mouse.down = e.x;
});
rectOut.onPointerUpObservable.add(function (e) {
var leftY = parseInt(_this.panelOut.left.toString());
mouse.up = leftY;
if (leftY > 0) {
_this.panelOut.left = "0px";
mouse.up = 0;
}
else if (parseInt(_this.panelOut.left.toString()) < parseInt(rectOut.width.toString()) - parseInt(_this.panelOut.width.toString())) {
var l = (parseInt(rectOut.width.toString()) - parseInt(_this.panelOut.width.toString())) * scaleUi;
_this.panelOut.left = l.toString() + "px";
mouse.up = parseInt(_this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function (e) {
var m = e.x - mouse.down;
var mul = (mouse.up + m) * scaleUi;
this.panelOut.left = mul.toString() + "px";
});
}
rectOut.addControl(this.panelOut);
return rectOut;
};
YtGuiCreate.prototype.optionsListCon = function (config, data, listTemplate) {
var _this = this;
var scaleUi = YtGuiManager_1.YtGuiManager.ins.fullscreenUI.idealWidth / document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist = this.createList("list", { width: config.bodyWidth, height: config.bodyHeight, top: config.bodyTop, left: config.bodyLeft, isVertical: config.isVertical }, scaleUi);
var _length = this.panelOut.children.length;
if (_length > 0) {
for (var i = 0; i < _length; i++) {
this.panelOut.removeControl(this.panelOut.children[0]);
}
}
data.forEach(function (_list) {
var list = listTemplate(config, _list);
_this.panelOut.addControl(list);
});
return prizeDatalist;
};
YtGuiCreate.prototype.preventDefault = function (Node) {
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', function (event) {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', function (event) {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = " + st);
console.log(y);
console.log(lastY);
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
};
return YtGuiCreate;
}());
exports.YtGuiCreate = YtGuiCreate;
//# sourceMappingURL=YtGuiCreate.js.map
\ No newline at end of file
{"version":3,"file":"YtGuiCreate.js","sourceRoot":"","sources":["../../src/others/YtGuiCreate.ts"],"names":[],"mappings":";;AAAA;;KAEK;AACL,wDAAqD;AAErD;IAcI;QAXQ,aAAQ,GAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAWhC,CAAC;IAPf,sBAAoB,kBAAG;aAAvB;YACI,IAAG,CAAC,IAAI,CAAC,QAAQ,EAAC;gBACd,IAAI,CAAC,QAAQ,GAAC,IAAI,WAAW,EAAE,CAAA;aAClC;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;;;OAAA;IAKM,gCAAU,GAAjB,UAAkB,IAAI,EAAC,OAAO,EAAC,OAAO;QAAtC,iBA2EC;QA1EG,IAAI,OAAO,GAAC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACxC,OAAO,CAAC,SAAS,GAAC,CAAC,CAAC;QACpB,OAAO,CAAC,gBAAgB,GAAC,IAAI,CAAC;QAC9B,OAAO,CAAC,iBAAiB,GAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC;Q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,IAAI,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;IACxB,CAAC;IAGM,oCAAc,GAArB,UAAsB,IAAI;QACtB,UAAU;QACV,IAAI,KAAK,CAAC;QACV,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAC,KAAK;YACtC,KAAK,GAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,UAAC,KAAK;YACrC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAC/B,OAAO;YACP,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,OAAO,GAAC,EAAE,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAClB,4CAA4C;YAC5C,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,IAAI,CAAC,EAAE;gBACvB,KAAK,GAAG,CAAC,CAAC;gBACV,KAAK,CAAC,cAAc,EAAE,CAAC;aAC1B;YACD,KAAK,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACR,CAAC;IAEJ,kBAAC;AAAD,CAAC,AAtID,IAsIC;AAtIY,kCAAW"}
\ No newline at end of file
"use strict";
/**
* Created by rjf on 2017/10/10.
* 粒子控制器
*/
Object.defineProperty(exports, "__esModule", { value: true });
var YtParticleCon = /** @class */ (function () {
function YtParticleCon(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;
}
YtParticleCon.prototype.start = function () {
this.particleSystem.start();
};
YtParticleCon.prototype.stop = function () {
this.particleSystem.stop();
};
YtParticleCon.prototype.Position = function (position) {
this.fountain.position = position;
};
YtParticleCon.prototype.Parent = function (parent) {
this.fountain.parent = parent;
};
return YtParticleCon;
}());
exports.YtParticleCon = YtParticleCon;
//# sourceMappingURL=YtParticleCon.js.map
\ No newline at end of file
{"version":3,"file":"YtParticleCon.js","sourceRoot":"","sources":["../../src/others/YtParticleCon.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH;IAEI,uBAAY,QAAQ,EAAC,KAAK,EAAC,QAAQ;QAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAC,KAAK,CAAA;QAC9B,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAC,IAAI,CAAC,EAAE,GAAC,GAAG,CAAC;QACrC,IAAI,CAAC,cAAc,GAAC,QAAQ,CAAC;QAC7B,OAAO;QACP,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,wDAAwD;QACrG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAC,QAAQ,CAAC;IACpC,CAAC;IAMM,6BAAK,GAAZ;QACI,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,4BAAI,GAAX;QACI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IACM,gCAAQ,GAAf,UAAgB,QAAQ;QACpB,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAC,QAAQ,CAAC;IACpC,CAAC;IAEM,8BAAM,GAAb,UAAc,MAAM;QAChB,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAC,MAAM,CAAC;IAChC,CAAC;IACL,oBAAC;AAAD,CAAC,AAhCD,IAgCC;AAhCY,sCAAa"}
\ No newline at end of file
{ {
"name": "yt", "name": "yt",
"version": "1.0.13", "version": "1.0.14",
"description": "基于Babylonjs的3D框架", "description": "基于Babylonjs的3D框架",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",
......
import {ResourceData} from "./interface/ResourceData"; import {YtResourceData} from "./interface/YtResourceData";
import {fileData} from "./interface/fileData"; import {YtFileData} from "./interface/YtFileData";
import {YtModuleName} from "./enum/YtModuleName"; import {YtModuleName} from "./enum/YtModuleName";
import {YtLang} from "./util/YtLang"; import {YtLang} from "./util/YtLang";
import {AssetsManager} from "./manager/AssetsManager"; import {YtAssetsManager} from "./manager/YtAssetsManager";
import {GuiManager} from "./manager/GuiManager"; import {YtGuiManager} from "./manager/YtGuiManager";
import {SceneManager} from "./manager/SceneManager"; import {YtSceneManager} from "./manager/YtSceneManager";
import {ModuleManager} from "./manager/ModuleManager"; import {YtModuleManager} from "./manager/YtModuleManager";
import {AnimationCon} from "./others/AnimationCon"; import {YtAnimationCon} from "./others/YtAnimationCon";
import {AnimationGui} from "./others/AnimationGui"; import {YtAnimationGui} from "./others/YtAnimationGui";
import {particleCon} from "./others/particleCon"; import {YtParticleCon} from "./others/YtParticleCon";
import {GuiCreate} from "./others/GuiCreate"; import {YtGuiCreate} from "./others/YtGuiCreate";
import {Module} from "./module/Module"; import {YtModule} from "./module/YtModule";
import {DisplayPool} from "./others/DisplayPool"; import {YtDisplayPool} from "./others/YtDisplayPool";
import {MsgModule} from "./module/MsgModule" import {MsgModule} from "./module/YtMsgModule"
import {LoadingModule} from "./module/LoadingModule"; import {YtLoadingModule} from "./module/YtLoadingModule";
import {WaitingModule} from "./module/WaitingModule"; import {YtWaitingModule} from "./module/YtWaitingModule";
import {PanelModule} from "./module/PanelModule"; import {YtPanelModule} from "./module/YtPanelModule";
export { export {
//UI创建和scene创建 //UI创建和scene创建
Module,DisplayPool,MsgModule,LoadingModule,WaitingModule,PanelModule, YtModule,YtDisplayPool,MsgModule,YtLoadingModule,YtWaitingModule,YtPanelModule,
//other //other
AnimationCon,AnimationGui,particleCon,GuiCreate, YtAnimationCon,YtAnimationGui,YtParticleCon,YtGuiCreate,
//接口 //接口
ResourceData,fileData, YtResourceData,YtFileData,
//枚举 //枚举
YtModuleName, YtModuleName,
...@@ -35,6 +35,6 @@ export { ...@@ -35,6 +35,6 @@ export {
YtLang, YtLang,
//管理器 //管理器
AssetsManager,GuiManager,SceneManager,ModuleManager, 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 {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 {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 {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 {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 {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 { 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 {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
import {YtGuiCreate} from "./YtGuiCreate";
/**
* Created by clq on 2017/10/10.
*动画控制器
*/
export class YtAnimationCon {
private static instance: YtAnimationCon;
private setbeginAnimation;
public static get ins():YtAnimationCon{
if(!this.instance){
this.instance=new YtAnimationCon()
}
return this.instance;
}
constructor(){}
public animationBody(object,scene){
//动画模式
var _endattr;
//动画对象
var _mesh;
//动画属性
var _attr;
//动画速度
var _speed;
//动画帧
var _keys;
//动画结束回调函数
var _endCall;
//动画数据类型
var _typeData
//动画数据类型
var _loop;
if(object.endattr!=null){
_endattr=object.endattr;
}else{
_endattr=BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE;
}
if(object.mesh!=null){
_mesh=object.mesh;
}else {
_mesh=null;
console.error("动画对象不能为空!")
}
if(object.attr!=null){
_attr=object.attr;
}else {
_attr=null;
console.error("动画对象属性不能为空!")
}
if(object.speed!=null){
_speed=object.speed;
}else {
_speed=10;
}
if(object.keys!=null){
_keys=object.keys;
}else {
_keys=[];
}
if(object.endCall!=null){
_endCall=object.endCall
}else{
_endCall=function(){}
}
if(object.typeData!=null){
_typeData=object.typedata
}else{
_typeData=BABYLON.Animation.ANIMATIONTYPE_FLOAT
}
if(object.loop!=null){
_loop=object.loop
}else{
_loop=false;
}
var animationBox = new BABYLON.Animation("myAnimation", _attr, _speed, _typeData, _endattr);
var keys = [];
keys=_keys
animationBox.setKeys(keys);
_mesh.animations.push(animationBox);
this.setbeginAnimation=scene.beginAnimation(_mesh, 0, _keys[_keys.length-1].frame, _loop);
this.setbeginAnimation.onAnimationEnd=function(){
_endCall()
}
}
public Pause(){
this.setbeginAnimation.pause()
}
public Reset(){
this.setbeginAnimation.reset()
}
public Speed(i){
this.setbeginAnimation.speedRatio=i
}
}
/**
* Created by clq on 2017/10/10.
* 弹框动画UI控制器
*/
export class YtAnimationGui {
private static instance: YtAnimationGui;
protected scene;
protected advancedTexture;
constructor(scene,advancedTexture){
this.scene=scene;
this.advancedTexture=advancedTexture
}
public show = function (gui,open?,opened?) {
var keys = [];
keys.push({
frame: 0,
value: 0.1
});
keys.push({
frame: 10,
value: 1
});
var animationX = new BABYLON.Animation("", "scaleX", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationX.setKeys(keys);
var animationY = new BABYLON.Animation("", "scaleY", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationY.setKeys(keys);
gui.animations = [];
gui.animations.push(animationX,animationY);
this.advancedTexture.addControl(gui);
if(open){
open()
}
this.scene.beginAnimation(gui, 0, 10, false,2,()=>{
if(opened){
opened()
}
});
};
public hide = function(gui,close?,closed?){
var keys = [];
keys.push({
frame: 0,
value: 1
});
keys.push({
frame: 10,
value: 0.1
});
var animationX = new BABYLON.Animation("", "scaleX", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationX.setKeys(keys);
var animationY = new BABYLON.Animation("", "scaleY", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
animationY.setKeys(keys);
gui.animations = [];
gui.animations.push(animationX,animationY);
if(close){
close()
}
this.scene.beginAnimation(gui, 0, 10, false,2,()=>{
this.advancedTexture.removeControl(gui);
//this.advancedTexture.dispose();
if(closed){
closed()
}
});
};
}
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
/**
* GUI控制器
* */
import {YtGuiManager} from "../manager/YtGuiManager";
export class YtGuiCreate{
private panelOut=new BABYLON.GUI.StackPanel();
private static instance: YtGuiCreate;
public static get ins():YtGuiCreate{
if(!this.instance){
this.instance=new YtGuiCreate()
}
return this.instance;
}
constructor(){}
public createList(name,options,scaleUi){
var rectOut=new BABYLON.GUI.Rectangle();
rectOut.thickness=0;
rectOut.isPointerBlocker=true;
rectOut.verticalAlignment=BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
rectOut.horizontalAlignment=BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
for (var key in options) {
if(rectOut[key]){
rectOut[key] = options[key];
}
}
// panelOut.height=1;
if(options&&options.isVertical){
this.panelOut.horizontalAlignment=2;
this.panelOut.verticalAlignment=0;
this.panelOut.isVertical =true;
var mouse={
up:0,
down:0,
};
mouse.up=parseInt(this.panelOut.top.toString());
rectOut.onPointerDownObservable.add(function(e){
mouse.down= e.y;
});
rectOut.onPointerUpObservable.add((e)=>{
var topY=parseInt(this.panelOut.top.toString());
mouse.up=topY;
if(topY>0){
this.panelOut.top="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.top.toString())<parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString())){
var l=(parseInt(rectOut.height.toString())-parseInt(this.panelOut.height.toString()))*scaleUi;
this.panelOut.top=l.toString()+"px";
mouse.up= parseInt(this.panelOut.top);
}
});
rectOut.onPointerMoveObservable.add((e)=>{
var m=e.y-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.top= mul.toString()+"px";
});
}else {
this.panelOut.horizontalAlignment=0;
this.panelOut.verticalAlignment=2;
this.panelOut.isVertical =false;
var mouse={
up:0,
down:0
};
mouse.up=parseInt(this.panelOut.left.toString());
rectOut.onPointerDownObservable.add((e)=>{
mouse.down= e.x;
});
rectOut.onPointerUpObservable.add((e)=>{
var leftY=parseInt(this.panelOut.left.toString());
mouse.up=leftY;
if(leftY>0){
this.panelOut.left="0px";
mouse.up= 0;
}
else if(parseInt(this.panelOut.left.toString())<parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString())){
var l=(parseInt(rectOut.width.toString())-parseInt(this.panelOut.width.toString()))*scaleUi;
this.panelOut.left=l.toString()+"px";
mouse.up= parseInt(this.panelOut.left);
}
});
rectOut.onPointerMoveObservable.add(function(e){
var m=e.x-mouse.down;
var mul=(mouse.up+m)*scaleUi;
this.panelOut.left= mul.toString()+"px";
});
}
rectOut.addControl(this.panelOut);
return rectOut
}
public optionsListCon(config,data,listTemplate){
var scaleUi=YtGuiManager.ins.fullscreenUI.idealWidth/document.getElementById("renderCanvas").offsetWidth;
var prizeDatalist=this.createList("list",{width:config.bodyWidth,height:config.bodyHeight,top:config.bodyTop,left:config.bodyLeft,isVertical:config.isVertical},scaleUi);
var _length=this.panelOut.children.length
if(_length>0){
for(var i=0;i<_length;i++){
this.panelOut.removeControl(this.panelOut.children[0])
}
}
data.forEach((_list)=>{
var list=listTemplate(config,_list)
this.panelOut.addControl(list)
})
return prizeDatalist
}
public preventDefault(Node){
//最后一次y坐标点
var lastY;
Node.addEventListener('touchstart', (event)=> {
lastY = event.touches[0].pageY;
});
Node.addEventListener('touchmove', (event)=> {
var y = event.touches[0].pageY;
//滚动条高度
var st = Node.scrollTop;
console.log("st = "+st);
console.log(y)
console.log(lastY)
//如果滚动条高度小于0,可以理解为到顶了,且是下拉情况下,阻止touchmove事件。
if (y >= lastY && st <= 0) {
lastY = y;
event.preventDefault();
}
lastY = y;
});
}
}
\ No newline at end of file
/**
* 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;
}
}
import { ResourceData } from "./interface/ResourceData"; import { YtResourceData } from "./interface/YtResourceData";
import { fileData } from "./interface/fileData"; import { YtFileData } from "./interface/YtFileData";
import { YtModuleName } from "./enum/YtModuleName"; import { YtModuleName } from "./enum/YtModuleName";
import { YtLang } from "./util/YtLang"; import { YtLang } from "./util/YtLang";
import { AssetsManager } from "./manager/AssetsManager"; import { YtAssetsManager } from "./manager/YtAssetsManager";
import { GuiManager } from "./manager/GuiManager"; import { YtGuiManager } from "./manager/YtGuiManager";
import { SceneManager } from "./manager/SceneManager"; import { YtSceneManager } from "./manager/YtSceneManager";
import { ModuleManager } from "./manager/ModuleManager"; import { YtModuleManager } from "./manager/YtModuleManager";
import { AnimationCon } from "./others/AnimationCon"; import { YtAnimationCon } from "./others/YtAnimationCon";
import { AnimationGui } from "./others/AnimationGui"; import { YtAnimationGui } from "./others/YtAnimationGui";
import { particleCon } from "./others/particleCon"; import { YtParticleCon } from "./others/YtParticleCon";
import { GuiCreate } from "./others/GuiCreate"; import { YtGuiCreate } from "./others/YtGuiCreate";
import { Module } from "./module/Module"; import { YtModule } from "./module/YtModule";
import { DisplayPool } from "./others/DisplayPool"; import { YtDisplayPool } from "./others/YtDisplayPool";
import { MsgModule } from "./module/MsgModule"; import { MsgModule } from "./module/YtMsgModule";
import { LoadingModule } from "./module/LoadingModule"; import { YtLoadingModule } from "./module/YtLoadingModule";
import { WaitingModule } from "./module/WaitingModule"; import { YtWaitingModule } from "./module/YtWaitingModule";
import { PanelModule } from "./module/PanelModule"; import { YtPanelModule } from "./module/YtPanelModule";
export { Module, DisplayPool, MsgModule, LoadingModule, WaitingModule, PanelModule, AnimationCon, AnimationGui, particleCon, GuiCreate, ResourceData, fileData, YtModuleName, YtLang, AssetsManager, GuiManager, SceneManager, ModuleManager }; export { YtModule, YtDisplayPool, MsgModule, YtLoadingModule, YtWaitingModule, YtPanelModule, YtAnimationCon, YtAnimationGui, YtParticleCon, YtGuiCreate, YtResourceData, YtFileData, YtModuleName, YtLang, YtAssetsManager, YtGuiManager, YtSceneManager, YtModuleManager };
export interface YtFileData {
/**
* name
*/
name: string;
/**
* 文件路径
*/
filePath: string;
/**
* 文件名
*/
fileName: string;
}
export interface YtIMsgData {
/**
* 展示文案
*/
msg?: string;
/**
* 确定文案
*/
sureBtnTxt?: string;
/**
* 取消文案
*/
cancelBtnTxt?: string;
}
import { YtFileData } from "./YtFileData";
export interface YtResourceData {
/**
* 二进制文件
*/
binarys: Array<YtFileData>;
/**
* 图片文件
*/
images: Array<YtFileData>;
/**
* 模型文件
*/
models: Array<YtFileData>;
/**
* 贴图文件
*/
textures: Array<YtFileData>;
/**
* 环境天空盒子
*/
cubeTextures: Array<YtFileData>;
}
export declare class YtAssetsManager {
private _resourceData;
private _resourceObject;
private static instance;
static readonly ins: YtAssetsManager;
constructor();
resourceData: any;
loadFile(sceneNames: Array<string>, scene: any, callback: any, progress: any): void;
readonly resourceObject: object;
}
export declare class YtGuiManager {
private _fullscreenUI;
private _lastGui;
private guiPoll;
private static instance;
static readonly ins: YtGuiManager;
constructor();
changeGui(gui: any, ...args: any[]): void;
appendGui(gui: any, ...args: any[]): void;
removeGui(gui: any, ...args: any[]): void;
removeAll(gui: any, ...args: any[]): void;
openPanel(gui: any): void;
closePanel(gui: any): void;
readonly fullscreenUI: any;
readonly lastGui: any;
}
import { YtIMsgData } from '../interface/YtIMsgData';
export declare class YtModuleManager {
private static instance;
static readonly ins: YtModuleManager;
/**
* 模块列表
*/
private moduleList;
/**
* 打开一个模块
* @param {ModuleName} moduleName
*/
openModule(moduleName: string, ...args: any[]): void;
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
getModule(moduleName: string): string | false;
/**
* 关闭一个模块
* @param {ModuleName} moduleName
*/
closeModule(moduleName: string, ...args: any[]): void;
/**
* 提示模块
*/
private msgModule;
/**
* 初始化
*/
init(): void;
/**
* 打开提示模块
* @param msgData
*/
openMsgModule(msgData: YtIMsgData): void;
}
export declare class YtSceneManager {
stage: any;
scene: BABYLON.Scene;
canvas: any;
engine: any;
private static instance;
static readonly ins: YtSceneManager;
constructor();
change(display: any): void;
}
import { YtModule } from "./YtModule";
export declare class YtLoadingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor();
init(): void;
/**
* 更新页面
* @param {number} max 最大进度值
*/
updateData(max: number): void;
onProgress(curr: number): void;
}
import { YtAnimationGui } from "../others/YtAnimationGui";
export declare class YtModule {
private timeoutId;
protected view: any;
protected parent: any;
protected doEvents: any[];
protected panelsAn: YtAnimationGui;
protected section: any;
/**
* 显示对象(皮肤)
*/
protected display: any;
/**
* 是否初始化完成
*/
protected isInit: boolean;
/**
* 点击事件回调池
*/
private clickCallbackBindPool;
constructor();
/**
* 初始化数据
*/
protected initModel(): void;
/**
* 初始化UI
*/
protected initUI(): void;
/**
* 显示
*/
protected show(...args: any[]): void;
/**
* 隐藏
*/
protected hide(): void;
/**
* 添加事件
*/
protected addEvent(): void;
/**
* 移除事件
*/
protected removeEvent(): void;
/**
* 更新页面
* @param args
*/
updateData(...args: any[]): void;
/**
* 添加点击事件
* @param display
*
* @param callback
*/
protected addClick(display: any, callback: Function): void;
/**
* 移除点击事件
* @param display
* @param callback
*/
protected removeClick(display: any): void;
/**
* 延时启用点击事件
* @param display 显示对象
* @param {number} delay 延时事件
*/
protected delayEnable(display: any, delay?: number): void;
protected viewNode: any;
protected listTemplateHtml(data: any, config: any): void;
protected htmlView: any;
protected htmlCreate(config: any, data: any): void;
dispose(): void;
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void;
/**
* 单个元件鼠标事件
* @param enable
*/
protected enableMouseEvtView(view: BABYLON.GUI.Control, enable: boolean): void;
}
import { YtPanelModule } from "./YtPanelModule";
import { YtIMsgData } from '../interface/YtIMsgData';
export declare class MsgModule extends YtPanelModule {
constructor();
init(): void;
/**
* 添加事件
* */
protected addEvent(): void;
protected onClick_closeBtn(): void;
protected removeEvent(): void;
/**
* 更新提示文案
*/
protected updateMsgTxt(msgTxt: string): void;
/**
* 更新确定按钮文案
*/
protected updateSureBtnTxt(btnTxt: string): void;
/**
* 更新取消按钮文案
*/
protected updateCancelBtnTxt(btnTxt: string): void;
/**
* 更新页面
* @param args
*/
updateData(msgData: YtIMsgData, ...args: any[]): void;
}
import { YtModule } from "./YtModule";
export declare class YtPanelModule extends YtModule {
/**
* 点击关闭按钮
*/
static CLOSE_BTN_CLICK: string;
/**
* 点击确定按钮
*/
static SURE_BTN_CLICK: string;
/**
* 点击取消按钮
*/
static CANCEL_BTN_CLICK: string;
updateData(...args: any[]): void;
protected addEvent(): void;
/**
* 显示
*/
protected show(...args: any[]): void;
/**
* 隐藏
*/
protected hide(): void;
/**
* 打开前
* */
protected onOpen(...args: any[]): void;
/**
* 打开后
* */
protected onOpened(...args: any[]): void;
/**
* 关闭前
* */
protected onClose(): void;
/**
* 关闭后
* */
protected onClosed(): void;
protected onClick_closeBtn(e: any): void;
protected removeEvent(): void;
}
import { YtModule } from "./YtModule";
/**
*Created by cuiliqiang on 2018/3/13
* 等待面板
*/
export declare class YtWaitingModule extends YtModule {
/**
* 最大进度值
*/
protected maxProgress: number;
constructor();
/**
* 更新页面
* @param {string} msgTxt 提示信息
*/
updateData(msgTxt: string, ...args: any[]): void;
/**
* 更新提示文案
* @param desc
*/
protected updateMsgTxt(msgTxt: string): void;
init(): void;
}
/**
* Created by clq on 2017/10/10.
*动画控制器
*/
export declare class YtAnimationCon {
private static instance;
private setbeginAnimation;
static readonly ins: YtAnimationCon;
constructor();
animationBody(object: any, scene: any): void;
Pause(): void;
Reset(): void;
Speed(i: any): void;
}
/**
* Created by clq on 2017/10/10.
* 弹框动画UI控制器
*/
export declare class YtAnimationGui {
private static instance;
protected scene: any;
protected advancedTexture: any;
constructor(scene: any, advancedTexture: any);
show: (gui: any, open?: any, opened?: any) => void;
hide: (gui: any, close?: any, closed?: any) => void;
}
export declare class YtDisplayPool {
private static instance;
static readonly ins: YtDisplayPool;
displayPool: any;
}
export declare class YtGuiCreate {
private panelOut;
private static instance;
static readonly ins: YtGuiCreate;
constructor();
createList(name: any, options: any, scaleUi: any): BABYLON.GUI.Rectangle;
optionsListCon(config: any, data: any, listTemplate: any): BABYLON.GUI.Rectangle;
preventDefault(Node: any): void;
}
/**
* Created by rjf on 2017/10/10.
* 粒子控制器
*/
export declare class YtParticleCon {
private static instance;
constructor(position: any, scene: any, particle: any);
private particleSystem;
private fountain;
start(): void;
stop(): void;
Position(position: any): void;
Parent(parent: any): void;
}
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