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 __());
    };
})();
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("./Global");
var MVCObjectPool_1 = require("./frameworks/mvc/MVCObjectPool");
var Debuger_1 = require("./frameworks/Debuger");
var EventUtils_1 = require("./frameworks/events/EventUtils");
var ComEventVO_1 = require("./frameworks/events/ComEventVO");
var RecConfigs_1 = require("./configs/gameConfigs/RecConfigs");
var TimesTamper_1 = require("./frameworks/TimesTamper");
var PathConfig_1 = require("./configs/gameConfigs/PathConfig");
var TimerService_1 = require("./frameworks/TimerService");
var GlobalWaiting_1 = require("./GlobalWaiting");
var BaseView_1 = require("./frameworks/mvc/BaseView");
var ObjectPool_1 = require("./frameworks/mvc/ObjectPool");
var GameLayerManager_1 = require("./managers/GameLayerManager");
var UiManager_1 = require("./managers/UiManager");
var ResourceManager_1 = require("./managers/ResourceManager");
var ResDataManager_1 = require("./managers/ResDataManager");
var SoundssManager_1 = require("./managers/SoundssManager");
var BinderManager_1 = require("./managers/BinderManager");
var PlatformTool_1 = require("./platform/PlatformTool");
var LoginProxy_1 = require("./gamemodule/loading/proxys/LoginProxy");
var UserInfoProxy_1 = require("./gamemodule/userinfo/UserInfoProxy");
var MainProxy_1 = require("./gamemodule/main/proxys/MainProxy");
var GameProxy_1 = require("./gamemodule/main/proxys/GameProxy");
var SkinProxy_1 = require("./gamemodule/skins/proxys/SkinProxy");
/*
* name;
*/
var GameContents = /** @class */ (function (_super) {
    __extends(GameContents, _super);
    function GameContents() {
        return _super.call(this) || this;
    }
    /**
     * 初始化游戏
     */
    GameContents.prototype.initGame = function () {
        RecConfigs_1.default.getInstance().init();
        EventUtils_1.EventUtils.init();
        TimerService_1.default.getInastance().init();
        GameLayerManager_1.GameLayerManager.getInstance().initlayer();
        UiManager_1.UiManager.getInstance().init();
        ResourceManager_1.default.getInstance().init();
        ResDataManager_1.default.getInastance().init();
        SoundssManager_1.default.getInstance().init();
        BinderManager_1.BinderManager.binderAll();
        TimesTamper_1.TimesTamper.getInstance().init();
        PlatformTool_1.default.getInstance().init();
        this.initPoolObject();
        this.initProxy();
        this.initmapView();
        this.beginLoadHandler();
    };
    /**
     * 初始化对象池
     */
    GameContents.prototype.initPoolObject = function () {
        ObjectPool_1.default.register(ComEventVO_1.default.poolkey, ComEventVO_1.default);
    };
    /**
     * 初始化模块代理类
     */
    GameContents.prototype.initProxy = function () {
        var mvcpool = MVCObjectPool_1.default.getInstance();
        mvcpool.addProxy(LoginProxy_1.default);
        mvcpool.addProxy(UserInfoProxy_1.default);
        mvcpool.addProxy(MainProxy_1.default);
        mvcpool.addProxy(GameProxy_1.default);
        mvcpool.addProxy(SkinProxy_1.default);
    };
    GameContents.prototype.initmapView = function () {
        var mvcpool = MVCObjectPool_1.default.getInstance();
        // mvcpool.mapView( MapViewType.DailyrewardView,DailyrewardView );
    };
    GameContents.prototype.beginLoadHandler = function () {
        var patharr = [];
        patharr.push({ url: PathConfig_1.PathConfig.getResConfig(), type: Laya.Loader.JSON });
        patharr.push({ url: PathConfig_1.PathConfig.getGameVersion(), type: Laya.Loader.JSON });
        ResourceManager_1.default.getInstance().Loaders(patharr, this, this.recloadComplete);
    };
    GameContents.prototype.recloadComplete = function () {
        var gameversion = ResDataManager_1.default.instance.getResByurl(PathConfig_1.PathConfig.getGameVersion(), false);
        if (gameversion) {
            Global_1.Global.gameVersion = gameversion.version;
        }
        else {
            Global_1.Global.gameVersion = "1.0.0";
        }
        Debuger_1.default.log("gameVersion:" + Global_1.Global.gameVersion);
        var configres = ResDataManager_1.default.instance.getResByurl(PathConfig_1.PathConfig.getResConfig(), false);
        RecConfigs_1.default.instance.initRec(configres);
        ResourceManager_1.default.instance.loadGroup("loading", this, this.onPreLoaded, this.onPreprogress);
    };
    GameContents.prototype.onPreprogress = function (value) {
    };
    GameContents.prototype.onPreLoaded = function () {
        ResDataManager_1.default.instance.adduiPackage("loading", true, false);
        var globalwaiturl = fairygui.UIPackage.getItemURL("loading", "globalWaiting");
        BaseView_1.default.viewbgUrl = fairygui.UIPackage.getItemURL("loading", "img_black");
        fairygui.UIObjectFactory.setPackageItemExtension(globalwaiturl, GlobalWaiting_1.default);
        fairygui.UIConfig.globalModalWaiting = globalwaiturl;
        fairygui.UIConfig.windowModalWaiting = globalwaiturl;
        // CPAUtils.init();
        this.startLogin();
    };
    GameContents.prototype.startLogin = function () {
        MVCObjectPool_1.default.getInstance().getProxy(LoginProxy_1.default).startLogin();
    };
    return GameContents;
}(Laya.EventDispatcher));
exports.GameContents = GameContents;
},{"./Global":2,"./GlobalWaiting":3,"./configs/gameConfigs/PathConfig":10,"./configs/gameConfigs/RecConfigs":11,"./frameworks/Debuger":12,"./frameworks/TimerService":13,"./frameworks/TimesTamper":14,"./frameworks/events/ComEventVO":15,"./frameworks/events/EventUtils":16,"./frameworks/mvc/BaseView":20,"./frameworks/mvc/MVCObjectPool":22,"./frameworks/mvc/ObjectPool":23,"./gamemodule/loading/proxys/LoginProxy":34,"./gamemodule/main/proxys/GameProxy":39,"./gamemodule/main/proxys/MainProxy":40,"./gamemodule/skins/proxys/SkinProxy":51,"./gamemodule/userinfo/UserInfoProxy":53,"./managers/BinderManager":58,"./managers/GameLayerManager":61,"./managers/ResDataManager":62,"./managers/ResourceManager":63,"./managers/SoundssManager":65,"./managers/UiManager":66,"./platform/PlatformTool":67}],2:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global;
(function (Global) {
    Global.httpurl = "";
    Global.resourcehtttp = "";
    Global.cdnurl = "https://wxgame.51yoyoyo.com/";
    /**
     * 资源后缀版本号
     */
    Global.versions = ""; //"?v=1.0.7";
    Global.initWidth = 720;
    Global.initHeight = 1280;
    /**
     * 资源版本号
     */
    Global.resconfigVersion = "";
    /**
     * 当前平台
     */
    Global.nowplatfrom = "";
    /**
     * 当前游戏appid
     */
    Global.appid = "wx46f4626932e5f48b";
    /**
     * 游戏版本号
     */
    Global.gameVersion = "1.0.0";
    /**
     * 是否调试版本
     */
    Global.isdebug = false;
    Global.AppKeyID = 0;
    Global.MemberID = 0;
    function curHeight() {
        return Laya.stage.height;
    }
    Global.curHeight = curHeight;
    function curWidth() {
        return Laya.stage.width;
    }
    Global.curWidth = curWidth;
    function setVars() {
        Global.stage = Laya.stage;
        Global.sethttpurl();
    }
    Global.setVars = setVars;
    function getUrl(url) {
        if (url.indexOf("wxlocal") == -1) {
            return Global.resourcehtttp + url + Global.versions;
        }
        return url;
    }
    Global.getUrl = getUrl;
    function sethttpurl() {
        if (Global.isdebug) {
            Global.httpurl = "https://wxgamedev.51yoyoyo.com/";
        }
        else {
            Global.httpurl = "https://minport.51yoyoyo.com/";
        }
    }
    Global.sethttpurl = sethttpurl;
})(Global = exports.Global || (exports.Global = {}));
},{}],3:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GlobalWaiting = /** @class */ (function (_super) {
    __extends(GlobalWaiting, _super);
    function GlobalWaiting() {
        var _this = _super.call(this) || this;
        _this._isforcehide = false;
        _this._lastTime = 0;
        return _this;
    }
    GlobalWaiting.prototype.constructFromXML = function (xml) {
        this.setSize(fairygui.GRoot.inst.width, fairygui.GRoot.inst.height);
        _super.prototype.constructFromXML.call(this, xml);
        this.img_0 = this.getChild("img_0").asImage;
        this.img_0.visible = false;
        this.on(Laya.Event.DISPLAY, this, this.onAddedToStage);
        this.on(Laya.Event.UNDISPLAY, this, this.onRemoveFromStage);
    };
    GlobalWaiting.prototype.onAddedToStage = function () {
        this._lastTime = Laya.Browser.now();
        Laya.timer.frameLoop(1, this, this.onTimer);
    };
    GlobalWaiting.prototype.onTimer = function () {
        if (this.img_0) {
            var nowtime = Laya.Browser.now();
            var distime = nowtime - this._lastTime;
            if (distime / 1000 >= 0) {
                if (!this._isforcehide) {
                    this.img_0.visible = true;
                }
                var i = this.img_0.rotation;
                i += 10;
                if (i > 360)
                    i = i % 360;
                this.img_0.rotation = i;
            }
            else {
                this.img_0.visible = false;
            }
        }
    };
    GlobalWaiting.prototype.hideimg = function () {
        this._isforcehide = true;
        if (this.img_0) {
            this.img_0.visible = false;
        }
    };
    GlobalWaiting.prototype.onRemoveFromStage = function () {
        Laya.timer.clear(this, this.onTimer);
    };
    return GlobalWaiting;
}(fairygui.GComponent));
exports.default = GlobalWaiting;
},{}],4:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("./Global");
var Stage = Laya.Stage;
var PathConfig_1 = require("./configs/gameConfigs/PathConfig");
var GameContents_1 = require("./GameContents");
var Sdk_1 = require("./platform/wxminigame/WXSDK/Sdk");
var Main = /** @class */ (function () {
    function Main() {
        //根据IDE设置初始化引擎		
        // Laya.init(Global.initWidth, Global.initHeight, Laya["WebGL"]);
        Laya3D.init(Global_1.Global.initWidth, Global_1.Global.initHeight);
        Laya.stage.scaleMode = Stage.SCALE_FIXED_WIDTH;
        Laya.stage.alignH = Stage.ALIGN_CENTER;
        Laya.stage.alignV = Stage.ALIGN_TOP;
        Laya.stage.screenMode = Stage.SCREEN_VERTICAL;
        Laya.stage.bgColor = "#54B9F6";
        // Laya.Stat.show();
        Laya.alertGlobalError = true;
        window['Config3D'] && (window['Config3D']["_default"]["_defaultPhysicsMemory"] = 128);
        if (Laya.Browser.onWeiXin) {
            Sdk_1.WxApi.WxInit();
            Sdk_1.WxApi.CheckWXUpdate();
        }
        Laya.stage.on("resize", this, this.onResize);
    }
    Main.prototype.onResize = function () {
        Laya.stage.off("resize", this, this.onResize);
        Global_1.Global.setVars();
        PathConfig_1.PathConfig.init();
        fairygui.UIConfig.packageFileExtension = "bin";
        fairygui.UIConfig.textureLinearSampling = true;
        fairygui.UIConfig.defaultFont = "黑体";
        fairygui.UIConfig.versions = Global_1.Global.versions;
        var gameContent = new GameContents_1.GameContents();
        gameContent.initGame();
    };
    return Main;
}());
//激活启动类
new Main();
},{"./GameContents":1,"./Global":2,"./configs/gameConfigs/PathConfig":10,"./platform/wxminigame/WXSDK/Sdk":75}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//------------------------------------------------------------------------------
//工具生成，请勿修改。
//配置文件名称：build.xlsx。
//------------------------------------------------------------------------------
var BuildCFG = /** @class */ (function () {
    function BuildCFG() {
    }
    BuildCFG.initCfg = function (str) {
        var i = 0;
        var arr = str.split("\n");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var singleStr = arr[i];
            var singleArr = singleStr.split("&");
            if (BuildCFG.dict[singleArr[0]])
                continue;
            var item = new BuildCFG();
            item.name = singleArr[0];
            item.buffx = Number(singleArr[1]);
            item.buffy = Number(singleArr[2]);
            item.buffz = Number(singleArr[3]);
            item.time = Number(singleArr[4]);
            BuildCFG.dict[item.name] = item;
            BuildCFG.vec.push(item);
        }
    };
    BuildCFG.dict = {};
    BuildCFG.vec = [];
    return BuildCFG;
}());
exports.default = BuildCFG;
},{}],6:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//------------------------------------------------------------------------------
//工具生成，请勿修改。
//配置文件名称：game.xlsx。
//------------------------------------------------------------------------------
var GameCFG = /** @class */ (function () {
    function GameCFG() {
    }
    GameCFG.initCfg = function (str) {
        var i = 0;
        var arr = str.split("\n");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var singleStr = arr[i];
            var singleArr = singleStr.split("&");
            if (GameCFG.dict[singleArr[0]])
                continue;
            var item = new GameCFG();
            item.id = Number(singleArr[0]);
            item.value = singleArr[1];
            GameCFG.dict[item.id] = item;
            GameCFG.vec.push(item);
        }
    };
    GameCFG.dict = {};
    GameCFG.vec = [];
    return GameCFG;
}());
exports.default = GameCFG;
},{}],7:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//------------------------------------------------------------------------------
//工具生成，请勿修改。
//配置文件名称：level.xlsx。
//------------------------------------------------------------------------------
var LevelCFG = /** @class */ (function () {
    function LevelCFG() {
    }
    LevelCFG.initCfg = function (str) {
        var i = 0;
        var arr = str.split("\n");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var singleStr = arr[i];
            var singleArr = singleStr.split("&");
            if (LevelCFG.dict[singleArr[0]])
                continue;
            var item = new LevelCFG();
            item.id = Number(singleArr[0]);
            item.road = singleArr[1];
            item.roleinitpos = JSON.parse(singleArr[2]);
            item.npc = JSON.parse(singleArr[3]);
            item.firstScenepos = singleArr[4];
            item.winGold = Number(singleArr[5]);
            item.failGod = singleArr[6];
            LevelCFG.dict[item.id] = item;
            LevelCFG.vec.push(item);
        }
    };
    LevelCFG.dict = {};
    LevelCFG.vec = [];
    return LevelCFG;
}());
exports.default = LevelCFG;
},{}],8:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//------------------------------------------------------------------------------
//工具生成，请勿修改。
//配置文件名称：npc.xlsx。
//------------------------------------------------------------------------------
var NpcCFG = /** @class */ (function () {
    function NpcCFG() {
    }
    NpcCFG.initCfg = function (str) {
        var i = 0;
        var arr = str.split("\n");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var singleStr = arr[i];
            var singleArr = singleStr.split("&");
            if (NpcCFG.dict[singleArr[0]])
                continue;
            var item = new NpcCFG();
            item.id = Number(singleArr[0]);
            item.name = singleArr[1];
            item.speed = Number(singleArr[2]);
            item.frontjump = JSON.parse(singleArr[3]);
            item.leftjump = JSON.parse(singleArr[4]);
            item.rightjump = JSON.parse(singleArr[5]);
            item.upclimb = Number(singleArr[6]);
            item.slideclimb = JSON.parse(singleArr[7]);
            item.jump_left = Number(singleArr[8]);
            item.jump_right = Number(singleArr[9]);
            item.start_ahead = Number(singleArr[10]);
            item.distance = Number(singleArr[11]);
            NpcCFG.dict[item.id] = item;
            NpcCFG.vec.push(item);
        }
    };
    NpcCFG.dict = {};
    NpcCFG.vec = [];
    return NpcCFG;
}());
exports.default = NpcCFG;
},{}],9:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//------------------------------------------------------------------------------
//工具生成，请勿修改。
//配置文件名称：role.xlsx。
//------------------------------------------------------------------------------
var RoleCFG = /** @class */ (function () {
    function RoleCFG() {
    }
    RoleCFG.initCfg = function (str) {
        var i = 0;
        var arr = str.split("\n");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var singleStr = arr[i];
            var singleArr = singleStr.split("&");
            if (RoleCFG.dict[singleArr[0]])
                continue;
            var item = new RoleCFG();
            item.id = Number(singleArr[0]);
            item.name = singleArr[1];
            item.speed = Number(singleArr[2]);
            item.frontjump = JSON.parse(singleArr[3]);
            item.leftjump = JSON.parse(singleArr[4]);
            item.rightjump = JSON.parse(singleArr[5]);
            item.upclimb = Number(singleArr[6]);
            item.slideclimb = JSON.parse(singleArr[7]);
            item.getState = Number(singleArr[8]);
            item.need = Number(singleArr[9]);
            item.icon = singleArr[10];
            RoleCFG.dict[item.id] = item;
            RoleCFG.vec.push(item);
        }
    };
    RoleCFG.dict = {};
    RoleCFG.vec = [];
    return RoleCFG;
}());
exports.default = RoleCFG;
},{}],10:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("../../Global");
/*
* name;
*/
var PathConfig;
(function (PathConfig) {
    PathConfig.res = "res/";
    PathConfig.wxlocal = "wxlocal/";
    PathConfig.configs = "configs/";
    PathConfig.ui = "ui/";
    PathConfig.sounds = "sound/";
    PathConfig.versionrandom = "";
    PathConfig.icon = "icon/";
    PathConfig.scene = "scenes/";
    function init() {
        PathConfig.versionrandom = "?v=" + Math.random();
    }
    PathConfig.init = init;
    function getsound(id) {
        return Global_1.Global.getUrl(PathConfig.wxlocal + PathConfig.sounds + id + ".mp3");
    }
    PathConfig.getsound = getsound;
    function getResConfig() {
        return Global_1.Global.getUrl(PathConfig.wxlocal + PathConfig.configs + "resConfig.json");
    }
    PathConfig.getResConfig = getResConfig;
    function getConfig(configname) {
        return Global_1.Global.getUrl(PathConfig.wxlocal + PathConfig.configs + configname + ".bin");
    }
    PathConfig.getConfig = getConfig;
    function get3Dscene(name) {
        return Global_1.Global.getUrl(PathConfig.res + PathConfig.scene + "Conventional/" + name + ".ls");
    }
    PathConfig.get3Dscene = get3Dscene;
    function get3DModel(name) {
        return Global_1.Global.getUrl(PathConfig.res + PathConfig.scene + "Conventional/" + name + ".lh");
    }
    PathConfig.get3DModel = get3DModel;
    function get3DRoleModel(name) {
        return Global_1.Global.getUrl(PathConfig.res + "role/Conventional/" + name + ".lh");
    }
    PathConfig.get3DRoleModel = get3DRoleModel;
    function getroleicon(id) {
        return Global_1.Global.getUrl(PathConfig.res + PathConfig.icon + "roleicon/" + id + ".png");
    }
    PathConfig.getroleicon = getroleicon;
    function getVerisonurl() {
        if (Global_1.Global.isdebug) {
            return Global_1.Global.getUrl(PathConfig.res + "version.json") + PathConfig.versionrandom;
        }
        return Global_1.Global.getUrl(PathConfig.res + "version" + Global_1.Global.resconfigVersion + ".json");
    }
    PathConfig.getVerisonurl = getVerisonurl;
    function getGameVersion() {
        return Global_1.Global.getUrl("gameversion.json");
    }
    PathConfig.getGameVersion = getGameVersion;
})(PathConfig = exports.PathConfig || (exports.PathConfig = {}));
},{"../../Global":2}],11:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PathConfig_1 = require("./PathConfig");
var Global_1 = require("../../Global");
/*
* name;
*/
var RecConfigs = /** @class */ (function (_super) {
    __extends(RecConfigs, _super);
    function RecConfigs() {
        return _super.call(this) || this;
    }
    RecConfigs.getInstance = function () {
        if (null == this.instance) {
            this.instance = new RecConfigs();
        }
        return this.instance;
    };
    RecConfigs.prototype.init = function () {
        this.groupdict = {};
    };
    RecConfigs.prototype.initRec = function (dict) {
        if (dict != null && !RecConfigs.ishasinit) {
            RecConfigs.ishasinit = true;
            var groupsArr = dict.groups;
            var resourcesArr = dict.resources;
            var resourcesDict = {};
            for (var item in resourcesArr) {
                var child = resourcesArr[item];
                switch (child.type) {
                    case "bin":
                        child.type = Laya.Loader.BUFFER;
                        break;
                    case "ls":
                        child.type = Laya.Scene;
                        break;
                    case "lh":
                        child.type = Laya.Sprite3D;
                        break;
                    case "lm":
                        child.type = Laya.MeshSprite3D;
                        break;
                }
                resourcesDict[child.name] = child;
            }
            for (var grouptype in groupsArr) {
                var groupchild = groupsArr[grouptype];
                var arr = groupchild.keys.split(",");
                var childArr = [];
                var chidstr;
                for (chidstr in arr) {
                    var strChild = arr[chidstr];
                    if (strChild != "") {
                        var urls = resourcesDict[strChild].url;
                        urls = urls.replace("res/", PathConfig_1.PathConfig.res);
                        childArr.push({ url: Global_1.Global.getUrl(urls), type: resourcesDict[strChild].type });
                    }
                }
                this.groupdict[groupchild.name] = childArr;
            }
            Laya.loader.clearRes(PathConfig_1.PathConfig.getResConfig());
        }
    };
    /**
     * 是否已经初始化
     */
    RecConfigs.ishasinit = false;
    return RecConfigs;
}(Laya.EventDispatcher));
exports.default = RecConfigs;
},{"../../Global":2,"./PathConfig":10}],12:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var Debuger = /** @class */ (function () {
    function Debuger() {
    }
    Debuger.log = function (msg) {
        var optionalParams = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            optionalParams[_i - 1] = arguments[_i];
        }
        // if (Debuger.isprint&& Global.isdebug ) {
        //     if(optionalParams&&optionalParams.length>0){
        //         console.log(msg,optionalParams);
        //     }else{
        //         console.log(msg);
        //     }
        // }
        if (Debuger.isprint) {
            if (optionalParams && optionalParams.length > 0) {
                console.log(msg, optionalParams);
            }
            else {
                console.log(msg);
            }
        }
    };
    Debuger.error = function (msg) {
        var optionalParams = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            optionalParams[_i - 1] = arguments[_i];
        }
        if (Debuger.isprint) {
            console.error(msg, optionalParams);
        }
    };
    /**
     * 是否打印
     */
    Debuger.isprint = true;
    return Debuger;
}());
exports.default = Debuger;
},{}],13:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var TimerService = /** @class */ (function (_super) {
    __extends(TimerService, _super);
    function TimerService() {
        var _this = _super.call(this) || this;
        _this._timeScale = 1;
        _this._unscalableList = [];
        return _this;
    }
    TimerService.getInastance = function () {
        if (null == this.instance) {
            this.instance = new TimerService();
        }
        return this.instance;
    };
    TimerService.prototype.init = function () {
        Laya.timer.frameLoop(1, this, this.onTimer);
    };
    TimerService.prototype.initEvent = function () {
    };
    TimerService.prototype.stop = function () {
        Laya.timer.clear(this, this.onTimer);
    };
    TimerService.prototype.recover = function () {
        this.stop();
        Laya.timer.frameLoop(1, this, this.onTimer);
    };
    TimerService.prototype.onTimer = function () {
        var i = 0;
        for (i = 0; i < this._unscalableList.length; i++) {
            this._unscalableList[i].update(Laya.timer.delta * this._timeScale);
        }
    };
    TimerService.prototype.hasUpdataTarget = function (updateTarget) {
        var index;
        index = this._unscalableList.indexOf(updateTarget);
        if (index != -1) {
            return true;
        }
        return false;
    };
    TimerService.prototype.addUpdateTarget = function (updateTarget) {
        var index;
        index = this._unscalableList.indexOf(updateTarget);
        if (index == -1) {
            this._unscalableList.push(updateTarget);
        }
    };
    TimerService.prototype.removeUpdateTarget = function (updateTarget) {
        var index = this._unscalableList.indexOf(updateTarget);
        if (index != -1) {
            this._unscalableList.splice(index, 1);
        }
    };
    Object.defineProperty(TimerService.prototype, "timeScale", {
        get: function () {
            return this._timeScale;
        },
        /**
         * @private
         */
        set: function (value) {
            if (value < 0 || isNaN(value)) {
                value = 1;
            }
            this._timeScale = value;
        },
        enumerable: true,
        configurable: true
    });
    return TimerService;
}(Laya.EventDispatcher));
exports.default = TimerService;
},{}],14:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var UserCacheType_1 = require("../gamemodule/userinfo/events/UserCacheType");
var CacheManager_1 = require("../managers/CacheManager");
var TongjiHttps_1 = require("./net/TongjiHttps");
var TimesTamper = /** @class */ (function () {
    function TimesTamper() {
        this.lastgameTime = 0;
        /**
         * 同步服务器时间(秒)
         */
        this._serverTime = 0;
        this.iscan = false;
        this._onlinedistime = 0;
        this._time = 0;
        this._onlinetime = 0;
    }
    TimesTamper.getInstance = function () {
        if (!this.instance) {
            this.instance = new TimesTamper();
        }
        return this.instance;
    };
    TimesTamper.prototype.init = function () {
        this.lastgameTime = CacheManager_1.default.getInstance().getnum(UserCacheType_1.default.lasttime);
        Laya.timer.frameLoop(1, this, this.update);
    };
    TimesTamper.prototype.updateServiceTime = function (serverTime) {
        this._serverTime = Number(serverTime);
        this.iscan = true;
        this._onlinedistime = this._serverTime;
        CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.lasttime, this._serverTime.toString());
    };
    TimesTamper.prototype.update = function () {
        if (this.iscan) {
            this._time += Laya.timer.delta;
            this._onlinetime += Laya.timer.delta;
            this._serverTime += Laya.timer.delta / 1000;
            if (this._time >= 30000) {
                this._time = 0;
                CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.lasttime, this._serverTime.toString());
            }
            if (this._onlinetime >= 90000) {
                this._onlinetime = 0;
                this.sendonlineTongji();
            }
        }
    };
    TimesTamper.prototype.sendonlineTongji = function () {
        var distime = this.serverTime - this._onlinedistime;
        if (distime > 0) {
            this._onlinedistime = this.serverTime;
            TongjiHttps_1.default.getInstance().tongjiData("Online", "", distime);
        }
    };
    Object.defineProperty(TimesTamper.prototype, "serverTime", {
        /**
         * 服务器时间 ( 秒 )
         * @return
         *
         */
        get: function () {
            return this._serverTime;
        },
        enumerable: true,
        configurable: true
    });
    return TimesTamper;
}());
exports.TimesTamper = TimesTamper;
},{"../gamemodule/userinfo/events/UserCacheType":55,"../managers/CacheManager":59,"./net/TongjiHttps":28}],15:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ObjectPool_1 = require("../mvc/ObjectPool");
var ComEventVO = /** @class */ (function () {
    function ComEventVO() {
    }
    ComEventVO.prototype.clear = function () {
        this.target = null;
        this.type = null;
        this.thisObject = null;
        this.listener = null;
        ObjectPool_1.default.clearObj(ComEventVO.poolkey, this);
    };
    ComEventVO.poolkey = "ComEventVO";
    return ComEventVO;
}());
exports.default = ComEventVO;
},{"../mvc/ObjectPool":23}],16:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LEvent_1 = require("./LEvent");
var LListener_1 = require("./LListener");
/*
* name;
*/
var EventUtils;
(function (EventUtils) {
    function init() {
        LListener_1.default.getInstance();
    }
    EventUtils.init = init;
    //新建事件
    function Event(type, obj, bubbles, cancelable) {
        if (obj === void 0) { obj = null; }
        if (bubbles === void 0) { bubbles = false; }
        if (cancelable === void 0) { cancelable = false; }
        return new LEvent_1.default(type, obj, bubbles, cancelable);
    }
    EventUtils.Event = Event;
    //派发事件
    function dispatchEvent(type, obj, bubbles, cancelable) {
        if (obj === void 0) { obj = null; }
        if (bubbles === void 0) { bubbles = false; }
        if (cancelable === void 0) { cancelable = false; }
        LListener_1.default._instance.dispatchEvent(type, obj);
    }
    EventUtils.dispatchEvent = dispatchEvent;
    //监听事件
    function addEventListener(type, thisObject, listener, useCapture, priority) {
        if (useCapture === void 0) { useCapture = false; }
        if (priority === void 0) { priority = 0; }
        LListener_1.default._instance.addEventListener(type, listener, thisObject, useCapture, priority);
    }
    EventUtils.addEventListener = addEventListener;
    function hasEventListener(type) {
        return LListener_1.default._instance.hasEventListener(type);
    }
    EventUtils.hasEventListener = hasEventListener;
    function removeEventListener(type, thisObject, listener, useCapture, priority) {
        if (useCapture === void 0) { useCapture = false; }
        if (priority === void 0) { priority = 0; }
        LListener_1.default._instance.removeEventListener(type, listener, thisObject);
    }
    EventUtils.removeEventListener = removeEventListener;
})(EventUtils = exports.EventUtils || (exports.EventUtils = {}));
},{"./LEvent":17,"./LListener":18}],17:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LEvent = /** @class */ (function (_super) {
    __extends(LEvent, _super);
    function LEvent(type, obj, bubbles, cancelable) {
        if (obj === void 0) { obj = null; }
        if (bubbles === void 0) { bubbles = false; }
        if (cancelable === void 0) { cancelable = false; }
        var _this = _super.call(this) || this;
        _this.CLASS_NAME = "LEvent";
        if (obj) {
            _this._obj = obj;
        }
        return _this;
    }
    LEvent.prototype.clone = function (obj) {
        return new LEvent(this.type, obj ? obj : this._obj);
    };
    LEvent.prototype.toString = function () {
        console.log(this.CLASS_NAME, "type", "bubbles", "cancelable");
    };
    Object.defineProperty(LEvent.prototype, "param", {
        /**
         * 传参获取
         * @returns {any}
         */
        get: function () {
            return this._obj;
        },
        enumerable: true,
        configurable: true
    });
    return LEvent;
}(Laya.Event));
exports.default = LEvent;
},{}],18:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 全局侦听类及消息处理
 */
var LListener = /** @class */ (function (_super) {
    __extends(LListener, _super);
    function LListener() {
        var _this = _super.call(this) || this;
        _this.isInit = false;
        if (_this.isInit) {
        }
        if (_this._dispatcher == null) {
            _this._dispatcher = new Laya.EventDispatcher();
            _this.isInit = true;
        }
        return _this;
    }
    LListener.getInstance = function () {
        if (this._instance == null)
            this._instance = new LListener();
        return this._instance;
    };
    LListener.prototype.addEventListener = function (type, listener, thisObject, useCapture, priority) {
        if (useCapture === void 0) { useCapture = false; }
        if (priority === void 0) { priority = 0; }
        this._dispatcher.on(type, thisObject, listener);
    };
    LListener.prototype.removeEventListener = function (type, listener, thisObject, useCapture) {
        if (useCapture === void 0) { useCapture = false; }
        this._dispatcher.off(type, thisObject, listener);
    };
    LListener.prototype.hasEventListener = function (type) {
        return this._dispatcher.hasListener(type);
    };
    LListener.prototype.dispatchEvent = function (type, data) {
        return this._dispatcher.event(type, data);
    };
    return LListener;
}(Laya.EventDispatcher));
exports.default = LListener;
},{}],19:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MVCObjectPool_1 = require("./MVCObjectPool");
var EventUtils_1 = require("../events/EventUtils");
var Singleton_1 = require("./Singleton");
var GameSocket_1 = require("../net/GameSocket");
var RoleVO_1 = require("../../gamemodule/userinfo/vo/RoleVO");
/*
* name;
*/
var BaseProxys = /** @class */ (function (_super) {
    __extends(BaseProxys, _super);
    function BaseProxys() {
        var _this = _super.call(this) || this;
        _this._objectPool = MVCObjectPool_1.default.getInstance();
        _this.initProxy();
        return _this;
    }
    BaseProxys.prototype.initProxy = function () {
    };
    /**
     *  注册全局侦听事件
     *
     */
    BaseProxys.prototype.addDataEvent = function (type, callbackobj, callbackHandler) {
        EventUtils_1.EventUtils.addEventListener(type, callbackobj, callbackHandler);
    };
    /**
     *  抛出全局事件
     */
    BaseProxys.prototype.dispacheDataEvent = function (type, data) {
        if (data === void 0) { data = null; }
        EventUtils_1.EventUtils.dispatchEvent(type, data);
    };
    /**
     * 移除全局侦听事件
     */
    BaseProxys.prototype.removeDataEvent = function (type, callbackobj, callbackHandler) {
        EventUtils_1.EventUtils.removeEventListener(type, callbackobj, callbackHandler);
    };
    BaseProxys.prototype.getProxy = function (ref) {
        return this._objectPool.getProxy(ref);
    };
    BaseProxys.prototype.sendMessage = function (act, data, isShowWait) {
        if (data === void 0) { data = null; }
        if (isShowWait === void 0) { isShowWait = true; }
        GameSocket_1.default.getInstance().sendMessage(act, data, isShowWait);
    };
    Object.defineProperty(BaseProxys.prototype, "roleVO", {
        get: function () {
            if (!this._roleVo) {
                this._roleVo = RoleVO_1.default.getInstance();
            }
            return this._roleVo;
        },
        enumerable: true,
        configurable: true
    });
    return BaseProxys;
}(Singleton_1.default));
exports.default = BaseProxys;
},{"../../gamemodule/userinfo/vo/RoleVO":57,"../events/EventUtils":16,"../net/GameSocket":27,"./MVCObjectPool":22,"./Singleton":24}],20:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ResDataManager_1 = require("../../managers/ResDataManager");
var ResourceManager_1 = require("../../managers/ResourceManager");
var EventUtils_1 = require("../events/EventUtils");
var MVCObjectPool_1 = require("./MVCObjectPool");
var WindowAnmoType_1 = require("./WindowAnmoType");
var UiManager_1 = require("../../managers/UiManager");
var ComEventVO_1 = require("../events/ComEventVO");
var ObjectPool_1 = require("./ObjectPool");
/*
* name;
*/
var BaseView = /** @class */ (function (_super) {
    __extends(BaseView, _super);
    /**
     * 界面初始化
     * @param pkgName 包名
     * @param resName 界面名
     * @param isAddpackage 是否添加包
     * @param windowAnmoType 界面打开动画类型
     * @param clickBgIsColse 黑色背景 0:无背景 1:背景无关闭事件 2:背景有关闭事件
     * @param iscache 是否添加到缓存池（如是为true,则加入进缓存池定时根据是否引用清理。 若是为false，则不清理当前缓存，如若清理，请手动清理 ）
     */
    function BaseView(pkgName, resName, isAddpackage, windowAnmoType, clickBgIsColse, iscache) {
        if (pkgName === void 0) { pkgName = ""; }
        if (resName === void 0) { resName = ""; }
        if (isAddpackage === void 0) { isAddpackage = false; }
        if (windowAnmoType === void 0) { windowAnmoType = WindowAnmoType_1.default.WindowAnmoType_none; }
        if (clickBgIsColse === void 0) { clickBgIsColse = 0; }
        if (iscache === void 0) { iscache = true; }
        var _this = _super.call(this) || this;
        _this.isguideing = false;
        _this._pkgName = "";
        _this._resName = "";
        _this._iscache = true;
        _this._WindowAnmoType = WindowAnmoType_1.default.WindowAnmoType_none;
        _this._clickBgIsColse = 0;
        /**
         * 事件容器
         */
        _this._eventdict = {};
        /**
         * 全局事件容器
         */
        _this._globalEventdict = {};
        _this._iscache = iscache;
        _this._pkgName = pkgName;
        _this._resName = resName;
        _this._isAddpackage = isAddpackage;
        _this._WindowAnmoType = windowAnmoType;
        _this._clickBgIsColse = clickBgIsColse;
        _this.showModalWait();
        return _this;
    }
    BaseView.prototype.setclickBgIsColse = function () {
        if (this.isShowing && this._clickBgIsColse > 0 && this.contentPane) {
            if (!this._clickBg && BaseView.viewbgUrl != "") {
                this._clickBg = new fairygui.GLoader();
                this._clickBg.touchable = true;
                this._clickBg.setSize(fairygui.GRoot.inst.width, fairygui.GRoot.inst.height);
                this._clickBg.url = BaseView.viewbgUrl;
                this._clickBg.fill = fairygui.LoaderFillType.ScaleFree;
                this._clickBg.alpha = 0;
                this.contentPane.addChildAt(this._clickBg, 0);
            }
        }
    };
    /**
     * 加载ui
     * @param groupName 组名
     * @param target    作用域
     * @param onLoadedHandler 加载完成回调函数
     */
    BaseView.prototype.loadUi = function (groupName, target, onLoadedHandler) {
        this._loadTarget = target;
        this._onLoadedHandler = onLoadedHandler;
        ResourceManager_1.default.getInstance().loadGroup(groupName, this, this.loadsucceed);
    };
    /**
     * 加载资源数组
     * @param urls 资源数组
     * @param target 作用域
     * @param onLoadedHandler 加载完成回调函数
     */
    BaseView.prototype.loadUibyArr = function (urls, target, onLoadedHandler) {
        // this.showModalWait();
        this._loadTarget = target;
        this._onLoadedHandler = onLoadedHandler;
        ResourceManager_1.default.getInstance().Loaders(urls, this, this.loadsucceed);
    };
    BaseView.prototype.loadsucceed = function () {
        if (this._loadTarget && this._onLoadedHandler) {
            this._onLoadedHandler.call(this._loadTarget);
        }
    };
    BaseView.prototype.removeEffectPackage = function (packageName) {
        ResDataManager_1.default.instance.removePackage(packageName, true);
    };
    BaseView.prototype.getpanelController = function (name) {
        if (this.item_panel) {
            return this.item_panel.getController(name);
        }
        return null;
    };
    BaseView.prototype.getpanelTransition = function (name) {
        if (this.item_panel) {
            return this.item_panel.getTransition(name);
        }
        return null;
    };
    BaseView.prototype.getChildformContentPanel = function (name) {
        if (this.contentPane) {
            return this.contentPane.getChild(name);
        }
        return null;
    };
    /*界面初始化*/
    BaseView.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
        if (this._pkgName != "" && this._resName != "") {
            this.parseUi(this._pkgName, this._resName, this._isAddpackage, this._WindowAnmoType, this._clickBgIsColse, this._iscache);
        }
    };
    //解析ui
    BaseView.prototype.parseUi = function (pkgname, resname, isaddpackage, windowAnmoType, clickBgIsColse, iscache) {
        if (windowAnmoType === void 0) { windowAnmoType = WindowAnmoType_1.default.WindowAnmoType_none; }
        if (clickBgIsColse === void 0) { clickBgIsColse = 0; }
        if (iscache === void 0) { iscache = true; }
        this._pkgName = pkgname;
        this._resName = resname;
        this._WindowAnmoType = windowAnmoType;
        this._clickBgIsColse = clickBgIsColse;
        ResDataManager_1.default.instance.adduiPackage(pkgname, isaddpackage, iscache);
        this.contentPane = fairygui.UIPackage.createObject(pkgname, resname).asCom;
        for (var str in this.contentPane._children) {
            var item = this.contentPane._children[str];
            if (item.name == "item_panel") {
                var itempanel = item;
                if (itempanel) {
                    for (var str1 in itempanel._children) {
                        var itempanelItem = itempanel._children[str1];
                        this[itempanelItem.name] = itempanelItem;
                    }
                }
                // this[item.name] = item;
                this.item_panel = item;
            }
            else {
                this[item.name] = item;
            }
        }
        this.setSize(fairygui.GRoot.inst.width, fairygui.GRoot.inst.height);
        this.contentPane.setPivot(0.5, 0.5);
        this.setPivot(0.5, 0.5);
        this.setclickBgIsColse();
        this.initView();
        this.initEvent();
        this.do1ShowAnimation();
    };
    BaseView.prototype.initView = function () {
    };
    BaseView.prototype.initEvent = function () {
    };
    BaseView.prototype.do1ShowAnimation = function () {
        switch (this._WindowAnmoType) {
            case WindowAnmoType_1.default.WindowAnmoType_none:
                this.windowanmoend();
                break;
            case WindowAnmoType_1.default.WindowAnmoType_addmoveToMiddle:
                this.contentPane.x = fairygui.GRoot.inst.width;
                Laya.Tween.to(this.contentPane, { x: 0 }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.windowanmoend));
                break;
            case WindowAnmoType_1.default.WindowAnmoType_addmoveFromBottom:
                this.contentPane.y = fairygui.GRoot.inst.height;
                Laya.Tween.to(this.contentPane, { y: 0 }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.windowanmoend));
                break;
            case WindowAnmoType_1.default.WindowAnmoType_addscaleMinToMax:
                this.contentPane.scaleX = this.contentPane.scaleY = 0.01;
                Laya.Tween.to(this.contentPane, { scaleX: 1, scaleY: 1 }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.windowanmoend));
                break;
        }
    };
    BaseView.prototype.windowanmoend = function () {
        Laya.timer.callLater(this, this.onShowView);
    };
    BaseView.prototype.onShowView = function () {
        this.closeModalWait();
        this.showClickBg();
    };
    BaseView.prototype.showClickBg = function () {
        if (this._clickBg) {
            this._clickBg.alpha = 0.55;
            if (this._clickBgIsColse == 2 && !this.hasClickListener()) {
                this._clickBg.onClick(this, this.closebgClick);
            }
        }
    };
    BaseView.prototype.closebgClick = function () {
        UiManager_1.UiManager.instance.close(this.viewKey, true);
    };
    /**
     * 界面关闭事件
     */
    BaseView.prototype.onCloseView = function (windowAnmoType) {
        if (windowAnmoType === void 0) { windowAnmoType = ""; }
        if (this._clickBg) {
            this._clickBg.visible = false;
        }
        if (windowAnmoType == "") {
            switch (this._WindowAnmoType) {
                case WindowAnmoType_1.default.WindowAnmoType_none:
                    this.destory();
                    break;
                case WindowAnmoType_1.default.WindowAnmoType_addmoveToMiddle:
                    Laya.Tween.to(this, { x: fairygui.GRoot.inst.width }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
                case WindowAnmoType_1.default.WindowAnmoType_addmoveFromBottom:
                    Laya.Tween.to(this, { y: fairygui.GRoot.inst.height }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
                case WindowAnmoType_1.default.WindowAnmoType_addscaleMinToMax:
                    Laya.Tween.to(this, { scaleX: 0.01, scaleY: 0.01 }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
            }
        }
        else {
            switch (windowAnmoType) {
                case WindowAnmoType_1.default.WindowAnmoType_none:
                    this.destory();
                    break;
                case WindowAnmoType_1.default.WindowAnmoType_removescaleMaxToMin:
                    Laya.Tween.to(this, { scaleX: 0.01, scaleY: 0.01 }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
                case WindowAnmoType_1.default.WindowAnmoType_removemoveToRight:
                    Laya.Tween.to(this, { x: fairygui.GRoot.inst.width }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
            }
        }
    };
    BaseView.prototype.getComById = function (id) {
        return this.contentPane.getChild(id).asCom;
    };
    BaseView.prototype.getControllerByBame = function (id) {
        return this.contentPane.getController(id);
    };
    BaseView.prototype.getTransitionByName = function (id) {
        return this.contentPane.getTransition(id);
    };
    /*获取管理数据模块*/
    BaseView.prototype.getProxy = function (d) {
        return MVCObjectPool_1.default.getInstance().getProxy(d);
    };
    BaseView.prototype.dispacheDataEvent = function (type, data) {
        if (data === void 0) { data = null; }
        EventUtils_1.EventUtils.dispatchEvent(type, data);
    };
    /**
     * 注册全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    BaseView.prototype.addDataEvent = function (type, thisObject, listener) {
        if (!this._globalEventdict.hasOwnProperty(type)) {
            var vo = ObjectPool_1.default.getObj(ComEventVO_1.default.poolkey);
            this._globalEventdict[type] = vo;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            EventUtils_1.EventUtils.addEventListener(type, thisObject, listener);
        }
    };
    /**
     * 移除全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    BaseView.prototype.removeDataEvent = function (type, thisObject, listener) {
        if (this._globalEventdict[type]) {
            var vo = this._globalEventdict[type];
            EventUtils_1.EventUtils.removeEventListener(type, thisObject, listener);
            vo.clear();
            delete this._globalEventdict[type];
        }
    };
    /**
     * 注册组件事件，调用此方法，界面关闭会自动移除
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    BaseView.prototype.addListener = function (target, type, thisObject, listener, args) {
        if (args === void 0) { args = null; }
        if (target) {
            if (target.name == null || target.name == "") {
                throw "baseview addListener target.name is null";
            }
            var vo = ObjectPool_1.default.getObj(ComEventVO_1.default.poolkey);
            vo.target = target;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            if (!this._eventdict.hasOwnProperty(target.name)) {
                this._eventdict[target.name] = [];
            }
            var bo = this.hasListener(target, type);
            if (!bo) {
                target.on(type, thisObject, listener, args);
                this._eventdict[target.name].push(vo);
            }
        }
    };
    BaseView.prototype.hasListener = function (target, type) {
        var eventArr;
        eventArr = this._eventdict[target.name];
        var childvo;
        for (var s in eventArr) {
            childvo = eventArr[s];
            if (childvo && childvo.type == type) {
                return true;
            }
        }
        return false;
    };
    /**
     * 移除组件事件
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    BaseView.prototype.removesListener = function (target, type, thisObject, listener) {
        if (target && this._eventdict[target.name]) {
            var arr = this._eventdict[target.name];
            var i = 0;
            var nums = arr.length;
            var vo;
            for (i; i < nums; i++) {
                vo = arr[i];
                if (vo && vo.type == type && vo.thisObject == thisObject && vo.listener == listener) {
                    target.off(type, thisObject, listener);
                    vo.clear();
                    arr.splice(i, 1);
                    break;
                }
            }
        }
    };
    /**
     * 移除所有全局事件
     */
    BaseView.prototype.removeAllGlobalEvent = function () {
        if (this._globalEventdict) {
            var s;
            var dict = this._globalEventdict;
            for (s in dict) {
                var vo = dict[s];
                if (vo) {
                    this.removeDataEvent(vo.type, vo.thisObject, vo.listener);
                }
            }
        }
        this._globalEventdict = {};
    };
    /**
     * 移除所有组件事件
     */
    BaseView.prototype.removeAllComEvent = function () {
        if (this._eventdict) {
            var s;
            var dict = this._eventdict;
            var arr;
            var i;
            var nums = 0;
            var vo;
            for (s in dict) {
                arr = dict[s];
                if (arr && arr.length > 0) {
                    i = 0;
                    nums = arr.length;
                    for (i = nums - 1; i >= 0; i--) {
                        vo = arr[i];
                        if (vo) {
                            if (vo.target) {
                                vo.target.off(vo.type, vo.thisObject, vo.listener);
                            }
                            vo.clear();
                        }
                        arr.splice(i, 1);
                    }
                }
                delete this._eventdict[s];
            }
        }
        this._eventdict = {};
    };
    BaseView.prototype.clearEvent = function () {
    };
    /* 销毁*/
    BaseView.prototype.destory = function () {
        this.clearEvent();
        this.closeModalWait();
        this.removeAllGlobalEvent();
        this.removeAllComEvent();
        this._loadTarget = null;
        this._onLoadedHandler = null;
        Laya.Tween.clearTween(this);
        ResDataManager_1.default.instance.removePackage(this._pkgName, false);
        this._pkgName = null;
        this._resName = null;
        if (this._clickBg) {
            this._clickBg.offClick(this, this.closebgClick);
            this._clickBg.dispose();
            this._clickBg = null;
        }
        this.viewKey = null;
        this.dispose();
    };
    BaseView.viewbgUrl = "";
    return BaseView;
}(fairygui.Window));
exports.default = BaseView;
},{"../../managers/ResDataManager":62,"../../managers/ResourceManager":63,"../../managers/UiManager":66,"../events/ComEventVO":15,"../events/EventUtils":16,"./MVCObjectPool":22,"./ObjectPool":23,"./WindowAnmoType":25}],21:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var EventUtils_1 = require("../events/EventUtils");
var MVCObjectPool_1 = require("./MVCObjectPool");
var ComEventVO_1 = require("../events/ComEventVO");
var ObjectPool_1 = require("./ObjectPool");
var ChildBaseView = /** @class */ (function (_super) {
    __extends(ChildBaseView, _super);
    function ChildBaseView() {
        var _this = _super.call(this) || this;
        _this.isguideing = false;
        /**
         * 事件容器
         */
        _this._eventdict = {};
        /**
         * 全局事件容器
         */
        _this._globalEventdict = {};
        return _this;
    }
    ChildBaseView.prototype.constructFromXML = function (xml) {
        _super.prototype.constructFromXML.call(this, xml);
        for (var str in this._children) {
            var item = this._children[str];
            this[item.name] = item;
        }
        this.onInit();
    };
    ChildBaseView.prototype.onInit = function () {
    };
    /*获取管理数据模块*/
    ChildBaseView.prototype.getProxy = function (d) {
        return MVCObjectPool_1.default.getInstance().getProxy(d);
    };
    ChildBaseView.prototype.dispacheDataEvent = function (type, data) {
        if (data === void 0) { data = null; }
        EventUtils_1.EventUtils.dispatchEvent(type, data);
    };
    ChildBaseView.prototype.hasDataEvent = function (type) {
        return EventUtils_1.EventUtils.hasEventListener(type);
    };
    /**
     * 注册全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    ChildBaseView.prototype.addDataEvent = function (type, thisObject, listener) {
        if (!this._globalEventdict.hasOwnProperty(type)) {
            var vo = ObjectPool_1.default.getObj(ComEventVO_1.default.poolkey);
            this._globalEventdict[type] = vo;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            EventUtils_1.EventUtils.addEventListener(type, thisObject, listener);
        }
    };
    /**
     * 移除全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    ChildBaseView.prototype.removeDataEvent = function (type, thisObject, listener) {
        if (this._globalEventdict[type]) {
            var vo = this._globalEventdict[type];
            EventUtils_1.EventUtils.removeEventListener(type, thisObject, listener);
            vo.clear();
            delete this._globalEventdict[type];
        }
    };
    /**
     * 注册组件事件，调用此方法，界面关闭会自动移除
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    ChildBaseView.prototype.addListener = function (target, type, thisObject, listener, args) {
        if (args === void 0) { args = null; }
        if (target) {
            if (target.name == null || target.name == "") {
                throw "childbaseview addListener target.name is null";
            }
            var vo = ObjectPool_1.default.getObj(ComEventVO_1.default.poolkey);
            vo.target = target;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            if (!this._eventdict.hasOwnProperty(target.name)) {
                this._eventdict[target.name] = [];
            }
            var bo = this.hasListener(target, type);
            if (!bo) {
                target.on(type, thisObject, listener, args);
                this._eventdict[target.name].push(vo);
            }
        }
    };
    ChildBaseView.prototype.hasListener = function (target, type) {
        var eventArr;
        eventArr = this._eventdict[target.name];
        var childvo;
        for (var s in eventArr) {
            childvo = eventArr[s];
            if (childvo && childvo.type == type) {
                return true;
            }
        }
        return false;
    };
    /**
     * 移除组件事件
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    ChildBaseView.prototype.removesListener = function (target, type, thisObject, listener) {
        if (target && this._eventdict[target.name]) {
            var arr = this._eventdict[target.name];
            var i = 0;
            var nums = arr.length;
            var vo;
            for (i; i < nums; i++) {
                vo = arr[i];
                if (vo && vo.type == type && vo.thisObject == thisObject && vo.listener == listener) {
                    target.off(type, thisObject, listener);
                    vo.clear();
                    arr.splice(i, 1);
                    break;
                }
            }
        }
    };
    /**
     * 移除所有全局事件
     */
    ChildBaseView.prototype.removeAllGlobalEvent = function () {
        if (this._globalEventdict) {
            var s;
            var dict = this._globalEventdict;
            for (s in dict) {
                var vo = dict[s];
                if (vo) {
                    this.removeDataEvent(vo.type, vo.thisObject, vo.listener);
                }
            }
        }
        this._globalEventdict = {};
    };
    /**
     * 移除所有组件事件
     */
    ChildBaseView.prototype.removeAllComEvent = function () {
        if (this._eventdict) {
            var s;
            var dict = this._eventdict;
            var arr;
            var i;
            var nums = 0;
            var vo;
            for (s in dict) {
                arr = dict[s];
                if (arr && arr.length > 0) {
                    i = 0;
                    nums = arr.length;
                    for (i = nums - 1; i >= 0; i--) {
                        vo = arr[i];
                        if (vo) {
                            if (vo.target) {
                                vo.target.off(vo.type, vo.thisObject, vo.listener);
                            }
                            vo.clear();
                        }
                        arr.splice(i, 1);
                    }
                }
                delete this._eventdict[s];
            }
        }
        this._eventdict = {};
    };
    ChildBaseView.prototype.dispose = function () {
        this.removeAllGlobalEvent();
        this.removeAllComEvent();
        _super.prototype.dispose.call(this);
    };
    return ChildBaseView;
}(fairygui.GComponent));
exports.default = ChildBaseView;
},{"../events/ComEventVO":15,"../events/EventUtils":16,"./MVCObjectPool":22,"./ObjectPool":23}],22:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Singleton_1 = require("./Singleton");
/*
* name;
*/
var MVCObjectPool = /** @class */ (function (_super) {
    __extends(MVCObjectPool, _super);
    function MVCObjectPool() {
        return _super.call(this) || this;
    }
    MVCObjectPool.getInstance = function () {
        if (this._instance == null) {
            this._instance = new MVCObjectPool();
        }
        return this._instance;
    };
    MVCObjectPool.prototype.addProxy = function (ref) {
        Singleton_1.default.create(ref);
    };
    MVCObjectPool.prototype.getProxy = function (ref) {
        return Singleton_1.default.getInstance(ref);
    };
    MVCObjectPool.prototype.removeProxy = function (ref) {
        Singleton_1.default.remove(ref);
    };
    MVCObjectPool.prototype.mapView = function (viewkey, ref) {
        if (!MVCObjectPool._mapviewDict[viewkey]) {
            MVCObjectPool._mapviewDict[viewkey] = ref;
            ref.key = viewkey;
        }
    };
    MVCObjectPool.getView = function (viewkey) {
        if (!MVCObjectPool._mapviewDict[viewkey]) {
            throw "err0 未绑定的viewkey:" + viewkey;
        }
        return MVCObjectPool._mapviewDict[viewkey];
    };
    MVCObjectPool._mapviewDict = {};
    return MVCObjectPool;
}(Laya.EventDispatcher));
exports.default = MVCObjectPool;
},{"./Singleton":24}],23:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* 对象池类
*/
var ObjectPool = /** @class */ (function (_super) {
    __extends(ObjectPool, _super);
    function ObjectPool() {
        return _super.call(this) || this;
    }
    ObjectPool.register = function (key, classarg) {
        ObjectPool._classargDict[key] = classarg;
        ObjectPool._content[key] = [];
    };
    ObjectPool.getObj = function (key) {
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        if (ObjectPool._content[key]) {
            var arr = ObjectPool._content[key];
            if (arr.length == 0) {
                var calssobj = ObjectPool._classargDict[key];
                var vo = new calssobj();
                return vo;
            }
            return ObjectPool._content[key].shift();
        }
        else {
            console.log("此key值对应的类未被注册");
            return null;
        }
    };
    ObjectPool.getObjByfgui = function (url) {
        if (!ObjectPool._content[url]) {
            ObjectPool._content[url] = [];
        }
        var arr = ObjectPool._content[url];
        if (arr.length == 0) {
            var vo = fairygui.UIPackage.createObjectFromURL(url);
            return vo;
        }
        return ObjectPool._content[url].shift();
    };
    ObjectPool.clearObj = function (key, obj) {
        if (ObjectPool._content[key]) {
            var index = ObjectPool._content[key].indexOf(obj);
            if (index == -1) {
                ObjectPool._content[key].push(obj);
            }
        }
    };
    ObjectPool._classargDict = {};
    ObjectPool._content = {};
    return ObjectPool;
}(Laya.EventDispatcher));
exports.default = ObjectPool;
},{}],24:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var Singleton = /** @class */ (function (_super) {
    __extends(Singleton, _super);
    function Singleton() {
        return _super.call(this) || this;
    }
    /**
    * 获取单例类，若不存在则返回空
    * @param	ref 继承自Singleton的类
    * @return	*
    */
    Singleton.getInstance = function (ref) {
        if (ref.key == null) {
            throw new Error("getinstance erro");
        }
        return this._dict[ref.key];
    };
    /**
     * 获取单例类，若不存在则创建
     * @param	ref		继承自Singleton的类
     * @return	*
     */
    Singleton.getInstanceOrCreate = function (ref) {
        if (ref.key == null) {
            throw new Error("getInstanceOrCreate erro");
        }
        this.create(ref);
        return this._dict[ref.key];
    };
    /**
   * 创建单例类
   * @param	ref		继承自Singleton的类
   * @return	void
   */
    Singleton.create = function (ref) {
        if (ref.key == null) {
            throw new Error("create erro");
        }
        if (this._dict[ref.key] == null) {
            this._dict[ref.key] = new ref();
        }
        return this._dict[ref.key];
    };
    /**
         * 删除单例类
         * @param	ref		继承自Singleton的类
         * @return	void
         */
    Singleton.remove = function (ref) {
        var key = ref.key;
        if (this._dict[key] != null) {
            this._dict[key].destory();
        }
    };
    /**
    * 销毁方法
    */
    Singleton.prototype.destory = function () {
    };
    Singleton._dict = {};
    return Singleton;
}(Laya.EventDispatcher));
exports.default = Singleton;
},{}],25:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 继承baseView界面的打开关闭动效类型
 */
var WindowAnmoType = /** @class */ (function () {
    function WindowAnmoType() {
    }
    /**
     * 没有动效
     */
    WindowAnmoType.WindowAnmoType_none = "WindowAnmoType_none";
    /**
     * 从右边移动到中央
     */
    WindowAnmoType.WindowAnmoType_addmoveToMiddle = "WindowAnmoType_addmoveToMiddle";
    /**
     * 从最右边移出
     */
    WindowAnmoType.WindowAnmoType_removemoveToRight = "WindowAnmoType_removemoveToRight";
    /**
     * 从底部向上移动
     */
    WindowAnmoType.WindowAnmoType_addmoveFromBottom = "WindowAnmoType_addmoveFromBottom";
    /**
     * 从上向底部移动
     */
    WindowAnmoType.WindowAnmoType_addmoveFromup = "WindowAnmoType_addmoveFromup";
    /**
     * 从小变大
     */
    WindowAnmoType.WindowAnmoType_addscaleMinToMax = "WindowAnmoType_addscaleMinToMax";
    /**
     * 从大变小移出
     */
    WindowAnmoType.WindowAnmoType_removescaleMaxToMin = "WindowAnmoType_removescaleMaxToMin";
    return WindowAnmoType;
}());
exports.default = WindowAnmoType;
},{}],26:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Debuger_1 = require("../Debuger");
var Global_1 = require("../../Global");
/*
* name;
*/
var GameHttps = /** @class */ (function (_super) {
    __extends(GameHttps, _super);
    function GameHttps() {
        var _this = _super.call(this) || this;
        _this._isrequesting = false;
        _this.init();
        return _this;
    }
    GameHttps.getInstance = function () {
        if (null == this._instance) {
            this._instance = new GameHttps();
        }
        return this._instance;
    };
    GameHttps.prototype.init = function () {
        this._callbackList = [];
        this.hr = new Laya.HttpRequest();
        // if(this.hr.http)
        // {
        //     this.hr.http.timeout = 5000;//设置超时时间；
        // }
        this.hr.on(Laya.Event.PROGRESS, this, this.onHttpRequestProgress);
        this.hr.on(Laya.Event.COMPLETE, this, this.onHttpRequestComplete);
        this.hr.on(Laya.Event.ERROR, this, this.onHttpRequestError);
    };
    GameHttps.prototype.sendPost = function (act, data, callback, callbackobj, isShowWait) {
        if (isShowWait === void 0) { isShowWait = false; }
        var itemdata = {};
        itemdata.act = act;
        itemdata.data = data;
        itemdata.callback = callback;
        itemdata.callbackobj = callbackobj;
        itemdata.isShowWait = isShowWait;
        itemdata.sendtype = "post";
        itemdata.httpurl = Global_1.Global.httpurl;
        this._callbackList.push(itemdata);
        this.sendByPost(act, data, callback, callbackobj, isShowWait);
    };
    GameHttps.prototype.sendbyHttpurl = function (url, act, data, callback, callbackobj, isShowWait) {
        if (isShowWait === void 0) { isShowWait = false; }
        var itemdata = {};
        itemdata.act = act;
        itemdata.data = data;
        itemdata.callback = callback;
        itemdata.callbackobj = callbackobj;
        itemdata.isShowWait = isShowWait;
        itemdata.sendtype = "get";
        itemdata.httpurl = url;
        this._callbackList.push(itemdata);
        this.sendbyget(act, data, callback, callbackobj, isShowWait);
    };
    GameHttps.prototype.sendByPost = function (act, data, callbackobj, callback, isShowWait) {
        if (isShowWait === void 0) { isShowWait = false; }
        if (this._isrequesting) {
            return;
        }
        this._isrequesting = true;
        if (isShowWait) {
            fairygui.GRoot.inst.showModalWait();
        }
        Debuger_1.default.log("http:" + Global_1.Global.httpurl + act, data);
        this.hr.send(Global_1.Global.httpurl + act, data, "post", "json", ["Content-Type", "application/json"]);
    };
    GameHttps.prototype.sendGet = function (act, data, callbackobj, callback, isShowWait) {
        if (act === void 0) { act = null; }
        if (data === void 0) { data = null; }
        if (callbackobj === void 0) { callbackobj = null; }
        if (callback === void 0) { callback = null; }
        if (isShowWait === void 0) { isShowWait = true; }
        var itemdata = {};
        itemdata.act = act;
        itemdata.data = data;
        itemdata.callback = callback;
        itemdata.callbackobj = callbackobj;
        itemdata.isShowWait = isShowWait;
        itemdata.sendtype = "get";
        itemdata.httpurl = Global_1.Global.httpurl;
        this._callbackList.push(itemdata);
        this.sendbyget(act, data, callback, callbackobj, isShowWait);
    };
    GameHttps.prototype.sendbyget = function (act, data, callback, callbackobj, isShowWait) {
        if (act === void 0) { act = null; }
        if (data === void 0) { data = null; }
        if (callback === void 0) { callback = null; }
        if (callbackobj === void 0) { callbackobj = null; }
        if (isShowWait === void 0) { isShowWait = false; }
        if (this._isrequesting) {
            return;
        }
        if (isShowWait) {
            fairygui.GRoot.inst.showModalWait();
        }
        var itemData = this._callbackList[0];
        var sendurl = "";
        if (data) {
            data.ACTION = act;
            sendurl = itemData.httpurl + "request?json=" + JSON.stringify(data);
        }
        else {
            sendurl = itemData.httpurl;
        }
        Debuger_1.default.log("GameHttp:send:", sendurl);
        this.hr.send(sendurl, null, "get", "text");
    };
    GameHttps.prototype.onHttpRequestError = function (e) {
        Debuger_1.default.log("********onHttpRequestError********");
        if (e) {
            Debuger_1.default.log(e);
        }
        fairygui.GRoot.inst.closeModalWait();
        this._isrequesting = false;
    };
    GameHttps.prototype.onHttpRequestProgress = function (e) {
    };
    GameHttps.prototype.onHttpRequestComplete = function (e) {
        fairygui.GRoot.inst.closeModalWait();
        Debuger_1.default.log("httpReceive:", this.hr.data);
        this._isrequesting = false;
        if (this._callbackList.length > 0) {
            var itemData = this._callbackList.shift();
            this.checkMessage();
            var callback = itemData.callback;
            var callbackobj = itemData.callbackobj;
            var data = JSON.parse(this.hr.data);
            if (this.hr.data != "") {
                if (data.hasOwnProperty("ACTIONCOM")) {
                    if (data.ACTIONCOM == 0) //succeed
                     {
                        if (callback && callbackobj) {
                            callback.call(callbackobj, data.JSDATA);
                        }
                    }
                    else //faild
                     {
                    }
                }
            }
        }
    };
    GameHttps.prototype.checkMessage = function () {
        if (this._callbackList.length > 0) {
            var nextItemData = this._callbackList[0];
            if (nextItemData.sendtype == "post") {
                this.sendByPost(nextItemData.act, nextItemData.data, nextItemData.callback, nextItemData.callbackobj, nextItemData.isShowWait);
            }
            else {
                this.sendbyget(nextItemData.act, nextItemData.data, nextItemData.callback, nextItemData.callbackobj, nextItemData.isShowWait);
            }
        }
    };
    return GameHttps;
}(Laya.EventDispatcher));
exports.default = GameHttps;
},{"../../Global":2,"../Debuger":12}],27:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var EventUtils_1 = require("../events/EventUtils");
var Debuger_1 = require("../Debuger");
var SocketNofify_1 = require("../notification/SocketNofify");
var GameSocket = /** @class */ (function () {
    function GameSocket() {
        /**
         * 1:自动断线，2：主动断线
         */
        this._offlinestate = 0;
        /**
         * 断线重连次数
         */
        this._connetNums = 0;
        /**
         * socket连接中
         */
        this._socketconneting = false;
    }
    GameSocket.getInstance = function () {
        if (this._instance == null) {
            this._instance = new GameSocket();
        }
        return this._instance;
    };
    //连接服务器
    GameSocket.prototype.connectServer = function (gameHost) {
        this._socketconneting = true;
        this.removeSocket();
        if (!this.sock || !this.sock.connected) {
            this.openwaitpanel();
            if (!this.sock) {
                this.sock = new Laya.Socket();
                this.sock.on(Laya.Event.OPEN, this, this.onSocketOpen);
                this.sock.on(Laya.Event.MESSAGE, this, this.onReceiveMessage);
                this.sock.on(Laya.Event.CLOSE, this, this.onSocketClose);
                this.sock.on(Laya.Event.ERROR, this, this.ioErro);
            }
            Debuger_1.default.log("开始连接socket:" + gameHost);
            this.sock.connectByUrl(gameHost);
        }
    };
    GameSocket.prototype.isConnect = function () {
        if (this.sock && this.sock.connected) {
            return true;
        }
        return false;
    };
    GameSocket.prototype.ioErro = function (e) {
        if (e === void 0) { e = null; }
        Debuger_1.default.log("gamesocketIOErrorEvent:" + e.type);
        this._socketconneting = false;
        this._connetNums++;
        this.closewaitpanel();
        this.removeSocket();
        this._offlinestate = 1;
    };
    GameSocket.prototype.removeSocket = function () {
        this._socketconneting = false;
        if (this.sock) {
            this.sock.off(Laya.Event.OPEN, this, this.onSocketOpen);
            this.sock.off(Laya.Event.MESSAGE, this, this.onReceiveMessage);
            this.sock.off(Laya.Event.CLOSE, this, this.onSocketClose);
            this.sock.off(Laya.Event.ERROR, this, this.ioErro);
            this.sock.cleanSocket();
            this.sock.close();
            this.sock = null;
        }
    };
    /**
     * 手动关闭游戏socket
     */
    GameSocket.prototype.colseSocket = function (offlinestate) {
        if (offlinestate === void 0) { offlinestate = 1; }
        if (this.isConnect()) {
            this.closewaitpanel();
            this.removeSocket();
            if (offlinestate != -1) {
                this._offlinestate = offlinestate;
            }
            EventUtils_1.EventUtils.dispatchEvent(SocketNofify_1.default.SOCKET_CLOSE);
        }
    };
    GameSocket.prototype.onSocketClose = function (e) {
        if (e === void 0) { e = null; }
        this._socketconneting = false;
        Debuger_1.default.log("socket 关闭");
        this.closewaitpanel();
        this._offlinestate = 1;
        EventUtils_1.EventUtils.dispatchEvent(SocketNofify_1.default.SOCKET_CLOSE);
    };
    GameSocket.prototype.closewaitpanel = function () {
        fairygui.GRoot.inst.closeModalWait();
    };
    GameSocket.prototype.openwaitpanel = function () {
        fairygui.GRoot.inst.showModalWait();
    };
    //连接成功返回
    GameSocket.prototype.onSocketOpen = function (event) {
        if (event === void 0) { event = null; }
        this._connetNums = 0;
        this.closewaitpanel();
        Debuger_1.default.log("socket 连接成功");
        this._offlinestate = 0;
        EventUtils_1.EventUtils.dispatchEvent(SocketNofify_1.default.SOCKET_CONNECT_SUCCEED, null, false);
    };
    //向服务端发送消息
    GameSocket.prototype.sendMessage = function (act, data, isShowWait) {
        if (isShowWait === void 0) { isShowWait = true; }
        if (this.sock && this.sock.connected) {
            if (isShowWait) {
                this.openwaitpanel();
            }
            if (!data) {
                data = {};
            }
            data.ACTION = act;
            this.sock.send(JSON.stringify(data));
            Debuger_1.default.log("socket send:" + JSON.stringify(data));
        }
        else {
            Debuger_1.default.log("当前socket未连接");
        }
    };
    //消息返回后，会广播出去
    //Global.addEventListener("你发送的cmd名称",监听方法,this)
    GameSocket.prototype.onReceiveMessage = function (msg) {
        if (msg === void 0) { msg = null; }
        var socketdata = JSON.parse(msg);
        Debuger_1.default.log("socket receive:", socketdata);
    };
    return GameSocket;
}());
exports.default = GameSocket;
},{"../Debuger":12,"../events/EventUtils":16,"../notification/SocketNofify":30}],28:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Debuger_1 = require("../Debuger");
var Global_1 = require("../../Global");
var PlatfromType_1 = require("../../platform/PlatfromType");
var PlatformEvent_1 = require("../../platform/events/PlatformEvent");
/*
* name;
*/
var TongjiHttps = /** @class */ (function (_super) {
    __extends(TongjiHttps, _super);
    function TongjiHttps() {
        var _this = _super.call(this) || this;
        _this._iscanSend = true;
        _this.init();
        return _this;
    }
    TongjiHttps.getInstance = function () {
        if (null == this._instance) {
            this._instance = new TongjiHttps();
        }
        return this._instance;
    };
    TongjiHttps.prototype.init = function () {
        this.hr = new Laya.HttpRequest();
    };
    TongjiHttps.prototype.send = function (act, data) {
        if (data === void 0) { data = null; }
        if (this._iscanSend) {
            this.sendbyget(act, data);
        }
    };
    TongjiHttps.prototype.tongjiData = function (TID2, TID3, Num, Total, Datas) {
        if (TID3 === void 0) { TID3 = ""; }
        if (Num === void 0) { Num = 0; }
        if (Total === void 0) { Total = 0; }
        if (Datas === void 0) { Datas = ""; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                this.sendTongjiData(PlatformEvent_1.default.message_9891002, TID2, TID3, Num, Total, Datas);
                break;
        }
    };
    TongjiHttps.prototype.sendTongjiData = function (act, TID2, TID3, Num, Total, Datas) {
        if (Num === void 0) { Num = 0; }
        var itemd = {};
        itemd.TID2 = TID2;
        itemd.TID3 = TID3;
        itemd.Num = Math.floor(Num);
        itemd.Total = Total;
        itemd.Datas = Datas;
        itemd.MEMBERID = Global_1.Global.MemberID;
        itemd.AppKeyID = Global_1.Global.AppKeyID;
        this.sendbyget(act, itemd);
    };
    TongjiHttps.prototype.sendbyget = function (act, data) {
        if (data === void 0) { data = null; }
        if (data) {
            var sendurl = "";
            data.ACTION = act;
            sendurl = Global_1.Global.httpurl + "request?json=" + JSON.stringify(data);
            Debuger_1.default.log("***sendtongji***:", sendurl);
            this.hr.send(sendurl, null, "get", "text");
        }
    };
    return TongjiHttps;
}(Laya.EventDispatcher));
exports.default = TongjiHttps;
},{"../../Global":2,"../../platform/PlatfromType":68,"../../platform/events/PlatformEvent":69,"../Debuger":12}],29:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 *
 * @author
 *
 */
var LayerNotify;
(function (LayerNotify) {
    /**
     * 背景层
     */
    LayerNotify.LAYER_BACKGROUND = "LAYER_BACKGROUND";
    /**
     * ui层
     */
    LayerNotify.LAYER_UILAYER = "LAYER_UILAYER";
    /**
     * ui层上层
     */
    LayerNotify.LAYER_UPUILAYER = "LAYER_UPUILAYER";
    /**
     * tips层
     */
    LayerNotify.LAYER_TIPSLAYER = "LAYER_TIPSLAYER";
    /**
     * 新手引导层
     */
    LayerNotify.LAYER_GUIDELAYER = "LAYER_GUIDELAYER";
})(LayerNotify = exports.LayerNotify || (exports.LayerNotify = {}));
},{}],30:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var SocketNofify = /** @class */ (function () {
    function SocketNofify() {
    }
    /**
     * socket连接成功
     */
    SocketNofify.SOCKET_CONNECT_SUCCEED = "SOCKET_CONNECT_SUCCEED";
    /**
     * socket关闭
     */
    SocketNofify.SOCKET_CLOSE = "SOCKET_CLOSE";
    /**
     * 游戏重新连接
     */
    SocketNofify.Game_againConnetSocket = "Game_againConnetSocket";
    return SocketNofify;
}());
exports.default = SocketNofify;
},{}],31:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var BaseVO = /** @class */ (function (_super) {
    __extends(BaseVO, _super);
    function BaseVO() {
        return _super.call(this) || this;
    }
    BaseVO.prototype.setInfo = function (data) {
        if (data) {
            for (var s in data) {
                var itemd = this[s];
                if (itemd != null) {
                    this[s] = data[s];
                }
                // else
                // {
                //     Debuger.log( "VO:未定义属性-" + s );
                // }
            }
        }
    };
    BaseVO.prototype.dispatchEvent = function (type, data) {
        this.event(type, data);
    };
    return BaseVO;
}(Laya.EventDispatcher));
exports.BaseVO = BaseVO;
},{}],32:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ObjectPool_1 = require("../mvc/ObjectPool");
/*
* name;
*/
var CacheVO = /** @class */ (function (_super) {
    __extends(CacheVO, _super);
    function CacheVO() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * 引用次数
         */
        _this.ref = 0;
        /**
         * 最后一次被引用的时间
         */
        _this.time = 0;
        /**
         * 包名
         */
        _this.packageName = "";
        return _this;
    }
    CacheVO.prototype.clear = function () {
        this.ref = 0;
        this.time = 0;
        this.packageName = "";
        ObjectPool_1.default.clearObj(CacheVO.poolkey, this);
    };
    CacheVO.poolkey = "CacheVO";
    return CacheVO;
}(Laya.EventDispatcher));
exports.default = CacheVO;
},{"../mvc/ObjectPool":23}],33:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var JoystickModule = /** @class */ (function (_super) {
    __extends(JoystickModule, _super);
    function JoystickModule(clickpanel) {
        var _this = _super.call(this) || this;
        _this.dis = 0;
        _this.degree = 0;
        _this.angle = 0;
        _this.offx = 0;
        _this._iscanCBack = false;
        _this._iacanCallback = false;
        _this._clickpanel = clickpanel;
        _this._button = new Laya.Point();
        _this.touchId = -1;
        _this.radius = 400;
        _this._curPos = new Laya.Point();
        _this._clickpanel.on(Laya.Event.MOUSE_DOWN, _this, _this.onTouchDown);
        return _this;
    }
    JoystickModule.prototype.setEventCallback = function (callobj, downCallback, movecallback, upcallback) {
        this._callobj = callobj;
        this._downCallback = downCallback;
        this._movecallback = movecallback;
        this._updatecallback = upcallback;
    };
    JoystickModule.prototype.Trigger = function (evt) {
        this.onTouchDown(evt);
    };
    JoystickModule.prototype.onTouchDown = function (evt) {
        if (this.touchId == -1) { //First touch
            this.touchId = evt.touchId;
            this.offx = 0;
            this._iscanCBack = false;
            fairygui.GRoot.inst.globalToLocal(Laya.stage.mouseX, Laya.stage.mouseY, this._curPos);
            var bx = this._curPos.x;
            var by = this._curPos.y;
            this._lastStageX = bx;
            this._lastStageY = by;
            this._startStageX = bx;
            this._startStageY = by;
            this._button.x = bx;
            this._button.y = by;
            if (this._callobj && this._downCallback) {
                this._downCallback.call(this._callobj);
            }
            this._clickpanel.on(Laya.Event.MOUSE_MOVE, this, this.OnTouchMove);
            this._clickpanel.on(Laya.Event.MOUSE_UP, this, this.OnTouchUp);
            this._clickpanel.on(Laya.Event.MOUSE_OUT, this, this.OnTouchUp);
        }
    };
    JoystickModule.prototype.OnTouchUp = function (evt) {
        if (evt === void 0) { evt = null; }
        if (this.touchId != -1 && evt.touchId == this.touchId) {
            this.touchup();
            if (this._callobj && this._updatecallback) {
                this._updatecallback.call(this._callobj);
            }
        }
    };
    JoystickModule.prototype.touchup = function () {
        this._iscanCBack = false;
        this.touchId = -1;
        this._clickpanel.off(Laya.Event.MOUSE_MOVE, this, this.OnTouchMove);
        this._clickpanel.off(Laya.Event.MOUSE_UP, this, this.OnTouchUp);
        this._clickpanel.off(Laya.Event.MOUSE_OUT, this, this.OnTouchUp);
        this._iacanCallback = false;
        this.degree = 0;
    };
    JoystickModule.prototype.OnTouchMove = function (evt) {
        if (this.touchId != -1 && evt.touchId == this.touchId) {
            var bx = Laya.stage.mouseX;
            var by = Laya.stage.mouseY;
            var moveX = bx - this._lastStageX;
            var moveY = by - this._lastStageY;
            this._lastStageX = bx;
            this._lastStageY = by;
            var buttonX = this._button.x + moveX;
            var buttonY = this._button.y + moveY;
            var offsetX = buttonX - this._startStageX;
            var offsetY = buttonY - this._startStageY;
            var disX = 0;
            if (moveX >= 2 || moveX <= -2) {
                this._iscanCBack = true;
            }
            else {
                this._iscanCBack = false;
            }
            this.offx = moveX;
            if (offsetX == 0 && offsetY == 0) {
                return;
            }
            if (offsetX > 0) {
                if (offsetX > this.radius) {
                    disX = this.radius;
                    this.angle = 90;
                }
                else {
                    disX = this.radius - offsetX;
                    this.angle = 90 - disX / this.radius * 90;
                }
            }
            else if (offsetX == 0) {
                this.angle = 0;
            }
            else {
                if (-offsetX > this.radius) {
                    disX = this.radius;
                    this.angle = -90;
                }
                else {
                    disX = this.radius + offsetX;
                    this.angle = -(90 - disX / this.radius * 90);
                }
            }
            var rad = Math.atan2(offsetY, offsetX);
            this.degree = rad;
            var maxX = this.radius * Math.cos(rad);
            var maxY = this.radius * Math.sin(rad);
            if (Math.abs(offsetX) > Math.abs(maxX))
                offsetX = maxX;
            if (Math.abs(offsetY) > Math.abs(maxY))
                offsetY = maxY;
            buttonX = this._startStageX + offsetX;
            buttonY = this._startStageY + offsetY;
            if (buttonX < 0)
                buttonX = 0;
            if (buttonY > fairygui.GRoot.inst.height)
                buttonY = fairygui.GRoot.inst.height;
            this._button.x = buttonX;
            this._button.y = buttonY;
            this.dis = Math.sqrt(offsetX * offsetX + offsetY * offsetY);
            this._iacanCallback = true;
            if (this._iscanCBack && this._callobj && this._movecallback && this._iacanCallback) {
                this._movecallback.call(this._callobj, this.offx);
            }
        }
    };
    JoystickModule.prototype.dispose = function () {
        this._clickpanel.off(Laya.Event.MOUSE_DOWN, this, this.onTouchDown);
    };
    // private _center:fairygui.GImage;
    JoystickModule.JoystickMoving = "JoystickMoving";
    JoystickModule.JoystickUp = "JoystickUp";
    return JoystickModule;
}(Laya.EventDispatcher));
exports.JoystickModule = JoystickModule;
},{}],34:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var UiManager_1 = require("../../../managers/UiManager");
var LoadingView_1 = require("../view/LoadingView");
var Debuger_1 = require("../../../frameworks/Debuger");
var PathConfig_1 = require("../../../configs/gameConfigs/PathConfig");
var ResourceManager_1 = require("../../../managers/ResourceManager");
var ResDataManager_1 = require("../../../managers/ResDataManager");
var UserInfoProxy_1 = require("../../userinfo/UserInfoProxy");
var PlatformEvent_1 = require("../../../platform/events/PlatformEvent");
var BaseProxys_1 = require("../../../frameworks/mvc/BaseProxys");
var MainProxy_1 = require("../../main/proxys/MainProxy");
var RoleCFG_1 = require("../../../configs/dataConfigs/RoleCFG");
var LevelCFG_1 = require("../../../configs/dataConfigs/LevelCFG");
var BuildCFG_1 = require("../../../configs/dataConfigs/BuildCFG");
var NpcCFG_1 = require("../../../configs/dataConfigs/NpcCFG");
var GameCFG_1 = require("../../../configs/dataConfigs/GameCFG");
var SkinProxy_1 = require("../../skins/proxys/SkinProxy");
var Sdk_1 = require("../../../platform/wxminigame/WXSDK/Sdk");
var YQSdk_1 = require("../../../platform/wxminigame/WXSDK/YQSdk");
var PlayerAccount_1 = require("../../../platform/wxminigame/WXSDK/PlayerAccount");
var NetworkManager_1 = require("../../../platform/wxminigame/NetworkManager");
var Global_1 = require("../../../Global");
var LoginProxy = /** @class */ (function (_super) {
    __extends(LoginProxy, _super);
    function LoginProxy() {
        return _super.call(this) || this;
    }
    LoginProxy.prototype.initProxy = function () {
        this.addDataEvent(PlatformEvent_1.default.PlatformEvent_loginSucceed, this, this.loginsucceed);
    };
    LoginProxy.prototype.startLogin = function () {
        UiManager_1.UiManager.instance.add(LoadingView_1.default);
        this.loginprogress(0);
        if (Laya.Browser.onWeiXin) {
            this.LoginYQ();
        }
        else {
            // this.loginsucceed();
            this.LoginLocalSever();
        }
        // PlatformTool.getInstance().login( );
    };
    LoginProxy.prototype.LoginYQ = function () {
        var _this = this;
        Sdk_1.WxApi.recordAldEvent("开始微信登录");
        Sdk_1.WxApi.WXLogin(function (res) {
            if (res != "error") {
                Sdk_1.WxApi.recordAldEvent("微信登录成功");
                console.log("hplogin:" + "querychannel->" + Sdk_1.WxApi.querychannel + " referrerInfoappId->" + Sdk_1.WxApi.referrerInfoappId);
                YQSdk_1.YQSdk.login(res.code, Sdk_1.WxApi.querychannel, Sdk_1.WxApi.referrerInfoappId, function () {
                    Laya.Browser.window.wx.onHide(function () {
                        YQSdk_1.YQSdk.exposure();
                    });
                    _this.LoginLocal();
                });
            }
            else {
                Sdk_1.WxApi.recordAldEvent("微信登录失败");
                _this.LoginYQ();
            }
        });
    };
    LoginProxy.prototype.LoginLocal = function () {
        var _this = this;
        Sdk_1.WxApi.recordAldEvent("开始登录");
        Sdk_1.WxApi.WXLogin(function (res) {
            if (res != "error") {
                Sdk_1.WxApi.recordAldEvent("微信登录成功2");
                _this.LoginLocalSever(res);
            }
            else {
                Sdk_1.WxApi.recordAldEvent("微信登录失败");
                _this.LoginLocal();
            }
        });
    };
    LoginProxy.prototype.LoginLocalSever = function (res) {
        if (res === void 0) { res = null; }
        Sdk_1.WxApi.recordAldEvent("开始本地登录");
        if (res) {
            new PlayerAccount_1.PlayerAccount(res.code, "", "", 0, "", "", "", "", Sdk_1.WxApi.shareOpenId, Sdk_1.WxApi.shareOpenId, Global_1.Global.gameVersion);
        }
        NetworkManager_1.NetworkManager.Instance.login(null, Laya.Handler.create(this, this.OnLoginLocalComplete), Laya.Handler.create(this, this.OnLoginError));
        //this.LoadSbp();
    };
    LoginProxy.prototype.OnLoginLocalComplete = function () {
        Sdk_1.WxApi.recordAldEvent("本地服务器登录完成...");
        Sdk_1.WxApi.aldSendOpenid(PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.openid);
        this.loginsucceed();
    };
    LoginProxy.prototype.OnLoginError = function (e) {
        console.log(e);
    };
    LoginProxy.prototype.loginprogress = function (value) {
        var loadingview = UiManager_1.UiManager.instance.getView(LoadingView_1.default);
        if (loadingview) {
            loadingview.showWord(value);
        }
    };
    LoginProxy.prototype.loginsucceed = function () {
        Debuger_1.default.log("登录成功");
        // this.loadconfig();
        if (Laya.Browser.onWeiXin) {
            this.parseConfig1();
            this.initData();
            this.enterMain();
        }
        else {
            this.loadconfig();
            // this.parseConfig1( );
            // this.initData();
            // this.enterMain();
        }
    };
    /**
     * 解析配置数据
     */
    LoginProxy.prototype.parseConfig1 = function () {
        var byteData = PlayerAccount_1.PlayerAccount.CurrentAccount.nowConfig.gameConfig[0].config;
        Debuger_1.default.log("配置表数据：", byteData);
        if (byteData && byteData != "") {
            var arr = byteData.split("%file%");
            var i;
            var nums = arr.length;
            for (i = 0; i < nums; i++) {
                var itemarr = arr[i].split("%cfg%");
                var cla = LoginProxy.configClass[itemarr[0]];
                if (cla) {
                    cla.initCfg(itemarr[1]);
                }
                else {
                    Debuger_1.default.log("没有注册此类" + itemarr[0]);
                }
            }
            return true;
        }
        return false;
    };
    LoginProxy.prototype.loadconfig = function () {
        var pathArr = [];
        pathArr.push({ url: PathConfig_1.PathConfig.getConfig("gameConfig"), type: Laya.Loader.TEXT });
        ResourceManager_1.default.getInstance().Loaders(pathArr, this, this.configComplete, this.loginprogress, false);
    };
    LoginProxy.prototype.configComplete = function () {
        this.parseConfig();
        this.initData();
        this.enterMain();
    };
    /**
     * 初始化游戏数据
     */
    LoginProxy.prototype.initData = function () {
        this.getProxy(UserInfoProxy_1.default).init();
        this.getProxy(SkinProxy_1.default).init();
    };
    LoginProxy.prototype.enterMain = function () {
        console.log("当前配置表总关卡：", LevelCFG_1.default.vec.length);
        this.getProxy(MainProxy_1.default).enterMain();
    };
    /**
     * 解析配置数据
     */
    LoginProxy.prototype.parseConfig = function () {
        var byteData = ResDataManager_1.default.getInastance().getResByurl(PathConfig_1.PathConfig.getConfig("gameConfig"));
        if (byteData && byteData != "") {
            var arr = byteData.split("%file%");
            var i;
            var nums = arr.length;
            for (i = 0; i < nums; i++) {
                var itemarr = arr[i].split("%cfg%");
                var cla = LoginProxy.configClass[itemarr[0]];
                if (cla) {
                    cla.initCfg(itemarr[1]);
                }
                else {
                    Debuger_1.default.log("没有注册此类" + itemarr[0]);
                }
            }
            return true;
        }
        return false;
    };
    LoginProxy.key = "LoginProxy";
    LoginProxy.configClass = {
        RoleCFG: RoleCFG_1.default,
        LevelCFG: LevelCFG_1.default,
        BuildCFG: BuildCFG_1.default,
        NpcCFG: NpcCFG_1.default,
        GameCFG: GameCFG_1.default
    };
    return LoginProxy;
}(BaseProxys_1.default));
exports.default = LoginProxy;
},{"../../../Global":2,"../../../configs/dataConfigs/BuildCFG":5,"../../../configs/dataConfigs/GameCFG":6,"../../../configs/dataConfigs/LevelCFG":7,"../../../configs/dataConfigs/NpcCFG":8,"../../../configs/dataConfigs/RoleCFG":9,"../../../configs/gameConfigs/PathConfig":10,"../../../frameworks/Debuger":12,"../../../frameworks/mvc/BaseProxys":19,"../../../managers/ResDataManager":62,"../../../managers/ResourceManager":63,"../../../managers/UiManager":66,"../../../platform/events/PlatformEvent":69,"../../../platform/wxminigame/NetworkManager":71,"../../../platform/wxminigame/WXSDK/PlayerAccount":74,"../../../platform/wxminigame/WXSDK/Sdk":75,"../../../platform/wxminigame/WXSDK/YQSdk":77,"../../main/proxys/MainProxy":40,"../../skins/proxys/SkinProxy":51,"../../userinfo/UserInfoProxy":53,"../view/LoadingView":35}],35:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../../frameworks/mvc/BaseView");
var LoadingView = /** @class */ (function (_super) {
    __extends(LoadingView, _super);
    function LoadingView() {
        return _super.call(this, "loading", "loading") || this;
    }
    LoadingView.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
    };
    LoadingView.prototype.initView = function () {
    };
    LoadingView.prototype.initEvent = function () {
    };
    LoadingView.prototype.showWord = function (value) {
        this.pro_bar.value = value;
    };
    LoadingView.prototype.clearEvent = function () {
    };
    LoadingView.prototype.destory = function () {
        this.clearEvent();
        _super.prototype.destory.call(this);
    };
    LoadingView.key = "LoadingView";
    return LoadingView;
}(BaseView_1.default));
exports.default = LoadingView;
},{"../../../frameworks/mvc/BaseView":20}],36:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WordTipsView_1 = require("./WordTipsView");
var GameLayerManager_1 = require("../../../managers/GameLayerManager");
var LayerNotify_1 = require("../../../frameworks/notification/LayerNotify");
var EventUtils_1 = require("../../../frameworks/events/EventUtils");
var GameEvent_1 = require("../../userinfo/events/GameEvent");
/*
* name;
*/
var WordTipsUtils = /** @class */ (function () {
    function WordTipsUtils() {
    }
    WordTipsUtils.getInstance = function () {
        if (!this._instance) {
            this._instance = new WordTipsUtils();
        }
        return this._instance;
    };
    WordTipsUtils.prototype.initEvent = function () {
        WordTipsUtils.isEvent = true;
        EventUtils_1.EventUtils.addEventListener(GameEvent_1.default.removeselect, this, this.addwordList);
    };
    WordTipsUtils.prototype.showWordTips = function (word) {
        if (!WordTipsUtils.isEvent) {
            WordTipsUtils.getInstance().initEvent();
        }
        if (WordTipsUtils.showWordList.length > 0) {
            var lastword = WordTipsUtils.showWordList[WordTipsUtils.showWordList.length - 1].nowword;
            // if( lastword == word )
            // {
            //     return;
            // }
        }
        if (WordTipsUtils.wordList.length > 0) {
            var item = WordTipsUtils.wordList.shift();
            GameLayerManager_1.GameLayerManager.getInstance().addtoLayer(item, LayerNotify_1.LayerNotify.LAYER_TIPSLAYER);
            WordTipsUtils.showWordList.push(item);
            item.showWord(word);
        }
        else {
            if (WordTipsUtils.showWordList.length < 10) {
                var item1 = new WordTipsView_1.WordTipsView();
                GameLayerManager_1.GameLayerManager.getInstance().addtoLayer(item1, LayerNotify_1.LayerNotify.LAYER_TIPSLAYER);
                WordTipsUtils.showWordList.push(item1);
                item1.showWord(word);
            }
            else {
                var item1 = WordTipsUtils.showWordList.shift();
                item1.showWord(word);
                WordTipsUtils.showWordList.push(item1);
            }
        }
    };
    WordTipsUtils.prototype.addwordList = function (item) {
        if (item) {
            item.removeFromParent();
            var index = WordTipsUtils.showWordList.indexOf(item);
            if (index != -1) {
                WordTipsUtils.showWordList.splice(index, 1);
            }
            GameLayerManager_1.GameLayerManager.getInstance().removeformLayer(LayerNotify_1.LayerNotify.LAYER_TIPSLAYER);
            WordTipsUtils.wordList.push(item);
        }
    };
    WordTipsUtils.wordList = [];
    WordTipsUtils.showWordList = [];
    WordTipsUtils.maxNum = 10;
    WordTipsUtils.isEvent = false;
    return WordTipsUtils;
}());
exports.WordTipsUtils = WordTipsUtils;
},{"../../../frameworks/events/EventUtils":16,"../../../frameworks/notification/LayerNotify":29,"../../../managers/GameLayerManager":61,"../../userinfo/events/GameEvent":54,"./WordTipsView":37}],37:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../../frameworks/mvc/BaseView");
var EventUtils_1 = require("../../../frameworks/events/EventUtils");
var GameEvent_1 = require("../../userinfo/events/GameEvent");
/*
* name;
*/
var WordTipsView = /** @class */ (function (_super) {
    __extends(WordTipsView, _super);
    function WordTipsView() {
        var _this = _super.call(this, "loading", "wordTips") || this;
        _this.nowword = "";
        return _this;
    }
    WordTipsView.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
        this.t1 = this.getpanelTransition("t1");
    };
    WordTipsView.prototype.showWord = function (word) {
        this.nowword = word;
        this.text_word.text = word;
        this.t1.play(Laya.Handler.create(this, this.playEndCallback), 1);
    };
    WordTipsView.prototype.playEndCallback = function () {
        EventUtils_1.EventUtils.dispatchEvent(GameEvent_1.default.removeselect, this);
    };
    WordTipsView.key = "WordTipsView";
    return WordTipsView;
}(BaseView_1.default));
exports.WordTipsView = WordTipsView;
},{"../../../frameworks/events/EventUtils":16,"../../../frameworks/mvc/BaseView":20,"../../userinfo/events/GameEvent":54}],38:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var JoystickModule_1 = require("../joystick/JoystickModule");
var EventUtils_1 = require("../../frameworks/events/EventUtils");
var GameEvent_1 = require("../userinfo/events/GameEvent");
var Scene3DManager_1 = require("../../managers/Scene3DManager");
var Scene3dObject_1 = require("../scene3ds/Scene3dObject");
var TimerService_1 = require("../../frameworks/TimerService");
var GameCFG_1 = require("../../configs/dataConfigs/GameCFG");
var SoundssManager_1 = require("../../managers/SoundssManager");
var Sdk_1 = require("../../platform/wxminigame/WXSDK/Sdk");
var GameStateManager = /** @class */ (function () {
    function GameStateManager() {
        /**
         * 0:未开始，1：游戏中，2：暂停中
         */
        this.nowGameState = 0;
        this._zhuanxiangbeishu = 0;
        this._huadongSpeedX = 0;
        this._huadongClimbSpeedX = 0;
        this.endGamePlayerArr = [];
        this._isneedShunyiX = false;
        this._nowTime = 0;
        this._lastAngle = 0;
        this._time = 0;
        this.nowMingCi = 0;
        this._nums = 0;
        this._all = 0;
    }
    GameStateManager.getInstance = function () {
        if (!this._instance) {
            this._instance = new GameStateManager();
        }
        return this._instance;
    };
    GameStateManager.prototype.init = function () {
        this._huadongSpeedX = Number(GameCFG_1.default.dict[4].value);
        this._huadongClimbSpeedX = Number(GameCFG_1.default.dict[5].value);
        if (GameCFG_1.default.dict[7]) {
            this._zhuanxiangbeishu = Number(GameCFG_1.default.dict[7].value);
        }
        else {
            this._zhuanxiangbeishu = 2;
        }
        this.initEvent();
    };
    GameStateManager.prototype.initEvent = function () {
        EventUtils_1.EventUtils.addEventListener(GameEvent_1.default.endGame, this, this.endGame);
        EventUtils_1.EventUtils.addEventListener(GameEvent_1.default.npcendGame, this, this.npcendGameHandler);
    };
    GameStateManager.prototype.npcendGameHandler = function (str) {
        this.endGamePlayerArr.push(str);
    };
    GameStateManager.prototype.setClickPanel = function (panel) {
        this._joystickModule = new JoystickModule_1.JoystickModule(panel);
        this._joystickModule.setEventCallback(this, this.ondownfun, this.onmovefun, this.onupfun);
    };
    GameStateManager.prototype.ondownfun = function () {
        this._lastAngle = 0;
        this._nowTime = Laya.Browser.now() / 1000;
    };
    GameStateManager.prototype.onmovefun = function (offsetX) {
        if (this.nowGameState == 1) {
            var disAngle = this._joystickModule.angle - this._lastAngle;
            this._lastAngle = this._joystickModule.angle;
            if (Scene3dObject_1.default.iscarmanpc) {
                Scene3dObject_1.default.npcscriptDict["npc_0"].joyStickCHange(offsetX > 0 ? this._huadongSpeedX : -this._huadongSpeedX, disAngle * this._zhuanxiangbeishu);
            }
            else {
                Scene3DManager_1.default.getInstance().mainRoleScript.joyStickCHange(offsetX > 0 ? this._huadongSpeedX : -this._huadongSpeedX, offsetX > 0 ? this._huadongClimbSpeedX : -this._huadongClimbSpeedX, disAngle * this._zhuanxiangbeishu);
            }
        }
    };
    GameStateManager.prototype.onupfun = function () {
        if (Scene3dObject_1.default.iscarmanpc) {
            Scene3dObject_1.default.npcscriptDict["npc_0"].joyStickCHange(0, 0);
        }
        else {
            if (this.nowGameState == 1) {
                Scene3DManager_1.default.getInstance().mainRoleScript.joyStickCHange(0, 0, 0);
                // if( Laya.Browser.now()/1000 - this._nowTime < 0.2 )
                // {
                //     if( this._joystickModule.offx > 4 )
                //     {
                //         Scene3DManager.getInstance().mainRoleScript.xshunyi( 1 );
                //     }
                //     else if( this._joystickModule.offx < -4 )
                //     {
                //         Scene3DManager.getInstance().mainRoleScript.xshunyi( -1 );
                //     }   
                // }
            }
        }
    };
    GameStateManager.prototype.update = function (dt) {
        if (this.nowGameState == 1) {
            this._time = 0;
            var npcdict = Scene3dObject_1.default.npcscriptDict;
            this._nums = 0;
            this._all = 0;
            var s;
            var npcsp;
            for (s in npcdict) {
                npcsp = npcdict[s];
                if (npcsp.getNowstate() == 1) {
                    if (Scene3dObject_1.default.mainRole.transform.position.z < npcsp.getPostion().z) {
                        this._nums++;
                    }
                    this._all++;
                }
            }
            this.nowMingCi = this.endGamePlayerArr.length + ((this._all + 1) - this._nums);
            Scene3dObject_1.default.txt_mingci.text = "第" + this.nowMingCi + "名";
        }
    };
    GameStateManager.prototype.startGame = function () {
        this.nowMingCi = 0;
        this.endGamePlayerArr.length = 0;
        this.nowGameState = 1;
        TimerService_1.default.instance.addUpdateTarget(this);
        this.update(500);
        EventUtils_1.EventUtils.dispatchEvent(GameEvent_1.default.startGame);
        SoundssManager_1.default.getInstance().playbgSound("bgm");
        Sdk_1.WxApi.recordAldEvent("主界面点击开始游戏...");
    };
    GameStateManager.prototype.stopGame = function () {
        this.nowGameState = 2;
        this.onupfun();
    };
    GameStateManager.prototype.endGame = function () {
        this.nowGameState = 0;
        TimerService_1.default.instance.removeUpdateTarget(this);
        var npcdict = Scene3dObject_1.default.npcscriptDict;
        if (npcdict) {
            for (var s in npcdict) {
                npcdict[s].stop();
            }
        }
        this.onupfun();
        SoundssManager_1.default.getInstance().stopbgSound();
    };
    return GameStateManager;
}());
exports.default = GameStateManager;
},{"../../configs/dataConfigs/GameCFG":6,"../../frameworks/TimerService":13,"../../frameworks/events/EventUtils":16,"../../managers/Scene3DManager":64,"../../managers/SoundssManager":65,"../../platform/wxminigame/WXSDK/Sdk":75,"../joystick/JoystickModule":33,"../scene3ds/Scene3dObject":48,"../userinfo/events/GameEvent":54}],39:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseProxys_1 = require("../../../frameworks/mvc/BaseProxys");
var GameEvent_1 = require("../../userinfo/events/GameEvent");
var UiManager_1 = require("../../../managers/UiManager");
var GameResultView_1 = require("../../result/GameResultView");
var GameStateManager_1 = require("../GameStateManager");
var GameUtils_1 = require("../../../utils/GameUtils");
var Scene3DManager_1 = require("../../../managers/Scene3DManager");
var Scene3dObject_1 = require("../../scene3ds/Scene3dObject");
var Sdk_1 = require("../../../platform/wxminigame/WXSDK/Sdk");
var GameProxy = /** @class */ (function (_super) {
    __extends(GameProxy, _super);
    function GameProxy() {
        return _super.call(this) || this;
    }
    GameProxy.prototype.initProxy = function () {
        this.addDataEvent(GameEvent_1.default.endGame, this, this.endgameHandler);
    };
    GameProxy.prototype.endgameHandler = function () {
        Laya.timer.once(1000, this, this.startEndView);
    };
    GameProxy.prototype.startEndView = function () {
        var nowmingcvi = GameStateManager_1.default.getInstance().nowMingCi;
        var getGold = 0;
        if (GameStateManager_1.default.getInstance().endGamePlayerArr.length == 0) {
            getGold = this.roleVO.levelcfg.winGold;
            Sdk_1.WxApi.recordAldEvent("打开结算界面(游戏胜利)");
        }
        else {
            var arr = GameUtils_1.GameUtils.cutstrtoArr(this.roleVO.levelcfg.failGod);
            getGold = GameUtils_1.GameUtils.randRangeint(Number(arr[0]), Number(arr[1]));
            Sdk_1.WxApi.recordAldEvent("打开结算界面(游戏失败)");
        }
        UiManager_1.UiManager.instance.add(GameResultView_1.default, getGold);
    };
    GameProxy.prototype.returnmainview = function () {
        Scene3dObject_1.default.getInstance().closeengamlizi();
        UiManager_1.UiManager.instance.close(GameResultView_1.default);
        this.dispacheDataEvent(GameEvent_1.default.returnMainView);
        Scene3DManager_1.default.getInstance().showScene();
    };
    GameProxy.prototype.startGame = function () {
        GameStateManager_1.default.getInstance().startGame();
    };
    GameProxy.key = "GameProxy";
    return GameProxy;
}(BaseProxys_1.default));
exports.default = GameProxy;
},{"../../../frameworks/mvc/BaseProxys":19,"../../../managers/Scene3DManager":64,"../../../managers/UiManager":66,"../../../platform/wxminigame/WXSDK/Sdk":75,"../../../utils/GameUtils":87,"../../result/GameResultView":45,"../../scene3ds/Scene3dObject":48,"../../userinfo/events/GameEvent":54,"../GameStateManager":38}],40:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseProxys_1 = require("../../../frameworks/mvc/BaseProxys");
var ResourceManager_1 = require("../../../managers/ResourceManager");
var LoadingView_1 = require("../../loading/view/LoadingView");
var UiManager_1 = require("../../../managers/UiManager");
var ResDataManager_1 = require("../../../managers/ResDataManager");
var MainView_1 = require("../view/MainView");
var Scene3DManager_1 = require("../../../managers/Scene3DManager");
var PathConfig_1 = require("../../../configs/gameConfigs/PathConfig");
var GameStateManager_1 = require("../GameStateManager");
var WXGamePlatform_1 = require("../../../platform/wxminigame/WXGamePlatform");
var NpcCFG_1 = require("../../../configs/dataConfigs/NpcCFG");
var YQSdk_1 = require("../../../platform/wxminigame/WXSDK/YQSdk");
var MainProxy = /** @class */ (function (_super) {
    __extends(MainProxy, _super);
    function MainProxy() {
        var _this = _super.call(this) || this;
        _this._loadjd = 0;
        _this._alljd = 0;
        return _this;
    }
    MainProxy.prototype.initProxy = function () {
    };
    MainProxy.prototype.enterMain = function () {
        this._loadjd = 0;
        this._alljd = 20;
        WXGamePlatform_1.default.getInstance().loadSubpackage("subpackage", this, this.sub1complete, this.loadprogress, null);
    };
    MainProxy.prototype.sub1complete = function () {
        this._loadjd = 20;
        this._alljd = 30;
        WXGamePlatform_1.default.getInstance().loadSubpackage("subpackage1", this, this.subcomplete, this.loadprogress, null);
    };
    MainProxy.prototype.subcomplete = function () {
        this._loadjd = 50;
        this._alljd = 40;
        var pathArr = [];
        var urlArr = [];
        urlArr.push(PathConfig_1.PathConfig.get3DModel("startPlane"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("endPlane"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("jiasulizi"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("tanse_bai"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("tanse_huang"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("win_xian"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("yanhua"));
        urlArr.push(PathConfig_1.PathConfig.get3DModel("DirectionalLight"));
        // urlArr.push( PathConfig.get3DModel( "distantview" ) );
        urlArr.push(PathConfig_1.PathConfig.get3DRoleModel(this.roleVO.roleCfg.name));
        var arr = this.roleVO.levelmapArr;
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            if (urlArr.indexOf(PathConfig_1.PathConfig.get3DModel(arr[i])) == -1) {
                urlArr.push(PathConfig_1.PathConfig.get3DModel(arr[i]));
            }
        }
        var npcArr = this.roleVO.levelcfg.npc;
        for (i = 0; i < npcArr.length; i++) {
            if (urlArr.indexOf(PathConfig_1.PathConfig.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name)) == -1) {
                urlArr.push(PathConfig_1.PathConfig.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name));
            }
        }
        for (i = 0; i < urlArr.length; i++) {
            pathArr.push({ url: urlArr[i] });
        }
        ResourceManager_1.default.getInstance().loader3DArr(pathArr, this, this.load3Dcomplete, this.loadprogress);
    };
    MainProxy.prototype.load3Dcomplete = function () {
        this._loadjd = 90;
        this._alljd = 10;
        ResourceManager_1.default.getInstance().loadGroup("main", this, this.loadcomplete, this.loadprogress, false);
    };
    MainProxy.prototype.loadprogress = function (value) {
        var loadingview = UiManager_1.UiManager.instance.getView(LoadingView_1.default);
        if (loadingview) {
            value = this._loadjd + Math.ceil(value / 100 * this._alljd);
            loadingview.showWord(value);
        }
    };
    MainProxy.prototype.loadcomplete = function () {
        fairygui.UIConfig.buttonSound = "ui://lecxynh2iz9y26";
        GameStateManager_1.default.getInstance().init();
        ResDataManager_1.default.getInastance().adduiPackage("main");
        UiManager_1.UiManager.instance.close(LoadingView_1.default);
        UiManager_1.UiManager.instance.add(MainView_1.default);
        Scene3DManager_1.default.getInstance().initGame();
        // SoundssManager.getInstance().playbgSound( "gamebg" );
        // CacheManager.getInstance().clearAll();
        YQSdk_1.YQSdk.pullAdPosition();
    };
    MainProxy.prototype.ceshi = function () {
    };
    MainProxy.key = "MainProxy";
    return MainProxy;
}(BaseProxys_1.default));
exports.default = MainProxy;
},{"../../../configs/dataConfigs/NpcCFG":8,"../../../configs/gameConfigs/PathConfig":10,"../../../frameworks/mvc/BaseProxys":19,"../../../managers/ResDataManager":62,"../../../managers/ResourceManager":63,"../../../managers/Scene3DManager":64,"../../../managers/UiManager":66,"../../../platform/wxminigame/WXGamePlatform":72,"../../../platform/wxminigame/WXSDK/YQSdk":77,"../../loading/view/LoadingView":35,"../GameStateManager":38,"../view/MainView":41}],41:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../../frameworks/mvc/BaseView");
var GameStateManager_1 = require("../GameStateManager");
var GameEvent_1 = require("../../userinfo/events/GameEvent");
var Scene3dObject_1 = require("../../scene3ds/Scene3dObject");
var UserInfoProxy_1 = require("../../userinfo/UserInfoProxy");
var UserInfoEvent_1 = require("../../userinfo/events/UserInfoEvent");
var SkinProxy_1 = require("../../skins/proxys/SkinProxy");
var GameProxy_1 = require("../proxys/GameProxy");
var UiManager_1 = require("../../../managers/UiManager");
var ChoutiPanView_1 = require("../../../platform/wxminigame/WXSDK/cpa/ChoutiPanView");
var TuijianView_1 = require("../../../platform/wxminigame/WXSDK/cpa/TuijianView");
var MainView = /** @class */ (function (_super) {
    __extends(MainView, _super);
    function MainView() {
        return _super.call(this, "main", "mainview") || this;
    }
    MainView.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
    };
    MainView.prototype.initView = function () {
        this._userinfoProxy = this.getProxy(UserInfoProxy_1.default);
        Scene3dObject_1.default.pro_jindu = this.pro_dis;
        Scene3dObject_1.default.txt_mingci = this.txt_mingci;
        this.c_state = this.getControllerByBame("c_state");
        GameStateManager_1.default.getInstance().setClickPanel(this.load_clickpanel);
        this.returnmainHandler();
        this.updateUserDataHandler();
    };
    MainView.prototype.initEvent = function () {
        this.addListener(this.load_start, Laya.Event.CLICK, this, this.btnclick);
        this.addListener(this.btn_skin, Laya.Event.CLICK, this, this.skinclick);
        this.addListener(this.btn_more, Laya.Event.CLICK, this, this.moreclick);
        this.addListener(this.btn_tuijian, Laya.Event.CLICK, this, this.tuijianclick);
        this.addDataEvent(GameEvent_1.default.returnMainView, this, this.returnmainHandler);
        this.addDataEvent(UserInfoEvent_1.default.UserInfoEvent_updateUserData, this, this.updateUserDataHandler);
    };
    MainView.prototype.tuijianclick = function () {
        UiManager_1.UiManager.instance.add(TuijianView_1.default);
    };
    MainView.prototype.skinclick = function () {
        this.getProxy(SkinProxy_1.default).openview();
    };
    MainView.prototype.moreclick = function () {
        UiManager_1.UiManager.instance.add(ChoutiPanView_1.default);
    };
    MainView.prototype.updateUserDataHandler = function () {
        this.txt_gold.text = this._userinfoProxy.roleVO.Gold.toString();
    };
    MainView.prototype.returnmainHandler = function () {
        var rolevo = this._userinfoProxy.roleVO;
        if (rolevo.nowlevel <= 2) {
            this.c_state.selectedIndex = 0;
        }
        else {
            this.c_state.selectedIndex = 1;
        }
    };
    MainView.prototype.btnclick = function () {
        this.c_state.selectedIndex = 2;
        this.txt_lv.text = this._userinfoProxy.roleVO.getNowServerLevel().toString();
        this.getProxy(GameProxy_1.default).startGame();
    };
    MainView.key = "MainView";
    return MainView;
}(BaseView_1.default));
exports.default = MainView;
},{"../../../frameworks/mvc/BaseView":20,"../../../managers/UiManager":66,"../../../platform/wxminigame/WXSDK/cpa/ChoutiPanView":79,"../../../platform/wxminigame/WXSDK/cpa/TuijianView":84,"../../scene3ds/Scene3dObject":48,"../../skins/proxys/SkinProxy":51,"../../userinfo/UserInfoProxy":53,"../../userinfo/events/GameEvent":54,"../../userinfo/events/UserInfoEvent":56,"../GameStateManager":38,"../proxys/GameProxy":39}],42:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Scene3dObject_1 = require("../scene3ds/Scene3dObject");
var GameUtils_1 = require("../../utils/GameUtils");
var GameCFG_1 = require("../../configs/dataConfigs/GameCFG");
var CamerasScript = /** @class */ (function (_super) {
    __extends(CamerasScript, _super);
    function CamerasScript() {
        var _this = _super.call(this) || this;
        _this.iscanfollow = false;
        _this._upvec = new Laya.Vector3(0, 1, 0);
        _this._index = 0;
        _this._slerpValue = 8;
        _this._lookatVec = new Laya.Vector3;
        return _this;
    }
    CamerasScript.prototype.onAwake = function () {
        //获取脚本所属对象
        this.camera = this.owner;
        this._toVec = new Laya.Vector3();
        this.camera.fieldOfView = 90;
    };
    CamerasScript.prototype.initPos = function (vec) {
        var valueArr = GameUtils_1.GameUtils.cutstrtoArr(GameCFG_1.default.dict[1].value);
        this._disVector = new Laya.Vector3(Number(valueArr[0]), Number(valueArr[1]), Number(valueArr[2]));
        Laya.Vector3.add(vec, this._disVector, this._toVec);
        this.camera.transform.position = this._toVec;
        this.camera.transform.position.x = vec.x;
        // this.camera.transform.lookAt( vec,new Laya.Vector3( 0,1,0 ) );
    };
    CamerasScript.prototype.onStart = function () {
        this._transform = this.camera.transform;
        //旋转摄像机角度
        this._transform.rotate(new Laya.Vector3(0, 0, 0), true, false);
        // this.camera.clearColor = null;
    };
    CamerasScript.prototype.onUpdate = function () {
        if (this.iscanfollow) {
            if (Scene3dObject_1.default.iscarmanpc) {
                if (Scene3dObject_1.default.npcDict["npc_0"]) {
                    Laya.Vector3.add(Scene3dObject_1.default.npcDict["npc_0"].transform.position, this._disVector, this._toVec);
                    this._transform.position = this._toVec;
                    this._transform.position.x = Scene3dObject_1.default.npcDict["npc_0"].transform.position.x;
                    this._transform.lookAt(Scene3dObject_1.default.npcDict["npc_0"].transform.position, this._upvec);
                }
            }
            else {
                if (Scene3dObject_1.default.mainRole) {
                    Laya.Vector3.add(Scene3dObject_1.default.mainRole.transform.position, this._disVector, this._toVec);
                    // this._toVec.x = Scene3dObject.mainRole.transform.position.x;
                    // this._transform.position = this._toVec;
                    // this._transform.lookAt( Scene3dObject.mainRole.transform.position,this._upvec );
                    Laya.Vector3.lerp(this._transform.position, this._toVec, 16 / 1000 * this._slerpValue, this._toVec);
                    // this._toVec.z = Scene3dObject.mainRole.transform.position.z+this._disVector.z;
                    // this._toVec.y = Scene3dObject.mainRole.transform.position.y + this._disVector.y;
                    this._transform.position = this._toVec;
                    this._lookatVec.x = this._toVec.x;
                    this._lookatVec.y = Scene3dObject_1.default.mainRole.transform.position.y;
                    this._lookatVec.z = Scene3dObject_1.default.mainRole.transform.position.z;
                    this._transform.lookAt(this._lookatVec, this._upvec);
                }
            }
        }
    };
    CamerasScript.prototype.MyRotateAround = function (targetPos, speed) {
        this.iscanfollow = false;
        this._transform.translate(speed, false);
        this._transform.lookAt(targetPos, this._upvec);
    };
    return CamerasScript;
}(Laya.Script3D));
exports.default = CamerasScript;
},{"../../configs/dataConfigs/GameCFG":6,"../../utils/GameUtils":87,"../scene3ds/Scene3dObject":48}],43:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Debuger_1 = require("../../frameworks/Debuger");
var TimerService_1 = require("../../frameworks/TimerService");
var Scene3dObject_1 = require("../scene3ds/Scene3dObject");
var RoleActions_1 = require("../scene3ds/RoleActions");
var MVCObjectPool_1 = require("../../frameworks/mvc/MVCObjectPool");
var UserInfoProxy_1 = require("../userinfo/UserInfoProxy");
var BuildCFG_1 = require("../../configs/dataConfigs/BuildCFG");
var CamerasScript_1 = require("./CamerasScript");
var EventUtils_1 = require("../../frameworks/events/EventUtils");
var GameEvent_1 = require("../userinfo/events/GameEvent");
var GameUtils_1 = require("../../utils/GameUtils");
var GameStateManager_1 = require("../main/GameStateManager");
var SoundssManager_1 = require("../../managers/SoundssManager");
var WXGamePlatform_1 = require("../../platform/wxminigame/WXGamePlatform");
var MainRAoleScript = /** @class */ (function (_super) {
    __extends(MainRAoleScript, _super);
    function MainRAoleScript() {
        var _this = _super.call(this) || this;
        /**
         * RoleAction
         */
        _this._nowState = "";
        _this.resouseName = "";
        _this._isColling = false;
        _this._nowCollTargetName = "";
        _this._normalizeVec = new Laya.Vector3;
        _this._nowbuildname = "";
        _this._nowscenename = "";
        /**
         * 0:未锁，1：锁左边，2：锁右边
         */
        _this._lockxstate = 0;
        _this._lockbyBuildname = "";
        /**
         * 0:未被锁，1：锁定左边，2：锁定右边，
         */
        _this._lockstate = 0;
        _this._shangpaVec = new Laya.Vector3;
        _this._lastState = "";
        _this._moveTime = 0;
        _this._isActionNums = false;
        _this._isneedactionnum = 0;
        _this._needactiontime = 0;
        /**
         * 加速buffvec
         */
        _this._lastjiasuState = "";
        _this._jiasubuffTime = 0;
        _this.iscanzhendong = false;
        _this.zhendongtime = 0;
        _this._isShuangbeijiasu = false;
        _this._beishuVec = new Laya.Vector3(1, 1, 1);
        _this._moveVec = new Laya.Vector3;
        _this.isPengzhuang = false;
        _this.jumpSpeed = new Laya.Vector3;
        _this.jumpHight = 0;
        _this._disy = 0;
        _this.g = 10; //重力加速度
        _this._ending = false;
        _this._endAnmoSpeed = new Laya.Vector3();
        _this._endanmotime = 1;
        _this._endAnmoSpeed1 = new Laya.Vector3;
        _this._changeMoveX = 0;
        _this.isforceJump = false;
        _this.quaternion = new Laya.Quaternion;
        return _this;
    }
    MainRAoleScript.prototype.onAwake = function () {
        this._animator = this.owner.getComponent(Laya.Animator);
        Scene3dObject_1.default.setAnimator(this._animator);
        this._speedMoveV3 = new Laya.Vector3(0, 0, 0);
        var sp = this.owner;
        this._transform = sp.transform;
        this._roleVO = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default).roleVO;
        sp.getComponent(Laya.Rigidbody3D).ccdMotionThreshold = 0.001;
        this._lefttrail = sp.getChildByName("lefttrail");
        this._righttrail = sp.getChildByName("righttrail");
    };
    MainRAoleScript.prototype.onEnable = function () {
    };
    MainRAoleScript.prototype.onStart = function () {
    };
    MainRAoleScript.prototype.startRun = function () {
        // this.pzdict = {};
        // this.pzarr = [];
        this._beishuVec.x = 1;
        this._beishuVec.y = 1;
        this._beishuVec.z = 1;
        this._jiasubuffTime = 0;
        this._isShuangbeijiasu = false;
        this._lastjiasuState = "";
        this._ending = false;
        this._changeMoveX = 0;
        this._initPosVec = this._transform.position.clone();
        this._nowbuildname = "";
        this._nowscenename = "";
        this.nowState = RoleActions_1.default.run;
        this._speedMoveV3.x = 0;
        this._speedMoveV3.y = 0;
        this._speedMoveV3.z = -this._roleVO.movespeed;
        Debuger_1.default.log("开始跑");
        this._iscanMove = true;
        TimerService_1.default.instance.addUpdateTarget(this);
    };
    // private pzdict:any = {};
    // private pzarr:Array<any> = [];
    /**
     * 开始碰撞时执行
     */
    MainRAoleScript.prototype.onCollisionEnter = function (collision) {
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.jisuanCollision(contactPoint.normal, collision.other.owner, contactPoint.positionOnB);
        }
    };
    MainRAoleScript.prototype.setnowSelectVec = function (pos) {
        this._nowselectVec = pos;
    };
    MainRAoleScript.prototype.jisuanCollision = function (normal, target, collpoint) {
        if (target.name == "SliderBoost" || target.name.indexOf("npc") != -1) {
            return;
        }
        this._nowCollTargetName = target.name;
        var n = new Laya.Vector3;
        Laya.Vector3.normalize(normal, this._normalizeVec);
        Debuger_1.default.log("开始碰撞", this._normalizeVec, target.name);
        if (this._nowCollTargetName.indexOf("build") != -1 || this._nowCollTargetName.indexOf("Scaffolding") != -1 ||
            this._nowCollTargetName.indexOf("irongauze") != -1) //碰到建筑，判断是上爬，左爬还是右爬
         {
            if (this._nowCollTargetName.indexOf("build") != -1) {
                this._nowbuildname = this._nowCollTargetName;
                this._nowscenename = target.parent.parent.name;
            }
            if (this._nowCollTargetName.indexOf("irongauze") != -1) {
                this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
            }
            else {
                this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.name, this._nowCollTargetName);
            }
            if (this._normalizeVec.z == -1) //上爬
             {
                if (this._nowselectVec && this._transform.position.y > (this._nowselectVec.y - 0.2)) {
                    this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                    this.nowState = RoleActions_1.default.run;
                }
                else {
                    this.nowState = RoleActions_1.default.Climb;
                    this._shangpaVec = this._nowselectVec.clone();
                    // this.pzdict[this._nowCollTargetName] = RoleActions.Climb;
                    // this.pzarr.push( this._nowCollTargetName );
                }
            }
            else if (this._normalizeVec.y == 1 || this._normalizeVec.y == -1) {
                this.nowState = RoleActions_1.default.run;
            }
            else if (this._normalizeVec.x == -1) {
                if (this.nowState == RoleActions_1.default.run) {
                    this._lockxstate = 1;
                }
                else if (this.nowState == RoleActions_1.default.Climb) {
                    this._lockxstate = 1;
                }
                else {
                    this.nowState = RoleActions_1.default.left_climb;
                }
            }
            else if (this._normalizeVec.x == 1) {
                if (this.nowState == RoleActions_1.default.run) {
                    this._lockxstate = 2;
                }
                else if (this.nowState == RoleActions_1.default.Climb) {
                    this._lockxstate = 2;
                }
                else {
                    this.nowState = RoleActions_1.default.right_climb;
                }
            }
            else {
                if (this._normalizeVec.z != 1) {
                    this.nowState = RoleActions_1.default.lockclimb;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
        }
        else if (this._nowCollTargetName.indexOf("panel_jump") != -1) //加速板跳跃
         {
            this.nowState = RoleActions_1.default.jiasuJump;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("panel_downslip") != -1) {
            this.nowState = RoleActions_1.default.downSlide;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("box_Board") != -1 && this.nowState != RoleActions_1.default.downSlide) {
            if (this._normalizeVec.z == -1) //上爬
             {
                this.nowState = RoleActions_1.default.Climb;
                this._shangpaVec = this._nowselectVec.clone();
            }
        }
        else if (this._nowCollTargetName.indexOf("box_sidejump") != -1) {
            this.nowState = RoleActions_1.default.slidejiasu;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("box_Surmount") != -1) {
            this.nowState = RoleActions_1.default.surmount;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("irongauze") != -1) {
            this.nowState = RoleActions_1.default.Climb;
            this._shangpaVec = this._nowselectVec.clone();
        }
    };
    /**
     * 持续碰撞时执行
     */
    MainRAoleScript.prototype.onCollisionStay = function (collision) {
        // Debuger.log( "碰撞中" );
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            this._isColling = true;
            var contactPoint = collision.contacts[0];
            var target = collision.other.owner;
            var targetname = target.name;
            if (targetname != "SliderBoost" && targetname.indexOf("npc") == -1) {
                this._nowCollTargetName = targetname;
            }
            if (this._nowCollTargetName.indexOf("build") != -1 || this._nowCollTargetName.indexOf("Scaffolding") != -1 ||
                this._nowCollTargetName.indexOf("irongauze") != -1) //碰到建筑，判断是上爬，左爬还是右爬
             {
                if (this._nowCollTargetName.indexOf("build") != -1) {
                    this._nowbuildname = this._nowCollTargetName;
                    this._nowscenename = target.parent.parent.name;
                }
                if (this._nowCollTargetName.indexOf("irongauze") != -1) {
                    this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
                }
                else {
                    this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.name, this._nowCollTargetName);
                }
            }
        }
    };
    /**
     * 结束碰撞时执行
     */
    MainRAoleScript.prototype.onCollisionExit = function (collision) {
        this._isColling = false;
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.checkendColl(contactPoint.normal, collision.other.owner);
        }
    };
    MainRAoleScript.prototype.checkendColl = function (normal, target) {
        Debuger_1.default.log("结束碰撞", target.name);
        if (target.name == "SliderBoost" || target.name.indexOf("npc") != -1) {
            return;
        }
        if (this.isforceJump) {
            this.isforceJump = false;
            return;
        }
        if (this._lockxstate) {
            this._lockxstate = 0;
            return;
        }
        if (this._nowCollTargetName != target.name) {
            return;
        }
        if (target.name.indexOf("panel_jump") != -1) {
            return;
        }
        Debuger_1.default.log("计算碰撞完成状态");
        switch (this.nowState) {
            case RoleActions_1.default.Climb:
            case RoleActions_1.default.lockclimb:
                if (this._nowCollTargetName.indexOf("box_Board") != -1) {
                    this.setJumpState(this._changeMoveX);
                }
                else {
                    // var istoTop:boolean = Scene3dObject.checkisClimbTop( target.parent.parent.name,target.name,this._transform.position );
                    // if( istoTop )
                    // {
                    //     Debuger.log( "播放爬楼完成动作" );
                    //     this.nowState = RoleActions.playPalouAction;
                    //     this.playAnmo("");
                    // }
                    // else
                    // {
                    //     if( this._changeMoveX > 0 )
                    //     {
                    //         this.nowState = RoleActions.right_jump;
                    //         // this.setJump( this.nowState );
                    //     }
                    //     else if( this._changeMoveX < 0 )
                    //     {
                    //         this.nowState = RoleActions.left_jump;
                    //         // this.setJump( this.nowState );
                    //     }
                    // }
                    if (this._changeMoveX > 0) {
                        this.nowState = RoleActions_1.default.right_jump;
                        // this.setJump( this.nowState );
                    }
                    else if (this._changeMoveX < 0) {
                        this.nowState = RoleActions_1.default.left_jump;
                        // this.setJump( this.nowState );
                    }
                }
                break;
            case RoleActions_1.default.right_climb:
            case RoleActions_1.default.left_climb:
                this.setJumpState(this._changeMoveX);
                break;
            case RoleActions_1.default.run:
                this.setJumpState(this._changeMoveX);
                break;
            case RoleActions_1.default.xshunyi:
                this.setJumpState(this._speedMoveV3.x);
                break;
        }
    };
    MainRAoleScript.prototype.setJumpState = function (value) {
        if (value > 0) {
            this.nowState = RoleActions_1.default.right_jump;
            // this.setJump( this.nowState );
        }
        else if (value < 0) {
            this.nowState = RoleActions_1.default.left_jump;
            // this.setJump( this.nowState );
        }
        else {
            this.nowState = RoleActions_1.default.jump;
            // this.setJump( this.nowState );
        }
    };
    MainRAoleScript.prototype.playAnmo = function (actinName) {
        this._isActionNums = true;
        this._isneedactionnum = 1;
        this.setAction(RoleActions_1.default.climbend);
    };
    MainRAoleScript.prototype.actionCompelte = function () {
        this.nowState = RoleActions_1.default.run;
    };
    Object.defineProperty(MainRAoleScript.prototype, "nowState", {
        get: function () {
            return this._nowState;
        },
        set: function (value) {
            if (this._nowState != value || this._lastState == RoleActions_1.default.jiasuJump || this._nowState == RoleActions_1.default.jiasuJump) {
                this._lastState = this._nowState;
                this._nowState = value;
                this._moveTime = 0;
                this.iscanzhendong = false;
                this.changtrailState(true);
                switch (this._nowState) {
                    case RoleActions_1.default.stand:
                        this._isActionNums = false;
                        this.setAction(RoleActions_1.default.stand);
                        break;
                    case RoleActions_1.default.run:
                        if (this._lastState == RoleActions_1.default.jump || this._lastState == RoleActions_1.default.left_jump || this._lastState == RoleActions_1.default.right_jump) {
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                            if (sort < 50) {
                                this.setAction(RoleActions_1.default.luodi1);
                            }
                            else {
                                this.setAction(RoleActions_1.default.luodi2);
                            }
                        }
                        else {
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.run);
                        }
                        break;
                    case RoleActions_1.default.jump:
                        this.setAction(RoleActions_1.default.jump);
                        Scene3dObject_1.default.getInstance().setliziPlaytanse("tanse_bai", this._transform.position);
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.jumpSpeed.x = this._roleVO.frontjump.x;
                        this.jumpSpeed.y = this._roleVO.frontjump.y;
                        this.jumpSpeed.z = this._roleVO.frontjump.z;
                        SoundssManager_1.default.getInstance().playGameSound("jump");
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        break;
                    case RoleActions_1.default.left_jump:
                        Scene3dObject_1.default.getInstance().setliziPlaytanse("tanse_bai", this._transform.position);
                        this.jumpSpeed.x = this._roleVO.leftjump.x;
                        this.jumpSpeed.y = this._roleVO.leftjump.y;
                        this.jumpSpeed.z = this._roleVO.leftjump.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.setAction(RoleActions_1.default.leftjump);
                        SoundssManager_1.default.getInstance().playGameSound("jump");
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        break;
                    case RoleActions_1.default.right_jump:
                        Scene3dObject_1.default.getInstance().setliziPlaytanse("tanse_bai", this._transform.position);
                        this.jumpSpeed.x = this._roleVO.rightjump.x;
                        this.jumpSpeed.y = this._roleVO.rightjump.y;
                        this.jumpSpeed.z = this._roleVO.rightjump.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.setAction(RoleActions_1.default.rightjump);
                        SoundssManager_1.default.getInstance().playGameSound("jump");
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        break;
                    case RoleActions_1.default.jiasuJump:
                        var buildcfg = BuildCFG_1.default.dict["panel_jump"];
                        if (this._jiasubuffTime > 0) {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz * buildcfg.buffz;
                            this._isShuangbeijiasu = true;
                        }
                        else {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz;
                        }
                        this._jiasubuffTime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._beishuVec.x;
                        this.jumpSpeed.y = buildcfg.buffy;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._beishuVec.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                        if (sort < 50) {
                            this.setAction(RoleActions_1.default.datiao1);
                        }
                        else {
                            this.setAction(RoleActions_1.default.datiao2);
                        }
                        SoundssManager_1.default.getInstance().playGameSound("jump");
                        Laya.timer.clear(this, this.playspeedSound);
                        Laya.timer.once(200, this, this.playspeedSound);
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        break;
                    case RoleActions_1.default.downSlide:
                        var buildcfg = BuildCFG_1.default.dict["panel_downslip"];
                        if (this._jiasubuffTime > 0) {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz * buildcfg.buffz;
                            this._isShuangbeijiasu = true;
                        }
                        else {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz;
                        }
                        this._jiasubuffTime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._beishuVec.x;
                        this.jumpSpeed.y = buildcfg.buffy * this._beishuVec.y;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._beishuVec.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.setAction(RoleActions_1.default.huachan);
                        this.playspeedSound();
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        break;
                    case RoleActions_1.default.slidejiasu:
                        var buildcfg = BuildCFG_1.default.dict["box_sidejump"];
                        if (this._jiasubuffTime > 0) {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz * buildcfg.buffz;
                            this._isShuangbeijiasu = true;
                        }
                        else {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz;
                        }
                        this._jiasubuffTime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._beishuVec.x;
                        this.jumpSpeed.y = buildcfg.buffy * this._beishuVec.y;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._beishuVec.z;
                        this._isActionNums = false;
                        this.playspeedSound();
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        // this.setAction( RoleActions. );
                        break;
                    case RoleActions_1.default.surmount:
                        var buildcfg = BuildCFG_1.default.dict["box_Surmount"];
                        if (this._jiasubuffTime > 0) {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz * buildcfg.buffz;
                            this._isShuangbeijiasu = true;
                        }
                        else {
                            this._beishuVec.x = 1;
                            this._beishuVec.y = 1;
                            this._beishuVec.z = buildcfg.buffz;
                        }
                        this._jiasubuffTime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._beishuVec.x;
                        this.jumpSpeed.y = (buildcfg.buffy + 0.5) * this._beishuVec.y;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._beishuVec.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.setAction(RoleActions_1.default.kualan);
                        break;
                    case RoleActions_1.default.Climb:
                    case RoleActions_1.default.lockclimb:
                        this.jumpSpeed.x = 0;
                        this.jumpSpeed.y = this._roleVO.upclimb;
                        this.jumpSpeed.z = 0;
                        this._isActionNums = false;
                        this.setAction(RoleActions_1.default.paqiang);
                        WXGamePlatform_1.default.getInstance().vibrateShort();
                        this.iscanzhendong = true;
                        this.zhendongtime = 0;
                        this.changtrailState(false);
                        break;
                    case RoleActions_1.default.left_climb:
                        this.jumpSpeed.x = 0;
                        this.jumpSpeed.y = this._roleVO.slideclimb.y;
                        this.jumpSpeed.z = this._roleVO.slideclimb.z;
                        this._isActionNums = false;
                        this.setAction(RoleActions_1.default.paoqiangleft);
                        this.changtrailState(false);
                        break;
                    case RoleActions_1.default.right_climb:
                        this.jumpSpeed.x = 0;
                        this.jumpSpeed.y = this._roleVO.slideclimb.y;
                        this.jumpSpeed.z = this._roleVO.slideclimb.z;
                        this._isActionNums = false;
                        this.setAction(RoleActions_1.default.paoqiangright);
                        this.changtrailState(false);
                        break;
                    case RoleActions_1.default.playPalouAction:
                        this._isActionNums = true;
                        this._isneedactionnum = 0;
                        this._needactiontime = 0.3;
                        this._moveTime = 0;
                        this.setAction(RoleActions_1.default.climbend);
                        break;
                }
            }
        },
        enumerable: true,
        configurable: true
    });
    MainRAoleScript.prototype.playspeedSound = function () {
        SoundssManager_1.default.getInstance().playGameSound("speed");
    };
    MainRAoleScript.prototype.changtrailState = function (bo) {
        if (this._lefttrail && this._righttrail && this._lefttrail.active != bo) {
            this._lefttrail.active = bo;
            this._righttrail.active = bo;
        }
    };
    MainRAoleScript.prototype.update = function (dt) {
        dt = 16;
        if (this._iscanMove) {
            var distime = dt / 1000;
            this._moveTime += distime;
            switch (this.nowState) {
                case RoleActions_1.default.run: //跑动
                    this._moveVec.y = 0;
                    this._moveVec.z = distime * (this._speedMoveV3.z * this._beishuVec.z);
                    if (this._lockxstate == 0) {
                        this._moveVec.x = this._changeMoveX * distime;
                    }
                    else if (this._lockxstate == 1) {
                        if (this._changeMoveX < 0) {
                            this._moveVec.x = 0;
                        }
                        else {
                            this._moveVec.x = this._changeMoveX * distime;
                        }
                    }
                    else if (this._lockxstate == 2) {
                        if (this._changeMoveX > 0) {
                            this._moveVec.x = 0;
                        }
                        else {
                            this._moveVec.x = this._changeMoveX * distime;
                        }
                    }
                    this._transform.translate(this._moveVec, false);
                    break;
                case RoleActions_1.default.Climb: //爬升
                    this._moveVec.z = 0;
                    this._moveVec.y = distime * this.jumpSpeed.y;
                    if (this._lockxstate == 1) {
                        if (this._changeMoveX < 0) {
                            this._moveVec.x = 0;
                        }
                        else {
                            this._moveVec.x = this._changeMoveX * distime;
                        }
                    }
                    else if (this._lockstate == 2) {
                        if (this._changeMoveX > 0) {
                            this._moveVec.x = 0;
                        }
                        else {
                            this._moveVec.x = this._changeMoveX * distime;
                        }
                    }
                    else {
                        this._moveVec.x = this._changeMoveX * distime;
                    }
                    this._transform.translate(this._moveVec, false);
                    if (this._shangpaVec) {
                        if (this._transform.position.y + 1 > this._shangpaVec.y) {
                            this.nowState = RoleActions_1.default.playPalouAction;
                        }
                    }
                    else if (this._nowselectVec) {
                        if (this._transform.position.y + 1 > this._nowselectVec.y) {
                            this.nowState = RoleActions_1.default.playPalouAction;
                        }
                    }
                    break;
                case RoleActions_1.default.lockclimb:
                    this._moveVec.z = 0;
                    this._moveVec.y = distime * this.jumpSpeed.y;
                    this._moveVec.x = 0;
                    this._transform.translate(this._moveVec, false);
                    if (this._shangpaVec) {
                        if (this._transform.position.y + 1 > this._shangpaVec.y) {
                            this.nowState = RoleActions_1.default.playPalouAction;
                        }
                    }
                    else if (this._transform.position.y + 1 > this._nowselectVec.y) {
                        this.nowState = RoleActions_1.default.playPalouAction;
                        Debuger_1.default.log("爬墙动作结束播放");
                    }
                    break;
                case RoleActions_1.default.jump: //跳跃
                case RoleActions_1.default.left_jump:
                case RoleActions_1.default.right_jump:
                    this._disy = this.jumpSpeed.y - this.g * distime;
                    this.jumpSpeed.y = this._disy;
                    this._moveVec.x = this.jumpSpeed.x * distime;
                    this._moveVec.y = this._disy * distime;
                    this._moveVec.z = this.jumpSpeed.z * distime;
                    this._transform.translate(this._moveVec, false);
                    break;
                case RoleActions_1.default.jiasuJump:
                    this._disy = this.jumpSpeed.y - this.g * distime;
                    this.jumpSpeed.y = this._disy;
                    this._moveVec.x = this.jumpSpeed.x * distime;
                    this._moveVec.y = this._disy * distime;
                    this._moveVec.z = this.jumpSpeed.z * distime;
                    this._transform.translate(this._moveVec, false);
                    break;
                case RoleActions_1.default.left_climb:
                case RoleActions_1.default.right_climb:
                    this._moveVec.z = distime * this.jumpSpeed.y;
                    this._moveVec.y = this.jumpSpeed.y * distime;
                    this._moveVec.x = 0;
                    this._transform.translate(this._moveVec, false);
                    break;
                case RoleActions_1.default.xshunyi:
                    this._moveVec.z = distime * this._speedMoveV3.z;
                    this._moveVec.x = this._speedMoveV3.x * distime;
                    this._transform.translate(this._moveVec, false);
                    if (this._moveTime > 0.1) {
                        this.nowState = RoleActions_1.default.run;
                    }
                    break;
                case RoleActions_1.default.downSlide:
                    this._moveVec.y = this.jumpSpeed.x;
                    this._moveVec.x = this.jumpSpeed.y;
                    this._moveVec.z = this.jumpSpeed.z * distime;
                    this._transform.translate(this._moveVec, false);
                    break;
                case RoleActions_1.default.slidejiasu:
                    this._moveVec.y = 0;
                    this._moveVec.x = 0;
                    this._moveVec.z = this.jumpSpeed.z * distime;
                    this._transform.translate(this._moveVec, false);
                    if (this._jiasubuffTime <= 0 && this._lastState == RoleActions_1.default.left_climb || this._lastState == RoleActions_1.default.right_climb) {
                        this.nowState = this._lastState;
                    }
                    else {
                        this.nowState = RoleActions_1.default.jump;
                        // this.setJump( this.nowState );
                    }
                    break;
                case RoleActions_1.default.surmount:
                    this._disy = this.jumpSpeed.y - this.g * distime;
                    this.jumpSpeed.y = this._disy;
                    this._moveVec.x = this.jumpSpeed.x * distime;
                    this._moveVec.y = this._disy * distime;
                    this._moveVec.z = this.jumpSpeed.z * distime;
                    this._transform.translate(this._moveVec, false);
                    break;
                case RoleActions_1.default.playPalouAction:
                    if (this._nowselectVec) {
                        if (this._transform.position.y < this._nowselectVec.y) {
                            this._moveVec.x = 0;
                            this._moveVec.y = (1 / 0.3) * distime;
                            this._moveVec.z = 0;
                            this._transform.translate(this._moveVec, false);
                        }
                    }
                    break;
            }
            if (this._nowselectVec && (this.nowState == RoleActions_1.default.run || this.nowState == RoleActions_1.default.downSlide) && !this._isColling) {
                if (this._transform.position.z <= this._nowselectVec.z) {
                    if (this._changeMoveX > 0) {
                        this.nowState = RoleActions_1.default.right_jump;
                    }
                    else if (this._changeMoveX < 0) {
                        this.nowState = RoleActions_1.default.left_jump;
                    }
                    else {
                        this.nowState = RoleActions_1.default.jump;
                    }
                }
            }
            if (this._transform.position.y < Scene3dObject_1.default.diePosY) //角色死亡
             {
                if (this._nowscenename == "" || this._nowbuildname == "") {
                    this._transform.position = this._initPosVec.clone();
                }
                else {
                    this._transform.position = Scene3dObject_1.default.getPosVecbyScene(this._nowscenename, this._nowbuildname).clone();
                }
                this.nowState = RoleActions_1.default.run;
            }
            if (this._transform.position.z < Scene3dObject_1.default.gamewinPosZ) {
                this.wingame();
            }
            else {
                Scene3dObject_1.default.pro_jindu.value = this._transform.position.z / Scene3dObject_1.default.gamewinPosZ * 100;
            }
            if (this._isActionNums) {
                if (this._isneedactionnum > 0) {
                    if (this._animator.getCurrentAnimatorPlayState().normalizedTime >= this._isneedactionnum) {
                        switch (this._nowActionName) {
                            case RoleActions_1.default.jump:
                            case RoleActions_1.default.leftjump:
                            case RoleActions_1.default.rightjump:
                            case RoleActions_1.default.datiao1:
                            case RoleActions_1.default.datiao2:
                            case RoleActions_1.default.kualan:
                                this._isActionNums = false;
                                this.setAction(RoleActions_1.default.kongzhong);
                                break;
                            case RoleActions_1.default.huachan:
                            case RoleActions_1.default.climbend:
                                this._isActionNums = false;
                                this.setAction(RoleActions_1.default.run);
                                this.nowState = RoleActions_1.default.run;
                                this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                                break;
                            case RoleActions_1.default.luodi1:
                            case RoleActions_1.default.luodi2:
                                this._isActionNums = false;
                                this.setAction(RoleActions_1.default.run);
                                break;
                            case RoleActions_1.default.huachan:
                                this.nowState = RoleActions_1.default.run;
                                break;
                        }
                    }
                }
                else if (this._needactiontime != 0 && this._moveTime > this._needactiontime) {
                    switch (this._nowActionName) {
                        case RoleActions_1.default.jump:
                        case RoleActions_1.default.leftjump:
                        case RoleActions_1.default.rightjump:
                        case RoleActions_1.default.datiao1:
                        case RoleActions_1.default.datiao2:
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.kongzhong);
                            this._changeMoveX = 0;
                            break;
                        case RoleActions_1.default.kualan:
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.kongzhong);
                            break;
                        case RoleActions_1.default.huachan:
                        case RoleActions_1.default.climbend:
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.run);
                            this.nowState = RoleActions_1.default.run;
                            this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                            break;
                    }
                }
            }
            if (this._jiasubuffTime > 0) {
                this._jiasubuffTime -= distime;
                Scene3dObject_1.default.getInstance().jiadulizi("jiasulizi", this._transform.position);
                if (this._isShuangbeijiasu) {
                    Scene3dObject_1.default.getInstance().jiadulizi1("jiasulizi", this._transform.position);
                }
            }
            else {
                this._beishuVec.x = 1;
                this._beishuVec.y = 1;
                this._beishuVec.z = 1;
                this._isShuangbeijiasu = false;
                Scene3dObject_1.default.getInstance().closeJiasulizi();
                Scene3dObject_1.default.getInstance().closeJiasulizi1();
            }
            if (this.iscanzhendong) {
                this.zhendongtime += distime;
                if (this.zhendongtime >= 0.5) {
                    this.zhendongtime = 0;
                    WXGamePlatform_1.default.getInstance().vibrateShort();
                }
            }
        }
        else {
            if (this._ending) {
                var distime = dt / 1000;
                this._moveTime += distime;
                if (this._moveTime >= this._endanmotime) {
                    this.endGame();
                }
                else {
                    this._endAnmoSpeed1.x = this._endAnmoSpeed.x * distime;
                    this._endAnmoSpeed1.y = this._endAnmoSpeed.y * distime;
                    this._endAnmoSpeed1.z = this._endAnmoSpeed.z * distime;
                    Scene3dObject_1.default.carma.getComponent(CamerasScript_1.default).MyRotateAround(this._transform.position, this._endAnmoSpeed1);
                }
            }
        }
    };
    MainRAoleScript.prototype.endGame = function () {
        this._ending = false;
        TimerService_1.default.instance.removeUpdateTarget(this);
    };
    MainRAoleScript.prototype.wingame = function () {
        SoundssManager_1.default.getInstance().playGameSound("complete");
        EventUtils_1.EventUtils.dispatchEvent(GameEvent_1.default.endGame);
        var carmaTrans = Scene3dObject_1.default.carma.transform;
        this._endAnmoSpeed.z = (this._transform.position.z - 2 - carmaTrans.position.z) / this._endanmotime;
        this._endAnmoSpeed.y = (this._transform.position.y - carmaTrans.position.y) / this._endanmotime;
        this._endAnmoSpeed.x = (this._transform.position.x + 3 - carmaTrans.position.x) / this._endanmotime;
        this._moveTime = 0;
        this._iscanMove = false;
        this._ending = true;
        this.setAction(RoleActions_1.default.kongzhong);
        Scene3dObject_1.default.getInstance().liziendgame("yanhua", this._transform.position, GameStateManager_1.default.getInstance().endGamePlayerArr.length == 0 ? true : false);
    };
    MainRAoleScript.prototype.joyStickCHange = function (value, value1, angle) {
        if (this.nowState == RoleActions_1.default.run) {
            this._changeMoveX = value;
        }
        else if (this.nowState == RoleActions_1.default.Climb || RoleActions_1.default.left_climb || RoleActions_1.default.right_climb) {
            this._changeMoveX = value1;
        }
        if (this.nowState == RoleActions_1.default.left_climb && this._changeMoveX > 0) //强制跳跃
         {
            this.isforceJump = true;
            this.nowState = RoleActions_1.default.right_jump;
        }
        else if (this.nowState == RoleActions_1.default.right_climb && this._changeMoveX < 0) {
            this.isforceJump = true;
            this.nowState = RoleActions_1.default.left_jump;
        }
        if (this.nowState == RoleActions_1.default.jump ||
            this.nowState == RoleActions_1.default.left_jump ||
            this.nowState == RoleActions_1.default.right_jump ||
            this.nowState == RoleActions_1.default.jiasuJump) {
            angle = -angle * Math.PI / 180;
            Laya.Quaternion.createFromAxisAngle(new Laya.Vector3(0, 1, 0), angle, this.quaternion);
            var jumpz = this.jumpSpeed.z;
            Laya.Vector3.transformQuat(this.jumpSpeed, this.quaternion, this.jumpSpeed);
            this.jumpSpeed.z = jumpz;
        }
    };
    MainRAoleScript.prototype.xshunyi = function (state) {
        if (this.nowState == RoleActions_1.default.run) {
            this._moveTime = 0;
            this._speedMoveV3.x = state * 20;
            this.nowState = RoleActions_1.default.xshunyi;
        }
    };
    MainRAoleScript.prototype.setAction = function (actionName) {
        this._nowActionName = actionName;
        if (this._animator) {
            if (this._nowActionName == RoleActions_1.default.climbend || this._nowActionName == RoleActions_1.default.luodi1 || this._nowActionName == RoleActions_1.default.luodi2) {
                this._animator.speed = 1.5;
            }
            else {
                this._animator.speed = 1;
            }
            this._animator.play(actionName, 0, 0);
        }
        // if( actionName == RoleActions.stand )
        // {
        //     this._animator.play(actionName);
        // }
        // else
        // {
        //     // this._animator.crossFade(actionName, 0.02, 0);
        //     this._animator.play(actionName);
        // }
    };
    MainRAoleScript.prototype.ceshitiaoyue = function () {
        this.nowState = RoleActions_1.default.jump;
    };
    MainRAoleScript.prototype.onUpdate = function () {
    };
    MainRAoleScript.prototype.onLateUpdate = function () {
    };
    MainRAoleScript.prototype.dispose = function () {
        TimerService_1.default.instance.removeUpdateTarget(this);
    };
    MainRAoleScript.prototype.destroy = function () {
        TimerService_1.default.instance.removeUpdateTarget(this);
        _super.prototype.destroy.call(this);
    };
    return MainRAoleScript;
}(Laya.Script3D));
exports.default = MainRAoleScript;
},{"../../configs/dataConfigs/BuildCFG":5,"../../frameworks/Debuger":12,"../../frameworks/TimerService":13,"../../frameworks/events/EventUtils":16,"../../frameworks/mvc/MVCObjectPool":22,"../../managers/SoundssManager":65,"../../platform/wxminigame/WXGamePlatform":72,"../../utils/GameUtils":87,"../main/GameStateManager":38,"../scene3ds/RoleActions":46,"../scene3ds/Scene3dObject":48,"../userinfo/UserInfoProxy":53,"../userinfo/events/GameEvent":54,"./CamerasScript":42}],44:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TimerService_1 = require("../../frameworks/TimerService");
var Scene3dObject_1 = require("../scene3ds/Scene3dObject");
var RoleActions_1 = require("../scene3ds/RoleActions");
var BuildCFG_1 = require("../../configs/dataConfigs/BuildCFG");
var CamerasScript_1 = require("./CamerasScript");
var EventUtils_1 = require("../../frameworks/events/EventUtils");
var GameEvent_1 = require("../userinfo/events/GameEvent");
var GameUtils_1 = require("../../utils/GameUtils");
var NpcScript = /** @class */ (function (_super) {
    __extends(NpcScript, _super);
    function NpcScript() {
        var _this = _super.call(this) || this;
        /**
         * RoleAction
         */
        _this._nowState = "";
        _this.resouseName = "";
        _this._shangpaVec = new Laya.Vector3;
        /**
         * 状态，0：等待状态，1：开始状态，2：完成状态
         */
        _this._nowRoleState = 0;
        _this.movespeed = 0;
        _this.frontjump = new Laya.Vector3;
        _this.leftjump = new Laya.Vector3;
        _this.rightjump = new Laya.Vector3;
        _this.upclimb = 0;
        _this.slideclimb = new Laya.Vector3;
        _this._isColling = false;
        _this._nowCollTargetName = "";
        _this._normalizeVec = new Laya.Vector3;
        _this._nowbuildname = "";
        _this._nowscenename = "";
        /**
         * 0:未锁，1：锁左边，2：锁右边
         */
        _this._lockxstate = 0;
        _this._lockbyBuildname = "";
        /**
         * 0:未被锁，1：锁定左边，2：锁定右边，
         */
        _this._lockstate = 0;
        _this._lastState = "";
        _this._moveTime = 0;
        _this._chixuTime = 0;
        _this._isActionNums = false;
        _this._isneedactionnum = 0;
        _this._needactiontime = 0;
        _this._moveVec = new Laya.Vector3;
        _this.isPengzhuang = false;
        _this.jumpSpeed = new Laya.Vector3;
        _this.jumpHight = 0;
        _this._disy = 0;
        _this.g = 10; //重力加速度
        _this._checktime = 0;
        _this._ending = false;
        _this._endAnmoSpeed = new Laya.Vector3();
        _this._endanmotime = 1;
        _this._endAnmoSpeed1 = new Laya.Vector3;
        _this._changeMoveX = 0;
        _this.isforceJump = false;
        _this.quaternion = new Laya.Quaternion;
        return _this;
    }
    NpcScript.prototype.onAwake = function () {
        this._animator = this.owner.getComponent(Laya.Animator);
        Scene3dObject_1.default.setAnimator(this._animator);
    };
    NpcScript.prototype.onStart = function () {
        this._speedMoveV3 = new Laya.Vector3(0, 0, 0);
        this._transform = this.owner.transform;
        var sp = this.owner;
        sp.getChildByName("lefttrail").active = false;
        sp.getChildByName("righttrail").active = false;
    };
    NpcScript.prototype.startRun = function () {
        this._checktime = 500;
        this._nowRoleState = 1;
        this._ending = false;
        this._changeMoveX = 0;
        this._initPosVec = this._transform.position.clone();
        this._nowbuildname = "";
        this._nowscenename = "";
        this._nowState = RoleActions_1.default.stand;
        this.nowState = RoleActions_1.default.run;
        this._speedMoveV3.x = 0;
        this._speedMoveV3.y = 0;
        this._speedMoveV3.z = -this.movespeed;
        this._iscanMove = true;
        TimerService_1.default.instance.addUpdateTarget(this);
    };
    NpcScript.prototype.setnpcCFG = function (cfg) {
        this._nowNpcCfg = cfg;
        this.movespeed = this._nowNpcCfg.speed;
        this.frontjump.x = Number(this._nowNpcCfg.frontjump.x);
        this.frontjump.y = Number(this._nowNpcCfg.frontjump.y);
        this.frontjump.z = Number(this._nowNpcCfg.frontjump.z);
        this.leftjump.x = Number(this._nowNpcCfg.leftjump.x);
        this.leftjump.y = Number(this._nowNpcCfg.leftjump.y);
        this.leftjump.z = Number(this._nowNpcCfg.leftjump.z);
        this.rightjump.x = Number(this._nowNpcCfg.rightjump.x);
        this.rightjump.y = Number(this._nowNpcCfg.rightjump.y);
        this.rightjump.z = Number(this._nowNpcCfg.rightjump.z);
        this.upclimb = Number(this._nowNpcCfg.upclimb);
        this.slideclimb.x = Number(this._nowNpcCfg.slideclimb.x);
        this.slideclimb.y = Number(this._nowNpcCfg.slideclimb.y);
        this.slideclimb.z = Number(this._nowNpcCfg.slideclimb.z);
    };
    /**
     * 开始碰撞时执行
     */
    NpcScript.prototype.onCollisionEnter = function (collision) {
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.jisuanCollision(contactPoint.normal, collision.other.owner);
        }
    };
    NpcScript.prototype.setnowSelectVec = function (pos) {
        this._nowselectVec = pos;
    };
    NpcScript.prototype.jisuanCollision = function (normal, target) {
        if (target.name == "SliderBoost" || target.name.indexOf("npc") != -1 || target.name.indexOf("role") != -1) {
            return;
        }
        this._nowCollTargetName = target.name;
        var n = new Laya.Vector3;
        Laya.Vector3.normalize(normal, this._normalizeVec);
        if (this._nowCollTargetName.indexOf("build") != -1 || this._nowCollTargetName.indexOf("Scaffolding") != -1 ||
            this._nowCollTargetName.indexOf("irongauze") != -1) //碰到建筑，判断是上爬，左爬还是右爬
         {
            if (this._nowCollTargetName.indexOf("build") != -1) {
                this._nowbuildname = this._nowCollTargetName;
                this._nowscenename = target.parent.parent.name;
            }
            if (this._nowCollTargetName.indexOf("irongauze") != -1) {
                this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
            }
            else {
                this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.name, this._nowCollTargetName);
            }
            if (this._normalizeVec.z == -1) //上爬
             {
                if (this._nowselectVec && this._transform.position.y > (this._nowselectVec.y - 0.1)) {
                    this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                    this.nowState = RoleActions_1.default.run;
                }
                else {
                    this.nowState = RoleActions_1.default.Climb;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
            else if (this._normalizeVec.y == 1 || this._normalizeVec.y == -1) {
                this.nowState = RoleActions_1.default.run;
            }
            else if (this._normalizeVec.x == -1) {
                if (this.nowState == RoleActions_1.default.run) {
                    this._lockxstate = 1;
                }
                else if (this.nowState == RoleActions_1.default.Climb) {
                    this._lockxstate = 1;
                }
                else {
                    this.nowState = RoleActions_1.default.left_climb;
                }
            }
            else if (this._normalizeVec.x == 1) {
                if (this.nowState == RoleActions_1.default.run) {
                    this._lockxstate = 2;
                }
                else if (this.nowState == RoleActions_1.default.Climb) {
                    this._lockxstate = 2;
                }
                else {
                    this.nowState = RoleActions_1.default.right_climb;
                }
            }
            else {
                if (this._normalizeVec.z != 1) {
                    this.nowState = RoleActions_1.default.lockclimb;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
        }
        else if (this._nowCollTargetName.indexOf("panel_jump") != -1) //加速板跳跃
         {
            this.nowState = RoleActions_1.default.jiasuJump;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("panel_downslip") != -1) {
            this.nowState = RoleActions_1.default.downSlide;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("box_Board") != -1 && this.nowState != RoleActions_1.default.downSlide) {
            if (this._normalizeVec.z == -1) //上爬
             {
                this.nowState = RoleActions_1.default.Climb;
                this._shangpaVec = this._nowselectVec.clone();
            }
        }
        else if (this._nowCollTargetName.indexOf("box_sidejump") != -1) {
            this.nowState = RoleActions_1.default.slidejiasu;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("box_Surmount") != -1) {
            this.nowState = RoleActions_1.default.surmount;
            // this.setJump( this.nowState );
        }
        else if (this._nowCollTargetName.indexOf("irongauze") != -1) {
            this.nowState = RoleActions_1.default.Climb;
            this._shangpaVec = this._nowselectVec.clone();
        }
    };
    /**
     * 持续碰撞时执行
     */
    NpcScript.prototype.onCollisionStay = function (collision) {
        // Debuger.log( "碰撞中" );
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            this._isColling = true;
            var contactPoint = collision.contacts[0];
            var target = collision.other.owner;
            var targetname = target.name;
            if (targetname != "SliderBoost" && targetname.indexOf("npc") == -1 && targetname.indexOf("role") == -1) {
                this._nowCollTargetName = targetname;
            }
            if (this._nowCollTargetName.indexOf("build") != -1 || this._nowCollTargetName.indexOf("Scaffolding") != -1 ||
                this._nowCollTargetName.indexOf("irongauze") != -1) //碰到建筑，判断是上爬，左爬还是右爬
             {
                if (this._nowCollTargetName.indexOf("build") != -1) {
                    this._nowbuildname = this._nowCollTargetName;
                    this._nowscenename = target.parent.parent.name;
                }
                if (this._nowCollTargetName.indexOf("irongauze") != -1) {
                    this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
                }
                else {
                    this._nowselectVec = Scene3dObject_1.default.getPosVecbyScene(target.parent.parent.name, this._nowCollTargetName);
                }
            }
        }
    };
    /**
     * 结束碰撞时执行
     */
    NpcScript.prototype.onCollisionExit = function (collision) {
        this._isColling = false;
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.checkendColl(contactPoint.normal, collision.other.owner);
        }
    };
    NpcScript.prototype.checkendColl = function (normal, target) {
        if (target.name == "SliderBoost" || target.name.indexOf("npc") != -1 || target.name.indexOf("role") != -1) {
            return;
        }
        if (this.isforceJump) {
            this.isforceJump = false;
            return;
        }
        if (this._lockxstate) {
            this._lockxstate = 0;
            return;
        }
        if (this._nowCollTargetName != target.name) {
            return;
        }
        if (target.name.indexOf("panel_jump") != -1) {
            return;
        }
        switch (this.nowState) {
            case RoleActions_1.default.Climb:
            case RoleActions_1.default.lockclimb:
                if (this._nowCollTargetName.indexOf("box_Board") != -1) {
                    this.setJumpState(this._changeMoveX);
                }
                else {
                    // var istoTop:boolean = Scene3dObject.checkisClimbTop( target.parent.parent.name,target.name,this._transform.position );
                    // if( istoTop )
                    // {
                    //     Debuger.log( "播放爬楼完成动作" );
                    //     this.nowState = RoleActions.playPalouAction;
                    //     this.playAnmo("");
                    // }
                    // else
                    // {
                    //     if( this._changeMoveX > 0 )
                    //     {
                    //         this.nowState = RoleActions.right_jump;
                    //         // this.setJump( this.nowState );
                    //     }
                    //     else if( this._changeMoveX < 0 )
                    //     {
                    //         this.nowState = RoleActions.left_jump;
                    //         // this.setJump( this.nowState );
                    //     }
                    // }
                    if (this._changeMoveX > 0) {
                        this.nowState = RoleActions_1.default.right_jump;
                        // this.setJump( this.nowState );
                    }
                    else if (this._changeMoveX < 0) {
                        this.nowState = RoleActions_1.default.left_jump;
                        // this.setJump( this.nowState );
                    }
                }
                break;
            case RoleActions_1.default.right_climb:
            case RoleActions_1.default.left_climb:
                this.setJumpState(this._changeMoveX);
                break;
            case RoleActions_1.default.run:
                this.setJumpState(this._changeMoveX);
                break;
            case RoleActions_1.default.xshunyi:
                this.setJumpState(this._speedMoveV3.x);
                break;
        }
    };
    NpcScript.prototype.setJumpState = function (value, isquanzhong) {
        if (isquanzhong === void 0) { isquanzhong = false; }
        if (value > 0) {
            this.nowState = RoleActions_1.default.right_jump;
        }
        else if (value < 0) {
            this.nowState = RoleActions_1.default.left_jump;
        }
        else {
            if (isquanzhong) {
                if (this._nowCollTargetName.indexOf("build") != -1) {
                    var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                    var allvalue = 0;
                    var sort;
                    var selectdir = "";
                    if (this._nowCollTargetName.indexOf("leftright") != -1) {
                        allvalue = this._nowNpcCfg.jump_left + this._nowNpcCfg.jump_right;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcCfg.jump_left) {
                            selectdir = "left";
                        }
                        else {
                            selectdir = "right";
                        }
                    }
                    else if (this._nowCollTargetName.indexOf("frontright") != -1) {
                        allvalue = this._nowNpcCfg.start_ahead + this._nowNpcCfg.jump_right;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcCfg.start_ahead) {
                            selectdir = "front";
                        }
                        else {
                            selectdir = "right";
                        }
                    }
                    else if (this._nowCollTargetName.indexOf("frontleft") != -1) {
                        allvalue = this._nowNpcCfg.start_ahead + this._nowNpcCfg.jump_left;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcCfg.start_ahead) {
                            selectdir = "front";
                        }
                        else {
                            selectdir = "left";
                        }
                    }
                    else if (this._nowCollTargetName.indexOf("right") != -1) {
                        selectdir = "right";
                    }
                    else if (this._nowCollTargetName.indexOf("left") != -1) {
                        selectdir = "left";
                    }
                    else if (this._nowCollTargetName.indexOf("front") != -1) {
                        selectdir = "front";
                    }
                    else {
                        allvalue = this._nowNpcCfg.start_ahead + this._nowNpcCfg.jump_left + this._nowNpcCfg.jump_right;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcCfg.start_ahead) {
                            selectdir = "front";
                        }
                        else if (sort <= this._nowNpcCfg.start_ahead + this._nowNpcCfg.jump_left) {
                            selectdir = "left";
                        }
                        else {
                            selectdir = "right";
                        }
                    }
                    switch (selectdir) {
                        case "left":
                            this.nowState = RoleActions_1.default.left_jump;
                            break;
                        case "right":
                            this.nowState = RoleActions_1.default.right_jump;
                            break;
                        case "front":
                            this.nowState = RoleActions_1.default.jump;
                            break;
                        default:
                            this.nowState = RoleActions_1.default.jump;
                            break;
                    }
                }
                else {
                    this.nowState = RoleActions_1.default.jump;
                }
            }
            else {
                this.nowState = RoleActions_1.default.jump;
            }
        }
    };
    NpcScript.prototype.playAnmo = function (actinName) {
        this._isActionNums = true;
        this._isneedactionnum = 1;
        this.setAction(RoleActions_1.default.climbend);
    };
    NpcScript.prototype.actionCompelte = function () {
        this.nowState = RoleActions_1.default.run;
    };
    Object.defineProperty(NpcScript.prototype, "nowState", {
        get: function () {
            return this._nowState;
        },
        set: function (value) {
            if (this._nowRoleState == 1) {
                if (this._nowState != value || this._lastState == RoleActions_1.default.jiasuJump || this._lastState == RoleActions_1.default.right_jump) {
                    this._lastState = this._nowState;
                    this._nowState = value;
                    this._moveTime = 0;
                    switch (this._nowState) {
                        case RoleActions_1.default.stand:
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.stand);
                            break;
                        case RoleActions_1.default.run:
                            if (this._lastState == RoleActions_1.default.jump || this._lastState == RoleActions_1.default.left_jump || this._lastState == RoleActions_1.default.right_jump) {
                                this._isActionNums = true;
                                this._isneedactionnum = 1;
                                var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                                if (sort < 50) {
                                    this.setAction(RoleActions_1.default.luodi1);
                                }
                                else {
                                    this.setAction(RoleActions_1.default.luodi2);
                                }
                            }
                            else {
                                this._isActionNums = false;
                                this.setAction(RoleActions_1.default.run);
                            }
                            break;
                        case RoleActions_1.default.jump:
                            this.setAction(RoleActions_1.default.jump);
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.jumpSpeed.x = this.frontjump.x;
                            this.jumpSpeed.y = this.frontjump.y;
                            this.jumpSpeed.z = this.frontjump.z;
                            break;
                        case RoleActions_1.default.left_jump:
                            this.jumpSpeed.x = this.leftjump.x;
                            this.jumpSpeed.y = this.leftjump.y;
                            this.jumpSpeed.z = this.leftjump.z;
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.setAction(RoleActions_1.default.leftjump);
                            break;
                        case RoleActions_1.default.right_jump:
                            this.jumpSpeed.x = this.rightjump.x;
                            this.jumpSpeed.y = this.rightjump.y;
                            this.jumpSpeed.z = this.rightjump.z;
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.setAction(RoleActions_1.default.rightjump);
                            break;
                        case RoleActions_1.default.jiasuJump:
                            var buildcfg = BuildCFG_1.default.dict["panel_jump"];
                            this.jumpSpeed.x = buildcfg.buffx;
                            this.jumpSpeed.y = buildcfg.buffy;
                            if (this._lastState == RoleActions_1.default.jiasuJump) {
                                this.jumpSpeed.z = this.jumpSpeed.z * buildcfg.buffz;
                            }
                            else {
                                this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz;
                            }
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                            if (sort < 50) {
                                this.setAction(RoleActions_1.default.datiao1);
                            }
                            else {
                                this.setAction(RoleActions_1.default.datiao2);
                            }
                            break;
                        case RoleActions_1.default.downSlide:
                            var buildcfg = BuildCFG_1.default.dict["panel_downslip"];
                            this.jumpSpeed.x = buildcfg.buffx;
                            this.jumpSpeed.y = buildcfg.buffy;
                            this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz;
                            this._chixuTime = buildcfg.time;
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.setAction(RoleActions_1.default.huachan);
                            break;
                        // case RoleActions.slidejiasu:
                        //     var buildcfg:BuildCFG = BuildCFG.dict[ "box_sidejump" ];
                        //     this.jumpSpeed.x = buildcfg.buffx;
                        //     this.jumpSpeed.y = buildcfg.buffy;
                        //     this.jumpSpeed.z = this._speedMoveV3.z*buildcfg.buffz;
                        //     this._chixuTime = buildcfg.time;
                        //     this._isActionNums = false;
                        //     // this.setAction( RoleActions. );
                        // break;
                        case RoleActions_1.default.surmount:
                            var buildcfg = BuildCFG_1.default.dict["box_Surmount"];
                            this.jumpSpeed.x = buildcfg.buffx;
                            this.jumpSpeed.y = buildcfg.buffy + 0.5;
                            this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz;
                            this._chixuTime = buildcfg.time;
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.setAction(RoleActions_1.default.kualan);
                            break;
                        case RoleActions_1.default.Climb:
                        case RoleActions_1.default.lockclimb:
                            this.jumpSpeed.x = 0;
                            this.jumpSpeed.y = this.upclimb;
                            this.jumpSpeed.z = 0;
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.paqiang);
                            break;
                        case RoleActions_1.default.left_climb:
                            this.jumpSpeed.x = 0;
                            this.jumpSpeed.y = this.slideclimb.y;
                            this.jumpSpeed.z = this.slideclimb.z;
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.paoqiangleft);
                            break;
                        case RoleActions_1.default.right_climb:
                            this.jumpSpeed.x = 0;
                            this.jumpSpeed.y = this.slideclimb.y;
                            this.jumpSpeed.z = this.slideclimb.z;
                            this._isActionNums = false;
                            this.setAction(RoleActions_1.default.paoqiangright);
                            break;
                        case RoleActions_1.default.playPalouAction:
                            this._isActionNums = true;
                            this._isneedactionnum = 0;
                            this._needactiontime = 0.3;
                            this._moveTime = 0;
                            this.setAction(RoleActions_1.default.climbend);
                            break;
                    }
                }
            }
        },
        enumerable: true,
        configurable: true
    });
    NpcScript.prototype.update = function (dt) {
        if (this._nowRoleState == 1) {
            dt = 16;
            this._checktime += dt;
            if (Scene3dObject_1.default.iscarmanpc) {
            }
            else {
                if (this._checktime >= 500) {
                    this._checktime = 0;
                    if (this._nowNpcCfg && Scene3dObject_1.default.mainRole) {
                        if (this._transform.position.z + this._nowNpcCfg.distance < Scene3dObject_1.default.mainRole.transform.position.z) {
                            this._iscanMove = false;
                        }
                        else {
                            this._iscanMove = true;
                        }
                    }
                }
            }
            if (this._iscanMove) {
                var distime = dt / 1000;
                this._moveTime += distime;
                switch (this.nowState) {
                    case RoleActions_1.default.run: //跑动
                        this._moveVec.y = 0;
                        this._moveVec.z = distime * this._speedMoveV3.z;
                        if (this._lockxstate == 0) {
                            this._moveVec.x = this._changeMoveX * distime;
                        }
                        else if (this._lockxstate == 1) {
                            if (this._changeMoveX < 0) {
                                this._moveVec.x = 0;
                            }
                            else {
                                this._moveVec.x = this._changeMoveX * distime;
                            }
                        }
                        else if (this._lockxstate == 2) {
                            if (this._changeMoveX > 0) {
                                this._moveVec.x = 0;
                            }
                            else {
                                this._moveVec.x = this._changeMoveX * distime;
                            }
                        }
                        this._transform.translate(this._moveVec, false);
                        break;
                    case RoleActions_1.default.Climb: //爬升
                        this._moveVec.z = 0;
                        this._moveVec.y = distime * this.jumpSpeed.y;
                        if (this._lockxstate == 1) {
                            if (this._changeMoveX < 0) {
                                this._moveVec.x = 0;
                            }
                            else {
                                this._moveVec.x = this._changeMoveX * distime;
                            }
                        }
                        else if (this._lockstate == 2) {
                            if (this._changeMoveX > 0) {
                                this._moveVec.x = 0;
                            }
                            else {
                                this._moveVec.x = this._changeMoveX * distime;
                            }
                        }
                        else {
                            this._moveVec.x = this._changeMoveX * distime;
                        }
                        this._transform.translate(this._moveVec, false);
                        if (this._shangpaVec) {
                            if (this._transform.position.y + 1 > this._shangpaVec.y) {
                                this.nowState = RoleActions_1.default.playPalouAction;
                            }
                        }
                        else if (this._nowselectVec) {
                            if (this._transform.position.y + 1 > this._nowselectVec.y) {
                                this.nowState = RoleActions_1.default.playPalouAction;
                            }
                        }
                        break;
                    case RoleActions_1.default.lockclimb:
                        this._moveVec.z = 0;
                        this._moveVec.y = distime * this.jumpSpeed.y;
                        this._moveVec.x = 0;
                        this._transform.translate(this._moveVec, false);
                        if (this._shangpaVec) {
                            if (this._transform.position.y + 1 > this._shangpaVec.y) {
                                this.nowState = RoleActions_1.default.playPalouAction;
                            }
                        }
                        else if (this._transform.position.y + 1 > this._nowselectVec.y) {
                            this.nowState = RoleActions_1.default.playPalouAction;
                        }
                        break;
                    case RoleActions_1.default.jump: //跳跃
                    case RoleActions_1.default.left_jump:
                    case RoleActions_1.default.right_jump:
                        this._disy = this.jumpSpeed.y - this.g * distime;
                        this.jumpSpeed.y = this._disy;
                        this._moveVec.x = this.jumpSpeed.x * distime;
                        this._moveVec.y = this._disy * distime;
                        this._moveVec.z = this.jumpSpeed.z * distime;
                        this._transform.translate(this._moveVec, false);
                        break;
                    case RoleActions_1.default.jiasuJump:
                        this._disy = this.jumpSpeed.y - this.g * distime;
                        this.jumpSpeed.y = this._disy;
                        this._moveVec.x = this.jumpSpeed.x * distime;
                        this._moveVec.y = this._disy * distime;
                        this._moveVec.z = this.jumpSpeed.z * distime;
                        this._transform.translate(this._moveVec, false);
                        break;
                    case RoleActions_1.default.left_climb:
                    case RoleActions_1.default.right_climb:
                        this._moveVec.z = distime * this.jumpSpeed.y;
                        this._moveVec.y = this.jumpSpeed.y * distime;
                        this._moveVec.x = 0;
                        this._transform.translate(this._moveVec, false);
                        break;
                    case RoleActions_1.default.xshunyi:
                        this._moveVec.z = distime * this._speedMoveV3.z;
                        this._moveVec.x = this._speedMoveV3.x * distime;
                        this._transform.translate(this._moveVec, false);
                        if (this._moveTime > 0.1) {
                            this.nowState = RoleActions_1.default.run;
                        }
                        break;
                    case RoleActions_1.default.downSlide:
                        this._moveVec.y = this.jumpSpeed.x;
                        this._moveVec.x = this.jumpSpeed.y;
                        this._moveVec.z = this.jumpSpeed.z * distime;
                        this._transform.translate(this._moveVec, false);
                        if (this._moveTime > this._chixuTime) {
                            this.nowState = RoleActions_1.default.run;
                        }
                        break;
                    case RoleActions_1.default.slidejiasu:
                        this._moveVec.y = 0;
                        this._moveVec.x = 0;
                        this._moveVec.z = this.jumpSpeed.z * distime;
                        this._transform.translate(this._moveVec, false);
                        if (this._moveTime > this._chixuTime && this._lastState == RoleActions_1.default.left_climb || this._lastState == RoleActions_1.default.right_climb) {
                            this.nowState = this._lastState;
                        }
                        else {
                            this.nowState = RoleActions_1.default.jump;
                            // this.setJump( this.nowState );
                        }
                        break;
                    case RoleActions_1.default.surmount:
                        this._disy = this.jumpSpeed.y - this.g * distime;
                        this.jumpSpeed.y = this._disy;
                        this._moveVec.x = this.jumpSpeed.x * distime;
                        this._moveVec.y = this._disy * distime;
                        this._moveVec.z = this.jumpSpeed.z * distime;
                        this._transform.translate(this._moveVec, false);
                        break;
                    case RoleActions_1.default.playPalouAction:
                        if (this._nowselectVec) {
                            if (this._transform.position.y < this._nowselectVec.y) {
                                this._moveVec.x = 0;
                                this._moveVec.y = (1 / 0.3) * distime;
                                this._moveVec.z = 0;
                                this._transform.translate(this._moveVec, false);
                            }
                        }
                        break;
                }
                if (this._nowselectVec && (this.nowState == RoleActions_1.default.run || this.nowState == RoleActions_1.default.downSlide) && !this._isColling) {
                    if (this._transform.position.z <= this._nowselectVec.z) {
                        if (this._changeMoveX > 0) {
                            this.nowState = RoleActions_1.default.right_jump;
                        }
                        else if (this._changeMoveX < 0) {
                            this.nowState = RoleActions_1.default.left_jump;
                        }
                        else {
                            this.nowState = RoleActions_1.default.jump;
                        }
                    }
                }
                if (this._transform.position.y < Scene3dObject_1.default.diePosY) //角色死亡
                 {
                    if (this._nowscenename == "" || this._nowbuildname == "") {
                        this._transform.position = this._initPosVec.clone();
                    }
                    else {
                        this._transform.position = Scene3dObject_1.default.getPosVecbyScene(this._nowscenename, this._nowbuildname).clone();
                    }
                    this.nowState = RoleActions_1.default.run;
                }
                if (this._transform.position.z < Scene3dObject_1.default.gamewinPosZ) {
                    this.wingame();
                }
                if (this._isActionNums) {
                    //如果当前播放state已经播放完了一次
                    if (this._isneedactionnum > 0) {
                        if (this._animator.getCurrentAnimatorPlayState().normalizedTime >= this._isneedactionnum) {
                            switch (this._nowActionName) {
                                case RoleActions_1.default.jump:
                                case RoleActions_1.default.leftjump:
                                case RoleActions_1.default.rightjump:
                                case RoleActions_1.default.datiao1:
                                case RoleActions_1.default.datiao2:
                                case RoleActions_1.default.kualan:
                                    this._isActionNums = false;
                                    this.setAction(RoleActions_1.default.kongzhong);
                                    break;
                                case RoleActions_1.default.huachan:
                                case RoleActions_1.default.climbend:
                                    this._isActionNums = false;
                                    this.setAction(RoleActions_1.default.run);
                                    this.nowState = RoleActions_1.default.run;
                                    this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                                    break;
                                case RoleActions_1.default.luodi1:
                                case RoleActions_1.default.luodi2:
                                    this._isActionNums = false;
                                    this.setAction(RoleActions_1.default.run);
                                    break;
                            }
                        }
                    }
                    else if (this._needactiontime != 0 && this._moveTime > this._needactiontime) {
                        switch (this._nowActionName) {
                            case RoleActions_1.default.jump:
                            case RoleActions_1.default.leftjump:
                            case RoleActions_1.default.rightjump:
                            case RoleActions_1.default.datiao1:
                            case RoleActions_1.default.datiao2:
                            case RoleActions_1.default.kualan:
                                this._isActionNums = false;
                                this.setAction(RoleActions_1.default.kongzhong);
                                break;
                            case RoleActions_1.default.huachan:
                            case RoleActions_1.default.climbend:
                                this._isActionNums = false;
                                this.setAction(RoleActions_1.default.run);
                                this.nowState = RoleActions_1.default.run;
                                this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                                break;
                        }
                    }
                }
            }
            else {
                if (this._ending) {
                    var distime = dt / 1000;
                    this._moveTime += distime;
                    if (this._moveTime >= this._endanmotime) {
                        this.endGame();
                    }
                    else {
                        this._endAnmoSpeed1.x = this._endAnmoSpeed.x * distime;
                        this._endAnmoSpeed1.y = this._endAnmoSpeed.y * distime;
                        this._endAnmoSpeed1.z = this._endAnmoSpeed.z * distime;
                        Scene3dObject_1.default.carma.getComponent(CamerasScript_1.default).MyRotateAround(this._transform.position, this._endAnmoSpeed1);
                    }
                }
            }
        }
    };
    NpcScript.prototype.endGame = function () {
        this._ending = false;
        TimerService_1.default.instance.removeUpdateTarget(this);
        EventUtils_1.EventUtils.dispatchEvent(GameEvent_1.default.endGame);
    };
    NpcScript.prototype.wingame = function () {
        TimerService_1.default.instance.removeUpdateTarget(this);
        this._nowRoleState = 2;
        this.setAction(RoleActions_1.default.kongzhong);
        EventUtils_1.EventUtils.dispatchEvent(GameEvent_1.default.npcendGame, this.owner.name);
    };
    NpcScript.prototype.joyStickCHange = function (value, angle) {
        if (this.nowState == RoleActions_1.default.run || this.nowState == RoleActions_1.default.Climb || RoleActions_1.default.left_climb || RoleActions_1.default.right_climb) {
            this._changeMoveX = value;
        }
        if (this.nowState == RoleActions_1.default.left_climb && this._changeMoveX > 0) //强制跳跃
         {
            this.isforceJump = true;
            this.nowState = RoleActions_1.default.right_jump;
        }
        else if (this.nowState == RoleActions_1.default.right_climb && this._changeMoveX < 0) {
            this.isforceJump = true;
            this.nowState = RoleActions_1.default.left_jump;
        }
        if (this.nowState == RoleActions_1.default.jump ||
            this.nowState == RoleActions_1.default.left_jump ||
            this.nowState == RoleActions_1.default.right_jump ||
            this.nowState == RoleActions_1.default.jiasuJump)
            angle = -angle * Math.PI / 180;
        Laya.Quaternion.createFromAxisAngle(new Laya.Vector3(0, 1, 0), angle, this.quaternion);
        Laya.Vector3.transformQuat(this.jumpSpeed, this.quaternion, this.jumpSpeed);
    };
    NpcScript.prototype.xshunyi = function (state) {
        if (this.nowState == RoleActions_1.default.run) {
            this._moveTime = 0;
            this._speedMoveV3.x = state * 30;
            this.nowState = RoleActions_1.default.xshunyi;
        }
    };
    NpcScript.prototype.setAction = function (actionName) {
        this._nowActionName = actionName;
        if (this._animator) {
            if (this._nowActionName == RoleActions_1.default.climbend) {
                this._animator.speed = 1.5;
            }
            else {
                this._animator.speed = 1;
            }
            this._animator.play(actionName, 0, 0);
        }
    };
    NpcScript.prototype.ceshitiaoyue = function () {
        this.nowState = RoleActions_1.default.jump;
    };
    NpcScript.prototype.onUpdate = function () {
    };
    NpcScript.prototype.onLateUpdate = function () {
    };
    NpcScript.prototype.getPostion = function () {
        return this._transform.position;
    };
    NpcScript.prototype.getNowstate = function () {
        return this._nowRoleState;
    };
    NpcScript.prototype.stop = function () {
        TimerService_1.default.instance.removeUpdateTarget(this);
    };
    NpcScript.prototype.destroy = function () {
        TimerService_1.default.instance.removeUpdateTarget(this);
        _super.prototype.destroy.call(this);
    };
    return NpcScript;
}(Laya.Script3D));
exports.default = NpcScript;
},{"../../configs/dataConfigs/BuildCFG":5,"../../frameworks/TimerService":13,"../../frameworks/events/EventUtils":16,"../../utils/GameUtils":87,"../scene3ds/RoleActions":46,"../scene3ds/Scene3dObject":48,"../userinfo/events/GameEvent":54,"./CamerasScript":42}],45:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../frameworks/mvc/BaseView");
var WindowAnmoType_1 = require("../../frameworks/mvc/WindowAnmoType");
var GameStateManager_1 = require("../main/GameStateManager");
var WordTipsUtils_1 = require("../loading/view/WordTipsUtils");
var UserInfoProxy_1 = require("../userinfo/UserInfoProxy");
var GameProxy_1 = require("../main/proxys/GameProxy");
var PlayerAccount_1 = require("../../platform/wxminigame/WXSDK/PlayerAccount");
var Debuger_1 = require("../../frameworks/Debuger");
var NetworkManager_1 = require("../../platform/wxminigame/NetworkManager");
var UiManager_1 = require("../../managers/UiManager");
var ChoutiPanView_1 = require("../../platform/wxminigame/WXSDK/cpa/ChoutiPanView");
var GameResultView = /** @class */ (function (_super) {
    __extends(GameResultView, _super);
    function GameResultView(gold) {
        var _this = _super.call(this, "main", "gameresult", false, WindowAnmoType_1.default.WindowAnmoType_none, 1) || this;
        _this.getgold = 0;
        _this.getgold = gold;
        return _this;
    }
    GameResultView.prototype.initView = function () {
        this._gameProxy = this.getProxy(GameProxy_1.default);
        this.c_state = this.getControllerByBame("c_state");
        this.txt_gold.text = this.getgold.toString();
        if (GameStateManager_1.default.getInstance().endGamePlayerArr.length == 0) {
            this.c_state.selectedIndex = 0;
        }
        else {
            this.c_state.selectedIndex = 1;
        }
    };
    GameResultView.prototype.initEvent = function () {
        this.addListener(this.btn_0, Laya.Event.CLICK, this, this.btn0click);
        this.addListener(this.btn_1, Laya.Event.CLICK, this, this.btn1click);
    };
    GameResultView.prototype.btn0click = function () {
        if (this.c_state.selectedIndex == 0) {
            WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("暂未开放");
        }
        else {
            this.getProxy(UserInfoProxy_1.default).changeGold(this.getgold);
            this._gameProxy.returnmainview();
        }
    };
    GameResultView.prototype.btn1click = function () {
        var _this = this;
        if (this.c_state.selectedIndex == 0) {
            this.getProxy(UserInfoProxy_1.default).changeGold(this.getgold);
            this.getProxy(UserInfoProxy_1.default).addLevel();
            this._gameProxy.returnmainview();
        }
        else {
            this.getProxy(UserInfoProxy_1.default).changeGold(this.getgold);
            this._gameProxy.returnmainview();
        }
        var wins = GameStateManager_1.default.getInstance().endGamePlayerArr.length == 0 ? 1 : 0;
        var userid = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.GetUser(PlayerAccount_1.AccountUser.user_id);
        var agrs = [{ "t": PlayerAccount_1.PlayerAccount.CurrentAccount.ServerTime.toString() }, { "play_id": userid }, { "money": "0" }, { "win": wins.toString() }];
        Debuger_1.default.log("上传：", agrs);
        NetworkManager_1.NetworkManager.Instance.HttpPostRequest(NetworkManager_1.PROTOCOLS.end, agrs, new Laya.Handler(this, function (_data) {
            _this.getProxy(UserInfoProxy_1.default).sendGoldSync();
        }), new Laya.Handler(this, function (_data) {
            console.log("游戏结果err");
        }));
    };
    GameResultView.prototype.destory = function () {
        _super.prototype.destory.call(this);
        UiManager_1.UiManager.instance.add(ChoutiPanView_1.default);
    };
    GameResultView.key = "GameResultView";
    return GameResultView;
}(BaseView_1.default));
exports.default = GameResultView;
},{"../../frameworks/Debuger":12,"../../frameworks/mvc/BaseView":20,"../../frameworks/mvc/WindowAnmoType":25,"../../managers/UiManager":66,"../../platform/wxminigame/NetworkManager":71,"../../platform/wxminigame/WXSDK/PlayerAccount":74,"../../platform/wxminigame/WXSDK/cpa/ChoutiPanView":79,"../loading/view/WordTipsUtils":36,"../main/GameStateManager":38,"../main/proxys/GameProxy":39,"../userinfo/UserInfoProxy":53}],46:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RoleActions = /** @class */ (function () {
    function RoleActions() {
    }
    RoleActions.stand = "stand";
    RoleActions.kongzhong = "kongzhong";
    RoleActions.luodi1 = "luodi1";
    RoleActions.luodi2 = "luodi2";
    RoleActions.datiao1 = "datiao1";
    RoleActions.datiao2 = "datiao2";
    RoleActions.huachan = "huachan";
    RoleActions.kualan = "kualan";
    RoleActions.cefan1 = "cefan1";
    RoleActions.cefan2 = "cefan2";
    RoleActions.paoqiangleft = "paoqiangleft";
    RoleActions.rightjump = "rightjump";
    RoleActions.paoqiangright = "paoqiangright";
    RoleActions.leftjump = "leftjump";
    RoleActions.paqiang = "paqiang";
    RoleActions.climbend = "climbend";
    /**
     * 跑动
     */
    RoleActions.run = "run";
    /**
     * 跳跃
     */
    RoleActions.jump = "jump";
    /**
     * 爬升
     */
    RoleActions.Climb = "Climb";
    /**
     * 自由落体
     */
    RoleActions.Freefalling = "Freefalling";
    RoleActions.left_climb = "left_climb";
    RoleActions.right_climb = "right_climb";
    RoleActions.right_jump = "right_jump";
    RoleActions.left_jump = "left_jump";
    RoleActions.playPalouAction = "playPalouAction";
    /**
     * 加速板跳跃
     */
    RoleActions.jiasuJump = "jiasuJump";
    /**
     * x方向瞬移
     */
    RoleActions.xshunyi = "xshunyi";
    /**
     * 下滑位移
     */
    RoleActions.downSlide = "downSlide";
    /**
     * 侧面加速
     */
    RoleActions.slidejiasu = "slidejiasu";
    /**
     * 翻越
     */
    RoleActions.surmount = "surmount";
    /**
     * 锁定爬升
     */
    RoleActions.lockclimb = "lockclimb";
    return RoleActions;
}());
exports.default = RoleActions;
},{}],47:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PathConfig_1 = require("../../configs/gameConfigs/PathConfig");
var RolesPool = /** @class */ (function () {
    function RolesPool() {
    }
    RolesPool.addRoleByName = function (resouceName, clas, parent) {
        var skinnedmesh;
        var arr = RolesPool.roledict[resouceName];
        if (arr && arr.length > 0) {
            skinnedmesh = arr.shift();
            skinnedmesh.active = true;
            parent.addChild(skinnedmesh);
        }
        else {
            var sp = Laya.Loader.getRes(PathConfig_1.PathConfig.get3DRoleModel(resouceName));
            skinnedmesh = Laya.Sprite3D.instantiate(sp, parent, false, new Laya.Vector3(0, 0, 0));
        }
        if (clas) {
            var cla = skinnedmesh.addComponent(clas);
            cla.resouseName = resouceName;
        }
        var _out = new Laya.Quaternion;
        Laya.Quaternion.createFromAxisAngle(new Laya.Vector3(0, 1, 0), 180 * Math.PI / 180, _out);
        skinnedmesh.transform.rotation = _out;
        return skinnedmesh;
    };
    RolesPool.removeRole = function (sp, resouceName, cla) {
        if (!RolesPool.roledict[resouceName]) {
            RolesPool.roledict[resouceName] = [];
        }
        if (cla) {
            cla.destroy();
        }
        sp.active = false;
        sp.removeSelf();
        RolesPool.roledict[resouceName].push(sp);
    };
    RolesPool.roledict = {};
    return RolesPool;
}());
exports.default = RolesPool;
},{"../../configs/gameConfigs/PathConfig":10}],48:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PathConfig_1 = require("../../configs/gameConfigs/PathConfig");
var GameUtils_1 = require("../../utils/GameUtils");
var Scene3dObject = /** @class */ (function () {
    function Scene3dObject() {
        this._outQUaternion4 = new Laya.Quaternion;
        this._outQUaternion = new Laya.Quaternion;
    }
    Scene3dObject.getInstance = function () {
        if (!this._instance) {
            this._instance = new Scene3dObject;
        }
        return this._instance;
    };
    Scene3dObject.getPosVecbyScene = function (sceneName, buildname) {
        if (Scene3dObject.patternDict[sceneName]) {
            return Scene3dObject.patternDict[sceneName][buildname];
        }
        return null;
    };
    /**
     * 判断是否爬到顶端
     */
    Scene3dObject.checkisClimbTop = function (sceneName, buildname, pos) {
        var vec = Scene3dObject.getPosVecbyScene(sceneName, buildname);
        if (vec && Math.abs(vec.y - pos.y) < 1.5) {
            return true;
        }
        return false;
    };
    /**
     * @param animator
     * @param animatorDict
     */
    Scene3dObject.setAnimator = function (animator) {
        var chiddict;
        for (var s in Scene3dObject.actionDict) {
            if (!animator.getControllerLayer().getAnimatorState(s)) {
                chiddict = Scene3dObject.actionDict[s];
                //创建一个动画动作状态
                var state1 = new Laya.AnimatorState();
                //设置动作状态的名称
                state1.name = s;
                //设置动作状态播放的起始时间（起始时间与结束时间的设置为0-1的百分比数值）  要截取的时间点 / 动画的总时长
                state1.clipStart = chiddict.s / Scene3dObject.actionnums;
                //设置动作状态播放的结束时间
                state1.clipEnd = chiddict.e / Scene3dObject.actionnums;
                //得到默认动画赋值给Clip（getDefaultState默认动画为Unity中animation的数组顺序0下标的动画）
                state1.clip = animator.getDefaultState().clip;
                //动画播放是否循环
                state1.clip.islooping = chiddict.islooping;
                //添加动画状态到动画组件里
                animator.addState(state1);
            }
        }
    };
    Scene3dObject.prototype.initlizi = function () {
        var lizi = Scene3dObject.getlizibyName("jiasulizi");
        lizi.particleSystem.play();
        lizi.active = false;
        var lizi = Scene3dObject.getlizibyName("tanse_bai");
        lizi.particleSystem.play();
        lizi.active = false;
        var lizi = Scene3dObject.getlizibyName("tanse_huang");
        lizi.particleSystem.play();
        lizi.active = false;
        // var lizi:Laya.ShuriKenParticle3D = Scene3dObject.getlizibyName( "win_xian" );
        // lizi.particleSystem.play();
        // lizi.active = false;
        // var lizi:Laya.ShuriKenParticle3D = Scene3dObject.getlizibyName( "yanhua" );
        // lizi.particleSystem.play();
        // lizi.active = false;
    };
    Scene3dObject.prototype.setliziPlaytanse = function (name, pos) {
        var closetime = 0;
        Laya.timer.clear(this, this.liziend);
        this.liziendtanse();
        if (name == "tanse_bai") {
            var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
            if (sort > 50) {
                name = "tanse_huang";
            }
        }
        closetime = 500;
        this._tanselizi = Scene3dObject.getlizibyName(name);
        this._tanselizi.transform.position = pos;
        this._tanselizi.particleSystem.play();
        if (closetime != 0) {
            Laya.timer.once(closetime, this, this.liziendtanse);
        }
    };
    Scene3dObject.prototype.liziendtanse = function () {
        if (this._tanselizi) {
            this._tanselizi.particleSystem.stop();
            this._tanselizi.active = false;
        }
    };
    Scene3dObject.prototype.jiadulizi1 = function (name, pos) {
        if (!this._engamelizi4 || (this._engamelizi4 && !this._engamelizi4.active)) {
            this._engamelizi4 = Scene3dObject.getlizibyName("jiasulizi");
            this._engamelizi4.particleSystem.looping = true;
            this._engamelizi4.transform.scale = new Laya.Vector3(20, 20, 20);
            Laya.Quaternion.createFromAxisAngle(new Laya.Vector3(1, 0, 0), -50, this._outQUaternion4);
            this._engamelizi4.transform.rotation = this._outQUaternion4;
            this._engamelizi4.particleSystem.play();
        }
        var lzpos = pos.clone();
        lzpos.y += 5;
        lzpos.z -= 10;
        this._engamelizi4.transform.position = lzpos;
    };
    Scene3dObject.prototype.closeJiasulizi1 = function () {
        if (this._engamelizi4 && this._engamelizi4.active) {
            this._engamelizi4.active = false;
        }
    };
    Scene3dObject.prototype.jiadulizi = function (name, pos) {
        if (!this._engamelizi3 || (this._engamelizi3 && !this._engamelizi3.active)) {
            this._engamelizi3 = Scene3dObject.getlizibyName("jiasulizi");
            this._engamelizi3.particleSystem.looping = true;
            this._engamelizi3.transform.scale = new Laya.Vector3(20, 20, 20);
            Laya.Quaternion.createFromAxisAngle(new Laya.Vector3(1, 0, 0), -50, this._outQUaternion);
            this._engamelizi3.transform.rotation = this._outQUaternion;
            this._engamelizi3.particleSystem.play();
        }
        var lzpos = pos.clone();
        lzpos.y += 5;
        this._engamelizi3.transform.position = lzpos;
    };
    Scene3dObject.prototype.closeJiasulizi = function () {
        if (this._engamelizi3 && this._engamelizi3.active) {
            this._engamelizi3.active = false;
        }
    };
    Scene3dObject.prototype.liziendgame = function (name, pos, iswin) {
        this._engamelizi1 = Scene3dObject.getlizibyName("yanhua");
        this._engamelizi1.transform.position = pos;
        this._engamelizi1.particleSystem.play();
        if (iswin) {
            this._engamelizi2 = Scene3dObject.getlizibyName("win_xian");
            this._engamelizi2.transform.position = pos;
            this._engamelizi2.particleSystem.play();
        }
    };
    Scene3dObject.prototype.closeengamlizi = function () {
        if (this._engamelizi1) {
            this._engamelizi1.particleSystem.stop();
            this._engamelizi1.active = false;
        }
        if (this._engamelizi2) {
            this._engamelizi2.particleSystem.stop();
            this._engamelizi2.active = false;
        }
    };
    // public setliziPlay( name:string,pos:Laya.Vector3 ):void
    // {
    //     var closetime:number = 0;
    //     Laya.timer.clear( this,this.liziend );
    //     switch( name )
    //     {
    //         case "tanse_bai":
    //             if( name == "tanse_bai" )
    //             {
    //                 var sort:number = GameUtils.randRangeint( 0,100 );
    //                 if( sort > 50 )
    //                 {
    //                     name = "tanse_huang";
    //                 }
    //             }
    //             closetime = 500;
    //         break;
    //         case "jiasulizi":
    //         break;
    //         case "win_xian":
    //             closetime = 0;
    //         break;
    //         case "yanhua":
    //             closetime = 0;
    //         break;
    //     }
    //     var lizi:Laya.ShuriKenParticle3D = Scene3dObject.getlizibyName( name );
    //     lizi.transform.position = pos;
    //     lizi.particleSystem.play();
    //     if( closetime != 0 )
    //     {
    //         Laya.timer.once( closetime,this,this.liziend,[lizi] );
    //     }
    // }
    Scene3dObject.prototype.liziend = function (lizi) {
        if (lizi) {
            lizi.particleSystem.stop();
            lizi.active = false;
        }
    };
    Scene3dObject.getlizibyName = function (name) {
        var lizisp;
        if (Scene3dObject.liziDict[name]) {
            lizisp = Scene3dObject.liziDict[name];
        }
        else {
            lizisp = Laya.Sprite3D.instantiate(Laya.Loader.getRes(PathConfig_1.PathConfig.get3DModel(name)));
            Scene3dObject.liziDict[name] = lizisp;
            Scene3dObject.scene3D.addChild(lizisp);
        }
        lizisp.active = true;
        return lizisp;
    };
    Scene3dObject.nowmapDict = {};
    Scene3dObject.diePosY = 0;
    Scene3dObject.gamewinPosZ = 0;
    Scene3dObject.patternDict = {};
    Scene3dObject.npcDict = {};
    Scene3dObject.npcscriptDict = {};
    Scene3dObject.npcnum = 0;
    Scene3dObject.iscarmanpc = false;
    Scene3dObject.liziDict = {};
    Scene3dObject.actionnums = 575;
    Scene3dObject.actionDict = {
        "climbend": { s: 550, e: 575, islooping: false },
        "stand": { s: 0, e: 80, islooping: true },
        "run": { s: 90, e: 106, islooping: true },
        "jump": { s: 110, e: 132, islooping: true },
        "kongzhong": { s: 132, e: 145, islooping: true },
        "luodi1": { s: 145, e: 160, islooping: true },
        "luodi2": { s: 170, e: 202, islooping: true },
        "datiao1": { s: 210, e: 235, islooping: true },
        "datiao2": { s: 240, e: 273, islooping: true },
        "huachan": { s: 280, e: 310, islooping: true },
        "kualan": { s: 310, e: 346, islooping: true },
        "cefan1": { s: 350, e: 391, islooping: true },
        "cefan2": { s: 400, e: 434, islooping: true },
        "paoqiangleft": { s: 440, islooping: true, e: 456 },
        "rightjump": { s: 460, e: 477, islooping: true },
        "paoqiangright": { s: 480, e: 496, islooping: true },
        "leftjump": { s: 500, e: 517, islooping: true },
        "paqiang": { s: 520, e: 542, islooping: true }
    };
    return Scene3dObject;
}());
exports.default = Scene3dObject;
},{"../../configs/gameConfigs/PathConfig":10,"../../utils/GameUtils":87}],49:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var SkinProxy_1 = require("./proxys/SkinProxy");
var MVCObjectPool_1 = require("../../frameworks/mvc/MVCObjectPool");
var WordTipsUtils_1 = require("../loading/view/WordTipsUtils");
var PathConfig_1 = require("../../configs/gameConfigs/PathConfig");
var PifuItem = /** @class */ (function (_super) {
    __extends(PifuItem, _super);
    function PifuItem() {
        return _super.call(this) || this;
    }
    PifuItem.prototype.constructFromXML = function (xml) {
        _super.prototype.constructFromXML.call(this, xml);
        for (var str in this._children) {
            var item = this._children[str];
            this[item.name] = item;
        }
        this.onInit();
    };
    PifuItem.prototype.onInit = function () {
        this.initView();
        this.initEvent();
    };
    PifuItem.prototype.initView = function () {
        this._skinProxy = MVCObjectPool_1.default.getInstance().getProxy(SkinProxy_1.default);
        this.c_state = this.getController("c_state");
    };
    PifuItem.prototype.initEvent = function () {
        this.on(Laya.Event.CLICK, this, this.btnclick);
    };
    PifuItem.prototype.btnclick = function () {
        if (this.pifuvo) {
            switch (this.c_state.selectedIndex) {
                case 0:
                    break;
                case 1: //拥有
                    this._skinProxy.getSkin(this.pifuvo);
                    break;
                case 2: //活动获取
                    WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("暂未开放");
                    break;
                case 3: //看视频获取
                    WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("暂未开放");
                    break;
                case 4: //金币购买
                    this._skinProxy.getSkin(this.pifuvo);
                    break;
            }
        }
    };
    PifuItem.prototype.showData = function (vo) {
        this.pifuvo = vo;
        if (this.pifuvo) {
            this.load_icon.icon = PathConfig_1.PathConfig.getroleicon(this.pifuvo.roleCFG.icon);
            if (this._skinProxy.roleVO.roleid == this.pifuvo.roleCFG.id) {
                this.c_state.selectedIndex = 0;
            }
            else if (this.pifuvo.state == 1) {
                this.c_state.selectedIndex = 1;
            }
            else {
                switch (this.pifuvo.roleCFG.getState) {
                    case 1:
                        this.c_state.selectedIndex = 3;
                        this.txt_need.text = this.pifuvo.hasnum + "/" + this.pifuvo.roleCFG.need;
                        break;
                    case 2:
                        this.c_state.selectedIndex = 4;
                        this.txt_need.text = this.pifuvo.roleCFG.need.toString();
                        break;
                    case 3:
                        this.c_state.selectedIndex = 2;
                        break;
                }
            }
        }
    };
    PifuItem.prototype.dispose = function () {
        this.off(Laya.Event.CLICK, this, this.btnclick);
        _super.prototype.dispose.call(this);
    };
    return PifuItem;
}(fairygui.GButton));
exports.default = PifuItem;
},{"../../configs/gameConfigs/PathConfig":10,"../../frameworks/mvc/MVCObjectPool":22,"../loading/view/WordTipsUtils":36,"./proxys/SkinProxy":51}],50:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../frameworks/mvc/BaseView");
var WindowAnmoType_1 = require("../../frameworks/mvc/WindowAnmoType");
var SkinProxy_1 = require("./proxys/SkinProxy");
var GameEvent_1 = require("../userinfo/events/GameEvent");
var UserInfoEvent_1 = require("../userinfo/events/UserInfoEvent");
var ResourceManager_1 = require("../../managers/ResourceManager");
var PathConfig_1 = require("../../configs/gameConfigs/PathConfig");
var RoleActions_1 = require("../scene3ds/RoleActions");
var UiManager_1 = require("../../managers/UiManager");
var RolesPool_1 = require("../scene3ds/RolesPool");
var MainRoleScript_1 = require("../modelScripts/MainRoleScript");
var SkinView = /** @class */ (function (_super) {
    __extends(SkinView, _super);
    function SkinView() {
        var _this = _super.call(this, "main", "skinview", false, WindowAnmoType_1.default.WindowAnmoType_none, 0) || this;
        _this._isdestorys = false;
        _this._out = new Laya.Quaternion;
        return _this;
    }
    SkinView.prototype.initView = function () {
        this._isdestorys = false;
        this.c_title = this.getControllerByBame("c_title");
        this._skinProxy = this.getProxy(SkinProxy_1.default);
        this.list_0.setVirtual();
        this.list_0.itemRenderer = Laya.Handler.create(this, this.itemlistrender, null, false);
        this.c_title.selectedIndex = 0;
        this.onchange();
        //添加3D场景
        this._ui3DScene = this.displayObject.addChildAt(new Laya.Scene3D(), 0);
        //添加照相机
        this._uicarma3D = (this._ui3DScene.addChild(new Laya.Camera(0, 0.1, 80)));
        // this._uicarma3D.clearColor = null;
        this._uicarma3D.viewport = new Laya.Viewport(this.x, this.y, this.width, this.height);
        this._uicarma3D.transform.translate(new Laya.Vector3(0, 1.2, 5), false);
        // //添加方向光
        // this._uilight = Scene3dObject.scene3D.addChild(new Laya.DirectionLight()) as Laya.DirectionLight;
        // this._uilight.color = new Laya.Vector3(0.6,0.6,0.6);
        // this._uilight.transform.worldMatrix.setForward(new Laya.Vector3(1, -1, 0));
        this.updateroleHandler();
    };
    SkinView.prototype.initEvent = function () {
        this.addListener(this.btn_close, Laya.Event.CLICK, this, this.onclosefun);
        this.addListener(this.c_title, fairygui.Events.STATE_CHANGED, this, this.onchange);
        this.addDataEvent(GameEvent_1.default.updateSKinView, this, this.onchange);
        this.addDataEvent(UserInfoEvent_1.default.userinfoEvent_updateroleid, this, this.updateroleHandler);
    };
    SkinView.prototype.updateroleHandler = function () {
        var roleVO = this._skinProxy.roleVO;
        this.removeRole();
        var pathArr = [];
        pathArr.push({ url: PathConfig_1.PathConfig.get3DRoleModel(roleVO.roleCfg.name) });
        ResourceManager_1.default.getInstance().loader3DArr(pathArr, this, this.loadcomplete, null, true, roleVO.roleCfg.name);
    };
    SkinView.prototype.loadcomplete = function (resousename) {
        var roleVO = this._skinProxy.roleVO;
        if (!this._isdestorys && this._ui3DScene && resousename == roleVO.roleCfg.name) {
            this._rolemo = RolesPool_1.default.addRoleByName(resousename, MainRoleScript_1.default, this._ui3DScene);
            this._rolemo.transform.position = new Laya.Vector3(0, 2, 0);
            Laya.Quaternion.createFromAxisAngle(new Laya.Vector3(0, 1, 0), -135 * 180 / Math.PI, this._out);
            this._rolemo.transform.rotation = this._out;
            this._rolemo.getComponent(MainRoleScript_1.default).setAction(RoleActions_1.default.stand);
        }
    };
    SkinView.prototype.removeRole = function () {
        if (this._rolemo) {
            var script = this._rolemo.getComponent(MainRoleScript_1.default);
            RolesPool_1.default.removeRole(this._rolemo, script.resouseName, script);
            this._rolemo = null;
        }
    };
    SkinView.prototype.onchange = function () {
        if (this.c_title.selectedIndex == 0) {
            this.list_0.numItems = this._skinProxy.pifuArr.length;
        }
        else {
            this.list_0.numItems = 0;
        }
    };
    SkinView.prototype.itemlistrender = function (index, item) {
        if (this.c_title.selectedIndex == 0) {
            if (index < this._skinProxy.pifuArr.length) {
                item.showData(this._skinProxy.pifuArr[index]);
            }
        }
    };
    SkinView.prototype.onclosefun = function () {
        UiManager_1.UiManager.instance.close(SkinView);
    };
    SkinView.prototype.destory = function () {
        this._isdestorys = true;
        this.removeRole();
        if (this._uicarma3D) {
            this._uicarma3D.destroy();
            this._uicarma3D = null;
        }
        if (this._ui3DScene) {
            this._ui3DScene.destroy();
            this._ui3DScene = null;
        }
        _super.prototype.destory.call(this);
    };
    SkinView.key = "SkinView";
    return SkinView;
}(BaseView_1.default));
exports.default = SkinView;
},{"../../configs/gameConfigs/PathConfig":10,"../../frameworks/mvc/BaseView":20,"../../frameworks/mvc/WindowAnmoType":25,"../../managers/ResourceManager":63,"../../managers/UiManager":66,"../modelScripts/MainRoleScript":43,"../scene3ds/RoleActions":46,"../scene3ds/RolesPool":47,"../userinfo/events/GameEvent":54,"../userinfo/events/UserInfoEvent":56,"./proxys/SkinProxy":51}],51:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseProxys_1 = require("../../../frameworks/mvc/BaseProxys");
var CacheManager_1 = require("../../../managers/CacheManager");
var UserCacheType_1 = require("../../userinfo/events/UserCacheType");
var PiFuVO_1 = require("../vo/PiFuVO");
var RoleCFG_1 = require("../../../configs/dataConfigs/RoleCFG");
var UiManager_1 = require("../../../managers/UiManager");
var SkinView_1 = require("../SkinView");
var WordTipsUtils_1 = require("../../loading/view/WordTipsUtils");
var GameEvent_1 = require("../../userinfo/events/GameEvent");
var UserInfoProxy_1 = require("../../userinfo/UserInfoProxy");
var SkinProxy = /** @class */ (function (_super) {
    __extends(SkinProxy, _super);
    function SkinProxy() {
        return _super.call(this) || this;
    }
    SkinProxy.prototype.initProxy = function () {
    };
    SkinProxy.prototype.init = function () {
        this.cachedata = CacheManager_1.default.getInstance().getCacheObj(UserCacheType_1.default.skin);
        var pifuData;
        if (!this.cachedata.hasOwnProperty("pifu")) {
            this.cachedata["pifu"] = {};
        }
        pifuData = this.cachedata["pifu"];
        this.pifuArr = [];
        this.pifuDict = {};
        var i = 0;
        var nums = RoleCFG_1.default.vec.length;
        for (i = 0; i < nums; i++) {
            var pifuvo = new PiFuVO_1.default;
            var cfg = RoleCFG_1.default.vec[i];
            pifuvo.roleCFG = cfg;
            var d = pifuData[cfg.id];
            if (d) {
                pifuvo.state = Number(d.state);
                pifuvo.hasnum = Number(d.hasnum);
            }
            else {
                pifuvo.state = 0;
                pifuvo.hasnum = 0;
            }
            if (cfg.getState == 0) {
                pifuvo.state = 1;
            }
            this.pifuArr.push(pifuvo);
            this.pifuDict[pifuvo.roleCFG.id] = pifuvo;
        }
    };
    SkinProxy.prototype.openview = function () {
        UiManager_1.UiManager.instance.add(SkinView_1.default);
    };
    SkinProxy.prototype.getSkin = function (pifu) {
        if (pifu.state == 1) {
            this.roleVO.roleid = pifu.roleCFG.id;
            this.dispacheDataEvent(GameEvent_1.default.updateSKinView);
        }
        else {
            switch (pifu.roleCFG.getState) {
                case 1: //视频获取
                    break;
                case 2: //金币购买
                    if (this.roleVO.Gold >= pifu.roleCFG.need) {
                        this.roleVO.roleid = pifu.roleCFG.id;
                        this.roleVO.Gold -= pifu.roleCFG.need;
                        pifu.state = 1;
                        this.addskinCache(pifu.roleCFG.id, pifu.state, pifu.hasnum);
                        this.dispacheDataEvent(GameEvent_1.default.updateSKinView);
                        WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("购买成功");
                        this.getProxy(UserInfoProxy_1.default).sendGoldSync();
                    }
                    else {
                        WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("金币不足");
                    }
                    break;
                case 3: //活动获取
                    break;
            }
        }
    };
    SkinProxy.prototype.addskinCache = function (id, state, hasnum) {
        this.cachedata["pifu"][id] = {};
        this.cachedata["pifu"][id]["state"] = state;
        this.cachedata["pifu"][id]["hasnum"] = hasnum;
        CacheManager_1.default.getInstance().addCacheObj(UserCacheType_1.default.skin, this.cachedata);
    };
    SkinProxy.key = "SkinProxy";
    return SkinProxy;
}(BaseProxys_1.default));
exports.default = SkinProxy;
},{"../../../configs/dataConfigs/RoleCFG":9,"../../../frameworks/mvc/BaseProxys":19,"../../../managers/CacheManager":59,"../../../managers/UiManager":66,"../../loading/view/WordTipsUtils":36,"../../userinfo/UserInfoProxy":53,"../../userinfo/events/GameEvent":54,"../../userinfo/events/UserCacheType":55,"../SkinView":50,"../vo/PiFuVO":52}],52:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PiFuVO = /** @class */ (function () {
    function PiFuVO() {
        /**
         * 0:未拥有，1：已经拥有
         */
        this.state = 0;
        this.hasnum = 0;
    }
    return PiFuVO;
}());
exports.default = PiFuVO;
},{}],53:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlatformEvent_1 = require("../../platform/events/PlatformEvent");
var BaseProxys_1 = require("../../frameworks/mvc/BaseProxys");
var PlayerAccount_1 = require("../../platform/wxminigame/WXSDK/PlayerAccount");
var Debuger_1 = require("../../frameworks/Debuger");
var NetworkManager_1 = require("../../platform/wxminigame/NetworkManager");
var UserInfoProxy = /** @class */ (function (_super) {
    __extends(UserInfoProxy, _super);
    function UserInfoProxy() {
        var _this = _super.call(this) || this;
        _this.hastilitime = 0;
        _this.isenterMainGame = false;
        return _this;
    }
    UserInfoProxy.prototype.initProxy = function () {
        this.addDataEvent(PlatformEvent_1.default.PlatformEvent_onAudioInterruptionEnd, this, this.audioInterruptionEnd);
    };
    UserInfoProxy.prototype.audioInterruptionEnd = function () {
        if (this.isenterMainGame) {
            // SoundssManager.getInstance().playbgSound( "gamebg" );
        }
    };
    UserInfoProxy.prototype.init = function () {
        this.roleVO.init();
    };
    UserInfoProxy.prototype.addLevel = function () {
        this.roleVO.addLevel();
    };
    UserInfoProxy.prototype.changeGold = function (value) {
        this.roleVO.Gold += value;
    };
    UserInfoProxy.prototype.sendGoldSync = function () {
        var agrs = [{ "t": PlayerAccount_1.PlayerAccount.CurrentAccount.ServerTime.toString() }, { "vmoney": this.roleVO.Gold.toString() }];
        Debuger_1.default.log("金币同步：", agrs);
        NetworkManager_1.NetworkManager.Instance.HttpPostRequest(NetworkManager_1.PROTOCOLS.usersync, agrs, new Laya.Handler(this, function (_data) {
        }), new Laya.Handler(this, function (_data) {
            console.log("游戏结果err");
        }));
    };
    UserInfoProxy.key = "UserInfoProxy";
    return UserInfoProxy;
}(BaseProxys_1.default));
exports.default = UserInfoProxy;
},{"../../frameworks/Debuger":12,"../../frameworks/mvc/BaseProxys":19,"../../platform/events/PlatformEvent":69,"../../platform/wxminigame/NetworkManager":71,"../../platform/wxminigame/WXSDK/PlayerAccount":74}],54:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameEvent = /** @class */ (function () {
    function GameEvent() {
    }
    GameEvent.removeselect = "GameEvent_removeselect";
    /**
     * 开始游戏
     */
    GameEvent.startGame = "GameEvent_startGame";
    /**
     * 结束游戏
     */
    GameEvent.endGame = "GameEvent_endGame";
    GameEvent.npcendGame = "GameEvent_npcendGame";
    /**
     * 暂停游戏
     */
    GameEvent.stopGame = "GameEvent_stopGame";
    /**
     * 通关成功
     */
    GameEvent.winGame = "GameEvent_winGame";
    /**
     * 通关失败
     */
    GameEvent.failGame = "GameEvent_failGame";
    GameEvent.jumpgame = "GameEvent_jumpgame";
    /**
     * 回到主界面
     */
    GameEvent.returnMainView = "returnMainView";
    GameEvent.updateSKinView = "GameEvent_updateSKinView";
    return GameEvent;
}());
exports.default = GameEvent;
},{}],55:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var UserCacheType = /** @class */ (function () {
    function UserCacheType() {
    }
    /******************************************************** */
    UserCacheType.lastDay = "lastDay";
    UserCacheType.nowdayShare = "dayshare";
    UserCacheType.nowdayVideo = "dayvideo";
    /**
     * 记录上次离开时间
     */
    UserCacheType.lasttime = "lasttime";
    UserCacheType.caplastflushtime = "captime";
    UserCacheType.capstorageappids = "capappids";
    UserCacheType.hasgetappids = "hasgetappids";
    /**
     * 角色信息
     */
    UserCacheType.roleData = "roleData";
    /********************************************************************** */
    UserCacheType.gold = "gold";
    UserCacheType.roleid = "roleid";
    UserCacheType.levelid = "levelid";
    /**
     * 皮肤
     */
    UserCacheType.skin = "skin";
    return UserCacheType;
}());
exports.default = UserCacheType;
},{}],56:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var UserInfoEvent = /** @class */ (function () {
    function UserInfoEvent() {
    }
    UserInfoEvent.UserInfoEvent_updateUserData = "UserInfoEvent_updateUserData";
    UserInfoEvent.userinfoEvent_updateroleid = "userinfoEvent_updateroleid";
    UserInfoEvent.userinfoEvent_levelid = "userinfoEvent_levelid";
    return UserInfoEvent;
}());
exports.default = UserInfoEvent;
},{}],57:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseVO_1 = require("../../../frameworks/vo/BaseVO");
var EventUtils_1 = require("../../../frameworks/events/EventUtils");
var UserInfoEvent_1 = require("../events/UserInfoEvent");
var CacheManager_1 = require("../../../managers/CacheManager");
var UserCacheType_1 = require("../events/UserCacheType");
var RoleCFG_1 = require("../../../configs/dataConfigs/RoleCFG");
var LevelCFG_1 = require("../../../configs/dataConfigs/LevelCFG");
var GameUtils_1 = require("../../../utils/GameUtils");
var PlayerAccount_1 = require("../../../platform/wxminigame/WXSDK/PlayerAccount");
var RoleVO = /** @class */ (function (_super) {
    __extends(RoleVO, _super);
    function RoleVO() {
        var _this = _super.call(this) || this;
        /**
         * 金币
         */
        _this._Gold = 0;
        _this._roleid = 0;
        _this._leveid = 0;
        _this._serverLevel = 0;
        _this.movespeed = 0;
        _this.frontjump = new Laya.Vector3;
        _this.leftjump = new Laya.Vector3;
        _this.rightjump = new Laya.Vector3;
        _this.upclimb = 0;
        _this.slideclimb = new Laya.Vector3;
        return _this;
    }
    RoleVO.getInstance = function () {
        if (!RoleVO._instance) {
            RoleVO._instance = new RoleVO;
        }
        return RoleVO._instance;
    };
    RoleVO.prototype.init = function () {
        var cachemanager = CacheManager_1.default.getInstance();
        var nowGold = Number(PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.GetUser(PlayerAccount_1.AccountUser.vmoney));
        this.Gold = nowGold; //cachemanager.getnum( UserCacheType.gold );
        this._roleid = cachemanager.getnum(UserCacheType_1.default.roleid);
        if (this.roleid == 0) {
            this.roleid = 1;
        }
        else {
            this.setRoleCFG();
        }
        // this._leveid = cachemanager.getnum( UserCacheType.levelid );
        this._serverLevel = Number(PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.GetUser(PlayerAccount_1.AccountUser.stage));
        // this._serverLevel = 9;
        this.updateLevel();
    };
    Object.defineProperty(RoleVO.prototype, "nowlevel", {
        get: function () {
            return this._leveid;
        },
        enumerable: true,
        configurable: true
    });
    RoleVO.prototype.getNowServerLevel = function () {
        return this._serverLevel + 1;
    };
    RoleVO.prototype.addLevel = function () {
        this._serverLevel++;
        this.updateLevel();
    };
    RoleVO.prototype.updateLevel = function () {
        var lv = this._serverLevel + 1;
        var allnums = LevelCFG_1.default.vec.length;
        if (lv > allnums) {
            var value = (lv - allnums) % (allnums - 2);
            if (value == 0) {
                this._leveid = allnums;
            }
            else {
                this._leveid = value + 2;
            }
        }
        else {
            this._leveid = lv;
        }
        this.levelcfg = LevelCFG_1.default.dict[this._leveid];
        this.levelmapArr = GameUtils_1.GameUtils.cutstrtoArr(this.levelcfg.road);
        EventUtils_1.EventUtils.dispatchEvent(UserInfoEvent_1.default.userinfoEvent_updateroleid);
    };
    RoleVO.prototype.setRoleCFG = function () {
        this.roleCfg = RoleCFG_1.default.dict[this._roleid];
        this.movespeed = this.roleCfg.speed;
        this.frontjump.x = Number(this.roleCfg.frontjump.x);
        this.frontjump.y = Number(this.roleCfg.frontjump.y);
        this.frontjump.z = Number(this.roleCfg.frontjump.z);
        this.leftjump.x = Number(this.roleCfg.leftjump.x);
        this.leftjump.y = Number(this.roleCfg.leftjump.y);
        this.leftjump.z = Number(this.roleCfg.leftjump.z);
        this.rightjump.x = Number(this.roleCfg.rightjump.x);
        this.rightjump.y = Number(this.roleCfg.rightjump.y);
        this.rightjump.z = Number(this.roleCfg.rightjump.z);
        this.upclimb = Number(this.roleCfg.upclimb);
        this.slideclimb.x = Number(this.roleCfg.slideclimb.x);
        this.slideclimb.y = Number(this.roleCfg.slideclimb.y);
        this.slideclimb.z = Number(this.roleCfg.slideclimb.z);
    };
    Object.defineProperty(RoleVO.prototype, "roleid", {
        get: function () {
            return this._roleid;
        },
        // public set leveid( value:number )
        // {
        //     if( this._leveid != value )
        //     {
        //         this._leveid = value;
        //         this.levelcfg = LevelCFG.dict[ this._leveid ];
        //         this.levelmapArr = GameUtils.cutstrtoArr(this.levelcfg.road);
        //         CacheManager.getInstance().addstr( UserCacheType.levelid,this._leveid.toString() );
        //         EventUtils.dispatchEvent( UserInfoEvent.userinfoEvent_updateroleid );
        //     }
        // }
        // public get leveid():number
        // {
        //     return this._leveid;
        // }
        set: function (value) {
            if (this._roleid != value) {
                this._roleid = value;
                this.setRoleCFG();
                CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.roleid, this._roleid.toString());
                EventUtils_1.EventUtils.dispatchEvent(UserInfoEvent_1.default.userinfoEvent_updateroleid);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RoleVO.prototype, "Gold", {
        get: function () {
            return this._Gold;
        },
        set: function (value) {
            if (this._Gold != value) {
                this._Gold = value;
                CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.gold, this._Gold.toString());
                EventUtils_1.EventUtils.dispatchEvent(UserInfoEvent_1.default.UserInfoEvent_updateUserData);
            }
        },
        enumerable: true,
        configurable: true
    });
    return RoleVO;
}(BaseVO_1.BaseVO));
exports.default = RoleVO;
},{"../../../configs/dataConfigs/LevelCFG":7,"../../../configs/dataConfigs/RoleCFG":9,"../../../frameworks/events/EventUtils":16,"../../../frameworks/vo/BaseVO":31,"../../../managers/CacheManager":59,"../../../platform/wxminigame/WXSDK/PlayerAccount":74,"../../../utils/GameUtils":87,"../events/UserCacheType":55,"../events/UserInfoEvent":56}],58:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ResourceManager_1 = require("./ResourceManager");
var PifuItem_1 = require("../gamemodule/skins/PifuItem");
var CpaDownsView_1 = require("../platform/wxminigame/WXSDK/cpa/CpaDownsView");
var CpaItem_1 = require("../platform/wxminigame/WXSDK/cpa/item/CpaItem");
var BaoKuanGameView_1 = require("../platform/wxminigame/WXSDK/cpa/BaoKuanGameView");
var ShiwantuijianView_1 = require("../platform/wxminigame/WXSDK/cpa/ShiwantuijianView");
/*
* name;
*/
var BinderManager = /** @class */ (function (_super) {
    __extends(BinderManager, _super);
    function BinderManager() {
        return _super.call(this) || this;
    }
    /**
     * 数据绑定
     */
    BinderManager.binderAll = function () {
        this.binderFairygui();
        this.binderGComponent();
    };
    /**
     * ui框架的绑定
     */
    BinderManager.binderFairygui = function () {
        fairygui.UIConfig.gameLoaderManager = ResourceManager_1.default.getInstance();
        //特效绑定( url 绑定组名，只有公共特效需要绑定 ) "ui://fqpgxr1kl6mw0":"effect1"
        fairygui.UIConfig.gameEffectDict = {};
    };
    /**
     * 组件绑定
     */
    BinderManager.binderGComponent = function () {
        //main
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2pwlk1a", PifuItem_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c527", CpaDownsView_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c528", CpaItem_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c529", BaoKuanGameView_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c52a", CpaItem_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c52b", ShiwantuijianView_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c52c", CpaItem_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2eksc21", CpaItem_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2eksc22", CpaItem_1.default);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c52e", CpaItem_1.default);
    };
    return BinderManager;
}(Laya.EventDispatcher));
exports.BinderManager = BinderManager;
},{"../gamemodule/skins/PifuItem":49,"../platform/wxminigame/WXSDK/cpa/BaoKuanGameView":78,"../platform/wxminigame/WXSDK/cpa/CpaDownsView":80,"../platform/wxminigame/WXSDK/cpa/ShiwantuijianView":83,"../platform/wxminigame/WXSDK/cpa/item/CpaItem":85,"./ResourceManager":63}],59:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("../Global");
var PlatfromType_1 = require("../platform/PlatfromType");
/*
* 本地数据缓存管理器
*/
var CacheManager = /** @class */ (function (_super) {
    __extends(CacheManager, _super);
    function CacheManager() {
        return _super.call(this) || this;
    }
    CacheManager.getInstance = function () {
        if (!this.instance) {
            this.instance = new CacheManager();
        }
        return this.instance;
    };
    CacheManager.prototype.init = function () {
    };
    /**
     * 添加本地缓存数据 object
     * @param key
     * @param value
     */
    CacheManager.prototype.addObj = function (key, value) {
        this.addCacheObj(key, value);
    };
    /**
     * 获取本地缓存数据 object
     * @param key
     */
    CacheManager.prototype.getObj = function (key) {
        return this.getCacheObj(key);
    };
    /**
     * 添加本地缓存数据 string
     * @param key
     * @param value
     */
    CacheManager.prototype.addstr = function (key, value) {
        this.addCacheStr(key, value);
    };
    CacheManager.prototype.addnum = function (key, value) {
        this.addCacheStr(key, value.toString());
    };
    /**
     * 获取本地缓存数据 string
     * @param key
     */
    CacheManager.prototype.getstr = function (key) {
        return this.getCachestr(key);
    };
    /**
     * 获取本地缓存数据 number
     * @param key
     */
    CacheManager.prototype.getnum = function (key) {
        return Number(this.getCachestr(key));
    };
    /**
     * 清理指定本地缓存数据
     * @param key
     */
    CacheManager.prototype.removeCache = function (key) {
        this.removeselectCache(key);
    };
    /**
     * 清理所有本地缓存数据
     */
    CacheManager.prototype.clearAll = function () {
        this.clearAllCache();
    };
    CacheManager.prototype.addCacheObj = function (key, value) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                this.setStorageSyncWX(key, value);
                break;
            default:
                Laya.LocalStorage.setJSON(key, value);
                break;
        }
    };
    CacheManager.prototype.getCacheObj = function (key) {
        var obj;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                obj = this.getStorageSyncWX(key);
                break;
            default:
                obj = Laya.LocalStorage.getJSON(key);
                break;
        }
        if (!obj) {
            obj = {};
        }
        return obj;
    };
    CacheManager.prototype.addCacheStr = function (key, value) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                this.setStorageSyncWX(key, value);
                break;
            default:
                Laya.LocalStorage.setItem(key, value);
                break;
        }
    };
    CacheManager.prototype.getCachestr = function (key) {
        var str = "0";
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                str = this.getStorageSyncWX(key);
                break;
            default:
                str = Laya.LocalStorage.getItem(key);
                break;
        }
        if (str == null || str == "") {
            str = "0";
        }
        return str;
    };
    CacheManager.prototype.removeselectCache = function (key) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                this.removeStorageWX(key);
                break;
            default:
                Laya.LocalStorage.removeItem(key);
                break;
        }
    };
    CacheManager.prototype.clearAllCache = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                this.clearStorageWX();
                break;
            default:
                Laya.LocalStorage.clear();
                break;
        }
    };
    /**
     * 本地存储
     * @param key
     * @param data
     */
    CacheManager.prototype.setStorageSyncWX = function (key, data) {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            wx.setStorageSync(key, data);
        }
    };
    /**
     * 获取本地存储
     * @param key
     */
    CacheManager.prototype.getStorageSyncWX = function (key) {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            return wx.getStorageSync(key);
        }
        return null;
    };
    /**
     * 从本地缓存中移除指定 key
     * @param key
     */
    CacheManager.prototype.removeStorageWX = function (key) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.removeStorage(key);
        }
    };
    /**
     * 清理存储数据
     */
    CacheManager.prototype.clearStorageWX = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.clearStorageSync();
        }
    };
    return CacheManager;
}(Laya.EventDispatcher));
exports.default = CacheManager;
},{"../Global":2,"../platform/PlatfromType":68}],60:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CacheManager_1 = require("./CacheManager");
var TimeUtils_1 = require("../utils/TimeUtils");
var UserCacheType_1 = require("../gamemodule/userinfo/events/UserCacheType");
var TimesTamper_1 = require("../frameworks/TimesTamper");
var DayManager = /** @class */ (function () {
    function DayManager() {
    }
    DayManager.getInstance = function () {
        if (!this._instance) {
            this._instance = new DayManager();
        }
        return this._instance;
    };
    DayManager.prototype.init = function () {
        var lastday = CacheManager_1.default.getInstance().getstr(UserCacheType_1.default.lastDay);
        var nowday = TimeUtils_1.TimeUtils.formatYearMonthDate1(TimesTamper_1.TimesTamper.getInstance().serverTime);
        if (lastday != nowday) {
            CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.lastDay, nowday);
            DayManager.isNewDay = true;
        }
        else {
            DayManager.isNewDay = false;
        }
    };
    return DayManager;
}());
exports.default = DayManager;
},{"../frameworks/TimesTamper":14,"../gamemodule/userinfo/events/UserCacheType":55,"../utils/TimeUtils":88,"./CacheManager":59}],61:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("../Global");
var LayerNotify_1 = require("../frameworks/notification/LayerNotify");
/*
* name;
*/
var GameLayerManager = /** @class */ (function (_super) {
    __extends(GameLayerManager, _super);
    function GameLayerManager() {
        var _this = _super.call(this) || this;
        /**
         * 背景层( 或者3D场景层 )
         */
        _this.background = new fairygui.GComponent();
        /**
         * ui层
         */
        _this.uiLayer = new fairygui.GComponent();
        /**
         * 最定层
         */
        _this.topLayer = new fairygui.GComponent();
        _this._uilayerZorder = 0;
        _this._upuilayerZorder = 200;
        _this._tipslayerZorder = 1000;
        _this._guidelayerZorder = 600;
        return _this;
    }
    GameLayerManager.getInstance = function () {
        if (!this._instance) {
            this._instance = new GameLayerManager();
        }
        return this._instance;
    };
    //初始化层级
    GameLayerManager.prototype.initlayer = function () {
        Global_1.Global.stage.addChild(fairygui.GRoot.inst.displayObject);
        fairygui.GRoot.inst.addChild(this.background);
        fairygui.GRoot.inst.addChild(this.uiLayer);
        fairygui.GRoot.inst.addChild(this.topLayer);
    };
    GameLayerManager.prototype.addtoLayer = function (itemview, layer) {
        if (layer == LayerNotify_1.LayerNotify.LAYER_BACKGROUND) {
            GameLayerManager.getInstance().background.addChild(itemview);
        }
        else if (layer == LayerNotify_1.LayerNotify.LAYER_UILAYER) {
            this._uilayerZorder++;
            GameLayerManager.getInstance().uiLayer.addChild(itemview);
            itemview.sortingOrder = this._uilayerZorder;
        }
        else if (layer == LayerNotify_1.LayerNotify.LAYER_UPUILAYER) {
            this._upuilayerZorder++;
            GameLayerManager.getInstance().uiLayer.addChild(itemview);
            itemview.sortingOrder = this._upuilayerZorder;
        }
        else if (layer == LayerNotify_1.LayerNotify.LAYER_TIPSLAYER) {
            // GameLayerManager.getInstance().tipsLayer.addChild(itemview);
            this._tipslayerZorder++;
            GameLayerManager.getInstance().uiLayer.addChild(itemview);
            itemview.sortingOrder = this._tipslayerZorder;
        }
        else if (layer == LayerNotify_1.LayerNotify.LAYER_GUIDELAYER) {
            this._guidelayerZorder++;
            GameLayerManager.getInstance().uiLayer.addChild(itemview);
            itemview.sortingOrder = this._guidelayerZorder;
        }
    };
    GameLayerManager.prototype.removeformLayer = function (layer) {
        switch (layer) {
            case LayerNotify_1.LayerNotify.LAYER_UILAYER:
                this._uilayerZorder--;
                if (this._uilayerZorder < 0) {
                    this._uilayerZorder = 0;
                }
                break;
            case LayerNotify_1.LayerNotify.LAYER_UPUILAYER:
                this._upuilayerZorder--;
                if (this._upuilayerZorder < 200) {
                    this._upuilayerZorder = 200;
                }
                break;
            case LayerNotify_1.LayerNotify.LAYER_TIPSLAYER:
                this._tipslayerZorder--;
                if (this._tipslayerZorder < 1000) {
                    this._tipslayerZorder = 1000;
                }
                break;
            case LayerNotify_1.LayerNotify.LAYER_GUIDELAYER:
                this._tipslayerZorder--;
                if (this._tipslayerZorder < 600) {
                    this._tipslayerZorder = 600;
                }
                break;
        }
    };
    return GameLayerManager;
}(Laya.EventDispatcher));
exports.GameLayerManager = GameLayerManager;
},{"../Global":2,"../frameworks/notification/LayerNotify":29}],62:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ResourceManager_1 = require("./ResourceManager");
var Debuger_1 = require("../frameworks/Debuger");
var CacheVO_1 = require("../frameworks/vo/CacheVO");
var ObjectPool_1 = require("../frameworks/mvc/ObjectPool");
var PathConfig_1 = require("../configs/gameConfigs/PathConfig");
var TimerService_1 = require("../frameworks/TimerService");
/*
* 资源管理器;
*/
var ResDataManager = /** @class */ (function () {
    function ResDataManager() {
        /**
         * 超过X分钟未被引用的资源，清理掉
         */
        this._clearTime = 60000;
        this._disUpdateTime = 30000;
        this._time = 0;
    }
    ResDataManager.getInastance = function () {
        if (null == this.instance) {
            this.instance = new ResDataManager();
        }
        return this.instance;
    };
    ResDataManager.prototype.init = function () {
        ObjectPool_1.default.register(CacheVO_1.default.poolkey, CacheVO_1.default);
        this._resourceurlPool = {};
        this._pkgPool = {};
        this.nocacheDict = { "loading": true, "main": true, "uicomponent": true };
        TimerService_1.default.getInastance().addUpdateTarget(this);
    };
    ResDataManager.prototype.update = function (dt) {
        this._time += dt;
        if (this._time > this._disUpdateTime) //1分钟检查一次
         {
            if (ResourceManager_1.default.instance.running) //如果当前在加载中，延时1秒检测
             {
                this._time -= 1000;
                return;
            }
            this.updateGroupPool();
            this._time = 0;
        }
    };
    ResDataManager.prototype.updateGroupPool = function () {
        var nowTime = Laya.Browser.now();
        var s;
        if (this._pkgPool) {
            var vo;
            for (s in this._pkgPool) {
                vo = this._pkgPool[s];
                if (vo.ref <= 0 && (nowTime - vo.time) > this._clearTime) {
                    this.removePackage(vo.packageName, true);
                    this.clearCacheVO(vo.packageName);
                }
            }
        }
        //清理图片缓存
        if (this._resourceurlPool) {
            var resourceurlPool = this._resourceurlPool;
            for (s in resourceurlPool) {
                if (resourceurlPool[s] <= 0) {
                    this.clearResByUrl(s, true);
                }
            }
        }
    };
    ResDataManager.prototype.addCacheVO = function (pkgname, isCache) {
        if (isCache && !this.nocacheDict.hasOwnProperty(pkgname)) {
            var vo;
            if (!this._pkgPool.hasOwnProperty(pkgname)) {
                vo = ObjectPool_1.default.getObj(CacheVO_1.default.poolkey);
                vo.packageName = pkgname;
                this._pkgPool[pkgname] = vo;
            }
            else {
                vo = this._pkgPool[pkgname];
            }
            vo.ref++;
            vo.time = Laya.Browser.now();
        }
    };
    ResDataManager.prototype.clearCacheVO = function (pkgName) {
        if (this._pkgPool[pkgName]) {
            var vo = this._pkgPool[pkgName];
            vo.clear();
            delete this._pkgPool[pkgName];
        }
    };
    /**
     * 添加ui包
     * @param pkgname 包名
     * @param isaddpackage 是否创建uipackage
     * @param isCache 是否添加到组缓存中（ 如果添加，则参与定时清理的逻辑,常驻资源请勿设置为ture ）
     */
    ResDataManager.prototype.adduiPackage = function (pkgname, isaddpackage, isCache) {
        if (isaddpackage === void 0) { isaddpackage = true; }
        if (isCache === void 0) { isCache = true; }
        if (isaddpackage) {
            if (pkgname == "main") {
                fairygui.UIPackage.addPackage(PathConfig_1.PathConfig.res + PathConfig_1.PathConfig.ui + pkgname, pkgname);
            }
            else {
                fairygui.UIPackage.addPackage(PathConfig_1.PathConfig.wxlocal + PathConfig_1.PathConfig.ui + pkgname, pkgname);
            }
        }
        this.addCacheVO(pkgname, isCache);
    };
    /**
     * 添加包
     * @param path 路径（ 事例：res/ui/ ）
     * @param pkgname 包名
     * @param isaddpackage 是否添加
     * @param isCache 是否缓存
     */
    ResDataManager.prototype.addPackage = function (path, pkgname, isaddpackage, isCache) {
        if (isaddpackage === void 0) { isaddpackage = true; }
        if (isCache === void 0) { isCache = true; }
        if (isaddpackage) {
            fairygui.UIPackage.addPackage(path + pkgname, pkgname);
        }
        this.addCacheVO(pkgname, isCache);
    };
    /**
     * 移除包
     * @param pkgname 包名
     * @param isclear 是否强制清除（ 如果为false则等待定时器判断清理，如果为true则强制清除 ）
     */
    ResDataManager.prototype.removePackage = function (pkgname, isclear) {
        if (isclear === void 0) { isclear = false; }
        if (pkgname == "" || pkgname == null) {
            return;
        }
        if (isclear) {
            Debuger_1.default.log("清理包资源缓存：" + pkgname);
            fairygui.UIPackage.removePackage(pkgname);
            if (this._pkgPool.hasOwnProperty(pkgname)) {
                delete this._pkgPool[pkgname];
            }
        }
        else {
            if (this._pkgPool.hasOwnProperty(pkgname)) {
                var vo = this._pkgPool[pkgname];
                if (vo) {
                    vo.ref--;
                }
            }
        }
    };
    ResDataManager.prototype.addeffectPackage = function (pkgname, isCache) {
        if (isCache === void 0) { isCache = true; }
        // Debuger.log("addeffectPackage:" + pkgname);
        // fairygui.UIPackage.addPackage(PathConfig.res + PathConfig.effects + pkgname,pkgname);
        // this.addCacheVO( pkgname,isCache );
    };
    ResDataManager.prototype.removeeffectpackage = function (pkgname, isclear) {
        if (isclear === void 0) { isclear = false; }
        Debuger_1.default.log("removeeffectpackage:" + pkgname);
        ResDataManager.getInastance().removePackage(pkgname, isclear);
    };
    /**
     * 获取已经加载过的数据
     * @param url 资源url
     * @param isCache 是否存储在缓存池中，默认为true
     */
    ResDataManager.prototype.getResByurl = function (url, isCache) {
        if (isCache === void 0) { isCache = true; }
        if (isCache) {
            if (this._resourceurlPool[url] == null) {
                this._resourceurlPool[url] = 0;
            }
            this._resourceurlPool[url]++;
        }
        return Laya.loader.getRes(url);
    };
    /**
     * 清理资源缓存(url)
     * @param url 要清理的资源url
     * @param isClear 对于缓存池中的数据，当引用为0时，是否直接强制清除（ 如果为false,则等待缓存定时刷新时候再去判断 ）
     */
    ResDataManager.prototype.clearResByUrl = function (url, isClear) {
        if (isClear === void 0) { isClear = false; }
        if (this._resourceurlPool.hasOwnProperty(url)) {
            if (isClear) {
                Debuger_1.default.log("clearResByUrl:" + url);
                Laya.loader.clearRes(url);
                delete this._resourceurlPool[url];
            }
            else {
                this._resourceurlPool[url]--;
            }
        }
        else {
            Laya.loader.clearRes(url);
        }
    };
    /**
     * 清理资源缓存(Array)
     * @param urls 资源数组
     * @param packageName 包名
     */
    ResDataManager.prototype.clearResByArrUrls = function (urls, packageName) {
        if (packageName === void 0) { packageName = ""; }
        if (packageName != "") {
            fairygui.UIPackage.removePackage(packageName);
        }
        for (var s in urls) {
            this.clearResByUrl(urls[s].url, true);
        }
    };
    return ResDataManager;
}());
exports.default = ResDataManager;
},{"../configs/gameConfigs/PathConfig":10,"../frameworks/Debuger":12,"../frameworks/TimerService":13,"../frameworks/mvc/ObjectPool":23,"../frameworks/vo/CacheVO":32,"./ResourceManager":63}],63:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var Handler = Laya.Handler;
var Debuger_1 = require("../frameworks/Debuger");
var EventUtils_1 = require("../frameworks/events/EventUtils");
var RecConfigs_1 = require("../configs/gameConfigs/RecConfigs");
var ResourceManager = /** @class */ (function (_super) {
    __extends(ResourceManager, _super);
    function ResourceManager() {
        var _this = _super.call(this) || this;
        _this._groupIndex = 0;
        _this.running = false;
        /**
         * 要加载的总数量
         */
        _this._loadNum = 0;
        /**
         * 已经加载的数量
         */
        _this._loadedNum = 0;
        _this._preloadNum = 0;
        _this._cut = 0;
        _this._nowLoadArr = null;
        return _this;
    }
    ResourceManager.getInstance = function () {
        if (this.instance == null) {
            this.instance = new ResourceManager();
        }
        return this.instance;
    };
    ResourceManager.prototype.init = function () {
        this._configs = new Array();
        this._groups = {};
        Laya.loader.retryNum = 4;
        Laya.loader.on(Laya.Event.ERROR, this, this.onError);
        Laya.loader.on("errorsMsg", this, this.errorsMsghandler);
        Laya.loader.on("gameerrorsMsg", this, this.gameerrorsMsghandler);
    };
    ResourceManager.prototype.onLoadConfigComplete = function () {
        if (this._onConfigCompleteTarget != null && this._onConfigComplete != null) {
            this._onConfigComplete.call(this._onConfigCompleteTarget);
        }
    };
    ResourceManager.prototype.errorsMsghandler = function (msg) {
        Debuger_1.default.log("errorsMsghandler", msg);
        EventUtils_1.EventUtils.dispatchEvent("loadfailEvent", msg);
    };
    ResourceManager.prototype.gameerrorsMsghandler = function (msg) {
        EventUtils_1.EventUtils.dispatchEvent("gameserrosEvent", msg);
    };
    /**
     * 加载资源组
     * @param groupName 组名
     * @param onResourceLoadTarget 作用域
     * @param ResourceLoadComplete 完成事件
     * @param onResourceProgress   加载进度事件
     * @param isShow               是否显示加载状态
     */
    ResourceManager.prototype.loadGroup = function (groupName, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, isShow, args) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (isShow === void 0) { isShow = true; }
        if (args === void 0) { args = null; }
        // Debuger.log(groupName);
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = RecConfigs_1.default.getInstance().groupdict[groupName];
        data.isShow = isShow;
        data.args = args;
        data.type = "group";
        data.resouseType = "2D";
        this._configs.push(data);
        this.loadStart();
    };
    /**
     * 加载单个资源
     * @param url 资源url
     * @param type 资源类型
     * @param onResourceLoadTarget 作用域
     * @param ResourceLoadComplete 完成事件
     * @param onResourceProgress 加载进度事件
     * @param isShow 是否显示加载状态
     */
    ResourceManager.prototype.Loader = function (url, type, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, isShow, args) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (isShow === void 0) { isShow = true; }
        if (args === void 0) { args = null; }
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = [{ url: url, type: type }];
        data.isShow = isShow;
        data.args = args;
        data.type = "single";
        data.resouseType = "2D";
        this._configs.push(data);
        this.loadStart();
    };
    /**
     * 加载数组资源
     * @param urls
     * @param onResourceLoadTarget
     * @param ResourceLoadComplete
     * @param onResourceProgress
     * @param isShow
     */
    ResourceManager.prototype.Loaders = function (urls, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, isShow, args) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (isShow === void 0) { isShow = true; }
        if (args === void 0) { args = null; }
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = urls;
        data.isShow = isShow;
        data.type = "arr";
        data.args = args;
        data.resouseType = "2D";
        this._configs.push(data);
        this.loadStart();
    };
    /**
     * 加载资源数组，此加载方法会单个加载数组内的资源，用于显示两个进度条（ 一个总进度条，一个单个资源进度条 ）
     * @param urls
     * @param onResourceLoadTarget
     * @param ResourceLoadComplete
     * @param onResourceProgress
     * @param isShow
     */
    ResourceManager.prototype.loaderArr = function (urls, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, cut) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (cut === void 0) { cut = 3; }
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = urls;
        data.isShow = false;
        data.type = "loaderArr";
        data.cut = cut;
        data.resouseType = "2D";
        this._configs.push(data);
        this.startLoad1();
    };
    ResourceManager.prototype.startLoad1 = function () {
        if (!this.running && this._configs.length > 0) {
            this._nowLoadData = this._configs.shift();
            this._nowLoadArr = this._nowLoadData.urls.concat().reverse();
            this._loadNum = this._nowLoadArr.length;
            this._loadedNum = 0;
            this._preloadNum = this._loadedNum;
            this._cut = Number(this._nowLoadData.cut);
            this.loadStart1();
        }
    };
    ResourceManager.prototype.loadStart1 = function () {
        if (this.running) {
            return;
        }
        if (this._nowLoadArr && this._nowLoadArr.length > 0) {
            this.running = true;
            var needArr;
            if (this._nowLoadArr.length > this._cut) {
                needArr = this._nowLoadArr.splice(0, this._cut);
            }
            else {
                needArr = this._nowLoadArr.splice(0);
            }
            this._cut = needArr.length;
            this._preloadNum = this._loadedNum;
            this.onLoadingArr(0);
            var resouseType = this._nowLoadData.resouseType;
            if (resouseType == "2D" || resouseType == null) {
                Laya.loader.load(needArr, Handler.create(this, this.onLoadCompleteArr), Handler.create(this, this.onLoadingArr, null, false));
            }
            else {
                Laya.loader.create(needArr, Handler.create(this, this.onLoadCompleteArr), Handler.create(this, this.onLoadingArr, null, false));
            }
        }
        else {
            this._nowLoadData = null;
            this.startLoad1();
        }
    };
    ResourceManager.prototype.onLoadingArr = function (value) {
        this._loadedNum = this._preloadNum + value * this._cut;
        if (this._nowLoadData) {
            var allvalue = Math.ceil((this._loadedNum / this._loadNum) * 100);
            if (this._nowLoadData.progress != null) {
                this._nowLoadData.progress.call(this._nowLoadData.completeTarget, allvalue, Math.floor(value * 100));
            }
        }
    };
    ResourceManager.prototype.onLoadCompleteArr = function () {
        this.onLoadingArr(1);
        this._loadedNum = this._preloadNum + this._cut;
        this.running = false;
        if (this._loadedNum == this._loadNum) {
            if (this._nowLoadData && this._nowLoadData.complete) {
                this._nowLoadData.complete.call(this._nowLoadData.completeTarget);
            }
        }
        Laya.timer.callLater(this, this.loadStart1);
        // this.loadStart1();
    };
    ResourceManager.prototype.loadStart = function () {
        if (this.running || this._configs.length == 0) {
            return;
        }
        this.running = true;
        this._nowLoadData = this._configs[0];
        var arr = this._nowLoadData.urls;
        var isShow = this._nowLoadData.isShow;
        if (isShow) {
            fairygui.GRoot.inst.showModalWait();
        }
        var resouseType = this._nowLoadData.resouseType;
        if (arr != null) {
            if (resouseType == "2D" || resouseType == null) {
                Laya.loader.load(arr, Handler.create(this, this.onLoadComplete), Handler.create(this, this.onLoading, null, false));
            }
            else {
                Laya.loader.create(arr, Handler.create(this, this.onLoadComplete), Handler.create(this, this.onLoading, null, false));
            }
        }
    };
    // 加载进度侦听器
    ResourceManager.prototype.onLoading = function (progress) {
        if (this._nowLoadData) {
            progress = Math.ceil(Number(progress * 100));
            if (this._nowLoadData.progress != null) {
                this._nowLoadData.progress.call(this._nowLoadData.completeTarget, progress);
            }
        }
    };
    ResourceManager.prototype.onLoadComplete = function (args) {
        if (args === void 0) { args = null; }
        fairygui.GRoot.inst.closeModalWait();
        if (this._nowLoadData && this._nowLoadData.complete) {
            if (this._nowLoadData.args) {
                this._nowLoadData.complete.call(this._nowLoadData.completeTarget, this._nowLoadData.args);
            }
            else {
                this._nowLoadData.complete.call(this._nowLoadData.completeTarget);
            }
        }
        this.running = false;
        this._nowLoadData = null;
        this._configs.shift();
        this.loadStart();
    };
    ResourceManager.prototype.onError = function (err) {
        fairygui.GRoot.inst.closeModalWait();
        Debuger_1.default.log("加载失败: " + err);
    };
    /**
     * 加载3D单个资源
     * @param url 资源url
     * @param type 资源类型
     * @param onResourceLoadTarget 作用域
     * @param ResourceLoadComplete 完成事件
     * @param onResourceProgress 加载进度事件
     * @param isShow 是否显示加载状态
     */
    ResourceManager.prototype.Loader3D = function (url, type, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, isShow) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (isShow === void 0) { isShow = true; }
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = [{ url: url, type: type }];
        data.isShow = isShow;
        data.type = "single";
        data.resouseType = "3D";
        this._configs.push(data);
        this.loadStart();
    };
    /**
     * 加载3D资源组
     * @param groupName 组名
     * @param onResourceLoadTarget 作用域
     * @param ResourceLoadComplete 完成事件
     * @param onResourceProgress   加载进度事件
     * @param isShow               是否显示加载状态
     */
    ResourceManager.prototype.loadGroup3D = function (groupName, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, isShow, args) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (isShow === void 0) { isShow = true; }
        if (args === void 0) { args = null; }
        Debuger_1.default.log(groupName);
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = RecConfigs_1.default.getInstance().groupdict[groupName];
        data.isShow = isShow;
        data.args = args;
        data.type = "group";
        data.resouseType = "3D";
        this._configs.push(data);
        this.loadStart();
    };
    /**
     * 加载资源数组，此加载方法会单个加载数组内的资源，用于显示两个进度条（ 一个总进度条，一个单个资源进度条 ）
     * @param urls
     * @param onResourceLoadTarget
     * @param ResourceLoadComplete
     * @param onResourceProgress
     * @param isShow
     */
    ResourceManager.prototype.loader3DArr = function (urls, onResourceLoadTarget, ResourceLoadComplete, onResourceProgress, isshow, args) {
        if (onResourceProgress === void 0) { onResourceProgress = null; }
        if (isshow === void 0) { isshow = false; }
        if (args === void 0) { args = null; }
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = urls;
        data.isShow = isshow;
        data.args = args;
        data.type = "loaderArr";
        data.resouseType = "3D";
        this._configs.push(data);
        this.loadStart();
    };
    /**
     * 加载特效
     * @param groupName
     * @param onResourceLoadTarget
     * @param ResourceLoadComplete
     * @param args
     */
    ResourceManager.prototype.loadEffect = function (groupName, onResourceLoadTarget, ResourceLoadComplete, args) {
        if (args === void 0) { args = null; }
        var urls = RecConfigs_1.default.getInstance().groupdict[groupName];
        if (urls && urls.length > 0) {
            Laya.loader.load(urls, Handler.create(onResourceLoadTarget, ResourceLoadComplete, [args]));
        }
    };
    return ResourceManager;
}(Laya.EventDispatcher));
exports.default = ResourceManager;
},{"../configs/gameConfigs/RecConfigs":11,"../frameworks/Debuger":12,"../frameworks/events/EventUtils":16}],64:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameLayerManager_1 = require("./GameLayerManager");
var PathConfig_1 = require("../configs/gameConfigs/PathConfig");
var CamerasScript_1 = require("../gamemodule/modelScripts/CamerasScript");
var Scene3dObject_1 = require("../gamemodule/scene3ds/Scene3dObject");
var MainRoleScript_1 = require("../gamemodule/modelScripts/MainRoleScript");
var EventUtils_1 = require("../frameworks/events/EventUtils");
var GameEvent_1 = require("../gamemodule/userinfo/events/GameEvent");
var Debuger_1 = require("../frameworks/Debuger");
var UserInfoProxy_1 = require("../gamemodule/userinfo/UserInfoProxy");
var MVCObjectPool_1 = require("../frameworks/mvc/MVCObjectPool");
var GameUtils_1 = require("../utils/GameUtils");
var NpcCFG_1 = require("../configs/dataConfigs/NpcCFG");
var NpcScript_1 = require("../gamemodule/modelScripts/NpcScript");
var ResourceManager_1 = require("./ResourceManager");
var GameCFG_1 = require("../configs/dataConfigs/GameCFG");
var RoleActions_1 = require("../gamemodule/scene3ds/RoleActions");
var UserInfoEvent_1 = require("../gamemodule/userinfo/events/UserInfoEvent");
var RolesPool_1 = require("../gamemodule/scene3ds/RolesPool");
var Scene3DManager = /** @class */ (function () {
    function Scene3DManager() {
        this._initPosY = 1;
    }
    Scene3DManager.getInstance = function () {
        if (!this._instance) {
            this._instance = new Scene3DManager();
        }
        return this._instance;
    };
    Scene3DManager.prototype.initGame = function () {
        var backgroundParent = GameLayerManager_1.GameLayerManager.getInstance().background.displayObject;
        var scenebg = fairygui.UIPackage.createObject("main", "sky");
        backgroundParent.addChild(scenebg.displayObject);
        scenebg.setScale(2.5, 2.5);
        scenebg.y = -200;
        var scenebg1 = fairygui.UIPackage.createObject("main", "sky_down");
        backgroundParent.addChild(scenebg1.displayObject);
        scenebg1.setScale(2.5, 2.5);
        scenebg1.y = scenebg.y + 740;
        //添加3D场景
        Scene3dObject_1.default.scene3D = backgroundParent.addChild(new Laya.Scene3D());
        Scene3dObject_1.default.scene3D.physicsSimulation.continuousCollisionDetection = true;
        //添加照相机
        Scene3dObject_1.default.carma = (Scene3dObject_1.default.scene3D.addChild(new Laya.Camera(0, 0.1, 70)));
        this.cameraScript = Scene3dObject_1.default.carma.addComponent(CamerasScript_1.default);
        Scene3dObject_1.default.carma.clearFlag = Laya.BaseCamera.CLEARFLAG_DEPTHONLY;
        //添加方向光
        var directionLight = Laya.Loader.getRes(PathConfig_1.PathConfig.get3DModel("DirectionalLight")); //Scene3dObject.scene3D.addChild(new Laya.DirectionLight()) as Laya.DirectionLight;
        Scene3dObject_1.default.scene3D.addChild(directionLight);
        // directionLight.transform.worldMatrix.setForward(new Laya.Vector3(1, -1, 0));
        // var directionLight: Laya.DirectionLight = Scene3dObject.scene3D.addChild(new Laya.DirectionLight()) as Laya.DirectionLight;
        // directionLight.color = new Laya.Vector3(1,1,1);
        // directionLight.intensity = 0.5;
        // directionLight.transform.worldMatrix.setForward(new Laya.Vector3(1, -1, 0));
        Scene3dObject_1.default.startPlane = Laya.Loader.getRes(PathConfig_1.PathConfig.get3DModel("startPlane"));
        Scene3dObject_1.default.scene3D.addChild(Scene3dObject_1.default.startPlane);
        Scene3dObject_1.default.endPlane = Laya.Loader.getRes(PathConfig_1.PathConfig.get3DModel("endPlane"));
        Scene3dObject_1.default.scene3D.addChild(Scene3dObject_1.default.endPlane);
        // Scene3dObject.bgsprite3d = Laya.Loader.getRes(PathConfig.get3DModel("distantview"));
        // Scene3dObject.scene3D.addChild(Scene3dObject.bgsprite3d);
        //雾化代码
        Scene3dObject_1.default.scene3D.enableFog = true;
        //设置雾化的颜色
        var fogArr = GameUtils_1.GameUtils.cutstrtoArr(GameCFG_1.default.dict[2].value);
        if (GameCFG_1.default.dict[8]) {
            var wucolor = GameUtils_1.GameUtils.cutstrtoArr(GameCFG_1.default.dict[8].value);
            Scene3dObject_1.default.scene3D.fogColor = new Laya.Vector3(Number(wucolor[0]), Number(wucolor[1]), Number(wucolor[2]));
        }
        else {
            Scene3dObject_1.default.scene3D.fogColor = new Laya.Vector3(0, 0, 0.6);
        }
        //设置雾化的起始位置，相对于相机的距离
        var valueArr = GameUtils_1.GameUtils.cutstrtoArr(GameCFG_1.default.dict[3].value);
        Scene3dObject_1.default.scene3D.fogStart = Number(valueArr[0]);
        //设置雾化最浓处的距离。
        Scene3dObject_1.default.scene3D.fogRange = Number(valueArr[1]);
        this.showScene();
        this.initEvent();
    };
    Scene3DManager.prototype.initLizi = function () {
    };
    Scene3DManager.prototype.showScene = function () {
        var pathArr = [];
        var urlArr = [];
        this.cameraScript.iscanfollow = true;
        var roleVO = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default).roleVO;
        var arr = roleVO.levelmapArr;
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            if (urlArr.indexOf(PathConfig_1.PathConfig.get3DModel(arr[i])) == -1) {
                urlArr.push(PathConfig_1.PathConfig.get3DModel(arr[i]));
            }
        }
        var npcArr = roleVO.levelcfg.npc;
        for (i = 0; i < npcArr.length; i++) {
            if (urlArr.indexOf(PathConfig_1.PathConfig.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name)) == -1) {
                urlArr.push(PathConfig_1.PathConfig.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name));
            }
        }
        for (i = 0; i < urlArr.length; i++) {
            pathArr.push({ url: urlArr[i] });
        }
        ResourceManager_1.default.getInstance().loader3DArr(pathArr, this, this.load3Dcomplete, null, true);
    };
    Scene3DManager.prototype.load3Dcomplete = function () {
        this.updateMap();
        this.createMainRole();
        this.createNpc();
    };
    Scene3DManager.prototype.initEvent = function () {
        EventUtils_1.EventUtils.addEventListener(GameEvent_1.default.startGame, this, this.startGameHandler);
        EventUtils_1.EventUtils.addEventListener(GameEvent_1.default.jumpgame, this, this.jumphandler);
        EventUtils_1.EventUtils.addEventListener(UserInfoEvent_1.default.userinfoEvent_updateroleid, this, this.updateroleModelHandler);
    };
    Scene3DManager.prototype.updateroleModelHandler = function () {
        var userinfoProxy = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default);
        var rolevo = userinfoProxy.roleVO;
        var pathArr = [];
        pathArr.push({ url: PathConfig_1.PathConfig.get3DRoleModel(rolevo.roleCfg.name) });
        ResourceManager_1.default.getInstance().loader3DArr(pathArr, this, this.loadrolecomplete, null, true, PathConfig_1.PathConfig.get3DModel(rolevo.roleCfg.name));
    };
    Scene3DManager.prototype.loadrolecomplete = function (url) {
        var userinfoProxy = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default);
        var rolevo = userinfoProxy.roleVO;
        if (PathConfig_1.PathConfig.get3DModel(rolevo.roleCfg.name) == url) {
            this.createMainRole();
        }
    };
    Scene3DManager.prototype.jumphandler = function () {
        this.mainRoleScript.ceshitiaoyue();
    };
    Scene3DManager.prototype.startGameHandler = function () {
        this.mainRoleScript.startRun();
        var npcdict = Scene3dObject_1.default.npcscriptDict;
        for (var s in npcdict) {
            var npcscript = npcdict[s];
            npcscript.startRun();
        }
    };
    Scene3DManager.prototype.removeNowRole = function () {
        if (Scene3dObject_1.default.mainRole && this.mainRoleScript) {
            RolesPool_1.default.removeRole(Scene3dObject_1.default.mainRole, this.mainRoleScript.resouseName, this.mainRoleScript);
            this.mainRoleScript = null;
            Scene3dObject_1.default.mainRole = null;
        }
    };
    //创建主角
    Scene3DManager.prototype.createMainRole = function () {
        var userinfoProxy = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default);
        var rolevo = userinfoProxy.roleVO;
        var iscreate = false;
        if (!Scene3dObject_1.default.mainRole) {
            iscreate = true;
        }
        else if (Scene3dObject_1.default.mainRole.name != "role_" + rolevo.roleCfg.name) {
            iscreate = true;
            this.removeNowRole();
        }
        if (iscreate) {
            // var sp:Laya.Sprite3D = Laya.Loader.getRes(PathConfig.get3DRoleModel(rolevo.roleCfg.name)) as Laya.Sprite3D;
            // Scene3dObject.mainRole = Laya.Sprite3D.instantiate(sp, Scene3dObject.scene3D, false,new Laya.Vector3( 0,0,0 )) as Laya.Sprite3D;
            Scene3dObject_1.default.mainRole = RolesPool_1.default.addRoleByName(rolevo.roleCfg.name, MainRoleScript_1.default, Scene3dObject_1.default.scene3D);
            Scene3dObject_1.default.mainRole.name = "role_" + rolevo.roleCfg.name;
            this.mainRoleScript = Scene3dObject_1.default.mainRole.getComponent(MainRoleScript_1.default);
            // this.mainRoleScript.resouseName = rolevo.roleCfg.name;
            // if(  )
            // this.mainRoleScript = Scene3dObject.mainRole.addComponent( MainRAoleScript );
        }
        var info = rolevo.levelcfg.roleinitpos;
        var chidarr = GameUtils_1.GameUtils.cutstrtoArr(info.offsetPos);
        var offsetPos = new Laya.Vector3(Number(chidarr[0]), Number(chidarr[1]), Number(chidarr[2]));
        var posVec = new Laya.Vector3;
        var selectVec;
        if (info.initbuild == "startPlane") {
            posVec.x = Scene3dObject_1.default.startPlane.transform.position.x + offsetPos.x;
            posVec.y = Scene3dObject_1.default.startPlane.transform.position.y + offsetPos.y;
            posVec.z = Scene3dObject_1.default.startPlane.transform.position.z + offsetPos.z;
            selectVec = Scene3dObject_1.default.startPlane.getChildByName("child_pos").transform.position;
        }
        else {
            var childpos = Scene3dObject_1.default.getPosVecbyScene(rolevo.levelmapArr[0], info.initbuild);
            posVec.x = childpos.x + offsetPos.x;
            posVec.y = childpos.y + offsetPos.y;
            posVec.z = childpos.z + offsetPos.z;
            selectVec = childpos;
        }
        Scene3dObject_1.default.mainRole.transform.position = posVec;
        this.cameraScript.initPos(Scene3dObject_1.default.mainRole.transform.position);
        this.mainRoleScript.setnowSelectVec(selectVec);
        this.mainRoleScript.nowState = RoleActions_1.default.stand;
        this.mainRoleScript.setAction(RoleActions_1.default.stand);
    };
    Scene3DManager.prototype.removeAllNpc = function () {
        var npcdict = Scene3dObject_1.default.npcDict;
        var s;
        for (s in npcdict) {
            var sp = npcdict[s];
            var npcscript = Scene3dObject_1.default.npcscriptDict[s];
            var resousename = npcscript.resouseName;
            RolesPool_1.default.removeRole(sp, resousename, npcscript);
            delete Scene3dObject_1.default.npcscriptDict[s];
            delete npcdict[s];
        }
    };
    //创建npc
    Scene3DManager.prototype.createNpc = function () {
        this.removeAllNpc();
        var userinfoProxy = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default);
        var rolevo = userinfoProxy.roleVO;
        var arr = rolevo.levelcfg.npc;
        var childdict;
        var index = 0;
        Scene3dObject_1.default.npcnum = arr.length;
        for (var s in arr) {
            childdict = arr[s];
            var selectVec = null;
            var npccfg = NpcCFG_1.default.dict[childdict.id];
            var sp = Laya.Loader.getRes(PathConfig_1.PathConfig.get3DRoleModel(npccfg.name));
            var chidarr = GameUtils_1.GameUtils.cutstrtoArr(childdict.offsetPos);
            var offsetPos = new Laya.Vector3(Number(chidarr[0]), Number(chidarr[1]), Number(chidarr[2]));
            var posVec = new Laya.Vector3;
            if (childdict.scene == "startPlane") {
                posVec.x = Scene3dObject_1.default.startPlane.transform.position.x + offsetPos.x;
                posVec.y = Scene3dObject_1.default.startPlane.transform.position.y + 1 + offsetPos.y;
                posVec.z = Scene3dObject_1.default.startPlane.transform.position.z + offsetPos.z;
                selectVec = Scene3dObject_1.default.startPlane.getChildByName("child_pos").transform.position;
            }
            else {
                var childpos = Scene3dObject_1.default.getPosVecbyScene(childdict.scene, childdict.initbuild);
                posVec.x = childpos.x + offsetPos.x;
                posVec.y = childpos.y + offsetPos.y;
                posVec.z = childpos.z + offsetPos.z;
                selectVec = childpos;
            }
            var npcsp = RolesPool_1.default.addRoleByName(npccfg.name, NpcScript_1.default, Scene3dObject_1.default.scene3D);
            npcsp.name = "npc_" + index;
            npcsp.transform.position = posVec;
            var npcscript = npcsp.getComponent(NpcScript_1.default);
            npcscript.setnowSelectVec(selectVec);
            npcscript.setnpcCFG(npccfg);
            Scene3dObject_1.default.npcDict[npcsp.name] = npcsp;
            Scene3dObject_1.default.npcscriptDict[npcsp.name] = npcscript;
            npcscript.setAction(RoleActions_1.default.stand);
            index++;
        }
    };
    Scene3DManager.prototype.updateMap = function () {
        var userinfoProxy = MVCObjectPool_1.default.getInstance().getProxy(UserInfoProxy_1.default);
        var rolevo = userinfoProxy.roleVO;
        var nowlevelcfg = rolevo.levelcfg;
        var mapArr = rolevo.levelmapArr;
        var mapSprite3D;
        var mapname;
        var _lastmapSprite3D;
        for (var s in Scene3dObject_1.default.nowmapDict) {
            Scene3dObject_1.default.nowmapDict[s].active = false;
        }
        for (var i = 0; i < mapArr.length; i++) {
            mapname = mapArr[i];
            if (Scene3dObject_1.default.nowmapDict[mapname]) {
                mapSprite3D = Scene3dObject_1.default.nowmapDict[mapname];
                mapSprite3D.active = true;
            }
            else {
                var sp = Laya.Loader.getRes(PathConfig_1.PathConfig.get3DModel(mapname));
                mapSprite3D = Laya.Sprite3D.instantiate(sp, Scene3dObject_1.default.scene3D, false, null);
                Scene3dObject_1.default.nowmapDict[mapname] = mapSprite3D;
            }
            if (i == 0) {
                var arr = GameUtils_1.GameUtils.cutstrtoArr(nowlevelcfg.firstScenepos);
                mapSprite3D.transform.position = new Laya.Vector3(Number(arr[0]), Number(arr[1]), Number(arr[2]));
            }
            else {
                var endPos = _lastmapSprite3D.getChildByName("END").transform.position.clone();
                endPos.x = 0;
                endPos.y = 0;
                mapSprite3D.transform.position = endPos;
            }
            this.addPatternChildPos(mapSprite3D);
            _lastmapSprite3D = mapSprite3D;
            var endPos1 = mapSprite3D.getChildByName("END").transform.position.clone();
            endPos1.z += Number(GameCFG_1.default.dict[6].value);
            Scene3dObject_1.default.endPlane.transform.position = endPos1;
            Scene3dObject_1.default.gamewinPosZ = endPos1.z;
            Scene3dObject_1.default.gamewinPosZ -= 2;
            // Scene3dObject.bgsprite3d.transform.position = new Laya.Vector3( 0,-20,-40 );
        }
    };
    Scene3DManager.prototype.addPatternChildPos = function (mapSprite3D) {
        if (Scene3dObject_1.default.patternDict[mapSprite3D.name]) {
            delete Scene3dObject_1.default.patternDict[mapSprite3D.name];
        }
        Debuger_1.default.log("绑定MapPatternPos");
        var BlocksSprite = mapSprite3D.getChildByName("Blocks");
        var chiddict = {};
        var chidsp;
        var buildSp;
        var index = 0;
        while (BlocksSprite.getChildByName("build_all_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_all_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_all_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        while (BlocksSprite.getChildByName("build_front_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_front_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_front_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        while (BlocksSprite.getChildByName("build_left_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_left_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_left_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        while (BlocksSprite.getChildByName("build_right_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_right_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_right_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        while (BlocksSprite.getChildByName("build_frontleft_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_frontleft_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_frontleft_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        while (BlocksSprite.getChildByName("build_frontright_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_frontright_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_frontright_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        while (BlocksSprite.getChildByName("build_leftright_" + index)) {
            buildSp = BlocksSprite.getChildByName("build_leftright_" + index);
            chidsp = buildSp.getChildByName("child_pos");
            chiddict["build_leftright_" + index] = chidsp.transform.position;
            if (Scene3dObject_1.default.diePosY > buildSp.transform.position.y) {
                Scene3dObject_1.default.diePosY = buildSp.transform.position.y;
            }
            index++;
        }
        index = 0;
        var Props = mapSprite3D.getChildByName("Props");
        while (Props.getChildByName("Scaffolding_" + index)) {
            chidsp = Props.getChildByName("Scaffolding_" + index).getChildByName("child_pos");
            chiddict["Scaffolding_" + index] = chidsp.transform.position;
            index++;
        }
        index = 0;
        while (Props.getChildByName("grilling_" + index)) {
            chidsp = Props.getChildByName("grilling_" + index).getChildByName("child_pos");
            chiddict["grilling_" + index] = chidsp.transform.position;
            index++;
        }
        Scene3dObject_1.default.patternDict[mapSprite3D.name] = chiddict;
    };
    return Scene3DManager;
}());
exports.default = Scene3DManager;
},{"../configs/dataConfigs/GameCFG":6,"../configs/dataConfigs/NpcCFG":8,"../configs/gameConfigs/PathConfig":10,"../frameworks/Debuger":12,"../frameworks/events/EventUtils":16,"../frameworks/mvc/MVCObjectPool":22,"../gamemodule/modelScripts/CamerasScript":42,"../gamemodule/modelScripts/MainRoleScript":43,"../gamemodule/modelScripts/NpcScript":44,"../gamemodule/scene3ds/RoleActions":46,"../gamemodule/scene3ds/RolesPool":47,"../gamemodule/scene3ds/Scene3dObject":48,"../gamemodule/userinfo/UserInfoProxy":53,"../gamemodule/userinfo/events/GameEvent":54,"../gamemodule/userinfo/events/UserInfoEvent":56,"../utils/GameUtils":87,"./GameLayerManager":61,"./ResourceManager":63}],65:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PathConfig_1 = require("../configs/gameConfigs/PathConfig");
var Debuger_1 = require("../frameworks/Debuger");
/*
* name;
*/
var SoundssManager = /** @class */ (function (_super) {
    __extends(SoundssManager, _super);
    function SoundssManager() {
        var _this = _super.call(this) || this;
        _this._isbgOpen = true;
        _this._gamesoundOpen = true;
        _this._isAllOpen = true;
        _this._nowBgName = "";
        _this._isPlaybging = false;
        /**
         * 声音开关引用索引
         */
        _this._soundIndex = 0;
        return _this;
    }
    SoundssManager.getInstance = function () {
        if (!this._instance) {
            this._instance = new SoundssManager();
        }
        return this._instance;
    };
    SoundssManager.prototype.init = function () {
        Laya.SoundManager.autoReleaseSound = false;
        Laya.SoundManager.autoStopMusic = true;
    };
    Object.defineProperty(SoundssManager.prototype, "gamesoundOpen", {
        /**
         * 音效是否开启
         */
        get: function () {
            return this._gamesoundOpen;
        },
        set: function (value) {
            this._gamesoundOpen = value;
            Laya.SoundManager.soundMuted = !value;
            if (value == true) {
                fairygui.UIConfig.buttonSoundVolumeScale = 1;
            }
            else {
                fairygui.UIConfig.buttonSoundVolumeScale = 0;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SoundssManager.prototype, "isbgOpen", {
        /**
         * 背景音乐是否开启
         */
        get: function () {
            return this._isbgOpen;
        },
        set: function (value) {
            this._isbgOpen = value;
            Laya.SoundManager.musicMuted = !value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SoundssManager.prototype, "isAllOpen", {
        /**
         * 所有音乐是否开启
         */
        get: function () {
            return this._isAllOpen;
        },
        set: function (value) {
            if (value) {
                this._soundIndex--;
                if (this._soundIndex < 0) {
                    this._soundIndex = 0;
                }
                if (!this._isPlaybging && this._soundIndex == 0) {
                    this._isAllOpen = true;
                    this.setGameVolume(1);
                    this.playbgSound(this._nowBgName);
                    fairygui.UIConfig.buttonSoundVolumeScale = 1;
                }
                else {
                    this._isAllOpen = false;
                }
            }
            else {
                this._isAllOpen = false;
                if (this._soundIndex < 0) {
                    this._soundIndex = 0;
                }
                this._soundIndex++;
                if (this._isPlaybging) {
                    this.stopbgSound();
                }
                this.setGameVolume(0);
                fairygui.UIConfig.buttonSoundVolumeScale = 0;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SoundssManager.prototype, "bgSoundVolume", {
        get: function () {
            return Laya.SoundManager.musicVolume;
        },
        /**
         * 设置背景音乐音量
         * @param value 音量范围从 0（静音）至 1（最大音量）。
         */
        set: function (value) {
            Laya.SoundManager.setMusicVolume(value);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SoundssManager.prototype, "soundVolume", {
        get: function () {
            return Laya.SoundManager.soundVolume;
        },
        /**
         * 设置背景音乐音量
         * @param value 音量范围从 0（静音）至 1（最大音量）。
         */
        set: function (value) {
            Laya.SoundManager.setSoundVolume(value);
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 设置所有声音音量
     * @param value 音量范围从 0（静音）至 1（最大音量）。
     */
    SoundssManager.prototype.setGameVolume = function (value) {
        this.bgSoundVolume = value;
        this.soundVolume = value;
    };
    /**
     * 播放背景音乐
     * @param soundName 声音名
     */
    SoundssManager.prototype.playbgSound = function (soundName) {
        this._nowBgName = soundName;
        if (this._isAllOpen && this._nowBgName != "" && this._soundIndex <= 0 && !this._isPlaybging) {
            this._isPlaybging = true;
            Debuger_1.default.log("playbgSound", PathConfig_1.PathConfig.getsound(this._nowBgName));
            Laya.SoundManager.playMusic(PathConfig_1.PathConfig.getsound(this._nowBgName));
            this.bgSoundVolume = 0.4;
        }
    };
    /**
     * 停止背景音乐
     */
    SoundssManager.prototype.stopbgSound = function () {
        this._isPlaybging = false;
        Laya.SoundManager.stopMusic();
    };
    /**
     * 播放音效
     * @param soundName 音效名
     * @param loop 播放次数
     */
    SoundssManager.prototype.playGameSound = function (soundName, loop) {
        if (loop === void 0) { loop = 1; }
        if (this._isAllOpen && soundName != "" && Laya.SoundManager.soundVolume != 0) {
            Laya.SoundManager.playSound(PathConfig_1.PathConfig.getsound(soundName), loop);
        }
    };
    /**
     * 停止播放音效
     */
    SoundssManager.prototype.stopGameSound = function () {
        Laya.SoundManager.stopAllSound();
    };
    /**
     * 停止所有声音
     */
    SoundssManager.prototype.stopAll = function () {
        this.stopGameSound();
        this.stopbgSound();
    };
    return SoundssManager;
}(Laya.EventDispatcher));
exports.default = SoundssManager;
},{"../configs/gameConfigs/PathConfig":10,"../frameworks/Debuger":12}],66:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LayerNotify_1 = require("../frameworks/notification/LayerNotify");
var GameLayerManager_1 = require("./GameLayerManager");
/**
 *
 * @author
 *
 */
var UiManager = /** @class */ (function (_super) {
    __extends(UiManager, _super);
    function UiManager() {
        return _super.call(this) || this;
    }
    UiManager.getInstance = function () {
        if (!this.instance) {
            this.instance = new UiManager();
        }
        return this.instance;
    };
    UiManager.prototype.init = function () {
        this._views = {};
        this.initEvent();
    };
    UiManager.prototype.initEvent = function () {
    };
    /**
     *  view 视图对象类
     *  data 绑定数据 （ data 如果不为空，代表构造函数传参 ）
     *  layer 层级
     */
    UiManager.prototype.add = function (view, data, layer) {
        if (data === void 0) { data = null; }
        if (layer === void 0) { layer = LayerNotify_1.LayerNotify.LAYER_UILAYER; }
        if (view.key == null) {
            throw new Error("view have no key");
        }
        var type = view.key;
        if (this._views[type]) {
            var itemview = this._views[type];
            return itemview;
        }
        var d;
        if (data != null) {
            d = new view(data);
        }
        else {
            d = new view();
        }
        d.viewKey = view;
        d.gameLayer = layer;
        GameLayerManager_1.GameLayerManager.getInstance().addtoLayer(d, layer);
        this._views[type] = d;
        return d;
    };
    /**
     * 关闭界面
     * @param view 界面
     * @param isbgclose 是否是点击背景关闭的状态
     * @param isplayAnmo 是否播放关闭动画（ 主要用于强制关闭 ）
     */
    UiManager.prototype.close = function (view, isbgclose, isplayAnmo) {
        if (isbgclose === void 0) { isbgclose = false; }
        if (isplayAnmo === void 0) { isplayAnmo = true; }
        var type = view.key;
        var item = this._views[type];
        if (!item) {
            return;
        }
        GameLayerManager_1.GameLayerManager.getInstance().removeformLayer(item.gameLayer);
        if (isplayAnmo) {
            item.onCloseView();
        }
        else {
            item.destory();
        }
        delete this._views[type];
    };
    UiManager.prototype.onresize = function (w, h) {
        if (this._views != null) {
            var itemview;
            for (var item in this._views) {
                itemview = this._views[item];
                itemview.setSize(w, h);
            }
        }
    };
    UiManager.prototype.getView = function (view) {
        var type = view.key;
        return this._views[type];
    };
    return UiManager;
}(Laya.EventDispatcher));
exports.UiManager = UiManager;
},{"../frameworks/notification/LayerNotify":29,"./GameLayerManager":61}],67:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WXGamePlatform_1 = require("./wxminigame/WXGamePlatform");
var PlatfromType_1 = require("./PlatfromType");
var PlatformEvent_1 = require("./events/PlatformEvent");
var Global_1 = require("../Global");
var Debuger_1 = require("../frameworks/Debuger");
var EventUtils_1 = require("../frameworks/events/EventUtils");
var TimesTamper_1 = require("../frameworks/TimesTamper");
var DayManager_1 = require("../managers/DayManager");
var SoundssManager_1 = require("../managers/SoundssManager");
/*
* name;
*/
var PlatformTool = /** @class */ (function () {
    function PlatformTool() {
        this._isenable = false;
    }
    PlatformTool.getInstance = function () {
        if (!this._instance) {
            this._instance = new PlatformTool();
        }
        return this._instance;
    };
    /**
     * 初始化平台
     */
    PlatformTool.prototype.initPlatfrom = function () {
        if (Laya.Browser.window.tt) {
            Global_1.Global.nowplatfrom = PlatfromType_1.default.tt;
        }
        else if (Laya.Browser.window.wx) //微信小游戏
         {
            Global_1.Global.nowplatfrom = PlatfromType_1.default.wx;
        }
        else {
            Global_1.Global.nowplatfrom = PlatfromType_1.default.pc;
        }
    };
    PlatformTool.prototype.init = function () {
        this.initPlatfrom();
        Debuger_1.default.log(Global_1.Global.nowplatfrom + "平台初始化");
        // switch( Global.nowplatfrom )
        // {
        //     case PlatfromType.wx:
        //         WXGamePlatform.getInstance().init();
        //     break;
        //     case PlatfromType.qq:
        //     break;
        //     default:
        //     break;
        // }
        // this.onShow( this,this.showcallback );
        // this.onHide(this,this.hidecallback);
    };
    PlatformTool.prototype.initData = function () {
        DayManager_1.default.getInstance().init();
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().initData();
                break;
            default:
                break;
        }
    };
    /**
     * 合违规判断 true：合规，false:违规
     */
    PlatformTool.checkEnable = function () {
        if (PlatformTool.islegal == 1) {
            return true;
        }
        return false;
    };
    PlatformTool.prototype.login = function (callobj, succeedcallback, progressCallback, failcallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        if (progressCallback === void 0) { progressCallback = null; }
        if (failcallback === void 0) { failcallback = null; }
        fairygui.GRoot.inst.showModalWait();
        this._logincallobj = callobj;
        this._loginsucceedcallback = succeedcallback;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().createUserAndLogin(this, this.loginSucceed, this.loginprogressCallback, this.loginfailcallback);
                break;
            default:
                this.loginSucceed(null);
                break;
        }
    };
    PlatformTool.prototype.loginprogressCallback = function (value) {
    };
    PlatformTool.prototype.loginSucceed = function (data) {
        fairygui.GRoot.inst.closeModalWait();
        // Debuger.log( "loginSucceed",data );
        // switch( Global.nowplatfrom )
        // {
        //     case PlatfromType.wx:
        //         var nowtime:number = data.NowTime;
        //         TimesTamper.getInstance().updateServiceTime(nowtime);
        //         PlatformTool.islegal = Number(data.Version);
        //         var Member:any = data.Member;
        //         var AppInfo:any = data.AppInfo;
        //         var Client2:any = AppInfo.Client2;
        //         Global.AppKeyID = Member.AppKeyID;
        //         Global.MemberID = Member.MemberID;
        //         WXGamePlatform.VideoTime = Number(Client2.VideoTime);
        //         WXGamePlatform.VideoNum = Number(Client2.VideoNum);
        //         WXGamePlatform.ShareTime = Number(Client2.ShareTime);
        //         WXGamePlatform.jiliweitime = Number( Client2.ShareTime );
        //         WXGamePlatform.SharetoVideo = Number( Client2.SharetoVideo );
        //         WXGamePlatform.VideotoShare = Number( Client2.VideotoShare );
        //         WXGamePlatform.getInstance().initShareDian( Client2.Share );
        //         EventUtils.dispatchEvent( CPAEvent.CPAEvent_initCPAData,data );
        //     break;
        //     default:
        //         TimesTamper.getInstance().updateServiceTime(Laya.Browser.now()/1000);
        //         var datas:any = JSON.parse('{"ACTION":9891001,"ACTIONCOM":0,"JSDATA":{"AppInfo":{"Client":[{"ID":"1","IsShow":true,"Param1":"30","Param2":""},{"ID":"2","IsShow":true,"Param1":"30","Param2":""},{"ID":"3","IsShow":true,"Param1":"30","Param2":""},{"ID":"4","IsShow":true,"Param1":"30","Param2":""},{"ID":"5","IsShow":true,"Param1":"30","Param2":""},{"ID":"6","IsShow":true,"Param1":"30","Param2":""},{"ID":"7","IsShow":true,"Param1":"30","Param2":""},{"ID":"8","IsShow":true,"Param1":"30","Param2":""}],"Client2":{"VideoTime":10,"VideoNum":"10","ShareTime":4,"Share":[{"key":"fuhuo","img":"bingduweiji/fuhuofx.png","tile":"来帮助我消灭病毒吧！"}],"jiliweitime":"600","VideotoShare":"1","SharetoVideo":"1"},"ReNum":100,"ReTime":259200},"Member":{"AppKeyID":3,"MemberID":100001,"UserName":""},"NowTime":1572251558,"Version":""}}');
        //         EventUtils.dispatchEvent( CPAEvent.CPAEvent_initCPAData,datas.JSDATA );
        //     break;
        // }
        // this.initData();
        if (this._logincallobj && this._loginsucceedcallback) {
            this._loginsucceedcallback.call(this._logincallobj);
        }
        else {
            EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_loginSucceed);
        }
    };
    PlatformTool.prototype.loginfailcallback = function () {
    };
    PlatformTool.prototype.onShow = function (callobj, succeedcallback, failCallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().onShow(callobj, succeedcallback, failCallback);
                break;
            case PlatfromType_1.default.qq:
                break;
        }
    };
    PlatformTool.prototype.showcallback = function () {
        Laya.timer.clear(this, this.againplaybgSound);
        Laya.timer.once(500, this, this.againplaybgSound);
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_onshow);
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_getfocus);
        var fromscene = PlatformTool.fromscene();
        if (fromscene == 1089 || fromscene == 1131) {
            EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_fromscorfk);
        }
    };
    PlatformTool.prototype.againplaybgSound = function () {
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_onAudioInterruptionEnd);
    };
    PlatformTool.prototype.onHide = function (callobj, succeedcallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().onHide(callobj, succeedcallback);
                break;
            case PlatfromType_1.default.qq:
                break;
        }
    };
    PlatformTool.prototype.hidecallback = function () {
        TimesTamper_1.TimesTamper.getInstance().sendonlineTongji();
        SoundssManager_1.default.getInstance().stopAll();
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_onhide);
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_losefocus);
    };
    Object.defineProperty(PlatformTool.prototype, "isshow", {
        /**
         * 当前游戏是否在显示中
         */
        get: function () {
            var bo = true;
            switch (Global_1.Global.nowplatfrom) {
                case PlatfromType_1.default.wx:
                    if (WXGamePlatform_1.default.isShowing) {
                        bo = true;
                    }
                    bo = false;
                    break;
            }
            return bo;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 分包加载
     */
    PlatformTool.prototype.loadSubpackage = function (typename, callobj, callback, callprogress, failcallback) {
        if (failcallback === void 0) { failcallback = null; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().loadSubpackage(typename, callobj, callback, callprogress, failcallback);
                break;
            default:
                if (callobj && callback) {
                    callback.call(callobj);
                }
                break;
        }
    };
    /**
     * 获取是否已经授权
     * @param callobj
     * @param callback
     */
    PlatformTool.prototype.isaccredit = function (callobj, accreditCallback) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().getaccredit(callobj, accreditCallback);
                break;
            case PlatfromType_1.default.qq:
                WXGamePlatform_1.default.getInstance().getaccredit(callobj, accreditCallback);
                break;
            default:
                if (accreditCallback && callobj) {
                    accreditCallback.call(callobj, true);
                }
                break;
        }
    };
    /**
     * 拿角色信息授权
     */
    PlatformTool.prototype.createaccredit = function (callobj, callback, failcallback) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().createUserInfoButton(callobj, callback, failcallback);
                break;
        }
    };
    PlatformTool.prototype.closeuserinfoButton = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().closeuserinfobUtton();
                break;
        }
    };
    /**
     * 退出游戏
     */
    PlatformTool.prototype.exitGame = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().exitGame();
                break;
        }
    };
    /**
     * 打开客服对话框
     */
    PlatformTool.prototype.openCustomerService = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().openCustomerService();
                break;
        }
    };
    /**
     * 短震动
     */
    PlatformTool.prototype.vibrateShort = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().vibrateShort();
                break;
            default:
                break;
        }
    };
    PlatformTool.isCanVideo = function () {
        var bo = false;
        if (PlatformTool.checkEnable()) {
            bo = true;
        }
        else {
            switch (Global_1.Global.nowplatfrom) {
                case PlatfromType_1.default.wx:
                    bo = WXGamePlatform_1.default.getInstance().isCanVideo();
                    break;
                default:
                    bo = true;
                    break;
            }
        }
        return bo;
    };
    PlatformTool.prototype.startShareApp = function (key, callobj, succeedCallback, failCallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedCallback === void 0) { succeedCallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().startShareApp(key, callobj, succeedCallback, failCallback);
                break;
            default:
                if (callobj && succeedCallback) {
                    succeedCallback.call(callobj);
                }
                break;
        }
    };
    PlatformTool.prototype.playVideo = function (key, callobj, succeedcallback, failCallback, istongjiNum) {
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        if (istongjiNum === void 0) { istongjiNum = true; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                // WordTipsUtils.getInstance().showWordTips("暂未开放");
                WXGamePlatform_1.default.getInstance().playVideo(key, callobj, succeedcallback, failCallback, istongjiNum);
                break;
            default:
                if (callobj && succeedcallback) {
                    succeedcallback.call(callobj);
                }
                break;
        }
    };
    PlatformTool.prototype.createBanner = function (bannertype, style) {
        if (style === void 0) { style = { x: 0, y: 0, scale: 1 }; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().createBanner(bannertype, style);
                break;
            default:
                break;
        }
    };
    PlatformTool.prototype.hideBanner = function (bannertype) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().hideBanner(bannertype);
                break;
            default:
                break;
        }
    };
    /**
     * 数据上传（用于排行榜数据显示）
     * @param param1 上报数据1
     * @param param2 上报数据2
     */
    PlatformTool.prototype.storeToCloud = function (param1, param2) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().storeToCloud(param1, param2);
                break;
            default:
                break;
        }
    };
    /**
     * 打开好友排行榜
     */
    PlatformTool.prototype.openFriendRank = function (type, viewType, rect, parent, data) {
        if (parent === void 0) { parent = null; }
        if (data === void 0) { data = null; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().openFriendRank(type, viewType, rect, parent, data);
                break;
            default:
                break;
        }
    };
    /**
     * 排行榜打开状态时候，切换显示类型
     * @param type
     */
    PlatformTool.prototype.changeFriendRank = function (type) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().changeFriendRank(type);
                break;
            default:
                break;
        }
    };
    /**
     * 排行榜上一页
     */
    PlatformTool.prototype.prePageRank = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().prePageRank();
                break;
            default:
                break;
        }
    };
    /**
     * 排行榜下一页
     */
    PlatformTool.prototype.nextPageRank = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().nextPageRank();
                break;
            default:
                break;
        }
    };
    /**
     * 关闭好友排行榜
     */
    PlatformTool.prototype.closeFriendRank = function (viewType) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().closeFriendRank(viewType);
                break;
            default:
                break;
        }
    };
    PlatformTool.prototype.lockVideoLeftTime = function () {
        var time = 0;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                time = WXGamePlatform_1.default.getInstance().lockVideoLeftTime();
                break;
            default:
                break;
        }
        return time;
    };
    PlatformTool.dayVideoNums = function () {
        var time = 0;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                time = WXGamePlatform_1.default.dayVideoNum;
                break;
            default:
                break;
        }
        return time;
    };
    /**
     * 1089:添加到我的小程序，1131:添加到浮窗
     */
    PlatformTool.fromscene = function () {
        var scene = 0;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                scene = WXGamePlatform_1.default.fromscene;
                break;
            default:
                break;
        }
        return scene;
    };
    PlatformTool.createGameClubButton = function (style, icon) {
        if (icon === void 0) { icon = "green"; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.default.wx:
                WXGamePlatform_1.default.getInstance().createGameClubButton(style, icon);
                break;
            default:
                break;
        }
    };
    /**
     * 是否合规
     */
    PlatformTool.islegal = 0;
    return PlatformTool;
}());
exports.default = PlatformTool;
},{"../Global":2,"../frameworks/Debuger":12,"../frameworks/TimesTamper":14,"../frameworks/events/EventUtils":16,"../managers/DayManager":60,"../managers/SoundssManager":65,"./PlatfromType":68,"./events/PlatformEvent":69,"./wxminigame/WXGamePlatform":72}],68:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlatfromType = /** @class */ (function () {
    function PlatfromType() {
    }
    /**
     * 电脑
     */
    PlatfromType.pc = "pc";
    /**
     * 微信小游戏
     */
    PlatfromType.wx = "wx";
    /**
     * qq小游戏
     */
    PlatfromType.qq = "qq";
    /**
     * 抖音
     */
    PlatfromType.tt = "tt";
    return PlatfromType;
}());
exports.default = PlatfromType;
},{}],69:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlatformEvent = /** @class */ (function () {
    function PlatformEvent() {
    }
    /**
     * 登录
     */
    PlatformEvent.message_9891001 = "9891001";
    /**
     * 广告点击
     */
    PlatformEvent.message_9891102 = "9891102";
    /**
     * 点击确定跳转到外部游戏
     */
    PlatformEvent.message_9891103 = "9891103";
    /**
     * 用户打点
     */
    PlatformEvent.message_9891002 = "9891002";
    /**
     * 获取后台数据
     */
    PlatformEvent.message_9891101 = "9891101";
    PlatformEvent.PlatformEvent_loginSucceed = "PlatformEvent_loginSucceed";
    /**
     * 游戏从后台恢复显示事件
     */
    PlatformEvent.PlatformEvent_onshow = "PlatformEvent_onshow";
    /**
     * 游戏进入后台事件
     */
    PlatformEvent.PlatformEvent_onhide = "PlatformEvent_onhide";
    PlatformEvent.PlatformEvent_onAudioInterruptionEnd = "PlatformEvent_onAudioInterruptionEnd";
    PlatformEvent.PlatformEvent_losefocus = "PlatformEvent_losefocus";
    PlatformEvent.PlatformEvent_getfocus = "PlatformEvent_getfocus";
    PlatformEvent.PlatformEvent_updateVideoNums = "PlatformEvent_updateVideoNums";
    /**
     * 从收藏或者浮窗进入游戏
     */
    PlatformEvent.PlatformEvent_fromscorfk = "PlatformEvent_fromscorfk";
    return PlatformEvent;
}());
exports.default = PlatformEvent;
},{}],70:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RankType;
(function (RankType) {
    /**
     * 打开好友排行榜
     */
    RankType.openfriendrank = "openfriendrank";
    /**
     * 关闭好友排行榜
     */
    RankType.closefriendrank = "closefriendrank";
    /**
     * 下一页
     */
    RankType.nextpage = "nextpage";
    /**
     * 上一页
     */
    RankType.prepage = "prepage";
    /**
     * 超越好友（显示后一名）
     */
    RankType.chaoyue = "chaoyue";
    /**
     * 超越好友（显示前后一名）
     */
    RankType.chaoyue1 = "chaoyue1";
})(RankType = exports.RankType || (exports.RankType = {}));
},{}],71:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Event = Laya.Event;
var HttpRequest = Laya.HttpRequest;
var PlayerAccount_1 = require("./WXSDK/PlayerAccount");
var ShareUtil_1 = require("./WXSDK/ShareUtil");
var Sdk_1 = require("./WXSDK/Sdk");
var TimesTamper_1 = require("../../frameworks/TimesTamper");
var Debuger_1 = require("../../frameworks/Debuger");
var Global_1 = require("../../Global");
// const PROTOCOL_URL:string = "https://pipelineapi.xwxgame.com/";
var PROTOCOL_URL = "https://parkourraceapi.xwxgame.com/";
var PROTOCOLS = /** @class */ (function () {
    function PROTOCOLS() {
    }
    PROTOCOLS.Login = "user/login"; // not token
    PROTOCOLS.game = "game/start";
    PROTOCOLS.end = "game/play";
    PROTOCOLS.Sign = "sign/sign";
    // public static EquipHero           = "theme/equipHero";
    // public static BuyHero             = "theme/buyHero";
    // public static EquipHat           = "theme/equipHat";
    // public static BuyHat             = "theme/buyHat";
    // public static BuyDance             = "theme/buyDance";
    // public static EquipDance           = "theme/equipDance";
    PROTOCOLS.Buy = "theme/buy";
    PROTOCOLS.Equip = "theme/equip";
    PROTOCOLS.share = "fission/share";
    PROTOCOLS.vd = "fission/vd";
    PROTOCOLS.revival = "game/revival";
    PROTOCOLS.fission = "theme/fission";
    PROTOCOLS.themefission = "theme/fission";
    PROTOCOLS.treasure = "treasure/click";
    PROTOCOLS.Config = "config/table";
    PROTOCOLS.Lottery = "lottery/lottery";
    PROTOCOLS.GetAchieve = "achievement/getRewards";
    PROTOCOLS.usersync = "user/sync";
    return PROTOCOLS;
}());
exports.PROTOCOLS = PROTOCOLS;
;
var NetworkManager = /** @class */ (function () {
    function NetworkManager() {
        NetworkManager.instance = this;
    }
    Object.defineProperty(NetworkManager, "Instance", {
        get: function () {
            if (NetworkManager.instance) {
                return NetworkManager.instance;
            }
            else {
                return new NetworkManager();
            }
        },
        enumerable: true,
        configurable: true
    });
    //#region 登入
    /******************************* login *****************************/
    NetworkManager.prototype.login = function (progresscb, completecb, errorcb) {
        var userInfor = PlayerAccount_1.PlayerAccount.CurrentAccount;
        var ver = Global_1.Global.gameVersion;
        var args = "code=" + userInfor.Code + "&nickname=" + userInfor.NickName + "&avatar=" + userInfor.Avatar + "&gender=" + userInfor.Gender + "&country=" + userInfor.Country + "&province=" + userInfor.Province + "&city=" + userInfor.City + "& device=" + userInfor.Device + "$&share_id=" + userInfor.ShareId + "&scene=" + userInfor.Scene + "&v=" + ver;
        var httpRequest = new HttpRequest();
        httpRequest.once(Event.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
        httpRequest.once(Event.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
        httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
        httpRequest.send(PROTOCOL_URL + PROTOCOLS.Login, args, "post", "text");
    };
    NetworkManager.prototype.onHttpRequestProgress = function (progresscb, httpRequest) {
        if (progresscb) {
            console.log("HttpRequestProgress:...");
            progresscb.run();
        }
    };
    NetworkManager.prototype.onLoginRequestComplete = function (completecb, httpRequest) {
        //console.log("登录数据：", httpRequest.data);
        var data = JSON.parse(httpRequest.data);
        if (data["code"] != "0") {
            console.log("登录异常错误！错误信息：", httpRequest.data);
            Sdk_1.WxApi.recordAldEvent("登录异常错误！错误信息：= " + data["code"], "httpRequest.dat");
            //completecb.runWith(data);
            return;
        }
        PlayerAccount_1.PlayerAccount.ServerTime = data["t"];
        TimesTamper_1.TimesTamper.getInstance().updateServiceTime(Number(data["t"]));
        Sdk_1.WxApi.recordAldEvent("登录正式成功");
        PlayerAccount_1.PlayerAccount.CurrentAccount.SetAccountData(data, completecb);
        ShareUtil_1.ShareUtil.ShareMessage();
    };
    NetworkManager.prototype.onHttpRequestError = function (errorcb, httpRequest) {
        if (errorcb != null) {
            errorcb.runWith(httpRequest);
        }
        Sdk_1.WxApi.recordAldEvent("Error! Http request error.. ", "httpRequest.dat");
        Sdk_1.WxApi.ShowLoading("连接网络失败...");
        Laya.timer.once(8000, this, function () { Sdk_1.WxApi.HideLoading(); });
        console.log("Error! Http request error..." + httpRequest.data);
    };
    //#endregion
    /*
    * 通用Http Post协议发送
    * protocol 		对应“PROTOCOLS”字典中协议名称
    * hasToken		是否使用token，目前只有login协议不需要token，其他都需要token，所以此处自动组合
    * param			参数列表，key是字段名，val是值，值需要先转string
    * completecb	协议发送成功回调函数
    * errorcb		协议发送失败回调函数
    * return		返回值为void
    */
    NetworkManager.prototype.HttpPostRequest = function (protocol, param, completecb, errorcb, hasToken) {
        if (hasToken === void 0) { hasToken = true; }
        var args = "";
        var url = PROTOCOL_URL + protocol;
        // chechk add token
        var account = PlayerAccount_1.PlayerAccount.CurrentAccount;
        var accountdata = account.CurAccountData;
        if (hasToken == true) {
            args = "token=" + accountdata.m_token + "&";
        }
        Sdk_1.WxApi.ShowLoading("连接网络中...");
        if (protocol == PROTOCOLS.game || protocol == PROTOCOLS.end || protocol == PROTOCOLS.fission || protocol == PROTOCOLS.vd ||
            protocol == PROTOCOLS.themefission || protocol == PROTOCOLS.Lottery || protocol == PROTOCOLS.usersync) {
            var str = "abcdefghijkimnopqrstuvwxyz0123456789";
            var code = "{";
            var mask = "";
            for (var i = 0; i < 4; i++) {
                mask += str[Math.floor(Math.random() * 100) % str.length];
            }
            for (var i = 0; i < param.length; i++) {
                for (var key in param[i]) {
                    code += "\"" + key + "\":\"" + param[i][key] + "\"";
                }
                if (i < param.length - 1) {
                    code += ",";
                }
                else {
                    code += "}";
                }
            }
            args += "_r=" + mask + this.base64Encode(code);
        }
        else {
            if (param != null) {
                for (var i = 0; i < param.length; i++) {
                    for (var key in param[i]) {
                        var val = param[i][key];
                        args += key + "=" + val;
                        if (i < param.length - 1) {
                            args += "&";
                        }
                    }
                }
            }
        }
        var httpRequest = new HttpRequest();
        httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest]);
        httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
        httpRequest.send(url, args, "post", "text");
    };
    NetworkManager.prototype.onHttpRequestComplete = function (succeedcb, failurecb, httpRequest) {
        Sdk_1.WxApi.HideLoading();
        var data = JSON.parse(httpRequest.data);
        if (data["code"] == 0) {
            PlayerAccount_1.PlayerAccount.CurrentAccount.SetAccountData(data, null);
            //EventManager.Trigger(EventType.RefreshMonery);
            if (succeedcb != null) {
                //console.log("上传成功回调方法 " + httpRequest.data);
                succeedcb.runWith(data);
                Debuger_1.default.log("receive:", data);
            }
        }
        else {
            if (failurecb != null) {
                failurecb.runWith(data);
            }
            console.log("Error! Http request complete error, code: " + data["code"] + " message: " + data["message"]);
        }
    };
    NetworkManager.prototype.base64Encode = function (str) {
        var c1, c2, c3;
        var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        var i = 0, len = str.length, string = '';
        while (i < len) {
            c1 = str.charCodeAt(i++) & 0xff;
            if (i == len) {
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt((c1 & 0x3) << 4);
                string += "==";
                break;
            }
            c2 = str.charCodeAt(i++);
            if (i == len) {
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                string += base64EncodeChars.charAt((c2 & 0xF) << 2);
                string += "=";
                break;
            }
            c3 = str.charCodeAt(i++);
            string += base64EncodeChars.charAt(c1 >> 2);
            string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
            string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
            string += base64EncodeChars.charAt(c3 & 0x3F);
        }
        return string;
    };
    return NetworkManager;
}());
exports.NetworkManager = NetworkManager;
},{"../../Global":2,"../../frameworks/Debuger":12,"../../frameworks/TimesTamper":14,"./WXSDK/PlayerAccount":74,"./WXSDK/Sdk":75,"./WXSDK/ShareUtil":76}],72:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TongjiHttps_1 = require("../../frameworks/net/TongjiHttps");
var Debuger_1 = require("../../frameworks/Debuger");
var GameUtils_1 = require("../../utils/GameUtils");
var GameHttps_1 = require("../../frameworks/net/GameHttps");
var PlatformEvent_1 = require("../events/PlatformEvent");
var Global_1 = require("../../Global");
var DayManager_1 = require("../../managers/DayManager");
var CacheManager_1 = require("../../managers/CacheManager");
var UserCacheType_1 = require("../../gamemodule/userinfo/events/UserCacheType");
var WordTipsUtils_1 = require("../../gamemodule/loading/view/WordTipsUtils");
var EventUtils_1 = require("../../frameworks/events/EventUtils");
var SoundssManager_1 = require("../../managers/SoundssManager");
var RankType_1 = require("../types/RankType");
/*
* name;
*/
var WXGamePlatform = /** @class */ (function () {
    function WXGamePlatform() {
        this.isShareing = false;
        this.bannerRunTime = 0;
        this._bannerTypeList = [];
        this._screenwidth = 0;
        this.bannerheight = 0;
        this.bannerwidth = 0;
        this.isonResize = false;
        /**
         * 排行榜打开类型存储
         */
        this._openrankDict = {};
    }
    WXGamePlatform.getInstance = function () {
        if (!this._instance) {
            this._instance = new WXGamePlatform();
        }
        return this._instance;
    };
    WXGamePlatform.prototype.init = function () {
        this.showShareMenu({ withShareTicket: true });
        this.onAudioInterruptionBegin();
        this.onAudioInterruptionEnd();
    };
    WXGamePlatform.prototype.initShareDian = function (data) {
        if (data && data.length > 0) {
            var itemd;
            for (var s in data) {
                itemd = data[s];
                WXGamePlatform.ShareDict[itemd.key] = itemd;
            }
            var firstd = data[0];
            this.onShareAppMessage(firstd.tile, Global_1.Global.cdnurl + firstd.img);
        }
    };
    WXGamePlatform.prototype.initData = function () {
        if (DayManager_1.default.isNewDay) {
            WXGamePlatform.dayShareNum = 0;
            WXGamePlatform.dayVideoNum = 0;
            this.updateDayShareInfo();
            this.updateDayVideoInfo();
        }
        else {
            WXGamePlatform.dayShareNum = CacheManager_1.default.getInstance().getnum(UserCacheType_1.default.nowdayShare);
            WXGamePlatform.dayVideoNum = CacheManager_1.default.getInstance().getnum(UserCacheType_1.default.nowdayVideo);
        }
        Debuger_1.default.log("initDayShareNum", WXGamePlatform.dayShareNum, WXGamePlatform.dayVideoNum);
    };
    /**
     * 存储当天分享的信息
     */
    WXGamePlatform.prototype.updateDayShareInfo = function () {
        CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.nowdayShare, WXGamePlatform.dayShareNum.toString());
        Debuger_1.default.log("updateDayShareInfo", WXGamePlatform.dayShareNum);
    };
    WXGamePlatform.prototype.updateDayVideoInfo = function () {
        CacheManager_1.default.getInstance().addstr(UserCacheType_1.default.nowdayVideo, WXGamePlatform.dayVideoNum.toString());
        Debuger_1.default.log("updateDayVideoInfo", WXGamePlatform.dayVideoNum);
    };
    WXGamePlatform.prototype.createUserAndLogin = function (callobj, succeedcallback, progressCallback, failcallback) {
        if (progressCallback === void 0) { progressCallback = null; }
        if (failcallback === void 0) { failcallback = null; }
        WXGamePlatform.loginCallobj = callobj;
        WXGamePlatform.loginsucceedcallback = succeedcallback;
        WXGamePlatform.loginprogressCallback = progressCallback;
        var wx = Laya.Browser.window.wx;
        if (wx) {
            var login_info = WXGamePlatform.getInstance().getLaunchOptionsSync();
            if (login_info) {
                Debuger_1.default.log("getLaunchOptionsSync:", login_info);
                var query = login_info.query;
                if (query && query.ChanID) {
                    WXGamePlatform.QuDaoID = query.ChanID;
                    Debuger_1.default.log('来源⼴告的广告id是' + WXGamePlatform.QuDaoID);
                }
                var referrerInfo = login_info.referrerInfo;
                if (WXGamePlatform.QuDaoID == "" && referrerInfo && referrerInfo.appId) {
                    WXGamePlatform.QuDaoID = referrerInfo.appId;
                    Debuger_1.default.log('来源微信小游戏的appid是' + WXGamePlatform.QuDaoID);
                }
                if (login_info.scene) {
                    WXGamePlatform.fromscene = Number(login_info.scene);
                }
            }
            var systemres = wx.getSystemInfoSync();
            var version = systemres.SDKVersion;
            if (wx.getUpdateManager) {
                var updateManager = wx.getUpdateManager();
                updateManager.onCheckForUpdate(function (res) {
                    // 请求完新版本信息的回调
                    Debuger_1.default.log("是否有新版本需要更新:" + res.hasUpdate);
                    if (res.hasUpdate == true) {
                        updateManager.onUpdateReady(function () {
                            Laya.Browser.window.wx.showModal({
                                title: '更新提示',
                                content: '新版本已经准备好，是否重启应用？',
                                success: function (res) {
                                    if (res.confirm) {
                                        // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
                                        updateManager.applyUpdate();
                                    }
                                    else {
                                        WXGamePlatform.getInstance().exitGame();
                                    }
                                }
                            });
                        });
                        updateManager.onUpdateFailed(function () {
                            // 新版本下载失败
                            WXGamePlatform.getInstance().exitGame();
                        });
                    }
                    else {
                        // if( WXGamePlatform.loginCallobj && WXGamePlatform.loginprogressCallback )
                        // {
                        //     WXGamePlatform.loginprogressCallback.call( WXGamePlatform.loginCallobj,10 );
                        // }
                        var wxplatform = WXGamePlatform.getInstance();
                        wxplatform.login(callobj, succeedcallback, failcallback);
                    }
                });
            }
            else {
                // if( WXGamePlatform.loginCallobj && WXGamePlatform.loginprogressCallback )
                // {
                //     WXGamePlatform.loginprogressCallback.call( WXGamePlatform.loginCallobj,10 );
                // }
                var wxplatform = WXGamePlatform.getInstance();
                wxplatform.login(callobj, succeedcallback, failcallback);
            }
        }
    };
    WXGamePlatform.prototype.createUserInfoButton = function (callobj, callback, failcallback) {
        this.userinfocallobj = callobj;
        this.userinfosuccallback = callback;
        this.userinfofailcallback = failcallback;
        var wx = Laya.Browser.window.wx;
        var res = wx.getSystemInfoSync();
        if (res) {
            Debuger_1.default.log("getSystemInfoSync", res);
            var posx = (res.windowWidth - 151) / 2;
            var posy = res.windowHeight - 172 - 40;
            WXGamePlatform.getInstance().userinfobutton = wx.createUserInfoButton({
                type: 'image',
                image: 'wxlocal/login.png',
                style: {
                    left: posx,
                    top: posy,
                    width: 151,
                    height: 72
                }
            });
            WXGamePlatform.getInstance().userinfobutton.onTap(WXGamePlatform.getInstance().userinfoButtonClick);
        }
    };
    /**
     * 判断是否已经授权
     */
    WXGamePlatform.prototype.getaccredit = function (callobj, accreditCallback) {
        if (WXGamePlatform.accreditstate == 0) {
            var wx = Laya.Browser.window.wx;
            if (wx) {
                wx.getSetting({
                    success: function (res) {
                        var itemd = res.authSetting;
                        if (itemd.hasOwnProperty("scope.userInfo") && itemd["scope.userInfo"] == true) //已经授权过
                         {
                            if (accreditCallback && callobj) {
                                accreditCallback.call(callobj, true);
                            }
                        }
                        else {
                            if (accreditCallback && callobj) {
                                accreditCallback.call(callobj, false);
                            }
                        }
                    }
                });
            }
            else {
                if (accreditCallback && callobj) {
                    accreditCallback.call(callobj, true);
                }
            }
        }
        else {
            if (accreditCallback && callobj) {
                accreditCallback.call(callobj, true);
            }
        }
    };
    WXGamePlatform.prototype.userinfoButtonClick = function (res) {
        var wxplatform = WXGamePlatform.getInstance();
        Debuger_1.default.log("userinfoButtonClick", res);
        if (res) {
            var errMsg = res.errMsg;
            if (errMsg == "getUserInfo:ok") {
                Debuger_1.default.log("同意授权");
                WXGamePlatform.accreditstate = 1;
                wxplatform.closeuserinfobUtton();
                wxplatform.getUserInfo(false, wxplatform.userinfocallobj, wxplatform.userinfosuccallback, wxplatform.userinfofailcallback);
            }
            else {
                Debuger_1.default.log("点击拒绝授权");
                if (wxplatform.userinfocallobj && wxplatform.userinfofailcallback) {
                    wxplatform.userinfofailcallback.call(wxplatform.userinfocallobj);
                }
            }
        }
    };
    WXGamePlatform.prototype.closeuserinfobUtton = function () {
        var wxplatform = WXGamePlatform.getInstance();
        if (wxplatform.userinfobutton) {
            wxplatform.userinfobutton.offTap(wxplatform.userinfoButtonClick);
            wxplatform.userinfobutton.destroy();
            wxplatform.userinfobutton = null;
        }
    };
    WXGamePlatform.prototype.getUserInfo = function (islogin, callobj, callback, failcallback) {
        fairygui.GRoot.inst.showModalWait();
        var wxplatform = WXGamePlatform.getInstance();
        var wx = Laya.Browser.window.wx;
        if (wx) {
            wx.getUserInfo({
                success: function (res) {
                    var userInfo = res.userInfo;
                    WXGamePlatform.nickName = userInfo.nickName;
                    if (islogin) {
                        wxplatform.login(callobj, callback, failcallback);
                    }
                    else {
                        if (callobj && callback) {
                            callback.call(callobj, WXGamePlatform.nickName);
                        }
                    }
                }
            });
        }
    };
    /**
     * 登录
     * @param callobj
     * @param succeedcallback
     * @param failCallback
     */
    WXGamePlatform.prototype.login = function (callobj, callback, failcallback) {
        var wxplatform = WXGamePlatform.getInstance();
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.login({
                success: function (res) {
                    Debuger_1.default.log("wx.login:", res);
                    WXGamePlatform.code = res.code;
                    var itemd = {};
                    if (WXGamePlatform.QuDaoID != "") {
                        itemd.ChanID = WXGamePlatform.QuDaoID;
                    }
                    itemd.Code = WXGamePlatform.code;
                    itemd.AppID = Global_1.Global.appid;
                    itemd.Version = Global_1.Global.gameVersion;
                    GameHttps_1.default.getInstance().sendGet(PlatformEvent_1.default.message_9891001, itemd, wxplatform, wxplatform.loginSucceedCallback);
                },
                fail: function (res) {
                    Debuger_1.default.log("微信登录失败，重新登录吧");
                    wxplatform.login(callobj, callback, failcallback);
                }
            });
        }
    };
    WXGamePlatform.prototype.loginSucceedCallback = function (data) {
        if (WXGamePlatform.loginCallobj && WXGamePlatform.loginsucceedcallback) {
            WXGamePlatform.loginsucceedcallback.call(WXGamePlatform.loginCallobj, data);
        }
    };
    WXGamePlatform.prototype.loadSubpackage = function (name, subcallobj, subcallback, updatecallback, subfailcallback) {
        if (Laya.Browser.window.wx) {
            this._subcallobj = subcallobj;
            this._subcallback = subcallback;
            this._updatecallback = updatecallback;
            this._subfailcallback = subfailcallback;
            var wx = Laya.Browser.window.wx;
            if (wx.loadSubpackage) {
                var loadTask = wx.loadSubpackage({
                    name: name,
                    success: function (res) {
                        // 分包加载成功后通过 success 回调
                        Debuger_1.default.log("分包加载成功");
                        var wxgamePlatform = WXGamePlatform.getInstance();
                        if (wxgamePlatform._subcallback && wxgamePlatform._subcallobj) {
                            wxgamePlatform._subcallback.call(wxgamePlatform._subcallobj);
                        }
                    },
                    fail: function (res) {
                        // 分包加载失败通过 fail 回调
                        var wxgamePlatform = WXGamePlatform.getInstance();
                        if (wxgamePlatform._subfailcallback && wxgamePlatform._subcallobj) {
                            wxgamePlatform._subfailcallback.call(wxgamePlatform._subcallobj);
                        }
                    }
                });
                if (loadTask.onProgressUpdate) {
                    loadTask.onProgressUpdate(function (res) {
                        var wxgamePlatform = WXGamePlatform.getInstance();
                        if (wxgamePlatform._updatecallback && wxgamePlatform._subcallobj) {
                            wxgamePlatform._updatecallback.call(wxgamePlatform._subcallobj, res.progress);
                        }
                        Debuger_1.default.log('下载进度', res.progress);
                        Debuger_1.default.log('已经下载的数据长度', res.totalBytesWritten);
                        Debuger_1.default.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite);
                    });
                }
            }
            else {
                if (subcallobj && subcallback) {
                    subcallback.call(subcallobj);
                }
            }
        }
        else {
            if (subcallobj && subcallback) {
                subcallback.call(subcallobj);
            }
        }
    };
    /**
     * 获取转发详细信息
     * @param obj
     * @param callobj
     * @param succeedcallback
     * @param failCallback
     */
    WXGamePlatform.prototype.getShareInfo = function (obj, callobj, succeedcallback, failCallback) {
        if (failCallback === void 0) { failCallback = null; }
        if (Laya.Browser.window.wx) {
            Debuger_1.default.log("shareTicket:", obj.shareTicket);
            Laya.Browser.window.wx.getShareInfo({
                shareTicket: obj.shareTicket,
                success: function (res) {
                    Debuger_1.default.log("成功：", res);
                    succeedcallback.call(callobj, res);
                }
            });
        }
    };
    /**
     * 监听用户点击右上角菜单的“转发”按钮时触发的事件
     * @param title
     * @param imageUrl
     */
    WXGamePlatform.prototype.onShareAppMessage = function (title, imageUrl) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.onShareAppMessage(function () {
                return {
                    title: title,
                    imageUrl: imageUrl
                };
            });
        }
    };
    /**
     * 主动拉起转发，进入选择通讯录界面。
     * @param title
     * @param imageUrl
     */
    WXGamePlatform.prototype.shareAppMessage = function (d) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.shareAppMessage(d);
        }
    };
    /**
     * 显示当前页面的转发按钮
     * @param obj
     */
    WXGamePlatform.prototype.showShareMenu = function (obj) {
        if (obj === void 0) { obj = null; }
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.showShareMenu(obj);
        }
    };
    /**
     * 更新转发属性
     * @param obj
     */
    WXGamePlatform.prototype.updateShareMenu = function (obj) {
        if (obj === void 0) { obj = null; }
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.updateShareMenu(obj);
        }
    };
    /**
     * 显示当前页面的转发按钮
     */
    WXGamePlatform.prototype.showMenu = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.showShareMenu();
        }
    };
    /**
     * 本地存储
     * @param key
     * @param data
     */
    WXGamePlatform.prototype.setStorageSync = function (key, data) {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            wx.setStorageSync(key, data);
        }
    };
    /**
     * 获取本地存储
     * @param key
     */
    WXGamePlatform.prototype.getStorageSync = function (key) {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            return wx.getStorageSync(key);
        }
        return null;
    };
    WXGamePlatform.prototype.setUserCloudStorage = function (obj, callobj, succeedcallback, failCallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        var wx = Laya.Browser.window.wx;
        if (wx && wx.setUserCloudStorage) {
            Debuger_1.default.log("setUserCloudStorage", obj);
            wx.setUserCloudStorage({
                KVDataList: obj,
                success: function (res) {
                    if (succeedcallback) {
                        succeedcallback.call(callobj, res);
                    }
                    Debuger_1.default.log("setUserCloudStorage", "上传成功");
                },
                fail: function (res) {
                    if (failCallback) {
                        failCallback.call(callobj);
                    }
                    Debuger_1.default.log("setUserCloudStorage", "上传失败");
                }
            });
        }
    };
    /**
     * 显示消息提示框
     * @param word
     */
    WXGamePlatform.prototype.toast = function (word) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.showToast({ title: word });
        }
    };
    /**
     * 向开放数据域发送消息
     * @param obj
     */
    WXGamePlatform.prototype.postMessage = function (str, data) {
        if (data === void 0) { data = null; }
        var wx = Laya.Browser.window.wx;
        if (wx) {
            Debuger_1.default.log("postMessage:", str);
            var context = wx.getOpenDataContext();
            context.postMessage({ action: str, data: data });
        }
    };
    /**
     * 创建一个 InnerAudioContext 实例
     */
    WXGamePlatform.prototype.createInnerAudioContext = function () {
        if (Laya.Browser.window.wx) {
            return Laya.Browser.window.wx.createInnerAudioContext();
        }
        return null;
    };
    /**
     * 获取系统信息
     */
    WXGamePlatform.prototype.getSystemInfoSync = function () {
        if (Laya.Browser.window.wx) {
            return Laya.Browser.window.wx.getSystemInfoSync();
        }
        return null;
    };
    /**
     * 预览图片，调用之后会在新打开的页面中全屏预览传入的图片，预览的过程中用户可以进行保存图片、发送给朋友等操作
     * @param obj
     */
    WXGamePlatform.prototype.previewImage = function (obj) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.previewImage(obj);
        }
    };
    /**
     * 监听小游戏隐藏到后台事件。锁屏、按 HOME 键退到桌面、显示在聊天顶部等操作会触发此事件。
     * @param callobj
     * @param succeedcallback
     */
    WXGamePlatform.prototype.onHide = function (callobj, succeedcallback) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.onHide(function (res) {
                WXGamePlatform.isShowing = false;
                if (succeedcallback && callobj) {
                    succeedcallback.call(callobj, res);
                }
            });
        }
    };
    /**
     * 返回小程序启动参数
     * @param callobj
     * @param succeedcallback
     */
    WXGamePlatform.prototype.getLaunchOptionsSync = function () {
        if (Laya.Browser.window.wx) {
            return Laya.Browser.window.wx.getLaunchOptionsSync();
        }
        return null;
    };
    /**
     * 隐藏消息提示框
     * @param obj
     */
    WXGamePlatform.prototype.hideToast = function (obj) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.hideToast(obj);
        }
    };
    /**
     * 显示模态对话框
     * @param obj
     */
    WXGamePlatform.prototype.showModal = function (obj) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.showModal(obj);
        }
    };
    /**
     * 清理存储数据
     */
    WXGamePlatform.prototype.clearStorage = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.clearStorageSync();
        }
    };
    /**
     * 使手机发生较短时间的振动（15 ms）
     * @param obj
     */
    WXGamePlatform.prototype.vibrateShort = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.vibrateShort();
        }
    };
    /**
     * 从本地缓存中移除指定 key
     * @param key
     */
    WXGamePlatform.prototype.removeStorage = function (key) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.removeStorage(key);
        }
    };
    WXGamePlatform.prototype.onAudioInterruptionBegin = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.onAudioInterruptionBegin(function () {
                // SoundssManager.getInstance().playbgSound("bgm");
                Debuger_1.default.log("onAudioInterruptionBegin");
                SoundssManager_1.default.getInstance().stopAll();
            });
        }
    };
    WXGamePlatform.prototype.onAudioInterruptionEnd = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.onAudioInterruptionEnd(function () {
                Debuger_1.default.log("onAudioInterruptionEnd");
                var wxgameplatform = WXGamePlatform.getInstance();
                Laya.timer.clear(wxgameplatform, wxgameplatform.onAudioEndCallback);
                Laya.timer.once(500, wxgameplatform, wxgameplatform.onAudioEndCallback);
            });
        }
    };
    WXGamePlatform.prototype.onAudioEndCallback = function () {
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_onAudioInterruptionEnd);
    };
    /**
     * 退出游戏
     */
    WXGamePlatform.prototype.exitGame = function () {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            wx.exitMiniProgram();
        }
    };
    /**
     * 打开客服对话框
     */
    WXGamePlatform.prototype.openCustomerService = function () {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            var version = wx.getSystemInfoSync().SDKVersion;
            if (GameUtils_1.GameUtils.compareVersion(version, '2.0.3') >= 0 && wx.openCustomerServiceConversation) {
                wx.openCustomerServiceConversation({
                    showMessageCard: true,
                    sendMessageImg: "https://resource.51yoyoyo.com/res/wxsendmessageimg/smi.jpg"
                });
            }
            else {
                // AlertUtils.showWordTips("当前微信版本不支持");
            }
        }
    };
    /**
     * 监听内存不足告警
     */
    WXGamePlatform.prototype.onMemoryWarning = function () {
        var wx = Laya.Browser.window.wx;
        if (wx && wx.onMemoryWarning) {
            wx.onMemoryWarning(function () {
                Debuger_1.default.log('onMemoryWarningReceive'); //收到警告，强制清理不必要的资源
            });
        }
    };
    WXGamePlatform.prototype.onError = function () {
        var wx = Laya.Browser.window.wx;
        if (wx && wx.onError) {
            wx.onError(function (res) {
                console.log("*****onError", res);
            });
        }
    };
    /**
     * 开始分享
     */
    WXGamePlatform.prototype.startShareApp = function (key, callobj, succeedCallback, failCallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedCallback === void 0) { succeedCallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        WXGamePlatform.nowShareindex = 0;
        if (WXGamePlatform.ShareDict[key]) {
            TongjiHttps_1.default.getInstance().tongjiData("share", key, 1);
            this.shareApp(WXGamePlatform.ShareDict[key], callobj, succeedCallback, failCallback);
        }
    };
    WXGamePlatform.prototype.shareApp = function (info, callobj, success, failCallback) {
        this.nowshareObj = callobj;
        this.nowshareinfo = info;
        this.nowsharesucceedfun = success;
        this.nowsharefailfun = failCallback;
        this.startShareTime = Laya.Browser.now();
        this.isShareing = true;
        WXGamePlatform.callbackfailstate = 0;
        this.shareAppMessage({
            title: info.tile, imageUrl: Global_1.Global.cdnurl + info.img, query: "",
            success: function (res) {
            },
            fail: function (res) {
                WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("您取消了分享");
                if (failCallback && callobj) {
                    failCallback.call(callobj);
                }
            },
            cancel: function (res) {
                WXGamePlatform.callbackfailstate = 1;
            }
        });
    };
    /**
     * 监听小游戏回到前台的事件
     * @param callobj
     * @param succeedcallback
     * @param failCallback
     */
    WXGamePlatform.prototype.onShow = function (callobj, succeedcallback, failCallback) {
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        this.showobj = callobj;
        this.showCallback = succeedcallback;
        var wx = Laya.Browser.window.wx;
        if (wx) {
            wx.onShow(function (res) {
                WXGamePlatform.isShowing = true;
                Debuger_1.default.log("onShow", res);
                if (res && res.scene) {
                    WXGamePlatform.fromscene = Number(res.scene);
                }
                Laya.timer.frameOnce(1, WXGamePlatform.getInstance(), WXGamePlatform.getInstance().onShowSucceed);
            });
        }
    };
    WXGamePlatform.prototype.onShowSucceed = function () {
        var wxgameplatform = WXGamePlatform.getInstance();
        if (wxgameplatform.showobj && wxgameplatform.showCallback) {
            wxgameplatform.showCallback.call(wxgameplatform.showobj);
        }
        if (wxgameplatform.isShareing) //如果是分享状态
         {
            wxgameplatform.isShareing = false;
            var isShareSucceed = false;
            if (WXGamePlatform.callbackfailstate == 0) {
                var nowTime = Laya.Browser.now();
                var disTime = (nowTime - wxgameplatform.startShareTime) / 1000;
                if (disTime >= WXGamePlatform.ShareTime || WXGamePlatform.nowShareindex >= 3) {
                    isShareSucceed = true;
                }
            }
            WXGamePlatform.callbackfailstate = 0;
            if (isShareSucceed) {
                if (wxgameplatform.nowshareinfo) {
                    TongjiHttps_1.default.getInstance().tongjiData("shareend", wxgameplatform.nowshareinfo.key, 1);
                }
                WXGamePlatform.dayShareNum++;
                wxgameplatform.updateDayShareInfo();
                if (wxgameplatform.nowshareObj && wxgameplatform.nowsharesucceedfun) {
                    wxgameplatform.nowsharesucceedfun.call(wxgameplatform.nowshareObj);
                }
            }
            else {
                WXGamePlatform.nowShareindex++;
                wxgameplatform.showModal({
                    title: "提示", content: "请每次分享到不同群,是否重新分享？", showCancel: true, cancelText: '取消', confirmText: '确定',
                    success: function (res) {
                        var wxplatform = WXGamePlatform.getInstance();
                        if (res.confirm) {
                            WXGamePlatform.getInstance().shareApp(wxplatform.nowshareinfo, wxplatform.nowshareObj, wxplatform.nowsharesucceedfun, wxplatform.nowsharefailfun);
                        }
                        else {
                            if (wxplatform.nowsharefailfun && wxplatform.nowshareObj) {
                                wxplatform.nowsharefailfun.call(wxplatform.nowshareObj);
                            }
                        }
                    },
                    fail: function () {
                    },
                    complete: function () {
                    }
                });
            }
        }
    };
    /**
     * 看视频领奖励
     * @param callobj
     * @param succeedcallback
     */
    WXGamePlatform.prototype.playVideo = function (key, callobj, succeedcallback, failCallback, istongjiNum) {
        var _this = this;
        if (callobj === void 0) { callobj = null; }
        if (succeedcallback === void 0) { succeedcallback = null; }
        if (failCallback === void 0) { failCallback = null; }
        if (istongjiNum === void 0) { istongjiNum = true; }
        var wx = Laya.Browser.window.wx;
        if (wx && wx.createRewardedVideoAd) {
            if (!WXGamePlatform.videoplaying) {
                var time = this.lockVideoLeftTime();
                if (time > 0) {
                    WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("广告尚未准备好，请" + time + "秒后再试");
                    return;
                }
                EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_losefocus);
                WXGamePlatform.istongjiVideoNum = istongjiNum;
                this.nowvideokey = key;
                TongjiHttps_1.default.getInstance().tongjiData("Video", key, 1);
                WXGamePlatform.videoplaying = true;
                this.videocallobj = callobj;
                this.videosucceedCallback = succeedcallback;
                this.videofailCallback = failCallback;
                this.videoAd = wx.createRewardedVideoAd({
                    adUnitId: 'adunit-de007388d8f86f71'
                });
                this.videoAd.onClose(this.closeAD);
                this.videoAd.onError(this.onerro);
                this.videoAd.load().then(function () { return _this.videoAd.show(); }).catch(function (err) { console.log(err.errMsg), WXGamePlatform.getInstance().failVideo(); });
            }
        }
    };
    WXGamePlatform.prototype.lockVideoLeftTime = function () {
        var time = (Laya.Browser.now() - WXGamePlatform.lastVideoTime) / 1000;
        time = WXGamePlatform.VideoTime - time;
        return Math.ceil(time);
    };
    WXGamePlatform.prototype.onerro = function (res) {
        var wxgamePlatform = WXGamePlatform.getInstance();
        WXGamePlatform.videoplaying = false;
        wxgamePlatform.videoAd.offError(wxgamePlatform.onerro); //移除 不然被多次调用
        wxgamePlatform.videoAd.offClose(wxgamePlatform.closeAD); //移除 不然被多次调用
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_getfocus);
    };
    // 关闭广告
    WXGamePlatform.prototype.closeAD = function (status) {
        WXGamePlatform.lastVideoTime = Laya.Browser.now();
        var wxgamePlatform = WXGamePlatform.getInstance();
        if (status && status.isEnded || status == undefined) {
            if (WXGamePlatform.istongjiVideoNum) {
                WXGamePlatform.dayVideoNum++;
                wxgamePlatform.updateDayVideoInfo();
                EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_updateVideoNums);
            }
            TongjiHttps_1.default.getInstance().tongjiData("Videoend", wxgamePlatform.nowvideokey, 1);
            if (wxgamePlatform.videocallobj && wxgamePlatform.videosucceedCallback) {
                wxgamePlatform.videosucceedCallback.call(wxgamePlatform.videocallobj);
            }
        }
        else {
            WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("未观看完整视频，无法获得奖励");
            if (wxgamePlatform.videocallobj && wxgamePlatform.videofailCallback) {
                wxgamePlatform.videofailCallback.call(wxgamePlatform.videocallobj);
            }
        }
        WXGamePlatform.videoplaying = false;
        wxgamePlatform.videoAd.offError(wxgamePlatform.onerro); //移除 不然被多次调用
        wxgamePlatform.videoAd.offClose(wxgamePlatform.closeAD); //移除 不然被多次调用
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_getfocus);
    };
    // 广告失败
    WXGamePlatform.prototype.failVideo = function () {
        WXGamePlatform.lastVideoTime = Laya.Browser.now();
        WXGamePlatform.videoplaying = false;
        WordTipsUtils_1.WordTipsUtils.getInstance().showWordTips("广告加载失败,试试别的方式吧~");
        var wxgamePlatform = WXGamePlatform.getInstance();
        wxgamePlatform.videoAd.offError(wxgamePlatform.onerro); //移除 不然被多次调用
        wxgamePlatform.videoAd.offClose(wxgamePlatform.closeAD); //移除 不然被多次调用
        if (wxgamePlatform.videocallobj && wxgamePlatform.videofailCallback) {
            wxgamePlatform.videofailCallback.call(wxgamePlatform.videocallobj);
        }
        EventUtils_1.EventUtils.dispatchEvent(PlatformEvent_1.default.PlatformEvent_getfocus);
    };
    WXGamePlatform.prototype.isCanVideo = function () {
        if (WXGamePlatform.dayVideoNum < WXGamePlatform.VideoNum) {
            if (WXGamePlatform.dayVideoNum == 0) {
                return true;
            }
            var videobs = Math.floor(WXGamePlatform.dayVideoNum / WXGamePlatform.VideotoShare);
            var sharebs = Math.floor(WXGamePlatform.dayShareNum / WXGamePlatform.SharetoVideo);
            if (videobs > sharebs) {
                return false;
            }
            else if (videobs < sharebs) {
                return true;
            }
            else {
                var videoyushu = WXGamePlatform.dayVideoNum % WXGamePlatform.VideotoShare;
                if (videoyushu != 0) {
                    return true;
                }
                var shareyushu = WXGamePlatform.dayShareNum % WXGamePlatform.SharetoVideo;
                if (shareyushu != 0) {
                    return false;
                }
                return true;
            }
        }
        return false;
    };
    WXGamePlatform.prototype.createBanner = function (bannertype, style) {
        if (bannertype === void 0) { bannertype = ""; }
        if (Laya.Browser.window.wx) {
            if (bannertype != "") {
                var bo = false;
                for (var i = 0; i < this._bannerTypeList.length; i++) {
                    if (bannertype == this._bannerTypeList[i].type) {
                        this._bannerTypeList[i].style = style;
                        var arr = this._bannerTypeList.splice(i, 1);
                        this._bannerTypeList.push(arr[0]);
                        bo = true;
                        break;
                    }
                }
                if (!bo) {
                    this._bannerTypeList.push({ type: bannertype, style: style });
                }
            }
            else {
                if (this._bannerTypeList.length == 0) {
                    return;
                }
                else {
                    var item = this._bannerTypeList[this._bannerTypeList.length - 1];
                    style = item.style;
                }
            }
            if (this.bannerAd) {
                var now = Laya.Browser.now();
                //超过3分钟刷新
                if (now - this.bannerRunTime > 60000 * 3) {
                    Debuger_1.default.log("先移除banner,再添加");
                    this.bannerAd.offError(this.bannerError);
                    this.bannerAd.offResize(this.bannerResize);
                    this.bannerAd.destory();
                    this.createNewBanner(style);
                }
                else {
                    this.showBanner(style);
                }
            }
            else {
                this.createNewBanner(style);
            }
        }
    };
    WXGamePlatform.prototype.createNewBanner = function (style) {
        var wx = Laya.Browser.window.wx;
        if (wx && wx.createBannerAd) {
            this.nowStype = style;
            this.bannerRunTime = Laya.Browser.now();
            var info = this.getSystemInfoSync();
            this._screenwidth = info.screenWidth;
            var scale = 1;
            if (style.hasOwnProperty("scale")) {
                scale = style.scale;
            }
            this.bannerAd = wx.createBannerAd({
                adUnitId: 'adunit-6ec2688adfaf5a34',
                adIntervals: 30,
                style: {
                    left: 0,
                    top: info.screenHeight - 105,
                    width: info.screenWidth * scale
                }
            });
            if (this.bannerAd) {
                this.bannerAd.onError(this.bannerError);
                this.showBanner(style);
            }
        }
    };
    WXGamePlatform.prototype.bannerResize = function (res) {
        Debuger_1.default.log("bannerResize", res);
        var self = WXGamePlatform.getInstance();
        self.bannerAd.offResize(self.bannerResize);
        self.isonResize = false;
        var nowstype = self.nowStype;
        if (!nowstype) {
            return;
        }
        var info = self.getSystemInfoSync();
        var percentageH = Laya.Browser.clientHeight / Laya.stage.displayHeight;
        var percentageW = Laya.Browser.clientWidth / Laya.stage.displayWidth;
        self.bannerwidth = res.width;
        self.bannerheight = res.height;
        if (nowstype.hasOwnProperty("x") && nowstype.x != 0) {
            self.bannerAd.style.left = nowstype.x * percentageW;
        }
        else {
            self.bannerAd.style.left = (info.windowWidth - res.width) * 0.5;
        }
        if (nowstype.hasOwnProperty("y") && nowstype.y != 0) {
            self.bannerAd.style.top = nowstype.y * percentageH;
        }
        else {
            self.bannerAd.style.top = (info.windowHeight - res.height) - 15;
        }
    };
    WXGamePlatform.prototype.bannerError = function (err) {
        Debuger_1.default.log(err);
    };
    WXGamePlatform.prototype.showBanner = function (style) {
        if (this.bannerAd) {
            this.nowStype = style;
            var info = this.getSystemInfoSync();
            Debuger_1.default.log("getSystemInfoSync:", info);
            var nowstype = this.nowStype;
            var scale = 1;
            if (nowstype.hasOwnProperty("scale")) {
                scale = nowstype.scale;
            }
            var percentageH = Laya.Browser.clientHeight / Laya.stage.displayHeight;
            var percentageW = Laya.Browser.clientWidth / Laya.stage.displayWidth;
            if (nowstype.hasOwnProperty("x") && nowstype.x != 0) {
                this.bannerAd.style.left = nowstype.x * percentageW;
            }
            else {
                this.bannerAd.style.left = (info.windowWidth - this.bannerwidth) * 0.5;
            }
            if (nowstype.hasOwnProperty("y") && nowstype.y != 0) {
                this.bannerAd.style.top = nowstype.y * percentageH;
            }
            else {
                this.bannerAd.style.top = (info.windowHeight - this.bannerheight) - 15;
            }
            this.bannerAd.style.width = info.screenWidth * scale;
            if (!this.isonResize) {
                this.isonResize = true;
                this.bannerAd.onResize(this.bannerResize);
            }
            this.bannerAd.show();
        }
    };
    WXGamePlatform.prototype.hideBanner = function (type) {
        if (type === void 0) { type = ""; }
        if (this.bannerAd) {
            this.bannerAd.hide();
        }
        if (type != "") {
            for (var i = 0; i < this._bannerTypeList.length; i++) {
                if (type == this._bannerTypeList[i].type) {
                    this._bannerTypeList.splice(i, 1);
                    break;
                }
            }
            if (this._bannerTypeList.length > 0) {
                var item = this._bannerTypeList[this._bannerTypeList.length - 1];
                this.createBanner(item.type, item.style);
            }
        }
    };
    // private _wxOpenDataViewer:WXOpenDataViewer;
    /**
     * 打开好友排行榜
     */
    WXGamePlatform.prototype.openFriendRank = function (type, viewType, rect, parent, data) {
        if (parent === void 0) { parent = null; }
        if (data === void 0) { data = null; }
        this.closeziyuStage();
        this._openrankDict[viewType] = { type: type, viewType: viewType, rect: rect, parent: parent, data: data };
        this.initziyuStage(rect, parent);
        this.postMessage(type, data);
    };
    /**
     * 排行榜打开状态时候，切换显示类型
     * @param type
     */
    WXGamePlatform.prototype.changeFriendRank = function (type) {
        this.postMessage(type);
    };
    /**
     * 排行榜上一页
     */
    WXGamePlatform.prototype.prePageRank = function () {
        this.postMessage(RankType_1.RankType.prepage);
    };
    /**
     * 排行榜下一页
     */
    WXGamePlatform.prototype.nextPageRank = function () {
        this.postMessage(RankType_1.RankType.nextpage);
    };
    /**
     * 关闭好友排行榜
     */
    WXGamePlatform.prototype.closeFriendRank = function (viewType) {
        this.postMessage(RankType_1.RankType.closefriendrank);
        this.closeziyuStage();
        if (this._openrankDict[viewType]) {
            delete this._openrankDict[viewType];
        }
        for (var s in this._openrankDict) {
            var itemd = this._openrankDict[s];
            this.openFriendRank(itemd.type, itemd.viewType, itemd.rect, itemd.parent, itemd.data);
            break;
        }
    };
    /**
     * 初始化子域
     * @param rect
     * @param parent
     */
    WXGamePlatform.prototype.initziyuStage = function (rect, parent) {
        // if( !this._wxOpenDataViewer )
        // {
        //     this._wxOpenDataViewer = new WXOpenDataViewer();
        //     if( parent )
        //     {
        //         parent.addChild( this._wxOpenDataViewer );
        //     }
        //     else
        //     {
        //         GameLayerManager.getInstance().topLayer.displayObject.addChild( this._wxOpenDataViewer );
        //     }
        // }
        // this._wxOpenDataViewer.x = rect.x;
        // this._wxOpenDataViewer.y = rect.y;
        // this._wxOpenDataViewer.width = rect.width;
        // this._wxOpenDataViewer.height = rect.height;
    };
    /**
     * 销毁子域
     */
    WXGamePlatform.prototype.closeziyuStage = function () {
        // if( this._wxOpenDataViewer )
        // {
        //     this._wxOpenDataViewer.destroy();
        //     this._wxOpenDataViewer.removeSelf();
        //     this._wxOpenDataViewer = null;
        // }
    };
    /**
     * 数据上传（用于排行榜数据显示）
     * @param param1 上报数据
     * @param param2 上报数据
     */
    WXGamePlatform.prototype.storeToCloud = function (param1, param2) {
        var cacheMager = CacheManager_1.default.getInstance();
        var score1 = cacheMager.getnum("param1");
        // var score2:number = cacheMager.getnum( "param2" );
        param1 = Math.floor(param1);
        param2 = Math.floor(param2);
        var result1 = param1;
        var result2 = param2;
        if (result1 < score1) {
            result1 = score1;
        }
        else {
            cacheMager.addstr("param1", result1.toString());
        }
        var arr = [];
        arr.push({ key: "param1", value: result1.toString() });
        arr.push({ key: "param2", value: result2 + "" });
        Debuger_1.default.log("storeToCloud", arr);
        this.setUserCloudStorage(arr);
    };
    WXGamePlatform.prototype.createGameClubButton = function (style, icon) {
        if (icon === void 0) { icon = "green"; }
        var wx = Laya.Browser.window.wx;
        if (wx && style) {
            style.width = 40;
            style.height = 40;
            WXGamePlatform.gameclubButton = wx.createGameClubButton({
                icon: icon,
                style: style
            });
            if (WXGamePlatform.gameclubButton) {
                WXGamePlatform.gameclubButton.show();
            }
        }
    };
    WXGamePlatform.QuDaoID = ""; //微信广告ID
    WXGamePlatform.isShowing = true;
    /**
     * 授权状态 0:未判断，1：已授权
     */
    WXGamePlatform.accreditstate = 0;
    /**
     * 当天分享次数
     */
    WXGamePlatform.dayShareNum = 0;
    /**
     * 当天看视频次数
     */
    WXGamePlatform.dayVideoNum = 0;
    /**
     * 判断分享是否成功时间间隔
     */
    WXGamePlatform.ShareTime = 0;
    /**
     * 每日最大看视频次数（成功累加一次）
     */
    WXGamePlatform.VideoNum = 0;
    /**
     * 看视频冷却时间
     */
    WXGamePlatform.VideoTime = 0;
    /**
     * 8好位cpa可弹出时间间隔(秒)
     */
    WXGamePlatform.jiliweitime = 100;
    /**
     * 分享几次切换到视频
     */
    WXGamePlatform.SharetoVideo = 1;
    /**
     * 视频几次切换到分享
     */
    WXGamePlatform.VideotoShare = 1;
    /**
     * 分享数据容器
     */
    WXGamePlatform.ShareDict = {};
    /**
     * 用户来源id
     */
    WXGamePlatform.fromscene = 0;
    WXGamePlatform.nowShareindex = 0;
    WXGamePlatform.callbackfailstate = 0;
    WXGamePlatform.lastVideoTime = 0;
    /**
    * 视频是否在播放中
    */
    WXGamePlatform.videoplaying = false;
    WXGamePlatform.istongjiVideoNum = true;
    return WXGamePlatform;
}());
exports.default = WXGamePlatform;
},{"../../Global":2,"../../frameworks/Debuger":12,"../../frameworks/events/EventUtils":16,"../../frameworks/net/GameHttps":26,"../../frameworks/net/TongjiHttps":28,"../../gamemodule/loading/view/WordTipsUtils":36,"../../gamemodule/userinfo/events/UserCacheType":55,"../../managers/CacheManager":59,"../../managers/DayManager":60,"../../managers/SoundssManager":65,"../../utils/GameUtils":87,"../events/PlatformEvent":69,"../types/RankType":70}],73:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Sdk_1 = require("./Sdk");
var YQSdk_1 = require("./YQSdk");
var ShareUtil_1 = require("./ShareUtil");
var PlayerAccount_1 = require("./PlayerAccount");
var WxGameItem = /** @class */ (function () {
    function WxGameItem() {
        this.appNameHidden = false;
        this.color = "C93B3BFF";
        this.size = 100;
        this.borderWidth = 50;
        this.borderColor = "A1A0A0FF";
    }
    return WxGameItem;
}());
exports.WxGameItem = WxGameItem;
var GuangGao = /** @class */ (function () {
    function GuangGao() {
    }
    Object.defineProperty(GuangGao, "hasbanner", {
        get: function () {
            if (PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.banner) {
                return true;
            }
            else {
                return false;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GuangGao, "hasvideo", {
        get: function () {
            if (Laya.Browser.onWeiXin && PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.video) {
                var videonum = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.GetGlobe;
                return true;
            }
            else {
                return false;
            }
        },
        enumerable: true,
        configurable: true
    });
    //预先加载视屏广告
    GuangGao.InitVideo = function () {
        var _this = this;
        if (!Laya.Browser.onWeiXin || !PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.video)
            return;
        console.log(this.bannerAdUnitId);
        //vedio
        this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
        this.fsaasfafssfa.onLoad(function () {
            console.log('激励视频 广告加载成功');
            _this.asfasfsaffsa = true;
        });
        this.fsaasfafssfa.onError(function (err) {
            console.log("激励视屏加载失败:" + err);
            _this.asfasfsaffsa = false;
        });
        this.afsfsaafsfsa = true;
    };
    //看视频
    GuangGao.ShowVideo = function (callback) {
        var _this = this;
        if (this.hasvideo) {
            if (this.asfasfsaffsa) {
                YQSdk_1.YQSdk.statistics1("video");
                console.log("showVideoAd:" + this.asfasfsaffsa);
                this.SetVideoCallBack(callback);
                this.fsaasfafssfa.show().catch(function (err) {
                    _this.fsaasfafssfa.load().then(function () {
                        _this.SetVideoCallBack(callback);
                        _this.fsaasfafssfa.show();
                    });
                });
            }
            else {
                ShareUtil_1.ShareUtil.shareImage("视频没有分享", callback, "1");
            }
        }
        else {
            callback(false);
            ShareUtil_1.ShareUtil.shareImage("视频没有分享", callback, "1");
        }
    };
    GuangGao.SetVideoCallBack = function (callback) {
        var _this = this;
        this.fsaasfafssfa.offClose();
        this.fsaasfafssfa.onClose(function (res) {
            console.log("激励视频关闭:" + res.isEnded);
            if (res && res.isEnded || res === undefined) {
                callback && callback(true);
            }
            else {
                callback && callback(false);
            }
            _this.fsaasfafssfa.offClose();
        });
    };
    //打开banner
    GuangGao.OpenBanner = function (gap, callVack, iswait) {
        var _this = this;
        if (gap === void 0) { gap = 0; }
        if (callVack === void 0) { callVack = null; }
        if (iswait === void 0) { iswait = false; }
        if (!this.hasbanner) {
            callVack(null);
            return;
        }
        if (!Laya.Browser.onWeiXin) {
            callVack(null);
            return;
        }
        this.canshowbanner = true;
        var idd = this.bannerAdUnitId;
        console.log("adUnitId:" + idd);
        var newBanner = Laya.Browser.window.wx.createBannerAd({
            adUnitId: idd,
            style: {
                left: 0,
                top: 0,
                width: 460
            }
        });
        newBanner.onError(function (err) {
            console.log(err);
            callVack(null);
        });
        newBanner.onLoad(function () {
            if (_this.curbanner)
                _this.curbanner.destroy();
            _this.curbanner = newBanner;
            var hight = _this.GetRealHight(gap);
            if (callVack != null) {
                callVack(hight);
            }
            if (_this.canshowbanner && !iswait) {
                _this.curbanner.show();
            }
            else {
                _this.curbanner.hide();
            }
        });
    };
    GuangGao.GetRealHight = function (gap) {
        if (this.curbanner) {
            var info = Laya.Browser.window.wx.getSystemInfoSync();
            this.curbanner.style.width = info.windowWidth;
            this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
            return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
        }
    };
    //clear
    GuangGao.Clear = function () {
        Laya.timer.clearAll(this);
        Laya.Tween.clearAll(this);
        this.canshowbanner = false;
        if (this.curbanner)
            this.curbanner.hide();
        YQSdk_1.YQSdk.HideBannerImage();
        // if (!Laya.Browser.onWeiXin) return;
        // if (this.curbanner) this.curbanner.hide();
    };
    GuangGao.hidebanner = function () {
        if (!Laya.Browser.onWeiXin)
            return;
        if (this.curbanner)
            this.curbanner.hide();
        YQSdk_1.YQSdk.HideBannerImage();
    };
    GuangGao.showbanner = function () {
        if (!Laya.Browser.onWeiXin)
            return;
        if (this.curbanner)
            this.curbanner.show();
    };
    Object.defineProperty(GuangGao, "cancheat", {
        get: function () {
            if (!PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.cheat) {
                console.log("cheat:false-> CurAccountData.cheat != 1");
                return false;
            }
            var checkscence = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.checkscence;
            if (checkscence == false) {
                console.log("cheat:true-> " + Sdk_1.WxApi.sceneValue);
                return true;
            }
            if (Sdk_1.WxApi.sceneValue == "1037" || Sdk_1.WxApi.sceneValue == "1058" || Sdk_1.WxApi.sceneValue == "1067" || Sdk_1.WxApi.sceneValue == "1095") {
                console.log("cheat:true-> " + Sdk_1.WxApi.sceneValue);
                return true;
            }
            console.log("cheat:false-> " + Sdk_1.WxApi.sceneValue);
            return false;
        },
        enumerable: true,
        configurable: true
    });
    GuangGao.SetPosBanner = function (btn, complete) {
        var _this = this;
        if (Laya.Browser.onPC) {
            complete(false);
            return;
        }
        var info = Laya.Browser.window.wx.getSystemInfoSync();
        //console.log(info);
        //console.log(btn);
        //console.log(btn.y,Laya.stage.height,info.windowHeight);
        var reshight = btn.y * info.windowHeight / Laya.stage.height;
        //console.log("reshight",reshight);
        var idd = this.bannerAdUnitId;
        console.log("adUnitId:" + idd);
        if (this.curbanner)
            this.curbanner.destroy();
        var newBanner = Laya.Browser.window.wx.createBannerAd({
            adUnitId: idd,
            style: {
                left: 0,
                top: 0,
                width: 720
            }
        });
        newBanner.onError(function (err) {
            console.log(err);
            complete(false);
        });
        newBanner.onLoad(function () {
            _this.curbanner = newBanner;
            _this.curbanner.style.top = reshight;
            //console.log("top",this.asgagassga.style.top);
            if (_this.curbanner) {
                console.log("banner show");
                _this.curbanner.show();
                Laya.timer.once(2300, _this, function () {
                    _this.curbanner.style.top = info.windowHeight - GuangGao.bannerhigt;
                    complete(true);
                });
            }
        });
        newBanner.onResize(function (res) {
            GuangGao.bannerhigt = res.height;
            _this.curbanner.style.width = info.windowWidth;
            _this.curbanner.style.top = reshight;
        });
    };
    //按钮误导
    GuangGao.CheatBanner = function (btn, complete, gap) {
        var _this = this;
        if (complete === void 0) { complete = null; }
        if (gap === void 0) { gap = 0; }
        if (!GuangGao.cancheat) {
            console.log("ignorecheat");
            GuangGao.OpenBanner(0, function (height) {
                if (height == null) {
                    YQSdk_1.YQSdk.ShowBannerImag(function (hh) {
                        var end = Laya.stage.height - hh - btn.height;
                        btn.y = end;
                    });
                }
            });
        }
        else {
            btn.y = Laya.stage.height - btn.height - 100;
            GuangGao.OpenBanner(gap, function (height) {
                // var random = Math.random();
                if (height == null) {
                    YQSdk_1.YQSdk.ShowBannerImag(function (hh) {
                        var end = Laya.stage.height - hh - btn.height;
                        btn.y = end;
                        console.log(btn.y);
                    });
                }
                else {
                    console.log("cheatstart", "bottom:100");
                    btn.mouseEnabled = false;
                    var end = Laya.stage.height - height - btn.height - 20;
                    console.log("y:" + end);
                    Laya.timer.once(PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.cheattime * 1000, _this, function () {
                        btn.mouseEnabled = true;
                        _this.showbanner();
                        Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(_this, function () {
                            if (complete != null) {
                                complete();
                            }
                        }));
                    });
                }
            }, true);
        }
    };
    GuangGao.videlAdUnitId = "adunit-a9203b2080cbb5dd";
    GuangGao.bannerAdUnitId = "adunit-41998ab40c864a45";
    GuangGao.afsfsaafsfsa = false;
    //视屏广告是否加载成功
    GuangGao.asfasfsaffsa = false;
    GuangGao.canshowbanner = true;
    // static get CanCreatWxBannerRe():boolean
    // {
    //     if(!Main.WX)return false;
    //     if(!Account.Instance.curplayerData.WxRe)return false;
    //     let info = Laya.Browser.window.wx.getSystemInfoSync();
    //     if(!this.cpVersionGreaterOrEqual(info.SDKVersion,"2.7.5"))return false;
    //     return true;
    // }
    // static get CanCreatWxGameRe():boolean
    // {
    //     if(!Main.WX)return false;
    //     if(!Account.Instance.curplayerData.WxRe)return false;
    //     let info = Laya.Browser.window.wx.getSystemInfoSync();
    //     if(!this.cpVersionGreaterOrEqual(info.SDKVersion,"2.8.3"))return false;
    //     return true;
    // }
    // static wxrebannerid = "PBgAA_2ABDZFRyYw";
    // static wxbanner:any;
    // static ShowXWBanner()
    // {
    //     if (!Main.WX) return;
    //     var idd = this.wxrebannerid;
    //     let newBanner = Laya.Browser.window.wx.createGameBanner({
    //         adUnitId: idd,
    //         style: 
    //         {
    //             left: 0,
    //             top: 0,
    //         }
    //     });
    //     newBanner.onError(err => {
    //         console.log(err);
    //     });
    //     newBanner.onLoad(() => 
    //     {
    //         if (this.wxbanner) this.wxbanner.destroy();
    //         this.wxbanner = newBanner;
    //         this.wxbanner.show();
    //     });
    // }
    // static wxregameid = "PBgAA_2ABDZKVIlM";
    // static wxgame:any;
    // static ShowXWGame()
    // {
    //     if (!Main.WX || !this.CanCreatWxGameRe) return;
    //     var idd = this.wxregameid;
    //     let info = Laya.Browser.window.wx.getSystemInfoSync();
    //     var game1 = new WxGameItem();
    //     game1.top = info.windowHeight * 0.3;
    //     game1.left = info.windowWidth - 80;
    //     var games = [game1];
    //     let newGame = Laya.Browser.window.wx.createGameIcon({
    //         adUnitId: idd,
    //         count: 1,
    //         style: games
    //     },game1);
    //     newGame.onError(err => {
    //         console.log(err);
    //     });
    //     newGame.onLoad(() => 
    //     {
    //         if (this.wxgame) this.wxgame.destroy();
    //         this.wxgame = newGame;
    //         this.wxgame.show();
    //     });
    // }
    GuangGao.bannerhigt = 0;
    return GuangGao;
}());
exports.default = GuangGao;
},{"./PlayerAccount":74,"./Sdk":75,"./ShareUtil":76,"./YQSdk":77}],74:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Sdk_1 = require("../WXSDK/Sdk");
var GameUtils_1 = require("../../../utils/GameUtils");
var NetworkManager_1 = require("../NetworkManager");
var requiretype;
(function (requiretype) {
    requiretype[requiretype["\u7CFB\u7EDF\u8D60\u9001"] = 1] = "\u7CFB\u7EDF\u8D60\u9001";
    requiretype[requiretype["\u91D1\u5E01\u8D2D\u4E70"] = 2] = "\u91D1\u5E01\u8D2D\u4E70";
    requiretype[requiretype["\u89C2\u770B\u89C6\u9891"] = 3] = "\u89C2\u770B\u89C6\u9891";
    requiretype[requiretype["\u5206\u4EAB"] = 4] = "\u5206\u4EAB";
    requiretype[requiretype["\u7B7E\u5230"] = 5] = "\u7B7E\u5230";
    requiretype[requiretype["\u6D3B\u52A8"] = 6] = "\u6D3B\u52A8";
    requiretype[requiretype["\u901A\u8FC7\u5173\u5361"] = 7] = "\u901A\u8FC7\u5173\u5361";
    requiretype[requiretype["\u7D2F\u8BA1\u767B\u9646"] = 8] = "\u7D2F\u8BA1\u767B\u9646";
    requiretype[requiretype["\u9080\u8BF7\u4EBA\u6570\u8FBE\u5230"] = 9] = "\u9080\u8BF7\u4EBA\u6570\u8FBE\u5230";
    requiretype[requiretype["\u7816\u77F3\u8D2D\u4E70"] = 10] = "\u7816\u77F3\u8D2D\u4E70";
})(requiretype = exports.requiretype || (exports.requiretype = {}));
var AccountConfig;
(function (AccountConfig) {
    AccountConfig[AccountConfig["crop"] = 0] = "crop";
    AccountConfig[AccountConfig["things"] = 1] = "things";
    AccountConfig[AccountConfig["land"] = 2] = "land";
    AccountConfig[AccountConfig["global"] = 3] = "global";
    AccountConfig[AccountConfig["entity"] = 4] = "entity";
    AccountConfig[AccountConfig["sign"] = 5] = "sign";
    AccountConfig[AccountConfig["rewards"] = 6] = "rewards";
    AccountConfig[AccountConfig["achievement"] = 7] = "achievement";
    AccountConfig[AccountConfig["invite"] = 8] = "invite";
    AccountConfig[AccountConfig["mission"] = 9] = "mission";
    AccountConfig[AccountConfig["treasure_click"] = 10] = "treasure_click";
    AccountConfig[AccountConfig["theme"] = 11] = "theme";
    AccountConfig[AccountConfig["lottery"] = 12] = "lottery";
})(AccountConfig = exports.AccountConfig || (exports.AccountConfig = {}));
var AccountUser;
(function (AccountUser) {
    AccountUser[AccountUser["money"] = 0] = "money";
    AccountUser[AccountUser["diamond"] = 1] = "diamond";
    AccountUser[AccountUser["user_id"] = 2] = "user_id";
    AccountUser[AccountUser["game_times"] = 3] = "game_times";
    AccountUser[AccountUser["get_themes"] = 4] = "get_themes";
    AccountUser[AccountUser["video_times"] = 5] = "video_times";
    AccountUser[AccountUser["equip_themes"] = 6] = "equip_themes";
    AccountUser[AccountUser["last_action_time"] = 7] = "last_action_time";
    AccountUser[AccountUser["last_favorite_time"] = 8] = "last_favorite_time";
    AccountUser[AccountUser["progress_themes"] = 9] = "progress_themes";
    AccountUser[AccountUser["revival"] = 10] = "revival";
    AccountUser[AccountUser["stage"] = 11] = "stage";
    AccountUser[AccountUser["vmoney"] = 12] = "vmoney";
})(AccountUser = exports.AccountUser || (exports.AccountUser = {}));
var heroAttr;
(function (heroAttr) {
    heroAttr[heroAttr["id"] = 0] = "id";
    heroAttr[heroAttr["name"] = 1] = "name";
    heroAttr[heroAttr["quality"] = 2] = "quality";
    heroAttr[heroAttr["icon"] = 3] = "icon";
    heroAttr[heroAttr["prefab"] = 4] = "prefab";
    heroAttr[heroAttr["require_num"] = 5] = "require_num";
    heroAttr[heroAttr["require_type"] = 6] = "require_type";
})(heroAttr = exports.heroAttr || (exports.heroAttr = {}));
var signdata;
(function (signdata) {
    signdata[signdata["sign_days"] = 0] = "sign_days";
    signdata[signdata["sign_time"] = 1] = "sign_time";
})(signdata = exports.signdata || (exports.signdata = {}));
var entity;
(function (entity) {
    entity[entity["id"] = 0] = "id";
    entity[entity["name"] = 1] = "name";
    entity[entity["entity_id"] = 2] = "entity_id";
    entity[entity["icon"] = 3] = "icon";
})(entity = exports.entity || (exports.entity = {}));
var skinattr;
(function (skinattr) {
    skinattr[skinattr["effectValue_1"] = 0] = "effectValue_1";
    skinattr[skinattr["effectValue_2"] = 1] = "effectValue_2";
    skinattr[skinattr["effectValue_3"] = 2] = "effectValue_3";
    skinattr[skinattr["effectValue_4"] = 3] = "effectValue_4";
})(skinattr = exports.skinattr || (exports.skinattr = {}));
var AccountData = /** @class */ (function () {
    function AccountData(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_stage, _user_sign, _user_achievement, _lottery, _use_land_task, _user_video) {
        if (_useInvite === void 0) { _useInvite = null; }
        if (_user_stage === void 0) { _user_stage = null; }
        this.openid = "";
        this.userId = "";
        this.roadconfig = {};
        this.m_RewardDic = {};
        this.m_EntityDic = {};
        this.m_AchievementDic = {};
        this.m_token = _token;
        this.m_app_setting = _appSetting;
        this.m_user = _user;
        this.m_user_base = _userbase;
        this.m_sign = _user_sign;
        this.m_task = _user_achievement;
        this.lottery = _lottery;
        this.m_use_land_task = _use_land_task;
        this.m_user_video = _user_video;
        this.userId = this.m_user["user_id"];
        this.openid = this.m_user_base["openid"];
        console.log("user_id:" + this.userId);
        //console.log("open_id:"+this.openid);
    }
    Object.defineProperty(AccountData.prototype, "lotterytime", {
        // public m_skinDic:Dictionary<number,SkinData> = new Dictionary();
        get: function () {
            return Number(this.lottery["day_video_times"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "share", {
        get: function () {
            return this.m_app_setting["share"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "sharecontent", {
        get: function () {
            return this.m_app_setting["sharecontent"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "ShareImage", {
        get: function () {
            return this.m_app_setting["ShareImage"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "cheattime", {
        get: function () {
            return Number(this.m_app_setting["cheattime"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "banner", {
        get: function () {
            return this.m_app_setting["banner"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "video", {
        get: function () {
            return this.m_app_setting["video"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "BtnCanMove", {
        get: function () {
            return this.m_app_setting["BtnCanMove"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "checkscence", {
        get: function () {
            return this.m_app_setting["checkscence"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "banner_dis", {
        get: function () {
            return Number(this.m_app_setting["banner_dis"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "bannerMoveTime", {
        get: function () {
            return Number(this.m_app_setting["bannerMoveTime"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "createBannerTimes", {
        get: function () {
            return Number(this.m_app_setting["createBannerTimes"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "bannerMoveProp", {
        get: function () {
            return Number(this.m_app_setting["bannerMoveProp"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "isShareThenVideo", {
        get: function () {
            return this.m_app_setting["isShareThenVideo"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "isShowHuiTui", {
        get: function () {
            return this.m_app_setting["isShowHuiTui"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "start_sprint", {
        get: function () {
            return Number(this.m_app_setting["start_sprint"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "IsVideoModel", {
        get: function () {
            return this.m_app_setting["IsVideoModel"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "videoModelNum", {
        get: function () {
            return Number(this.m_app_setting["videoModelNum"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "VideoModelTitle", {
        get: function () {
            return this.m_app_setting["VideoModelTitle"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "failcount", {
        get: function () {
            return Number(this.m_app_setting["failcount"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "spminspeed", {
        get: function () {
            return Number(this.m_app_setting["spminspeed"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "bgm", {
        get: function () {
            return this.m_app_setting["bgm"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "camerahight", {
        get: function () {
            return Number(this.m_app_setting["camerahight"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "ctnfilename", {
        get: function () {
            return this.m_app_setting["ctnfilename"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "cheat", {
        get: function () {
            return this.m_app_setting["cheat"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "shakestage", {
        get: function () {
            return this.m_app_setting["shakestage"] && this.m_app_setting["shakestage"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "stageconfigcdn", {
        get: function () {
            return this.m_app_setting["stageconfigcdn"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "playerspeed", {
        get: function () {
            return Number(this.m_app_setting["playerspeed"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "videlAdUnitId", {
        get: function () {
            return this.m_app_setting["videlAdUnitId"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "bannerAdUnitId", {
        get: function () {
            return this.m_app_setting["bannerAdUnitId"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "tri", {
        get: function () {
            return this.m_app_setting["tri"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "recommend", {
        get: function () {
            return this.m_app_setting["recommend"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "recommendflg", {
        get: function () {
            return this.m_app_setting["recommendflg"];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "egg", {
        get: function () {
            return this.m_app_setting["egg"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "eggrate", {
        get: function () {
            return Number(this.m_app_setting["eggrate"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "UseId", {
        get: function () {
            return this.userId;
        },
        enumerable: true,
        configurable: true
    });
    AccountData.prototype.GetConfig = function (_type) {
        var type = AccountConfig[_type];
        return this.m_configs[type];
    };
    AccountData.prototype.GetUser = function (_type) {
        var type = AccountUser[_type];
        return this.m_user[type];
    };
    Object.defineProperty(AccountData.prototype, "GetVideoTotal", {
        get: function () {
            return Number(this.m_user_video["total"]);
        },
        enumerable: true,
        configurable: true
    });
    AccountData.prototype.GetSign = function (_datatype) {
        var type = signdata[_datatype];
        return this.m_sign[type];
    };
    AccountData.prototype.GetRewardConfig = function (_rewardid) {
        var reward = this.m_RewardDic[_rewardid];
        return reward;
    };
    AccountData.prototype.GetEntity = function (_id, attr) {
        if (!this.m_EntityDic[_id])
            return null;
        return this.m_EntityDic[_id][entity[attr]];
    };
    AccountData.prototype.GetRewardDic = function () {
        var config = this.GetConfig(AccountConfig.rewards);
        for (var key in config) {
            this.m_RewardDic[config[key].id] = config[key];
        }
    };
    AccountData.prototype.GetEntityDic = function () {
        var config = this.GetConfig(AccountConfig.entity);
        for (var key in config) {
            this.m_EntityDic[config[key].entity_id] = config[key];
        }
    };
    AccountData.prototype.GetThemeById = function (_id) {
        var data = this.GetConfig(AccountConfig.theme);
        if (data) {
            for (var index = 0; index < data.length; index++) {
                var element = data[index];
                if (element.id == _id) {
                    return element;
                }
            }
        }
    };
    AccountData.prototype.GetSkinAttr = function (_id) {
        var config = this.GetConfig(AccountConfig.theme);
        for (var i = 0; i < config.length; i++) {
            if (config[i].id == _id) {
                return config[i];
            }
        }
    };
    AccountData.prototype.GetAchievementData = function () {
        var data = this.GetConfig(AccountConfig.achievement);
        var dic = {};
        for (var key1 in data) {
            var type1 = data[key1].type;
            //var obj = {};
            if (dic[type1]) {
                continue;
            }
            var array = [];
            for (var key2 in data) {
                var type2 = data[key2].type;
                if (type1 == type2) {
                    array.push(data[key2]);
                }
            }
            dic[type1] = array;
        }
        this.m_AchievementDic = dic;
    };
    AccountData.prototype.HasTheme = function (_id) {
        var has = false;
        var getthemes = this.GetUser(AccountUser.get_themes);
        for (var i = 0; i < getthemes.length; i++) {
            if (getthemes[i] == _id) {
                has = true;
            }
        }
        return has;
    };
    AccountData.prototype.GetSkinDic = function (_config) {
    };
    AccountData.prototype.GetHeroProgress = function (_id) {
        var config = this.m_user["progress_heroes"];
        var progress = config[_id] ? config[_id] : 0;
        return progress;
    };
    AccountData.prototype.GetHatProgress = function (_id) {
        var config = this.m_user["progress_hats"];
        var progress = config[_id] ? config[_id] : 0;
        return progress;
    };
    AccountData.prototype.GetCbProgress = function (_id) {
        var config = this.m_user["progress_dances"];
        var progress = config[_id] ? config[_id] : 0;
        return progress;
    };
    AccountData.prototype.HasMotor = function (_id) {
        var data = this.GetUser(AccountUser.get_themes);
        for (var i = 0; i < data.length; i++) {
            var hd = data[i];
            if (_id == hd) {
                return true;
            }
        }
        return false;
    };
    //获取皮肤的进度
    AccountData.prototype.GetMotorProgress = function (_id) {
        var config = this.m_user["progress_themes"];
        var progress = config[_id] ? config[_id] : 0;
        return progress;
    };
    AccountData.prototype.GetSeverConfig = function (_config) {
        this.m_configs = _config;
        this.GetSkinDic(this.m_configs);
        this.GetRewardDic();
        this.GetEntityDic();
        // this.GetAchievementData();
        var _globe = _config["global"];
        for (var index = 0; index < _globe.length; index++) {
            var element = _globe[index];
            if (element.key == "tilirec") {
                PlayerAccount.CurrentAccount.tilirec = Number(element.value);
                return;
            }
        }
    };
    AccountData.prototype.UpdateSkinDic = function () {
        this.GetSkinDic(this.m_configs);
    };
    AccountData.prototype.GetGlobe = function (_key) {
        var globe = this.GetConfig(AccountConfig.global);
        for (var key in globe) {
            var obj = globe[key];
            var kkk = obj["key"];
            if (kkk == _key) {
                var value = obj["value"];
                return value;
            }
        }
        return null;
    };
    return AccountData;
}());
exports.AccountData = AccountData;
var PlayerAccount = /** @class */ (function () {
    function PlayerAccount(_code, _nickname, _avatar, _gender, _country, _province, _city, _device, _shareid, _scence, _ver) {
        this.IsTest = false;
        this.localTime = Laya.timer.currTimer;
        this.Code = _code;
        this.NickName = _nickname;
        this.Avatar = _avatar;
        this.Gender = _gender;
        this.Country = _country;
        this.Province = _province;
        this.City = _city;
        this.Device = _device;
        this.ShareId = _shareid;
        this.Scene = _scence;
        this.ver = _ver;
        this.IsTest = false;
        PlayerAccount.instance = this;
    }
    Object.defineProperty(PlayerAccount, "CurrentAccount", {
        get: function () {
            if (PlayerAccount.instance == null) {
                console.log("生成本地测试账号...");
                return PlayerAccount.TestAccount;
            }
            return PlayerAccount.instance;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(PlayerAccount, "TestAccount", {
        get: function () {
            var code = Laya.LocalStorage.getItem("localcode");
            if (!code) {
                var time = new Date().getTime().toString();
                var random = GameUtils_1.GameUtils.randRangeint(10000, 99999).toString();
                code = "xj_" + time + random;
                Laya.LocalStorage.setItem("localcode", code);
                console.log(time, random);
                console.log("新用户", code);
            }
            else {
                console.log("老用户", code);
            }
            var curaccount = new PlayerAccount(code, null, null, null, null, null, null, null, null, null, null);
            curaccount.IsTest = true;
            return curaccount;
        },
        enumerable: true,
        configurable: true
    });
    PlayerAccount.prototype.SetAccountData = function (data, completecb) {
        var _this = this;
        var token = data["token"];
        var configs = data["configs"];
        var app_setting = data["app_setting"];
        var user = data["user"];
        var user_base = data["user_base"];
        var user_sign = data["user_sign"];
        var user_achievement = data["user_achievement"];
        var user_lottery = data["user_lottery"];
        var user_land_task = data["user_land_task"];
        var user_video = data["user_video"];
        if (this.CurAccountData == null) {
            Sdk_1.WxApi.recordAldEvent("开始获取config数据");
            this.CurAccountData = new AccountData(token, configs, app_setting, user, user_base, null, null, user_sign, user_achievement, user_lottery, user_land_task, user_video);
            this.CheckLocalConfig(data.table_version, function (_config) {
                _this.CurAccountData.GetSeverConfig(_config);
                _this.nowConfig = _config;
                if (completecb != null) {
                    completecb.runWith(data);
                }
            });
        }
        else {
            if (configs) {
                this.CurAccountData.m_configs = configs;
            }
            if (app_setting) {
                this.CurAccountData.m_app_setting = app_setting;
            }
            if (user) {
                this.CurAccountData.m_user = user;
            }
            if (user_base) {
                this.CurAccountData.m_user_base = user_base;
            }
            if (user_sign) {
                this.CurAccountData.m_sign = user_sign;
            }
            if (user_achievement) {
                this.CurAccountData.m_task = user_achievement;
            }
            if (user_lottery) {
                this.CurAccountData.lottery = user_lottery;
            }
            if (user_land_task) {
                this.CurAccountData.m_use_land_task = user_land_task;
            }
            if (user_video) {
                this.CurAccountData.m_user_video = user_video;
            }
        }
    };
    PlayerAccount.prototype.CheckLocalConfig = function (_ver, cb) {
        var curconfig = Laya.LocalStorage.getJSON(PlayerAccount.localcofigkey);
        if (curconfig) {
            //Laya.LocalStorage.removeItem(PlayerAccount.localcofigkey);
            if (curconfig.ver == _ver) {
                console.log("sever配置是最新的...", _ver);
                Sdk_1.WxApi.recordAldEvent("config接口获取成功");
                cb(curconfig);
            }
            else {
                NetworkManager_1.NetworkManager.Instance.HttpPostRequest(NetworkManager_1.PROTOCOLS.Config, null, Laya.Handler.create(this, function (data) {
                    data.configs.ver = _ver;
                    Laya.LocalStorage.setJSON(PlayerAccount.localcofigkey, data.configs);
                    console.log("sever配置更新完成...", _ver);
                    Sdk_1.WxApi.recordAldEvent("config接口获取成功");
                    cb(data.configs);
                }), Laya.Handler.create(this, function (data) {
                    console.log("配置获取失败" + data);
                    Sdk_1.WxApi.recordAldEvent("config接口获取失败");
                }));
            }
        }
        else {
            NetworkManager_1.NetworkManager.Instance.HttpPostRequest(NetworkManager_1.PROTOCOLS.Config, null, Laya.Handler.create(this, function (data) {
                data.configs.ver = _ver;
                Laya.LocalStorage.setJSON(PlayerAccount.localcofigkey, data.configs);
                console.log("sever保存配置完成...", _ver);
                Sdk_1.WxApi.recordAldEvent("config接口获取成功");
                cb(data.configs);
            }), Laya.Handler.create(this, function (data) {
                console.log("配置获取失败" + data);
                Sdk_1.WxApi.recordAldEvent("config接口获取失败");
            }));
        }
    };
    Object.defineProperty(PlayerAccount.prototype, "ServerTime", {
        get: function () {
            var time = Laya.timer.currTimer;
            var stime = PlayerAccount.ServerTime + Math.ceil((time - this.localTime) / 1000);
            return stime;
        },
        enumerable: true,
        configurable: true
    });
    PlayerAccount.localcofigkey = "mconfig";
    return PlayerAccount;
}());
exports.PlayerAccount = PlayerAccount;
},{"../../../utils/GameUtils":87,"../NetworkManager":71,"../WXSDK/Sdk":75}],75:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var systemtype;
(function (systemtype) {
    systemtype[systemtype["ios"] = 0] = "ios";
    systemtype[systemtype["android"] = 1] = "android";
    systemtype[systemtype["other"] = 2] = "other";
})(systemtype = exports.systemtype || (exports.systemtype = {}));
var WxApi = /** @class */ (function () {
    function WxApi() {
    }
    WxApi.recordAldEvent = function (key, value) {
        if (value === void 0) { value = ""; }
        if (Laya.Browser.window && Laya.Browser.window.wx) {
            Laya.Browser.window.wx.aldSendEvent(key, { key: value });
        }
        console.log("事件: ", key);
    };
    WxApi.WXLogin = function (cb) {
        var that = this;
        Laya.Browser.window.wx.login({
            success: function (res) {
                if (res.code) {
                    console.log("code:", res.code);
                    cb(res);
                }
                else {
                    console.log('获取用户登录态失败！' + res.errMsg);
                }
            },
            fail: function (res) { console.log("wx.login: failed, res=" + res); }
        });
    };
    WxApi.WxInit = function () {
        var _this = this;
        if (!Laya.Browser.onWeiXin)
            return;
        Laya.Browser.window.wx.showShareMenu({
            withShareTicket: true
        });
        Laya.Browser.window.wx.onShow(function (option) {
            console.log(option);
            _this.shareOpenId = option.query.userId;
            _this.querychannel = option.query.channel;
            if (option.referrerInfo) {
                _this.referrerInfoappId = option.referrerInfo.appId;
                console.log("onShow appId is:", option.referrerInfo.appId);
            }
            _this.sceneValue = option.scene;
            var scene = Laya.LocalStorage.getItem("scene");
            if (scene) {
                _this.sceneValue = scene;
                console.log("读取配置场景值:" + scene);
            }
            else {
                console.log("第一次拉取场景值:" + _this.sceneValue);
                Laya.LocalStorage.setItem("scene", _this.sceneValue);
            }
        });
    };
    WxApi.ShowLoading = function (title) {
        if (title === void 0) { title = "加载中..."; }
        if (this.isShowing)
            return;
        this.isShowing = true;
        (Laya.Browser.onMiniGame) && Laya.Browser.window.wx.showLoading({ title: title, mask: true });
    };
    WxApi.HideLoading = function () {
        this.isShowing = false;
        (Laya.Browser.onMiniGame) && Laya.Browser.window.wx.hideLoading();
    };
    WxApi.aldSendOpenid = function (_openid) {
        if (Laya.Browser.onMiniGame) {
            console.log("aldSendOpenid", _openid);
            Laya.Browser.window.wx.aldSendOpenid(_openid);
        }
    };
    //检测更新
    WxApi.CheckWXUpdate = function () {
        var updateManager = Laya.Browser.window.wx.getUpdateManager();
        updateManager.onCheckForUpdate(function (res) {
            console.log("最新版本:" + res.hasUpdate);
        });
        updateManager.onUpdateReady(function () {
            Laya.Browser.window.wx.showModal({
                showCancel: false,
                title: '更新提示',
                content: '新版本已经准备好，是否重启应用？',
                success: function (res) {
                    updateManager.applyUpdate();
                },
                fail: function (res) {
                    updateManager.applyUpdate();
                }
            });
        });
    };
    WxApi.levelStart = function (stageId, stageName, userId) {
        console.log("开始记录关卡:" + stageId);
        if (Laya.Browser.window && Laya.Browser.window.wx) {
            Laya.Browser.window.wx.aldStage.onStart({
                stageId: stageId,
                stageName: stageName,
                userId: userId //用户ID 可选
            });
            if (WxApi.newaccount) {
                Laya.Browser.window.wx.aldStage.onStart({
                    stageId: "新用户:" + stageId,
                    stageName: stageName,
                    userId: userId //用户ID 可选
                });
            }
        }
    };
    WxApi.levelRunning = function (stageId, stageName, userId, userevive) {
        console.log("记录关卡中:" + stageId);
        if (Laya.Browser.window && Laya.Browser.window.wx) {
            Laya.Browser.window.wx.aldStage.onRunning({
                stageId: stageId,
                stageName: stageName,
                userId: userId,
                event: "revive",
                params: {
                    itemName: "使用复活",
                    itemCount: 1,
                    desc: userevive //使用道具描述
                }
            });
            if (WxApi.newaccount) {
                Laya.Browser.window.wx.aldStage.onRunning({
                    stageId: "新用户:" + stageId,
                    stageName: stageName,
                    userId: userId,
                    event: "revive",
                    params: {
                        itemName: "使用复活",
                        itemCount: 1,
                        desc: userevive //使用道具描述
                    }
                });
            }
        }
    };
    WxApi.levelSuccess = function (stageId, stageName, userId) {
        console.log("记录关卡:完成" + stageId);
        if (Laya.Browser.window && Laya.Browser.window.wx) {
            Laya.Browser.window.wx.aldStage.onEnd({
                stageId: stageId,
                stageName: stageName,
                userId: userId,
                event: "complete",
                params: {
                    desc: "关卡完成" //描述
                }
            });
            if (WxApi.newaccount) {
                Laya.Browser.window.wx.aldStage.onEnd({
                    stageId: "新用户:" + stageId,
                    stageName: stageName,
                    userId: userId,
                    event: "complete",
                    params: {
                        desc: "关卡完成" //描述
                    }
                });
            }
        }
    };
    WxApi.levelFail = function (stageId, stageName, userId, score, carname) {
        console.log("记录关卡:失败" + stageId);
        if (Laya.Browser.window && Laya.Browser.window.wx) {
            Laya.Browser.window.wx.aldStage.onEnd({
                stageId: stageId,
                stageName: stageName,
                userId: userId,
                event: "fail",
                params: {
                    desc: "失败",
                    score: score,
                    car: carname //描述
                }
            });
            if (WxApi.newaccount) {
                Laya.Browser.window.wx.aldStage.onEnd({
                    stageId: "新用户:" + stageId,
                    stageName: stageName,
                    userId: userId,
                    event: "fail",
                    params: {
                        desc: "失败",
                        score: score,
                        car: carname //描述
                    }
                });
            }
        }
    };
    WxApi.shake = function () {
        Laya.Browser.window.wx.vibrateShort({});
    };
    WxApi.shakeLong = function () {
        Laya.Browser.window.wx.vibrateLong({});
    };
    WxApi.Shake = function (_short) {
        if (_short === void 0) { _short = true; }
        if (Laya.Browser.onWeiXin && WxApi.CanShake) {
            if (_short) {
                this.shake();
            }
            else {
                this.shakeLong();
            }
        }
        if (!_short) {
            this.stageShake();
        }
    };
    WxApi.stageShake = function (callBack, speed) {
        if (callBack === void 0) { callBack = null; }
        if (speed === void 0) { speed = 32; }
        if (this.isShake || !this.canshakestage)
            return;
        this.isShake = true;
        var point = new Laya.Vector2(Laya.stage.x, Laya.stage.y);
        Laya.stage.timerLoop(speed, this, this.shakeObject, [point, callBack]);
    };
    WxApi.shakeObject = function (_point, _callBack) {
        var count = (this.num++) % 4;
        this.offsetArr[this.num % 2] = count < 2 ? 0 : this.offset;
        Laya.stage.x = this.offsetArr[0] + _point.x;
        Laya.stage.y = this.offsetArr[1] + _point.y;
        if (this.num > (this.times * 4 + 1)) {
            Laya.stage.clearTimer(this, this.shakeObject);
            Laya.stage.pos(0, 0);
            this.num = 0;
            this.isShake = false;
            if (_callBack != null) {
                _callBack();
            }
        }
    };
    WxApi.ShowTxt = function (text) {
        if (Laya.Browser.onWeiXin) {
            Laya.Browser.window.wx.showToast({ title: text });
        }
        else {
            console.log(text);
        }
    };
    Object.defineProperty(WxApi, "SystemFrom", {
        get: function () {
            if (!Laya.Browser.onWeiXin)
                return systemtype.other;
            var info = Laya.Browser.window.wx.getSystemInfoSync();
            var system = info.system;
            var IOS = system.indexOf("iOS") != -1;
            var Android = system.indexOf("Android") != -1;
            if (IOS) {
                return systemtype.ios;
            }
            else if (Android) {
                return systemtype.android;
            }
            else {
                return systemtype.other;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(WxApi, "IsLongScreenSystem", {
        get: function () {
            if (!Laya.Browser.onWeiXin)
                return false;
            var systemInfo = Laya.Browser.window.wx.getSystemInfoSync();
            var platformModel = "ipx";
            if (systemInfo != null) {
                var model = systemInfo.model;
                platformModel = systemInfo.brand + "_" + model + "_" + systemInfo.system + "_wx" + systemInfo.version + "_SDKVer" + systemInfo.SDKVersion;
                console.log("platformModel:" + platformModel);
                return !(model.indexOf("X") < 0) ||
                    ((model.indexOf("oppo") >= 0 || model.indexOf("OPPO") >= 0) && (model.indexOf("R15") >= 0 || model.indexOf("r15") >= 0)) ||
                    systemInfo.statusBarHeight > 20 ||
                    (model.indexOf("Note") >= 0 && (model.indexOf("7") >= 0 || model.indexOf("8") >= 0)) ||
                    ((model.indexOf("iPhone") >= 0) && (model.indexOf("11") >= 0));
            }
        },
        enumerable: true,
        configurable: true
    });
    WxApi.writeStage = function (stage) {
        var kvDataList = new Array();
        var date = new Date().getTime();
        var myValue = JSON.stringify({
            "wxgame": {
                "stage": stage,
                "update_time": date.toString(),
            }
        });
        kvDataList.push({ key: "stage", value: myValue });
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.setUserCloudStorage({
                KVDataList: kvDataList,
                success: function (r) {
                    console.log("上传分数成功");
                }
            });
        }
    };
    WxApi.cpVersionGreaterOrEqual = function (v1, v2) {
        console.log("[LOG]\u57FA\u7840\u5E93\u7248\u672C\u53F7 curVer:" + v1 + " targVer:" + v2);
        var v1Arr = v1.split(".");
        var v2Arr = v2.split(".");
        var len = v1Arr.length;
        if (v2Arr.length < len) {
            len = v2Arr.length;
        }
        for (var i = 0; i < len; i++) {
            var ver1 = Number(v1Arr[i]);
            var ver2 = Number(v2Arr[i]);
            if (ver1 > ver2) {
                return true;
            }
            else if (ver1 < ver2) {
                return false;
            }
        }
        return v1Arr.length >= v2Arr.length;
    };
    WxApi.newaccount = false;
    WxApi.sceneValue = "";
    WxApi.shareOpenId = "";
    WxApi.querychannel = "";
    WxApi.referrerInfoappId = "";
    //显示加载信息
    WxApi.isShowing = false;
    WxApi.CanShake = true;
    WxApi.times = 1.3;
    WxApi.num = 0;
    WxApi.offsetArr = [0, 0];
    WxApi.offset = 14;
    WxApi.canshakestage = false;
    return WxApi;
}());
exports.WxApi = WxApi;
},{}],76:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Sdk_1 = require("./Sdk");
var GameUtils_1 = require("../../../utils/GameUtils");
var PlayerAccount_1 = require("./PlayerAccount");
/*
* name;
*/
var ShareUtil = /** @class */ (function () {
    function ShareUtil() {
    }
    ShareUtil.prototype.beginShare = function (callBack) {
        ShareUtil.beginShareTime = new Date().getTime();
        console.log("分享点击时间=" + ShareUtil.beginShareTime);
        ShareUtil.isSharing = true;
        ShareUtil.callback = callBack;
    };
    ShareUtil.prototype.onRegister = function () {
        if (Laya.Browser.window.wx == null) {
            return;
        }
        Laya.Browser.window.wx.onShow(function (option) {
            console.log("onshow share start");
            if (ShareUtil.isSharing) {
                ShareUtil.isSharing = false;
                var time = new Date().getTime();
                console.log("分享回到游戏时间" + time);
                var wait = (time - ShareUtil.beginShareTime) / 1000;
                console.log("分享停留时间为：" + wait);
                var shareSuccess = false;
                var realSuccess = false;
                if (wait < 3) {
                    Laya.Browser.window.wx.showToast({ title: "请重试一次" });
                    ShareUtil.callback(false);
                }
                else {
                    var random = Math.random();
                    if (random <= 0.3) {
                        var message = ["你已分享过该群", "请重新换个群分享！", "请分享到30人大群中！"];
                        var curmes = message[GameUtils_1.GameUtils.randRangeint(0, 2)];
                        Laya.Browser.window.wx.showToast({ title: curmes });
                        ShareUtil.callback(false);
                    }
                    else {
                        Laya.Browser.window.wx.showToast({ title: "分享成功!" });
                        ShareUtil.callback(true);
                    }
                }
                //  if(wait >= 2)
                //  {
                //     if(wait < 4)
                //     {
                //         shareSuccess = (Math.random() > 0.5)?false:true;
                //     }
                //     else
                //     {
                //         shareSuccess = true;
                //     }
                //  }
                //  else{
                //     shareSuccess = false;
                //  }
                //  if(shareSuccess == false)
                //  {
                //      Laya.Browser.window.wx.showToast( {title:"请重试一次"} );
                //      ShareUtil.callback(false);
                //  }
                //  else{
                //     Laya.Browser.window.wx.showToast( {title:"分享成功"} );
                //     ShareUtil.callback(true);
                //  }
            }
        });
    };
    ShareUtil.ShareMessage = function () {
        if (!Laya.Browser.onWeiXin)
            return;
        var t = PlayerAccount_1.PlayerAccount.CurrentAccount.ServerTime;
        var _title = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.sharecontent;
        _title = (_title == "" || !_title) ? "你能跟得上我的速度吗！？" : _title;
        var _image = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.ShareImage;
        _image = (_image == "" || !_image) ? "bg/share1.png" : _image;
        console.log("ShareMessage");
        Laya.Browser.window.wx.onShareAppMessage(function () { return ({
            title: _title,
            imageUrl: _image,
            query: "shareid=" + PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.UseId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
        }); });
    };
    ShareUtil.shareImage = function (channel, callback, shareType) {
        if (callback === void 0) { callback = null; }
        if (Laya.Browser.window.wx == null) {
            return;
        }
        if (!PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.share) {
            Sdk_1.WxApi.ShowTxt("暂未开放");
            return;
        }
        var t = PlayerAccount_1.PlayerAccount.CurrentAccount.ServerTime;
        var _title = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.sharecontent;
        _title = (_title == "" || !_title) ? "你能跟得上我的速度吗！？" : _title;
        var _image = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.ShareImage;
        _image = (_image == "" || !_image) ? "bg/share1.png" : _image;
        if (Sdk_1.WxApi.sceneValue == "1037" || Sdk_1.WxApi.sceneValue == "1058" || Sdk_1.WxApi.sceneValue == "1067" || Sdk_1.WxApi.sceneValue == "1095") {
            _title = "2020全新工资走势，你跟上节奏了吗？";
            _image = "bg/share2.png";
        }
        Laya.Browser.window.wx.aldShareAppMessage({
            title: _title,
            imageUrl: _image,
            query: "userId=" + PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.UseId + "_" + shareType + "_" + t + "_" + Math.floor(9999 * Math.random()).toString() // + "&shareTitle=" + _title,
        });
        if (callback) {
            ShareUtil.Instance.beginShare(callback);
        }
    };
    ShareUtil.Instance = new ShareUtil();
    ShareUtil.shareSuccessTime = 0;
    ShareUtil.isSharing = false;
    return ShareUtil;
}());
exports.ShareUtil = ShareUtil;
},{"../../../utils/GameUtils":87,"./PlayerAccount":74,"./Sdk":75}],77:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GuangGao_1 = require("./GuangGao");
var Dictionary_1 = require("../../../utils/Dictionary");
var PlayerAccount_1 = require("./PlayerAccount");
var Sdk_1 = require("./Sdk");
var GameUtils_1 = require("../../../utils/GameUtils");
var RecommendView_1 = require("./cpa/RecommendView");
var YQSdk = /** @class */ (function () {
    function YQSdk() {
    }
    YQSdk.postbj = function (url, args, callback, header) {
        if (header === void 0) { header = null; }
        var httpRequest = new Laya.HttpRequest();
        if (callback) {
            httpRequest.once(Laya.Event.PROGRESS, this, function () { callback.progress && callback.progress(httpRequest); });
            httpRequest.once(Laya.Event.ERROR, this, function () { callback.error && callback.error(httpRequest); });
            httpRequest.once(Laya.Event.COMPLETE, this, function () { callback.complete && callback.complete(httpRequest); });
        }
        if (header) {
            httpRequest.send(url, args, "post", "json", ["Content-Type", "application/json"]);
        }
        else {
            httpRequest.send(url, args, "post", "json");
        }
    };
    //登录
    YQSdk.login = function (code, _channel, _appid, cb) {
        if (cb === void 0) { cb = null; }
        var url1 = "https://api.yz061.com/auth?";
        var url;
        var channel = _channel;
        var appid = _appid;
        if (!channel)
            channel = "own";
        var args1 = {
            flg: this.flg,
            code: code,
            channel: channel
        };
        if (appid) {
            url = url1 + "flg=" + args1.flg + "&code=" + args1.code + "&channel=" + args1.channel + "&appid=" + appid;
        }
        else {
            url = url1 + "flg=" + args1.flg + "&code=" + args1.code + "&channel=" + args1.channel;
        }
        this.postbj(url, null, {
            complete: function (request) {
                if (cb != null)
                    cb();
                console.log("HP_login complete" + JSON.stringify(request.data));
            },
            progress: function (request) {
                console.log("HP_login progress:" + JSON.stringify(request.data));
            },
            error: function (request) {
                console.log("HP_login error:" + JSON.stringify(request.data));
            }
        });
        console.log("登录参数:" + url);
    };
    //获取广告（含分享）素材接口
    YQSdk.pullAdPosition = function (cb) {
        if (cb === void 0) { cb = null; }
        //ad position
        this.postbj("https://api.yz061.com/game/" + this.flg, null, {
            complete: function (request) {
                if (request.data.status == 1) {
                    console.log("allPosition :", request.data);
                    YQSdk.adPosition = request.data.result;
                    YQSdk.GetAdInfo();
                    YQSdk.getad = true;
                    if (cb)
                        cb();
                }
                else {
                    console.log("allPositionfailed:", request.data);
                }
            },
            error: function (request) {
                console.log("allPosition failed:", request.data);
            }
        });
    };
    YQSdk.GetAdInfo = function () {
        var _this = this;
        for (var index = 0; index < this.adPosition.length; index++) {
            switch (this.adPosition[index].location_flg) {
                case "C":
                    this.adPositionDic.add("C", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        YQSdk.cainixihuan = data;
                        _this.getc = true;
                    });
                    break;
                case "C2":
                    this.adPositionDic.add("C2", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        //this.fuhuocainixihuan = data;
                    });
                    break;
                case "B":
                    this.adPositionDic.add("B", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        YQSdk.baokuanyouxi1 = data;
                        _this.getb = true;
                        //console.log(this.baokuanyouxi1);
                    });
                    break;
                case "banner":
                    this.adPositionDic.add("banner", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        YQSdk.banner_data = data;
                        _this.getbanner = true;
                    });
                    break;
                case "GDYX":
                    this.adPositionDic.add("GDYX", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        YQSdk.gdyy = data;
                        _this.getgdyx = true;
                    });
                    break;
                case "JS":
                    this.adPositionDic.add("JS", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        YQSdk.js = data;
                        _this.getjs = true;
                    });
                    break;
                case "TC":
                    this.adPositionDic.add("TC", this.adPosition[index]);
                    this.getAddetail(this.adPosition[index].url, function (data) {
                        YQSdk.tc = data;
                        _this.gettc = true;
                    });
                    break;
            }
        }
    };
    Object.defineProperty(YQSdk, "CheckGetDataComplete", {
        get: function () {
            var complete = false;
            if (this.getc && this.getgdyx && this.getb && this.getjs && this.getbanner) {
                complete = true;
            }
            return complete;
        },
        enumerable: true,
        configurable: true
    });
    //获取广告详细信息接口
    YQSdk.getAddetail = function (url, callback) {
        var _this = this;
        var uid = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.openid;
        this.postbj(url + "&uid=" + uid, null, {
            complete: function (request) {
                if (request.data.status == 1) {
                    //console.log("pullAdPosition :", request.data);
                    callback(request.data.result);
                    if (_this.CheckGetDataComplete) {
                        new RecommendView_1.Recommend();
                    }
                }
                else {
                    console.log("pullAdPositionfailed:", request.data);
                }
            },
            error: function (request) {
                console.log("pullAdPosition failed:", request.data);
            }
        });
    };
    YQSdk.GetShare = function (_cb) {
        if (_cb === void 0) { _cb = null; }
        var url1 = "https://api.yz061.com/matter/share?id=281&gflg= " + this.flg + " &lflg=F";
        var uid = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.openid;
        var url = url1 + "&uid=" + uid;
        this.postbj(url, null, {
            complete: function (request) {
                if (_cb != null)
                    _cb(JSON.stringify(request.data));
                var data = request.data;
                YQSdk.shares = data.result;
            },
            progress: function (request) {
                //console.log("GetShare progress:" + JSON.stringify(request.data));
            },
            error: function (request) {
                //console.log("GetShare error:" + JSON.stringify(request.data));
            }
        });
    };
    //广告点击上报接口
    YQSdk.reportad = function (ad_id, location_id, issuccess) {
        if (issuccess === void 0) { issuccess = false; }
        var url = "https://api.yz061.com/reportad?";
        var curuid = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.openid;
        var channel = Sdk_1.WxApi.querychannel;
        if (!channel)
            channel = "own";
        var rgs1 = {
            gflg: this.flg,
            uid: curuid,
            ad_id: ad_id,
            location_id: location_id,
            channel: channel
        };
        if (issuccess) {
            var rgs = url + "gflg=" + rgs1.gflg + "&uid=" + rgs1.uid + "&ad_id=" + rgs1.ad_id + "&location_id=" + rgs1.location_id + "&channel=" + rgs1.channel + "&status=cb";
        }
        else {
            var rgs = url + "gflg=" + rgs1.gflg + "&uid=" + rgs1.uid + "&ad_id=" + rgs1.ad_id + "&location_id=" + rgs1.location_id + "&channel=" + rgs1.channel;
        }
        console.log("上报的参数" + rgs);
        this.postbj(rgs, null, {
            complete: function (request) {
                if (request.data.status == 1) {
                    console.log("上报成功 :", request.data);
                }
                else {
                    console.log("上报失败:", request.data);
                }
            },
            error: function (request) {
                console.log("错误消息:", request.data);
            }
        });
    };
    YQSdk.statistics1 = function (loc, _shareid) {
        if (_shareid === void 0) { _shareid = ""; }
        var url = "https://api.yz061.com/stat?";
        var curuid = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.openid;
        var channel = Sdk_1.WxApi.querychannel;
        if (!channel)
            channel = "own";
        var sid = _shareid;
        if (!sid)
            sid = "";
        var r = {
            flg: this.flg,
            uid: curuid,
            channel: channel,
            loc: loc,
            sid: sid
        };
        var args = url + "&flg=" + r.flg + "&uid=" + r.uid + "&channel=" + r.channel + "&loc=" + r.loc + "&sid=" + r.sid;
        this.postbj(args, null, {
            complete: function (request) {
                if (request.data.status == 1) {
                    console.log("统计完成 :", request.data);
                }
                else {
                    console.log("统计失败:", request.data);
                }
            },
            error: function (request) {
                console.log("错误消息:", request.data);
            }
        });
    };
    YQSdk.exposure = function () {
        var d = this.exposureData();
        if (d.length == 0)
            return;
        var url = "https://api.yz061.com/exposure";
        var channel = Sdk_1.WxApi.querychannel;
        if (!channel)
            channel = "own";
        var r = {
            data: d,
            gflg: this.flg,
            channel: channel
        };
        var args = JSON.stringify(r);
        this.postbj(url, args, {
            complete: function (request) {
                if (request.data.status == 1) {
                    console.log("曝光成功 :", request.data);
                }
                else {
                    console.log("曝光失败:", request.data);
                }
            },
            error: function (request) {
                console.log("错误消息:", request);
            }
        }, true);
        this.CleraData();
    };
    YQSdk.exposureData = function () {
        var data = [];
        for (var i = 0; i < RecommendView_1.Recommend.cainixihuanData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["C"] || !RecommendView_1.Recommend.recommendDic["C"].location_id == undefined)
                continue;
            var c = { ad_id: RecommendView_1.Recommend.cainixihuanData[i].ad_id.toString(), location_id: RecommendView_1.Recommend.recommendDic["C"].location_id.toString(), num: RecommendView_1.Recommend.cainixihuanData[i].shownum.toString() };
            if (RecommendView_1.Recommend.cainixihuanData[i].shownum != 0) {
                data.push(c);
            }
        }
        for (var i = 0; i < RecommendView_1.Recommend.jiesuanData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["JS"] || !RecommendView_1.Recommend.recommendDic["JS"].location_id == undefined)
                continue;
            var c2 = { ad_id: RecommendView_1.Recommend.jiesuanData[i].ad_id.toString(), location_id: RecommendView_1.Recommend.recommendDic["FH"].location_id.toString(), num: RecommendView_1.Recommend.jiesuanData[i].shownum.toString() };
            if (RecommendView_1.Recommend.jiesuanData[i].shownum != 0) {
                data.push(c2);
            }
        }
        for (var i = 0; i < RecommendView_1.Recommend.gdyxData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["GDYX"] || !RecommendView_1.Recommend.recommendDic["GDYX"].location_id == undefined)
                continue;
            var s = { ad_id: RecommendView_1.Recommend.gdyxData[i].ad_id.toString(), location_id: RecommendView_1.Recommend.recommendDic["GDYX"].location_id.toString(), num: RecommendView_1.Recommend.gdyxData[i].shownum.toString() };
            if (RecommendView_1.Recommend.gdyxData[i].shownum != 0) {
                data.push(s);
            }
        }
        for (var i = 0; i < RecommendView_1.Recommend.baokuanyouxiData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["B"] || !RecommendView_1.Recommend.recommendDic["B"].location_id == undefined)
                continue;
            var s = { ad_id: RecommendView_1.Recommend.baokuanyouxiData[i].ad_id.toString(), location_id: RecommendView_1.Recommend.recommendDic["B"].location_id.toString(), num: RecommendView_1.Recommend.baokuanyouxiData[i].shownum.toString() };
            if (RecommendView_1.Recommend.baokuanyouxiData[i].shownum != 0) {
                data.push(s);
            }
        }
        return data;
    };
    YQSdk.CleraData = function () {
        var data = [];
        for (var i = 0; i < RecommendView_1.Recommend.cainixihuanData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["C"] || !RecommendView_1.Recommend.recommendDic["C"].location_id == undefined)
                continue;
            RecommendView_1.Recommend.cainixihuanData[i].shownum = 0;
        }
        for (var i = 0; i < RecommendView_1.Recommend.jiesuanData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["JS"] || !RecommendView_1.Recommend.recommendDic["JS"].location_id == undefined)
                continue;
            RecommendView_1.Recommend.cainixihuanData[i].shownum = 0;
        }
        for (var i = 0; i < RecommendView_1.Recommend.gdyxData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["GDYX"] || !RecommendView_1.Recommend.recommendDic["GDYX"].location_id == undefined)
                continue;
            var s = { ad_id: RecommendView_1.Recommend.gdyxData[i].ad_id.toString(), location_id: RecommendView_1.Recommend.recommendDic["GDYX"].location_id.toString(), num: RecommendView_1.Recommend.gdyxData[i].shownum.toString() };
            RecommendView_1.Recommend.cainixihuanData[i].shownum = 0;
        }
        for (var i = 0; i < RecommendView_1.Recommend.baokuanyouxiData.length; i++) {
            if (!RecommendView_1.Recommend.recommendDic["B"] || !RecommendView_1.Recommend.recommendDic["B"].location_id == undefined)
                continue;
            var s = { ad_id: RecommendView_1.Recommend.baokuanyouxiData[i].ad_id.toString(), location_id: RecommendView_1.Recommend.recommendDic["B"].location_id.toString(), num: RecommendView_1.Recommend.baokuanyouxiData[i].shownum.toString() };
            RecommendView_1.Recommend.baokuanyouxiData[i].shownum = 0;
        }
    };
    YQSdk.prototype.showOpenHander = function () {
    };
    YQSdk.ShowBannerImag = function (callback) {
        var _this = this;
        if (callback === void 0) { callback = null; }
        //960*334
        console.log("ShowBannerImag");
        if (!this.banner_data)
            return;
        if (this.bannerImag) {
            this.bannerindex += 1;
            if (this.bannerindex >= this.banner_data.length)
                this.bannerindex = 0;
            this.bannerImag.skin = this.banner_data[this.bannerindex].ad_img;
            this.appId = this.banner_data[this.bannerindex].ad_appid;
            this.path = this.banner_data[this.bannerindex].ad_path;
            this.ad_id = this.banner_data[this.bannerindex].ad_id;
            //  this.bannerImag.visible=true;
        }
        else {
            this.bannerImag = new Laya.Image();
            console.log("new Laya.Image");
            this.bannerImag.visible = false;
            Laya.stage.addChild(this.bannerImag);
            this.bannerImag.skin = this.banner_data[this.bannerindex].ad_img;
            this.height = Laya.stage.width / 960 * 334;
            this.bannerImag.width = Laya.stage.width;
            this.bannerImag.height = this.height;
            console.log(" this.bannerImag.height:" + this.bannerImag.height);
            this.bannerImag.x = 0;
            this.bannerImag.y = Laya.stage.height - this.height;
            this.bannerImag.zOrder = 2;
            this.bannerImag.on(Laya.Event.CLICK, this, function () {
                var adPosition = YQSdk.adPositionDic.getValue("banner");
                var location_id = adPosition.location_id;
                Laya.Browser.onWeiXin && Laya.Browser.window.wx.navigateToMiniProgram({
                    "appId": _this.appId, "path": _this.path,
                    success: function (res) {
                        console.log("上报操作成功!" + res);
                        YQSdk.reportad(_this.ad_id, location_id, true);
                    },
                    fail: function (res) {
                        YQSdk.reportad(_this.ad_id, location_id);
                        console.log("上报操作失败" + res);
                    }
                });
            });
        }
        this.appId = this.banner_data[this.bannerindex].ad_appid;
        this.path = this.banner_data[this.bannerindex].ad_path;
        this.ad_id = this.banner_data[this.bannerindex].ad_id;
        this.Add_BannerData(this.ad_id.toString());
        Laya.timer.once(500, this, function () {
            if (_this.bannerImag) {
                _this.bannerImag.visible = true;
                if (callback != null) {
                    if (PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.banner && GuangGao_1.default.cancheat) {
                        callback(_this.height);
                    }
                    else {
                        callback(300);
                    }
                }
            }
            else {
                callback(300);
            }
        });
        Laya.timer.clear(this, this.BannerLoop);
        var looprate = GameUtils_1.GameUtils.randRangeint(7, 10) * 1000;
        Laya.timer.loop(looprate, this, this.BannerLoop);
    };
    YQSdk.BannerLoop = function () {
        if (this.bannerImag) {
            this.bannerindex += 1;
            if (this.bannerindex >= this.banner_data.length)
                this.bannerindex = 0;
            this.bannerImag.skin = this.banner_data[this.bannerindex].ad_img;
            this.appId = this.banner_data[this.bannerindex].ad_appid;
            this.path = this.banner_data[this.bannerindex].ad_path;
            this.ad_id = this.banner_data[this.bannerindex].ad_id;
        }
    };
    YQSdk.HideBannerImage = function () {
        if (this.bannerImag && this.bannerImag.visible) {
            this.bannerImag.visible = false;
        }
    };
    YQSdk.Add_BannerData = function (ad_id) {
        for (var index = 0; index < this.banner_data.length; index++) {
            var element = this.banner_data[index];
            if (element.ad_id == ad_id) {
                element.num = (Number(element.num) + 1).toString();
                return;
            }
        }
        var d = { ad_id: ad_id, location_id: this.adPositionDic["banner"].location_id.toString(), num: "1" };
        this.banner_data.push(d);
    };
    YQSdk.flg = "sgpyp";
    YQSdk.getad = false;
    YQSdk.getc = false;
    YQSdk.getgdyx = false;
    YQSdk.getbanner = false;
    YQSdk.getjs = false;
    YQSdk.getb = false;
    YQSdk.gettc = false;
    YQSdk.adPositionDic = new Dictionary_1.default();
    YQSdk.bannerindex = 0;
    YQSdk.height = 0;
    return YQSdk;
}());
exports.YQSdk = YQSdk;
},{"../../../utils/Dictionary":86,"../../../utils/GameUtils":87,"./GuangGao":73,"./PlayerAccount":74,"./Sdk":75,"./cpa/RecommendView":82}],78:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ChildBaseView_1 = require("../../../../frameworks/mvc/ChildBaseView");
var CpaEvent_1 = require("./CpaEvent");
var PlayerAccount_1 = require("../PlayerAccount");
var RecommendView_1 = require("./RecommendView");
var TimerService_1 = require("../../../../frameworks/TimerService");
var BaoKuanGameView = /** @class */ (function (_super) {
    __extends(BaoKuanGameView, _super);
    function BaoKuanGameView() {
        var _this = _super.call(this) || this;
        _this._time = 0;
        _this.key = 0;
        _this._istart = false;
        return _this;
    }
    BaoKuanGameView.prototype.onInit = function () {
        this.initView();
        this.initEvent();
    };
    BaoKuanGameView.prototype.initView = function () {
        this.c_state = this.getController("c_state");
        this.t0 = this.getTransition("t0");
        this.c_state.selectedIndex = 0;
    };
    BaoKuanGameView.prototype.initEvent = function () {
        this.addDataEvent(CpaEvent_1.default.YQHomeData, this, this.yqhomedataHandler);
    };
    BaoKuanGameView.prototype.yqhomedataHandler = function () {
        this.RefreshBKYX();
        TimerService_1.default.instance.addUpdateTarget(this);
    };
    BaoKuanGameView.prototype.update = function (dt) {
        if (this._istart) {
            this._time += dt;
            if (this._time >= 5000) {
                this._time = 0;
                this.RefreshBKYX(true);
            }
        }
    };
    BaoKuanGameView.prototype.RefreshBKYX = function (isanmo) {
        if (isanmo === void 0) { isanmo = false; }
        if (!PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.recommend)
            return;
        this.c_state.selectedIndex = 1;
        var datas = RecommendView_1.Recommend.gdyxData;
        var item;
        for (var i = 0; i < 4; i++) {
            if (this.key + i >= datas.length - 1) {
                this.key = 0;
            }
            var curdata = datas[this.key + i];
            item = this["item_" + i];
            item.showData(curdata);
            if (curdata == null)
                continue;
            curdata.shownum++;
        }
        this.key += 4;
        if (this.key >= datas.length - 1) {
            this.key = 0;
        }
        this._istart = true;
        if (isanmo) {
            this.t0.play(null, 1);
        }
    };
    return BaoKuanGameView;
}(ChildBaseView_1.default));
exports.default = BaoKuanGameView;
},{"../../../../frameworks/TimerService":13,"../../../../frameworks/mvc/ChildBaseView":21,"../PlayerAccount":74,"./CpaEvent":81,"./RecommendView":82}],79:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../../../frameworks/mvc/BaseView");
var RecommendView_1 = require("./RecommendView");
var UiManager_1 = require("../../../../managers/UiManager");
var TimerService_1 = require("../../../../frameworks/TimerService");
var ChoutiPanView = /** @class */ (function (_super) {
    __extends(ChoutiPanView, _super);
    function ChoutiPanView() {
        var _this = _super.call(this, "main", "choutipanView") || this;
        _this._iscanmove = false;
        _this._movetime = 0;
        _this._flushtime = 0;
        _this.dir = true;
        _this._nowvalue = 0;
        return _this;
    }
    ChoutiPanView.prototype.initView = function () {
        this.list_0.setVirtual();
        this.list_0.itemRenderer = Laya.Handler.create(this, this.itemrenderlist, null, false);
        this.list_1.setVirtual();
        this.list_1.itemRenderer = Laya.Handler.create(this, this.itemrenderlist1, null, false);
        this._nowList0 = RecommendView_1.Recommend.gdyxData;
        this._nowList1 = RecommendView_1.Recommend.gdyxData;
        this.list_0.numItems = this._nowList0.length;
        this.list_1.numItems = this._nowList1.length;
        this._isStart = true;
        this._iscanmove = true;
        TimerService_1.default.instance.addUpdateTarget(this);
    };
    ChoutiPanView.prototype.initEvent = function () {
        this.addListener(this.btn_return, Laya.Event.CLICK, this, this.onclosefun);
        this.addListener(this.btn_jixugame, Laya.Event.CLICK, this, this.onclosefun);
        this.addListener(this.list_0, Laya.Event.MOUSE_DOWN, this, this.downclick);
        this.addListener(this.list_0, Laya.Event.MOUSE_UP, this, this.upclick);
        this.addListener(this.list_0, Laya.Event.MOUSE_OUT, this, this.upclick);
    };
    ChoutiPanView.prototype.itemrenderlist = function (index, item) {
        if (index < this._nowList0.length) {
            item.showData(this._nowList0[index]);
        }
    };
    ChoutiPanView.prototype.itemrenderlist1 = function (index, item) {
        if (index < this._nowList1.length) {
            item.showData(this._nowList1[index]);
        }
    };
    ChoutiPanView.prototype.downclick = function () {
        this._isdown = true;
        this._iscanmove = false;
        Laya.timer.clear(this, this.timeoutCallback);
    };
    ChoutiPanView.prototype.timeoutCallback = function () {
        this._iscanmove = true;
    };
    ChoutiPanView.prototype.upclick = function () {
        if (this._isdown) {
            this._isdown = false;
            this._nowvalue = this.list_0.scrollPane.percX;
            Laya.timer.once(2000, this, this.timeoutCallback);
        }
    };
    ChoutiPanView.prototype.update = function (dt) {
        if (this._isStart) {
            if (this.list_0.scrollPane && this._nowList0 && this._iscanmove) {
                if (this.dir) {
                    this._nowvalue += 0.001;
                    if (this._nowvalue >= 1) {
                        this._nowvalue = 1;
                        this.dir = false;
                    }
                }
                else {
                    this._nowvalue -= 0.001;
                    if (this._nowvalue <= 0) {
                        this._nowvalue = 0;
                        this.dir = true;
                    }
                }
                this.list_0.scrollPane.setPercX(this._nowvalue);
            }
        }
    };
    ChoutiPanView.prototype.onclosefun = function () {
        UiManager_1.UiManager.instance.close(ChoutiPanView);
    };
    ChoutiPanView.prototype.destory = function () {
        TimerService_1.default.instance.removeUpdateTarget(this);
        _super.prototype.destory.call(this);
    };
    ChoutiPanView.key = "ChoutiPanView";
    return ChoutiPanView;
}(BaseView_1.default));
exports.default = ChoutiPanView;
},{"../../../../frameworks/TimerService":13,"../../../../frameworks/mvc/BaseView":20,"../../../../managers/UiManager":66,"./RecommendView":82}],80:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ChildBaseView_1 = require("../../../../frameworks/mvc/ChildBaseView");
var CpaEvent_1 = require("./CpaEvent");
var RecommendView_1 = require("./RecommendView");
var TimerService_1 = require("../../../../frameworks/TimerService");
var CpaDownsView = /** @class */ (function (_super) {
    __extends(CpaDownsView, _super);
    function CpaDownsView() {
        var _this = _super.call(this) || this;
        _this._iscanmove = false;
        _this._movetime = 0;
        _this._flushtime = 0;
        _this.dir = true;
        _this._nowvalue = 0;
        return _this;
    }
    CpaDownsView.prototype.onInit = function () {
        this.c_state = this.getController("c_state");
        this.c_state.selectedIndex = 0;
        this.initView();
        this.initEvent();
    };
    CpaDownsView.prototype.initView = function () {
        this.list_0.setVirtual();
        this.list_0.itemRenderer = Laya.Handler.create(this, this.itemrenderlist, null, false);
        this._isStart = false;
    };
    CpaDownsView.prototype.initEvent = function () {
        this.addDataEvent(CpaEvent_1.default.YQHomeData, this, this.yqhomedataHandler);
        this.addListener(this.list_0, Laya.Event.MOUSE_DOWN, this, this.downclick);
        this.addListener(this.list_0, Laya.Event.MOUSE_UP, this, this.upclick);
        this.addListener(this.list_0, Laya.Event.MOUSE_OUT, this, this.upclick);
    };
    CpaDownsView.prototype.downclick = function () {
        this._isdown = true;
        this._iscanmove = false;
        Laya.timer.clear(this, this.timeoutCallback);
    };
    CpaDownsView.prototype.timeoutCallback = function () {
        this._iscanmove = true;
    };
    CpaDownsView.prototype.upclick = function () {
        if (this._isdown) {
            this._isdown = false;
            this._nowvalue = this.list_0.scrollPane.percX;
            Laya.timer.once(2000, this, this.timeoutCallback);
        }
    };
    CpaDownsView.prototype.update = function (dt) {
        if (this._isStart) {
            if (this.list_0.scrollPane && this._nowList && this._iscanmove) {
                if (this.dir) {
                    this._nowvalue += 0.001;
                    if (this._nowvalue >= 1) {
                        this._nowvalue = 1;
                        this.dir = false;
                    }
                }
                else {
                    this._nowvalue -= 0.001;
                    if (this._nowvalue <= 0) {
                        this._nowvalue = 0;
                        this.dir = true;
                    }
                }
                this.list_0.scrollPane.setPercX(this._nowvalue);
            }
        }
    };
    CpaDownsView.prototype.itemrenderlist = function (index, item) {
        if (index < this._nowList.length) {
            item.showData(this._nowList[index]);
        }
    };
    CpaDownsView.prototype.yqhomedataHandler = function () {
        this.c_state.selectedIndex = 1;
        this._nowList = RecommendView_1.Recommend.cainixihuanData;
        this.list_0.numItems = this._nowList.length;
        for (var i = 0; i < this._nowList.length; i++) {
            this._nowList[i].shownum++;
        }
        this._isStart = true;
        this._iscanmove = true;
        TimerService_1.default.instance.addUpdateTarget(this);
    };
    CpaDownsView.prototype.dispose = function () {
        TimerService_1.default.getInastance().removeUpdateTarget(this);
        _super.prototype.dispose.call(this);
    };
    return CpaDownsView;
}(ChildBaseView_1.default));
exports.default = CpaDownsView;
},{"../../../../frameworks/TimerService":13,"../../../../frameworks/mvc/ChildBaseView":21,"./CpaEvent":81,"./RecommendView":82}],81:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CpaEvent = /** @class */ (function () {
    function CpaEvent() {
    }
    CpaEvent.YQHomeData = "CpaEvent_YQHomeData";
    return CpaEvent;
}());
exports.default = CpaEvent;
},{}],82:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var YQSdk_1 = require("../YQSdk");
var EventUtils_1 = require("../../../../frameworks/events/EventUtils");
var CpaEvent_1 = require("./CpaEvent");
var recommendPan = /** @class */ (function () {
    function recommendPan(data) {
        this.game_flg = data["game_flg"];
        this.game_id = data["game_id"];
        this.game_name = data["game_name"];
        this.id = data["id"];
        this.location_flg = data["location_flg"];
        this.location_id = data["location_id"];
        this.location_name = data["location_name"];
        this.matter_type = data["matter_type"];
    }
    return recommendPan;
}());
exports.recommendPan = recommendPan;
var Recommend = /** @class */ (function () {
    function Recommend() {
        Recommend.InitData();
    }
    Recommend.InitData = function () {
        Recommend.cainixihuanData = Recommend.GetCaiNiXiaHuanDatas();
        Recommend.jiesuanData = Recommend.GetJIeSuanDatas();
        Recommend.gdyxData = Recommend.GetGDYXDatas();
        Recommend.baokuanyouxiData = Recommend.GetBaoKuanYouXiDatas();
        Recommend.moreData = Recommend.GetMoreDatas();
        for (var key in YQSdk_1.YQSdk.adPosition) {
            Recommend.recommendDic[YQSdk_1.YQSdk.adPosition[key].location_flg] = new recommendPan(YQSdk_1.YQSdk.adPosition[key]);
        }
        YQSdk_1.YQSdk.GetShare();
        Recommend.getdata = true;
        EventUtils_1.EventUtils.dispatchEvent(CpaEvent_1.default.YQHomeData);
    };
    Recommend.GetCaiNiXiaHuanDatas = function () {
        var items = [];
        if (!YQSdk_1.YQSdk.cainixihuan)
            return items;
        for (var i = 0; i < YQSdk_1.YQSdk.cainixihuan.length; i++) {
            items.push(new RecommendItem(YQSdk_1.YQSdk.cainixihuan[i]));
            items[i].shownum++;
        }
        return items;
    };
    Recommend.GetMoreDatas = function () {
        var items = [];
        if (!YQSdk_1.YQSdk.tc)
            return items;
        for (var i = 0; i < YQSdk_1.YQSdk.tc.length; i++) {
            items.push(new RecommendItem(YQSdk_1.YQSdk.tc[i]));
            items[i].shownum++;
        }
        return items;
    };
    Recommend.GetBaoKuanYouXiDatas = function () {
        var items = [];
        if (!YQSdk_1.YQSdk.baokuanyouxi1)
            return items;
        for (var i = 0; i < YQSdk_1.YQSdk.baokuanyouxi1.length; i++) {
            items.push(new RecommendItem(YQSdk_1.YQSdk.baokuanyouxi1[i]));
            items[i].shownum++;
        }
        return items;
    };
    Recommend.GetJIeSuanDatas = function () {
        var items = [];
        if (!YQSdk_1.YQSdk.js)
            return items;
        for (var i = 0; i < YQSdk_1.YQSdk.js.length; i++) {
            items.push(new RecommendItem(YQSdk_1.YQSdk.js[i]));
            items[i].shownum++;
        }
        return items;
    };
    Recommend.GetGDYXDatas = function () {
        var items = [];
        if (!YQSdk_1.YQSdk.gdyy)
            return items;
        for (var i = 0; i < YQSdk_1.YQSdk.gdyy.length; i++) {
            items.push(new RecommendItem(YQSdk_1.YQSdk.gdyy[i]));
            items[i].shownum++;
        }
        return items;
    };
    Recommend.getdata = false;
    Recommend.recommendDic = {};
    Recommend.cainixihuanData = [];
    Recommend.baokuanyouxiData = [];
    Recommend.gdyxData = [];
    Recommend.jiesuanData = [];
    Recommend.moreData = [];
    return Recommend;
}());
exports.Recommend = Recommend;
var RecommendItem = /** @class */ (function () {
    function RecommendItem(Data) {
        this.shownum = 0;
        this.ad_appid = Data["ad_appid"];
        this.ad_count = Data["ad_count"];
        this.ad_device = Data["ad_device"];
        this.ad_dot = Data["ad_dot"];
        this.ad_id = Data["ad_id"];
        this.ad_img = Data["ad_img"];
        this.ad_name = Data["ad_name"];
        this.ad_path = Data["ad_path"];
    }
    return RecommendItem;
}());
exports.RecommendItem = RecommendItem;
var RecommendView = /** @class */ (function () {
    function RecommendView() {
    }
    return RecommendView;
}());
exports.default = RecommendView;
},{"../../../../frameworks/events/EventUtils":16,"../YQSdk":77,"./CpaEvent":81}],83:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ChildBaseView_1 = require("../../../../frameworks/mvc/ChildBaseView");
var RecommendView_1 = require("./RecommendView");
var TimerService_1 = require("../../../../frameworks/TimerService");
var ShiwantuijianView = /** @class */ (function (_super) {
    __extends(ShiwantuijianView, _super);
    function ShiwantuijianView() {
        var _this = _super.call(this) || this;
        _this._iscanmove = false;
        _this._movetime = 0;
        _this._flushtime = 0;
        _this.dir = true;
        _this._nowvalue = 0;
        return _this;
    }
    ShiwantuijianView.prototype.onInit = function () {
        this.initView();
        this.initEvent();
    };
    ShiwantuijianView.prototype.initView = function () {
        this.list_0.setVirtual();
        this.list_0.itemRenderer = Laya.Handler.create(this, this.itemrenderlist, null, false);
        this._nowlist = RecommendView_1.Recommend.jiesuanData;
        if (this._nowlist.length > 0) {
            this.list_0.numItems = this._nowlist.length;
            this.visible = true;
            for (var i = 0; i < this._nowlist.length; i++) {
                this._nowlist[i].shownum++;
            }
            this._isStart = true;
            this._iscanmove = true;
            TimerService_1.default.instance.addUpdateTarget(this);
        }
        else {
            this.visible = false;
        }
    };
    ShiwantuijianView.prototype.initEvent = function () {
        this.addListener(this.list_0, Laya.Event.MOUSE_DOWN, this, this.downclick);
        this.addListener(this.list_0, Laya.Event.MOUSE_UP, this, this.upclick);
        this.addListener(this.list_0, Laya.Event.MOUSE_OUT, this, this.upclick);
    };
    ShiwantuijianView.prototype.downclick = function () {
        this._isdown = true;
        this._iscanmove = false;
        Laya.timer.clear(this, this.timeoutCallback);
    };
    ShiwantuijianView.prototype.timeoutCallback = function () {
        this._iscanmove = true;
    };
    ShiwantuijianView.prototype.upclick = function () {
        if (this._isdown) {
            this._isdown = false;
            this._nowvalue = this.list_0.scrollPane.percY;
            Laya.timer.once(2000, this, this.timeoutCallback);
        }
    };
    ShiwantuijianView.prototype.itemrenderlist = function (index, item) {
        if (index < this._nowlist.length) {
            item.showData(this._nowlist[index], true);
        }
    };
    ShiwantuijianView.prototype.update = function (dt) {
        if (this._isStart) {
            if (this.list_0.scrollPane && this._nowlist && this._nowlist.length > 0 && this._iscanmove) {
                if (this.dir) {
                    this._nowvalue += 0.001;
                    if (this._nowvalue >= 1) {
                        this._nowvalue = 1;
                        this.dir = false;
                    }
                }
                else {
                    this._nowvalue -= 0.001;
                    if (this._nowvalue <= 0) {
                        this._nowvalue = 0;
                        this.dir = true;
                    }
                }
                this.list_0.scrollPane.setPercY(this._nowvalue);
            }
        }
    };
    ShiwantuijianView.prototype.dispose = function () {
        this._iscanmove = false;
        TimerService_1.default.instance.removeUpdateTarget(this);
        _super.prototype.dispose.call(this);
    };
    return ShiwantuijianView;
}(ChildBaseView_1.default));
exports.default = ShiwantuijianView;
},{"../../../../frameworks/TimerService":13,"../../../../frameworks/mvc/ChildBaseView":21,"./RecommendView":82}],84:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("../../../../frameworks/mvc/BaseView");
var RecommendView_1 = require("./RecommendView");
var UiManager_1 = require("../../../../managers/UiManager");
var TuijianView = /** @class */ (function (_super) {
    __extends(TuijianView, _super);
    function TuijianView() {
        return _super.call(this, "main", "tuijianView") || this;
    }
    TuijianView.prototype.initView = function () {
        this.list_0.setVirtual();
        this.list_0.itemRenderer = Laya.Handler.create(this, this.itemrenderlist, null, false);
        this._nowlist = RecommendView_1.Recommend.gdyxData;
        this.list_0.numItems = this._nowlist.length;
    };
    TuijianView.prototype.initEvent = function () {
        this.addListener(this.btn_close, Laya.Event.CLICK, this, this.onclosefun);
    };
    TuijianView.prototype.itemrenderlist = function (index, item) {
        if (index < this._nowlist.length) {
            item.showData(this._nowlist[index]);
        }
    };
    TuijianView.prototype.onclosefun = function () {
        UiManager_1.UiManager.instance.close(TuijianView);
    };
    TuijianView.key = "TuijianView";
    return TuijianView;
}(BaseView_1.default));
exports.default = TuijianView;
},{"../../../../frameworks/mvc/BaseView":20,"../../../../managers/UiManager":66,"./RecommendView":82}],85:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ChildBaseView_1 = require("../../../../../frameworks/mvc/ChildBaseView");
var RecommendView_1 = require("../RecommendView");
var Sdk_1 = require("../../Sdk");
var YQSdk_1 = require("../../YQSdk");
var GameUtils_1 = require("../../../../../utils/GameUtils");
var UiManager_1 = require("../../../../../managers/UiManager");
var ChoutiPanView_1 = require("../ChoutiPanView");
var CpaItem = /** @class */ (function (_super) {
    __extends(CpaItem, _super);
    function CpaItem() {
        var _this = _super.call(this) || this;
        _this.ispenchoutipan = false;
        return _this;
    }
    CpaItem.prototype.onInit = function () {
        this.name = "capItem";
        this.addListener(this, Laya.Event.CLICK, this, this.onbtnclick);
    };
    CpaItem.prototype.onbtnclick = function () {
        var _this = this;
        if (this._vo) {
            var data = this._vo;
            var appid = data.ad_appid;
            var path = data.ad_path;
            var param = { "appId": appid.toString(), "path": path.toString() };
            if (Laya.Browser.onWeiXin) {
                Sdk_1.WxApi.recordAldEvent("点击跳转到游戏" + data.ad_name, "1");
                Laya.Browser.window.wx.navigateToMiniProgram({
                    appId: appid.toString(),
                    path: path.toString(),
                    success: function (res) {
                        Sdk_1.WxApi.recordAldEvent("跳转到游戏成功", "1");
                        var location_id = RecommendView_1.Recommend.recommendDic["C"].location_id;
                        YQSdk_1.YQSdk.reportad(data.ad_id, location_id, true);
                    },
                    fail: function (res) {
                        Sdk_1.WxApi.recordAldEvent("跳转到游戏失败", "1");
                        var location_id = RecommendView_1.Recommend.recommendDic["C"].location_id;
                        YQSdk_1.YQSdk.reportad(data.ad_id, location_id, false);
                        if (_this.ispenchoutipan) {
                            UiManager_1.UiManager.instance.add(ChoutiPanView_1.default);
                        }
                        // if(WindowManager.Instance.curOpenedView.name == "HomeWindow")this.OnOpenCtView(true);
                    }
                });
            }
        }
    };
    CpaItem.prototype.showData = function (data, isopenchoutipan) {
        if (isopenchoutipan === void 0) { isopenchoutipan = false; }
        this.ispenchoutipan = isopenchoutipan;
        this._vo = data;
        if (data) {
            this.load_icon.url = data.ad_img;
            if (this.txt_word) {
                this.txt_word.text = data.ad_name;
            }
            if (this.img_tip) {
                this.img_tip.visible = data.ad_dot == 1 ? true : false;
            }
            if (this.txt_word1) {
                this.txt_word1.text = GameUtils_1.GameUtils.randRangeint(235470, 1561430).toString() + "人玩";
            }
        }
    };
    return CpaItem;
}(ChildBaseView_1.default));
exports.default = CpaItem;
},{"../../../../../frameworks/mvc/ChildBaseView":21,"../../../../../managers/UiManager":66,"../../../../../utils/GameUtils":87,"../../Sdk":75,"../../YQSdk":77,"../ChoutiPanView":79,"../RecommendView":82}],86:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Dictionary = /** @class */ (function () {
    function Dictionary() {
        this.keys = new Array();
        this.values = new Array();
    }
    Object.defineProperty(Dictionary.prototype, "count", {
        get: function () {
            return this.keys.length;
        },
        enumerable: true,
        configurable: true
    });
    Dictionary.prototype.add = function (key, value) {
        var index = this.keys.indexOf(key);
        if (index == -1) {
            this.keys.push(key);
            this.values.push(value);
        }
        else {
            this.values[index] = value;
        }
    };
    Dictionary.prototype.remove = function (key) {
        var index = this.keys.indexOf(key);
        if (index != -1) {
            this.keys.splice(index, 1);
            this.values.splice(index, 1);
        }
    };
    Dictionary.prototype.getValue = function (key) {
        var index = this.keys.indexOf(key);
        if (index != -1) {
            return this.values[index];
        }
        return null;
    };
    Dictionary.prototype.containKey = function (key) {
        var index = this.keys.indexOf(key);
        if (index != -1) {
            return true;
        }
        return false;
    };
    Dictionary.prototype.containValue = function (value) {
        var index = this.values.indexOf(value);
        if (index != -1) {
            return true;
        }
        return false;
    };
    Dictionary.prototype.clear = function () {
        this.keys.length = 0;
        this.values.length = 0;
    };
    return Dictionary;
}());
exports.default = Dictionary;
},{}],87:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* 公共接口
*/
var GameUtils;
(function (GameUtils) {
    /**
     * 随机函数(返回整型)
     */
    function randRangeint(min, max) {
        var value = Math.floor(Math.random() * (max - min + 1)) + min;
        if (value > max) {
            value = max;
        }
        return value;
    }
    GameUtils.randRangeint = randRangeint;
    /**
     * 随机函数( 不取整 )
     */
    function randRangefloat(min, max) {
        var value = Math.random() * (max - min + 1) + min;
        if (value > max) {
            value = max;
        }
        return value;
    }
    GameUtils.randRangefloat = randRangefloat;
    function getTexbyPkgAndName(pkgname, texname) {
        var uipackage = fairygui.UIPackage.getByName(pkgname);
        if (uipackage) {
            return uipackage.getItemAssetByName(texname);
        }
        return null;
    }
    GameUtils.getTexbyPkgAndName = getTexbyPkgAndName;
    /**
     * 切割分号变成Point对象
     * @param str
     */
    function cutfenhaoPoint(str) {
        var arr = str.split(";");
        return new Laya.Point(Number(arr[0]), Number(arr[1]));
    }
    GameUtils.cutfenhaoPoint = cutfenhaoPoint;
    /**
     * 切割分号变成数据(number)
     */
    function cutfenhaotoArrnum(str) {
        var numArr = [];
        if (str == "") {
            return numArr;
        }
        var arr = str.split(";");
        var i = 0;
        for (i; i < arr.length; i++) {
            numArr.push(Number(arr[i]));
        }
        return numArr;
    }
    GameUtils.cutfenhaotoArrnum = cutfenhaotoArrnum;
    /**
     * 切割分号变成数据(string)
     */
    function cutfenhaotoArrstr(str) {
        return str.split(";");
    }
    GameUtils.cutfenhaotoArrstr = cutfenhaotoArrstr;
    /**
     * 切割分号变成数据( { key:1,value:1 } )
     */
    function cutfenhaotoObj(str) {
        var obj = {};
        var arr = str.split(";");
        obj.key = arr[0];
        obj.value = arr[1];
        return obj;
    }
    GameUtils.cutfenhaotoObj = cutfenhaotoObj;
    /**切割str*/
    function cutstrtoArr(str) {
        var arr = str.split("|");
        return arr;
    }
    GameUtils.cutstrtoArr = cutstrtoArr;
    /**切割str( 1:1|1:1 ) to Array<{ key:1,value:1 }> */
    function cutstrtoArr1(str) {
        var reslutArr = [];
        var arr = str.split("|");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var itemarr = arr[i].split(";");
            reslutArr.push({ key: itemarr[0], value: itemarr[1] });
        }
        return reslutArr;
    }
    GameUtils.cutstrtoArr1 = cutstrtoArr1;
    function cutstrtoObj(str) {
        var resultobj = {};
        var arr = str.split("|");
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            var itemarr = arr[i].split(";");
            resultobj[itemarr[0]] = itemarr[1];
        }
        return resultobj;
    }
    GameUtils.cutstrtoObj = cutstrtoObj;
    function compareVersion(v1, v2) {
        v1 = v1.split('.');
        v2 = v2.split('.');
        var len = Math.max(v1.length, v2.length);
        while (v1.length < len) {
            v1.push('0');
        }
        while (v2.length < len) {
            v2.push('0');
        }
        for (var i = 0; i < len; i++) {
            var num1 = parseInt(v1[i]);
            var num2 = parseInt(v2[i]);
            if (num1 > num2) {
                return 1;
            }
            else if (num1 < num2) {
                return -1;
            }
        }
        return 0;
    }
    GameUtils.compareVersion = compareVersion;
})(GameUtils = exports.GameUtils || (exports.GameUtils = {}));
},{}],88:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TimeUtils;
(function (TimeUtils) {
    /**
     * 月/日 小时:分钟
     * @param value
     */
    function formatData(value) {
        var str = "";
        var date = new Date(value * 1000);
        str = this.getTwo(date.getMonth() + 1) + "/" + this.getTwo(date.getDate()) + " " + this.getTwo(date.getHours()) + ":" + this.getTwo(date.getMinutes());
        return str;
    }
    TimeUtils.formatData = formatData;
    /**
     * 月/日
     * @param value
     */
    function formatData1(value) {
        var str = "";
        var date = new Date(value * 1000);
        str = (date.getMonth() + 1) + "月" + date.getDate() + "日";
        return str;
    }
    TimeUtils.formatData1 = formatData1;
    /**
     * 年月日
     * @param value
     */
    function formatYearMonthDate(value) {
        var str = "";
        var date = new Date(value * 1000);
        str = date.getFullYear() + "." + (date.getMonth() + 1) + "." + date.getDate();
        return str;
    }
    TimeUtils.formatYearMonthDate = formatYearMonthDate;
    /**
     * 年-月-日
     * @param value
     */
    function formatYearMonthDate1(value) {
        var str = "";
        var date = new Date(value * 1000);
        var month = (date.getMonth() + 1) >= 10 ? (date.getMonth() + 1).toString() : "0" + (date.getMonth() + 1);
        var dates = date.getDate() >= 10 ? date.getDate().toString() : "0" + date.getDate();
        str = date.getFullYear() + "-" + month + "-" + dates;
        return str;
    }
    TimeUtils.formatYearMonthDate1 = formatYearMonthDate1;
    function LXandJXTimeType(value) {
        var str = "";
        if (value < 0) {
            str = "0秒";
        }
        else if (value < 60) {
            str = Math.floor(value) + "秒";
        }
        else if (value < 60 * 60) {
            str = Math.floor(value / 60) + "分钟";
        }
        else {
            var hour;
            hour = Math.floor(value / 60 / 60);
            str = hour + "小时";
            str += Math.floor((value - hour * 60 * 60) / 60) + "分钟";
        }
        return str;
    }
    TimeUtils.LXandJXTimeType = LXandJXTimeType;
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回24:59:59
     */
    function formatTime(time) {
        var str = "";
        var hours = Math.floor(time / 3600);
        if (hours > 0) {
            str += hours >= 10 ? (hours + ":") : ("0" + hours + ":");
        }
        var minutes = Math.floor((time % 3600) / 60);
        str += minutes >= 10 ? (minutes + ":") : ("0" + minutes + ":");
        var second = Math.floor(time % 60);
        str += second >= 10 ? (second + "") : ("0" + second);
        return str;
    }
    TimeUtils.formatTime = formatTime;
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回24小时59分59秒
     */
    function formatTime1(time) {
        var str = "";
        var hours = Math.floor(time / 3600);
        if (hours > 0) {
            str += hours + "小时";
        }
        var minutes = Math.floor((time % 3600) / 60);
        str += minutes + "分钟";
        var second = Math.floor(time % 60);
        str += second + "秒";
        return str;
    }
    TimeUtils.formatTime1 = formatTime1;
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回1小时24分10秒
     */
    function formatTime5(time) {
        var str = "";
        var hours = Math.floor(time / 3600);
        if (hours > 0) {
            str += hours + "小时";
        }
        var minutes = Math.floor((time % 3600) / 60);
        if (minutes > 0) {
            str += minutes + "分";
        }
        var second = Math.floor(time % 60);
        str += second + "秒";
        return str;
    }
    TimeUtils.formatTime5 = formatTime5;
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回1天24小时59分59秒
     */
    function formatTime2(time) {
        var str = "";
        var day = Math.floor(time / 86400);
        if (day > 0) {
            str += day + "天";
        }
        var hours = Math.floor(time / 3600);
        if (hours > 0) {
            str += hours + "小时";
        }
        var minutes = Math.floor((time % 3600) / 60);
        if (minutes > 0) {
            str += minutes + "分钟";
        }
        var second = Math.ceil(time % 60);
        str += second + "秒";
        return str;
    }
    TimeUtils.formatTime2 = formatTime2;
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回1天24小时（ 只保留两个 ）
     */
    function formatTime6(time) {
        var str = "";
        var index = 0;
        var day = Math.floor(time / 86400);
        if (day > 0) {
            str += day + "天";
            index++;
        }
        var hours = Math.floor((time % 86400) / 3600);
        if (hours > 0) {
            str += hours + "小时";
            index++;
        }
        if (index < 2) {
            var minutes = Math.floor((time % 3600) / 60);
            if (minutes > 0) {
                str += minutes + "分";
                index++;
            }
        }
        if (index < 2) {
            var second = Math.ceil(time % 60);
            str += second + "秒";
        }
        return str;
    }
    TimeUtils.formatTime6 = formatTime6;
    /**
 * 格式化时间
 * @param time 秒
 * @return 返回1天24小时59分
 */
    function formatTime3(time) {
        var str = "";
        var day = Math.floor(time / 86400);
        str += day + "天";
        var hours = Math.floor(time % 86400 / 3600);
        str += hours + "小时";
        var minutes = Math.floor((time % 86400 % 3600) / 60);
        str += minutes + "分";
        return str;
    }
    TimeUtils.formatTime3 = formatTime3;
    /**
* 格式化时间
* @param time 秒
* @return 返回1天24小时59分
*/
    function formatTime4(time) {
        var str = "";
        if (time > 86400) {
            var day = Math.floor(time / 86400);
            str += day + "天";
        }
        if (time > 3600) {
            var hours = Math.floor(time % 86400 / 3600);
            str += hours + "小时";
        }
        if (time > 60) {
            var minutes = Math.floor((time % 86400 % 3600) / 60);
            str += minutes + "分钟";
        }
        return str;
    }
    TimeUtils.formatTime4 = formatTime4;
    /**
* 格式化时间
* @param time 秒
* @return 返回1天24小时59分
*/
    function formatTime4Arr(time) {
        var arrTime = [];
        var str = "";
        // if (time >= 86400) {
        //     var day: number = Math.floor(time / 86400);
        //     arrTime.unshift(String(day));
        // }
        if (time >= 3600) {
            var hours = Math.floor(time % 86400 / 3600);
            arrTime.unshift(String(hours));
        }
        if (time >= 60) {
            var minutes = Math.floor((time % 86400 % 3600) / 60);
            arrTime.unshift(String(minutes));
        }
        return arrTime;
    }
    TimeUtils.formatTime4Arr = formatTime4Arr;
    function getTwo(value) {
        var str = String(value);
        if (str.length < 2) {
            str = "0" + str;
        }
        return str;
    }
    TimeUtils.getTwo = getTwo;
    /**
     * 日期转时间戳
     * @param str 2018-1-1
     */
    function datetoTime(str) {
        return Date.parse(str) / 1000;
    }
    TimeUtils.datetoTime = datetoTime;
})(TimeUtils = exports.TimeUtils || (exports.TimeUtils = {}));
},{}]},{},[4])
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 1202700 characters]
