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 PanelResDic_1 = require("../PrefabControl/PanelResDic");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var Singleton_1 = require("../utils/Singleton");
var ServerSocket_1 = require("../WXSDK/ServerSocket");
var RoleData_1 = require("../Data/RoleData");
/*
* name;
*/
var AgencyBaseControl = /** @class */ (function (_super) {
    __extends(AgencyBaseControl, _super);
    function AgencyBaseControl() {
        var _this = _super.call(this) || this;
        _this._objectPool = PanelResDic_1.PanelResDic.Instance;
        _this.initSelf();
        return _this;
    }
    AgencyBaseControl.prototype.initSelf = function () {
    };
    /**********混淆 */
    AgencyBaseControl.prototype.drawSomething = function () {
        this.sp = new Laya.Sprite();
        Laya.stage.addChild(this.sp);
        //画线
        this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3);
        //画连续直线
        this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5);
        //画曲线
        this.sp.graphics.drawCurves(352, 58, [0, 0, 19, -100, 39, 0, 58, 100, 78, 0, 97, -100, 117, 0, 136, 100, 156, 0], "#ff0000", 5);
        //画矩形
        this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00");
        //画多边形
        this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00");
        //画三角形
        this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00");
        //画圆
        this.sp.graphics.drawCircle(98, 332, 50, "#00ffff");
        //画扇形
        this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff");
        //绘制圆角矩形，自定义路径
        this.sp.graphics.drawPath(400, 310, [["moveTo", 5, 0], ["lineTo", 105, 0], ["arcTo", 110, 0, 110, 5, 5], ["lineTo", 110, 55], ["arcTo", 110, 60, 105, 60, 5], ["lineTo", 5, 60], ["arcTo", 0, 60, 0, 55, 5], ["lineTo", 0, 5], ["arcTo", 0, 0, 5, 0, 5], ["closePath"]], { fillStyle: "#00ffff" });
    };
    /********** */
    /**
     *  注册全局侦听事件
     *
     */
    AgencyBaseControl.prototype.DisOn = function (type, callbackobj, callbackHandler) {
        DispatcherManager_1.DispatcherManager.addEventListener(type, callbackobj, callbackHandler);
    };
    /**
     *  抛出全局事件
     */
    AgencyBaseControl.prototype.DisTrigger = function (type, data) {
        if (data === void 0) { data = null; }
        DispatcherManager_1.DispatcherManager.dispatchEvent(type, data);
    };
    /**
     * 移除全局侦听事件
     */
    AgencyBaseControl.prototype.DisOff = function (type, callbackobj, callbackHandler) {
        DispatcherManager_1.DispatcherManager.removeEventListener(type, callbackobj, callbackHandler);
    };
    /************************** */
    AgencyBaseControl.prototype.setup = function () {
        var textBox = new Laya.Sprite();
        // 随机摆放文本
        var text;
        for (var i = 0; i < 1000; i++) {
            text = new Laya.Text();
            text.fontSize = 20;
            text.text = (Math.random() * 100).toFixed(0);
            text.rotation = Math.random() * 360;
            text.color = "#CCCCCC";
            text.x = Math.random() * Laya.stage.width;
            text.y = Math.random() * Laya.stage.height;
            textBox.addChild(text);
        }
        //缓存为静态图像
        textBox.cacheAs = "bitmap";
        Laya.stage.addChild(textBox);
    };
    /********* ********************/
    AgencyBaseControl.prototype.getSingleTon = function (ref) {
        return this._objectPool.getSingleTon(ref);
    };
    AgencyBaseControl.prototype.sendMessage = function (act, data, isShowWait) {
        if (data === void 0) { data = null; }
        if (isShowWait === void 0) { isShowWait = true; }
        ServerSocket_1.ServerSocket.Instance.sendMessage(act, data, isShowWait);
    };
    Object.defineProperty(AgencyBaseControl.prototype, "RoleData", {
        get: function () {
            if (!this.roleData) {
                this.roleData = RoleData_1.RoleData.Instance;
            }
            return this.roleData;
        },
        enumerable: true,
        configurable: true
    });
    return AgencyBaseControl;
}(Singleton_1.Singleton));
exports.AgencyBaseControl = AgencyBaseControl;
},{"../Data/RoleData":31,"../PrefabControl/PanelResDic":46,"../WXSDK/ServerSocket":76,"../utils/DispatcherManager":83,"../utils/Singleton":89}],2:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var GameState_1 = require("../utils/GameState");
var ViewManager_1 = require("../View/ViewManager");
var CompletePanel_1 = require("../View/CompletePanel");
var GameStateControl_1 = require("../Control/GameStateControl");
var GameUtils_1 = require("../utils/GameUtils");
var SceneControl_1 = require("../Control/SceneControl");
var PropManager_1 = require("../PrefabControl/PropManager");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var Sdk_1 = require("../WXSDK/Sdk");
var AgencyTrial_1 = require("./AgencyTrial");
var GiftView_1 = require("../View/GiftView");
var RecordManager_1 = require("../WXSDK/RecordManager");
var AgencyInGame = /** @class */ (function (_super) {
    __extends(AgencyInGame, _super);
    function AgencyInGame() {
        return _super.call(this) || this;
    }
    AgencyInGame.prototype.initSelf = function () {
        this.DisOn(GameState_1.GameState.end, this, this.endgameHandler);
        this.DisOn(GameState_1.GameState.revive, this, this.RevivegameHandler);
        this.DisOn(GameState_1.GameState.lose, this, this.LosegameHandler);
    };
    /**复活界面 */
    AgencyInGame.prototype.RevivegameHandler = function () {
        Laya.timer.once(1000, this, this.reviveView);
    };
    /**失败界面 */
    AgencyInGame.prototype.LosegameHandler = function () {
        Laya.timer.once(1000, this, this.loseView);
    };
    AgencyInGame.prototype.reviveView = function () {
        RecordManager_1.RecordManager.Instance.RecordStop();
        var nowmingcvi = GameStateControl_1.GameStateControl.Instance.nowMingCi;
        var getGold = 0;
        Sdk_1.WxApi.recordAldEvent("打开结算界面(复活)");
        ViewManager_1.ViewManager.Instance.add(CompletePanel_1.CompletePanel, getGold);
    };
    AgencyInGame.prototype.loseView = function () {
        RecordManager_1.RecordManager.Instance.RecordStop();
        var nowmingcvi = GameStateControl_1.GameStateControl.Instance.nowMingCi;
        var getGold = 0;
        Sdk_1.WxApi.recordAldEvent("打开结算界面(失败)");
        this.RecropLevelEnd(false);
        ViewManager_1.ViewManager.Instance.add(CompletePanel_1.CompletePanel, getGold);
    };
    AgencyInGame.prototype.endgameHandler = function () {
        RecordManager_1.RecordManager.Instance.RecordStop();
        Laya.timer.once(1000, this, this.startEndView);
    };
    AgencyInGame.prototype.startEndView = function () {
        var nowmingcvi = GameStateControl_1.GameStateControl.Instance.nowMingCi;
        var getGold = 0;
        if (GameStateControl_1.GameStateControl.Instance.endGamePlayerArr.length == 0) {
            getGold = this.RoleData.levelcfg.winGold;
            Sdk_1.WxApi.recordAldEvent("打开结算界面(游戏胜利)");
            this.RecropLevelEnd(true);
        }
        else {
            var arr = GameUtils_1.GameUtils.cutstrtoArr(this.RoleData.levelcfg.failGod);
            getGold = GameUtils_1.GameUtils.randRangeint(Number(arr[0]), Number(arr[1]));
            Sdk_1.WxApi.recordAldEvent("打开结算界面(游戏失败)");
            this.RecropLevelEnd(false);
        }
        ViewManager_1.ViewManager.Instance.add(CompletePanel_1.CompletePanel, getGold);
        // ViewManager.Instance.add( ChoutiPanView,2 );
    };
    AgencyInGame.prototype.RecropLevelEnd = function (_win) {
        // if(!Laya.Browser.onWeiXin)return;
        // var stageid = this.RoleData.LevelID.toString();
        // var useid = PlayerAccount.CurrentAccount.CurAccountData.UseId;
        // var stagename = "第" + this.RoleData.LevelID + "关";
        // if(_win)
        // {
        //     WxApi.levelSuccess(stageid,stagename,stageid);
        // }
        // else
        // {
        //     var equipid = this.RoleData.CharacterID.toString();
        //     var carname = this.RoleData.roleCfg.name;
        //     WxApi.levelFail(stageid,stagename,stageid,"0",carname);
        // }
    };
    AgencyInGame.prototype.returnmainview = function (win) {
        if (win && PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.WhiteUser) {
            var ran = Math.random();
            console.log("误触几率为---", ran);
            if (ran <= PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.EndCheat) {
                ViewManager_1.ViewManager.Instance.add(GiftView_1.default);
            }
            GameState_1.GameState.fuhuocishu = 1;
            GameState_1.GameState.recordscree = false;
            GameState_1.GameState.isdie = false;
            PropManager_1.PropManager.Instance.CloseGameOverEffect();
            ViewManager_1.ViewManager.Instance.close(CompletePanel_1.CompletePanel);
            this.DisTrigger(GameState_1.GameState.returnMainView);
            SceneControl_1.SceneControl.Instance.ShowTheGameScene();
            var agencytrial = this.getSingleTon(AgencyTrial_1.AgencyTrial);
            if (agencytrial.isshiyonging) {
                SceneControl_1.SceneControl.Instance.CreatePlayer(this.RoleData.roleCfg);
                agencytrial.isshiyonging = false;
            }
        }
        else {
            GameState_1.GameState.fuhuocishu = 1;
            GameState_1.GameState.recordscree = false;
            GameState_1.GameState.isdie = false;
            PropManager_1.PropManager.Instance.CloseGameOverEffect();
            ViewManager_1.ViewManager.Instance.close(CompletePanel_1.CompletePanel);
            this.DisTrigger(GameState_1.GameState.returnMainView);
            SceneControl_1.SceneControl.Instance.ShowTheGameScene();
            var agencytrial = this.getSingleTon(AgencyTrial_1.AgencyTrial);
            if (agencytrial.isshiyonging) {
                SceneControl_1.SceneControl.Instance.CreatePlayer(this.RoleData.roleCfg);
                agencytrial.isshiyonging = false;
            }
        }
        //打开好友邀请界面
        // ViewManager.Instance.add(FriendInviteView);
    };
    AgencyInGame.prototype.startGame = function () {
        AgencyInGame.gamenum++;
        var stageid = this.RoleData.getNowServerLevel().toString().toString();
        var stagename = "第" + stageid + "关";
        var useid = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.UseId;
        Sdk_1.WxApi.levelStart(stageid, stagename, useid);
        GameStateControl_1.GameStateControl.Instance.startGame();
    };
    AgencyInGame.key = "AgencyInGame";
    AgencyInGame.gamenum = 0;
    return AgencyInGame;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencyInGame = AgencyInGame;
},{"../Control/GameStateControl":20,"../Control/SceneControl":27,"../PrefabControl/PropManager":47,"../View/CompletePanel":59,"../View/GiftView":61,"../View/ViewManager":68,"../WXSDK/PlayerAccount":73,"../WXSDK/RecordManager":74,"../WXSDK/Sdk":75,"../utils/GameState":84,"../utils/GameUtils":85,"./AgencyBaseControl":1,"./AgencyTrial":7}],3:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ViewManager_1 = require("../View/ViewManager");
var LoadingPanel_1 = require("../View/LoadingPanel");
var AgencyUserMessage_1 = require("./AgencyUserMessage");
var WECHATEVENT_1 = require("../WXSDK/WECHATEVENT");
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var AgencyMain_1 = require("./AgencyMain");
var RoleCFG_1 = require("../CFG/RoleCFG");
var LevelCFG_1 = require("../CFG/LevelCFG");
var BuildCFG_1 = require("../CFG/BuildCFG");
var NpcCFG_1 = require("../CFG/NpcCFG");
var GameCFG_1 = require("../CFG/GameCFG");
var AgencySkin_1 = require("./AgencySkin");
var Sdk_1 = require("../WXSDK/Sdk");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var NetworkManager_1 = require("../WXSDK/NetworkManager");
var Global_1 = require("../Global");
var LotteryCFG_1 = require("../CFG/LotteryCFG");
var AgencyLottery_1 = require("./AgencyLottery");
var ttad_1 = require("../WXSDK/ttad");
var AgencyLogin = /** @class */ (function (_super) {
    __extends(AgencyLogin, _super);
    function AgencyLogin() {
        return _super.call(this) || this;
    }
    AgencyLogin.prototype.initSelf = function () {
        this.DisOn(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_loginSucceed, this, this.Success);
    };
    AgencyLogin.prototype.Login = function () {
        ViewManager_1.ViewManager.Instance.add(LoadingPanel_1.LoadingPanel);
        this.loginprogress(0);
        // if(Laya.Browser.onWeiXin)
        // {
        //     this.LoginWX();
        // }
        // else
        // {
        this.LoginLocal();
        // }
    };
    AgencyLogin.prototype.LoginWX = 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);
                _this.LoginLocal();
            }
            else {
                Sdk_1.WxApi.recordAldEvent("微信登录失败");
                _this.LoginWX();
            }
        });
    };
    AgencyLogin.prototype.LoginLocal = 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.LoginComplete), null);
        //this.LoadSbp();
    };
    AgencyLogin.prototype.LoginComplete = function () {
        Sdk_1.WxApi.recordAldEvent("本地服务器登录完成...");
        // ShareUtil.Instance.onRegister();
        // GuangGao.InitVideo();
        Sdk_1.WxApi.aldSendOpenid(PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.openid);
        this.Success();
    };
    AgencyLogin.prototype.loginprogress = function (value) {
        var loadingPanel = ViewManager_1.ViewManager.Instance.getView(LoadingPanel_1.LoadingPanel);
        if (loadingPanel) {
            loadingPanel.showWord(value);
        }
    };
    AgencyLogin.prototype.Success = function () {
        this.ResolveData();
        this.initData();
        this.StartMain();
        ttad_1.ttad.InitAD();
    };
    AgencyLogin.prototype.StartMain = function () {
        console.log("当前配置表总关卡：", LevelCFG_1.default.vec.length);
        this.getSingleTon(AgencyMain_1.AgencyMain).StartMain();
    };
    /**
     * 解析配置数据
     */
    AgencyLogin.prototype.ResolveData = function () {
        var byteData = PlayerAccount_1.PlayerAccount.CurrentAccount.nowConfig.gameConfig[0].config;
        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 = AgencyLogin.configClass[itemarr[0]];
                if (cla) {
                    cla.initCfg(itemarr[1]);
                }
                else {
                }
            }
            return true;
        }
        return false;
    };
    /**
     * 初始化游戏数据
     */
    AgencyLogin.prototype.initData = function () {
        this.getSingleTon(AgencyUserMessage_1.AgencyUserMessage).init();
        this.getSingleTon(AgencySkin_1.AgencySkin).init();
        this.getSingleTon(AgencyLottery_1.AgencyLottery).init();
    };
    AgencyLogin.key = "AgencyLogin";
    AgencyLogin.configClass = {
        RoleCFG: RoleCFG_1.default,
        LevelCFG: LevelCFG_1.default,
        BuildCFG: BuildCFG_1.default,
        NpcCFG: NpcCFG_1.default,
        GameCFG: GameCFG_1.default,
        LotteryCFG: LotteryCFG_1.default
    };
    return AgencyLogin;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencyLogin = AgencyLogin;
},{"../CFG/BuildCFG":9,"../CFG/GameCFG":10,"../CFG/LevelCFG":11,"../CFG/LotteryCFG":12,"../CFG/NpcCFG":13,"../CFG/RoleCFG":14,"../Global":39,"../View/LoadingPanel":63,"../View/ViewManager":68,"../WXSDK/NetworkManager":71,"../WXSDK/PlayerAccount":73,"../WXSDK/Sdk":75,"../WXSDK/WECHATEVENT":78,"../WXSDK/ttad":81,"./AgencyBaseControl":1,"./AgencyLottery":4,"./AgencyMain":5,"./AgencySkin":6,"./AgencyUserMessage":8}],4:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var ViewManager_1 = require("../View/ViewManager");
var LotteryPanel_1 = require("../View/LotteryPanel");
var LotteryCFG_1 = require("../CFG/LotteryCFG");
var GameUtils_1 = require("../utils/GameUtils");
var GlobalTip_1 = require("../utils/GlobalTip");
var RoleCFG_1 = require("../CFG/RoleCFG");
var AgencySkin_1 = require("./AgencySkin");
var AgencyLottery = /** @class */ (function (_super) {
    __extends(AgencyLottery, _super);
    function AgencyLottery() {
        var _this = _super.call(this) || this;
        _this.mStartX = 400;
        _this.mStartY = 500;
        _this.mActionIndex = 0;
        _this.mCurrIndex = 0;
        _this.mCurrSkinIndex = 0;
        return _this;
    }
    AgencyLottery.prototype.init = function () {
    };
    AgencyLottery.prototype.openView = function () {
        ViewManager_1.ViewManager.Instance.add(LotteryPanel_1.LotteryPanel);
    };
    /**************************** */
    AgencyLottery.prototype.createAnimation = function () {
        var ani = new Laya.Animation();
        // ani.loadAtlas(this.AniConfPath); // 加载图集动画
        ani.interval = 30; // 设置播放间隔（单位：毫秒）
        ani.index = 1; // 当前播放索引
        ani.play(); // 播放图集动画
        // 获取动画的边界信息
        var bounds = ani.getGraphicBounds();
        ani.pivot(bounds.width / 2, bounds.height / 2);
        ani.pos(Laya.stage.width / 2, Laya.stage.height / 2);
        Laya.stage.addChild(ani);
    };
    /************************* */
    AgencyLottery.prototype.getreward = function (cfg) {
        if (cfg) {
            switch (cfg.type) {
                case 1:
                    this.RoleData.Money += Number(cfg.value);
                    GlobalTip_1.GlobalTip.Instance.showWordTips("恭喜获得" + cfg.value + "金币！");
                    break;
                case 2:
                    var rolecfg = RoleCFG_1.default.dict[cfg.value];
                    this.getSingleTon(AgencySkin_1.AgencySkin).setRoleState(rolecfg, 1);
                    GlobalTip_1.GlobalTip.Instance.showWordTips("恭喜获得角色" + rolecfg.rolename);
                    break;
            }
        }
    };
    AgencyLottery.prototype.GetReward = function () {
        var index = 0;
        var dicts = LotteryCFG_1.default.vec;
        var maxNum = 0;
        var cfg;
        var i = 0;
        for (i = 0; i < dicts.length; i++) {
            cfg = dicts[i];
            maxNum += cfg.weight;
        }
        var sordvalue = GameUtils_1.GameUtils.randRangeint(1, maxNum);
        var totalnum = 0;
        for (i = 0; i < dicts.length; i++) {
            cfg = dicts[i];
            totalnum += cfg.weight;
            if (totalnum >= sordvalue) {
                index = i;
                break;
            }
        }
        return index;
    };
    /************************************************ */
    AgencyLottery.prototype.startFun = function () {
        this.mAniPath = "res/spine/spineRes1/dragon.sk";
        // this.mFactory = new Templet();
        // this.mFactory.on(Event.COMPLETE, this, this.parseComplete);
        // this.mFactory.on(Event.ERROR, this, this.onError);
        // this.mFactory.loadAni(this.mAniPath);
    };
    AgencyLottery.prototype.onError = function () {
        console.log("error");
    };
    AgencyLottery.prototype.parseComplete = function () {
        //创建模式为1，可以启用换装
        this.mArmature = this.mFactory.buildArmature(1);
        this.mArmature.x = this.mStartX;
        this.mArmature.y = this.mStartY;
        this.mArmature.scale(0.5, 0.5);
        Laya.stage.addChild(this.mArmature);
        // this.mArmature.on(Event.STOPPED, this, this.completeHandler);
        this.play();
    };
    AgencyLottery.prototype.completeHandler = function () {
        this.play();
    };
    AgencyLottery.prototype.play = function () {
        this.mCurrIndex++;
        if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
            this.mCurrIndex = 0;
        }
        this.mArmature.play(this.mCurrIndex, false);
    };
    AgencyLottery.key = "AgencyLottery";
    return AgencyLottery;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencyLottery = AgencyLottery;
},{"../CFG/LotteryCFG":12,"../CFG/RoleCFG":14,"../View/LotteryPanel":64,"../View/ViewManager":68,"../utils/GameUtils":85,"../utils/GlobalTip":86,"./AgencyBaseControl":1,"./AgencySkin":6}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var ResourceControl_1 = require("../Control/ResourceControl");
var LoadingPanel_1 = require("../View/LoadingPanel");
var ViewManager_1 = require("../View/ViewManager");
var ResDataControl_1 = require("../Control/ResDataControl");
var MainPanel_1 = require("../View/MainPanel");
var SceneControl_1 = require("../Control/SceneControl");
var AssetPath_1 = require("../Config/AssetPath");
var GameStateControl_1 = require("../Control/GameStateControl");
var WXGamePlatform_1 = require("../WXSDK/WXGamePlatform");
var NpcCFG_1 = require("../CFG/NpcCFG");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var PropManager_1 = require("../PrefabControl/PropManager");
var FYHD_Sdk_1 = require("../WXSDK/FYHD_Sdk");
var GiftView_1 = require("../View/GiftView");
var AgencyMain = /** @class */ (function (_super) {
    __extends(AgencyMain, _super);
    function AgencyMain() {
        var _this = _super.call(this) || this;
        _this._loadjd = 0;
        _this._alljd = 0;
        return _this;
    }
    AgencyMain.prototype.initSelf = function () {
    };
    AgencyMain.prototype.StartMain = function () {
        this._loadjd = 0;
        this._alljd = 20;
        WXGamePlatform_1.WXGamePlatform.Instance.loadSubpackage("subpackage", this, this.sub1complete, this.loadprogress, null);
    };
    AgencyMain.prototype.sub1complete = function () {
        this._loadjd = 20;
        this._alljd = 30;
        WXGamePlatform_1.WXGamePlatform.Instance.loadSubpackage("subpackage1", this, this.SubpackageOver, this.loadprogress, null);
    };
    AgencyMain.prototype.onComplete = function () {
        //添加父级猴子
        var dude = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/skinModel/dude/dude.lh"));
        //缩放
        var scale = new Laya.Vector3(0.1, 0.1, 0.1);
        dude.transform.localScale = scale;
        dude.transform.rotate(new Laya.Vector3(0, 3.14, 0));
    };
    /*************************************** */
    AgencyMain.prototype.SubpackageOver = function () {
        this._loadjd = 50;
        this._alljd = 40;
        var pathArr = [];
        var urlArr = [];
        urlArr.push(AssetPath_1.AssetPath.get3DModel("startpanel"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("endpanel"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("speedupeffect"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("color_white"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("color_yellow"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("winline"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("fireworks"));
        urlArr.push(AssetPath_1.AssetPath.get3DModel("DirectionalLight"));
        // urlArr.push( AssetPath.get3DModel( "distantview" ) );
        urlArr.push(AssetPath_1.AssetPath.get3DRoleModel(this.RoleData.roleCfg.name));
        urlArr.push(AssetPath_1.AssetPath.get3DRoleModel("Arrow"));
        var arr = this.RoleData.levelmapArr;
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            if (urlArr.indexOf(AssetPath_1.AssetPath.get3DModel(arr[i])) == -1) {
                urlArr.push(AssetPath_1.AssetPath.get3DModel(arr[i]));
            }
        }
        var npcArr = this.RoleData.levelcfg.npc;
        for (i = 0; i < npcArr.length; i++) {
            if (urlArr.indexOf(AssetPath_1.AssetPath.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name)) == -1) {
                urlArr.push(AssetPath_1.AssetPath.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name));
            }
        }
        for (i = 0; i < urlArr.length; i++) {
            pathArr.push({ url: urlArr[i] });
        }
        ResourceControl_1.ResourceControl.Instance.loader3DArr(pathArr, this, this.load3Dcomplete, this.loadprogress);
    };
    AgencyMain.prototype.load3Dcomplete = function () {
        this._loadjd = 90;
        this._alljd = 10;
        ResourceControl_1.ResourceControl.Instance.loadGroup("main", this, this.loadcomplete, this.loadprogress, false);
    };
    AgencyMain.prototype.loadprogress = function (value) {
        var loadingpanel = ViewManager_1.ViewManager.Instance.getView(LoadingPanel_1.LoadingPanel);
        if (loadingpanel) {
            value = this._loadjd + Math.ceil(value / 100 * this._alljd);
            loadingpanel.showWord(value);
        }
    };
    AgencyMain.prototype.loadcomplete = function () {
        fairygui.UIConfig.buttonSound = "ui://lecxynh2iz9y26";
        GameStateControl_1.GameStateControl.Instance.init();
        ResDataControl_1.ResDataControl.Instance.AddViewPackByName("main");
        ViewManager_1.ViewManager.Instance.close(LoadingPanel_1.LoadingPanel);
        // FYHD_Sdk.InitSdk();
        ViewManager_1.ViewManager.Instance.add(MainPanel_1.MainPanel);
        console.log("新用户FYHD_Sdk.isnewuser---", FYHD_Sdk_1.FYHD_Sdk.isnewuser);
        var newuser = Laya.LocalStorage.getItem("is_newuser");
        if (FYHD_Sdk_1.FYHD_Sdk.isnewuser) {
            Laya.timer.once(500, this, function () {
                if (PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.WhiteUser) {
                    ViewManager_1.ViewManager.Instance.add(GiftView_1.default);
                }
            });
        }
        else {
            Laya.LocalStorage.setItem("is_newuser", "1");
        }
        SceneControl_1.SceneControl.Instance.SetScene();
        PropManager_1.PropManager.Instance.InitEffect();
    };
    AgencyMain.key = "AgencyMain";
    return AgencyMain;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencyMain = AgencyMain;
},{"../CFG/NpcCFG":13,"../Config/AssetPath":15,"../Control/GameStateControl":20,"../Control/ResDataControl":25,"../Control/ResourceControl":26,"../Control/SceneControl":27,"../PrefabControl/PropManager":47,"../View/GiftView":61,"../View/LoadingPanel":63,"../View/MainPanel":65,"../View/ViewManager":68,"../WXSDK/FYHD_Sdk":69,"../WXSDK/PlayerAccount":73,"../WXSDK/WXGamePlatform":79,"./AgencyBaseControl":1}],6:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var LocalDataControl_1 = require("../Control/LocalDataControl");
var UserDataInfo_1 = require("../Data/UserDataInfo");
var SkinData_1 = require("../Data/SkinData");
var RoleCFG_1 = require("../CFG/RoleCFG");
var ViewManager_1 = require("../View/ViewManager");
var SkinPanel_1 = require("../View/SkinPanel");
var GlobalTip_1 = require("../utils/GlobalTip");
var GameState_1 = require("../utils/GameState");
var AgencySkin = /** @class */ (function (_super) {
    __extends(AgencySkin, _super);
    function AgencySkin() {
        return _super.call(this) || this;
    }
    AgencySkin.prototype.initSelf = function () {
    };
    AgencySkin.prototype.init = function () {
        this.localdata = LocalDataControl_1.LocalDataControl.Instance.GetLocalCaCheData(UserDataInfo_1.UserDataInfo.skin);
        var pifuData;
        if (!this.localdata.hasOwnProperty("pifu")) {
            this.localdata["pifu"] = {};
        }
        pifuData = this.localdata["pifu"];
        this.pifuArr = [];
        this.pifuDict = {};
        var i = 0;
        var nums = RoleCFG_1.default.vec.length;
        for (i = 0; i < nums; i++) {
            var pifuvo = new SkinData_1.SkinData;
            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;
        }
    };
    AgencySkin.prototype.openview = function () {
        ViewManager_1.ViewManager.Instance.add(SkinPanel_1.SkinPanel);
    };
    AgencySkin.prototype.setRoleState = function (cfg, value) {
        var pifuvo = this.pifuDict[cfg.id];
        if (pifuvo) {
            pifuvo.state = 1;
            this.AddLocalSkinData(pifuvo.roleCFG.id, pifuvo.state, pifuvo.hasnum);
        }
    };
    AgencySkin.prototype.AddLocalSkinData = function (id, state, hasnum) {
        this.localdata["pifu"][id] = {};
        this.localdata["pifu"][id]["state"] = state;
        this.localdata["pifu"][id]["hasnum"] = hasnum;
        LocalDataControl_1.LocalDataControl.Instance.AddData(UserDataInfo_1.UserDataInfo.skin, this.localdata);
    };
    AgencySkin.prototype.createCantralRect = function () {
        this.rect = new Laya.Sprite();
        this.rect.graphics.drawRect(-100, -100, 200, 200, "gray");
        Laya.stage.addChild(this.rect);
        this.updateRectPos();
    };
    AgencySkin.prototype.updateRectPos = function () {
        this.rect.x = Laya.stage.width / 2;
        this.rect.y = Laya.stage.height / 2;
    };
    /****************************************** */
    AgencySkin.prototype.GainPifu = function (_skinitem) {
        if (_skinitem.state == 1) {
            this.RoleData.CharacterID = _skinitem.roleCFG.id;
            this.DisTrigger(GameState_1.GameState.updateSKinView);
        }
        else {
            switch (_skinitem.roleCFG.getState) {
                case 1: //视频获取
                    _skinitem.hasnum++;
                    if (_skinitem.roleCFG.need <= _skinitem.hasnum) {
                        _skinitem.state = 1;
                    }
                    this.AddLocalSkinData(_skinitem.roleCFG.id, _skinitem.state, _skinitem.hasnum);
                    this.DisTrigger(GameState_1.GameState.updateSKinView);
                    break;
                case 2: //金币购买
                    if (this.RoleData.Money >= _skinitem.roleCFG.need) {
                        this.RoleData.Money -= _skinitem.roleCFG.need;
                        _skinitem.state = 1;
                        this.AddLocalSkinData(_skinitem.roleCFG.id, _skinitem.state, _skinitem.hasnum);
                        this.DisTrigger(GameState_1.GameState.updateSKinView);
                        GlobalTip_1.GlobalTip.Instance.showWordTips("购买成功");
                    }
                    else {
                        GlobalTip_1.GlobalTip.Instance.showWordTips("金币不足");
                    }
                    break;
                case 3: //活动获取
                    break;
            }
        }
    };
    AgencySkin.prototype.GainNoHaveSkin = function () {
        var arr = [];
        for (var s in this.pifuDict) {
            if (this.pifuDict[s].state == 0) {
                arr.push(this.pifuDict[s]);
            }
        }
        return arr;
    };
    AgencySkin.key = "AgencySkin";
    return AgencySkin;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencySkin = AgencySkin;
},{"../CFG/RoleCFG":14,"../Control/LocalDataControl":22,"../Data/SkinData":32,"../Data/UserDataInfo":33,"../View/SkinPanel":66,"../View/ViewManager":68,"../utils/GameState":84,"../utils/GlobalTip":86,"./AgencyBaseControl":1}],7:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var ViewManager_1 = require("../View/ViewManager");
var TrialPanel_1 = require("../View/TrialPanel");
var GameStateControl_1 = require("../Control/GameStateControl");
var AssetPath_1 = require("../Config/AssetPath");
var ResourceControl_1 = require("../Control/ResourceControl");
var SceneControl_1 = require("../Control/SceneControl");
var AgencyInGame_1 = require("./AgencyInGame");
var EggPanel_1 = require("../View/EggPanel");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var AgencyTrial = /** @class */ (function (_super) {
    __extends(AgencyTrial, _super);
    function AgencyTrial() {
        var _this = _super.call(this) || this;
        _this.isshiyonging = false;
        return _this;
    }
    AgencyTrial.prototype.openview = function (arr) {
        ViewManager_1.ViewManager.Instance.add(TrialPanel_1.TrialPanel, arr);
    };
    /**退出界面 */
    AgencyTrial.prototype.ExitPanel = function (_data) {
        this.isshiyonging = _data ? true : false;
        this._selectvo = _data;
        if (_data) {
            var urlArr = [];
            urlArr.push({ url: AssetPath_1.AssetPath.get3DRoleModel(_data.roleCFG.name) });
            ResourceControl_1.ResourceControl.Instance.loader3DArr(urlArr, this, this.SceneCreateComplete, null, true);
        }
        else {
            // if(AgencyInGame.gamenum>1){
            var random = Math.random();
            if (PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.WhiteUser && random <= PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.HitEgg) {
                ViewManager_1.ViewManager.Instance.add(EggPanel_1.default);
            }
            else {
                GameStateControl_1.GameStateControl.Instance.entergame();
            }
            // }
            // else{
            //     GameStateControl.Instance.entergame();
            // }
        }
        ViewManager_1.ViewManager.Instance.close(TrialPanel_1.TrialPanel);
    };
    /************************************************ */
    AgencyTrial.prototype.createSprite = function () {
        this.sprit = new Laya.Sprite();
        this.sprit.graphics.drawRect(0, 0, 200, 200, "#D2691E");
        this.sprit.pivot(100, 100);
        this.sprit.x = Laya.stage.width / 2;
        this.sprit.y = Laya.stage.height / 2;
        this.sprit.size(200, 200);
        Laya.stage.addChild(this.sprit);
        // this.sp.on(Interaction_CustomEvent.ROTATE, this, this.onRotate);    // 侦听自定义的事件
        // this.sprit.on(Event.CLICK, this, this.onSpriteClick);
    };
    AgencyTrial.prototype.onSpriteClick = function (e) {
        var randomAngle = Math.random() * 180;
        //发送自定义事件
        // this.sprit.event(Interaction_CustomEvent.ROTATE, [randomAngle]);
    };
    // 触发自定义的rotate事件
    AgencyTrial.prototype.onRotate = function (newAngle) {
        // Tween.to(this.sp, { "rotation": newAngle }, 1000, Ease.elasticOut);
    };
    /******************************* */
    AgencyTrial.prototype.SceneCreateComplete = function () {
        SceneControl_1.SceneControl.Instance.CreatePlayer(this._selectvo.roleCFG);
        if (AgencyInGame_1.AgencyInGame.gamenum > 1) {
            if (PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.WhiteUser) {
                ViewManager_1.ViewManager.Instance.add(EggPanel_1.default);
            }
            else {
                GameStateControl_1.GameStateControl.Instance.entergame();
            }
        }
        else {
            GameStateControl_1.GameStateControl.Instance.entergame();
        }
    };
    /******************************* */
    AgencyTrial.prototype.createText = function () {
        var txt = new Laya.Text();
        //给文本的text属性赋值
        txt.text = "Layabox是性能最强的HTML5引擎技术提供商与优秀的游戏发行商，面向Flash开发者提供HTML5开发技术方案！";
        //设置宽度，高度自动匹配
        txt.width = 400;
        //自动换行
        txt.wordWrap = true;
        txt.align = "center";
        txt.fontSize = 40;
        txt.font = "Microsoft YaHei";
        txt.color = "#ff0000";
        txt.bold = true;
        txt.leading = 5;
        //设置描边属性
        txt.stroke = 2;
        txt.strokeColor = "#ffffff";
        txt.borderColor = "#00ff00";
        txt.x = (Laya.stage.width - txt.textWidth) / 2;
        txt.y = (Laya.stage.height - txt.textHeight) / 2;
        Laya.stage.addChild(txt);
    };
    /************************** */
    AgencyTrial.prototype.createInput = function () {
        var inputText = new Laya.Input();
        // 移动端输入提示符
        inputText.prompt = "Type some word...";
        //多行输入
        inputText.multiline = true;
        inputText.wordWrap = true;
        inputText.size(350, 100);
        inputText.x = Laya.stage.width - inputText.width >> 1;
        inputText.y = Laya.stage.height - inputText.height >> 1;
        inputText.padding = [2, 2, 2, 2];
        inputText.bgColor = "#666666";
        inputText.color = "#ffffff";
        inputText.fontSize = 20;
        Laya.stage.addChild(inputText);
    };
    AgencyTrial.key = "AgencyTrial";
    return AgencyTrial;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencyTrial = AgencyTrial;
},{"../Config/AssetPath":15,"../Control/GameStateControl":20,"../Control/ResourceControl":26,"../Control/SceneControl":27,"../View/EggPanel":60,"../View/TrialPanel":67,"../View/ViewManager":68,"../WXSDK/PlayerAccount":73,"./AgencyBaseControl":1,"./AgencyInGame":2}],8:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencyBaseControl_1 = require("./AgencyBaseControl");
var AgencyUserMessage = /** @class */ (function (_super) {
    __extends(AgencyUserMessage, _super);
    function AgencyUserMessage() {
        var _this = _super.call(this) || this;
        _this.roleisinit = false;
        return _this;
    }
    AgencyUserMessage.prototype.initSelf = function () {
    };
    /**加金币 */
    AgencyUserMessage.prototype.GoldUp = function (_num) {
        this.RoleData.Money += _num;
    };
    /**************************** */
    AgencyUserMessage.prototype.createInput = function () {
        var inputText = new Laya.Input();
        inputText.size(350, 100);
        inputText.x = Laya.stage.width - inputText.width >> 1;
        inputText.y = Laya.stage.height - inputText.height >> 1;
        inputText.text = "这段文本不可编辑，但可复制";
        inputText.editable = false;
        // 设置字体样式
        inputText.bold = true;
        inputText.bgColor = "#666666";
        inputText.color = "#ffffff";
        inputText.fontSize = 20;
        Laya.stage.addChild(inputText);
    };
    /******************************** */
    AgencyUserMessage.prototype.init = function () {
        this.RoleData.init();
        this.roleisinit = true;
    };
    /************************ */
    AgencyUserMessage.prototype.createText = function () {
        var txt = new Laya.Text();
        txt.text =
            "Layabox是HTML5引擎技术提供商与优秀的游戏发行商，面向AS/JS/TS开发者提供HTML5开发技术方案！\n" +
                "Layabox是HTML5引擎技术提供商与优秀的游戏发行商，面向AS/JS/TS开发者提供HTML5开发技术方案！\n" +
                "Layabox是HTML5引擎技术提供商与优秀的游戏发行商，面向AS/JS/TS开发者提供HTML5开发技术方案！";
        txt.borderColor = "#FFFF00";
        txt.size(300, 50);
        txt.fontSize = 20;
        txt.color = "#ffffff";
        Laya.stage.addChild(txt);
        return txt;
    };
    /**************************** */
    /**升级 */
    AgencyUserMessage.prototype.LevelUp = function () {
        this.RoleData.LevelUp();
    };
    AgencyUserMessage.key = "AgencyUserMessage";
    return AgencyUserMessage;
}(AgencyBaseControl_1.AgencyBaseControl));
exports.AgencyUserMessage = AgencyUserMessage;
},{"./AgencyBaseControl":1}],9:[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;
},{}],10:[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;
},{}],11:[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;
},{}],12:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//------------------------------------------------------------------------------
//工具生成，请勿修改。
//配置文件名称：lottery.xlsx。
//------------------------------------------------------------------------------
var LotteryCFG = /** @class */ (function () {
    function LotteryCFG() {
    }
    LotteryCFG.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 (LotteryCFG.dict[singleArr[0]])
                continue;
            var item = new LotteryCFG();
            item.id = Number(singleArr[0]);
            item.type = Number(singleArr[1]);
            item.value = singleArr[2];
            item.weight = Number(singleArr[3]);
            LotteryCFG.dict[item.id] = item;
            LotteryCFG.vec.push(item);
        }
    };
    LotteryCFG.dict = {};
    LotteryCFG.vec = [];
    return LotteryCFG;
}());
exports.default = LotteryCFG;
},{}],13:[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]);
            item.gravity = Number(singleArr[12]);
            NpcCFG.dict[item.id] = item;
            NpcCFG.vec.push(item);
        }
    };
    NpcCFG.dict = {};
    NpcCFG.vec = [];
    return NpcCFG;
}());
exports.default = NpcCFG;
},{}],14:[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];
            item.gravity = Number(singleArr[11]);
            item.rolename = singleArr[12];
            RoleCFG.dict[item.id] = item;
            RoleCFG.vec.push(item);
        }
    };
    RoleCFG.dict = {};
    RoleCFG.vec = [];
    return RoleCFG;
}());
exports.default = RoleCFG;
},{}],15:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("../Global");
/*
* name;
*/
var AssetPath = /** @class */ (function () {
    function AssetPath() {
    }
    AssetPath.init = function () {
        AssetPath.versionrandom = "?v=" + Math.random();
    };
    AssetPath.getsound = function (id) {
        return Global_1.Global.getUrl(AssetPath.resources + AssetPath.music + id + ".mp3");
    };
    AssetPath.getResConfig = function () {
        return Global_1.Global.getUrl(AssetPath.resources + "resConfig.json");
    };
    AssetPath.getConfig = function (configname) {
        return Global_1.Global.getUrl(AssetPath.resources + configname + ".bin");
    };
    AssetPath.get3Dscene = function (name) {
        return Global_1.Global.getUrl(AssetPath.res + AssetPath.prop + "Conventional/" + name + ".ls");
    };
    AssetPath.get3DModel = function (name) {
        return Global_1.Global.getUrl(AssetPath.res + AssetPath.prop + "Conventional/" + name + ".lh");
    };
    AssetPath.get3DRoleModel = function (name) {
        return Global_1.Global.getUrl(AssetPath.res + "character/Conventional/" + name + ".lh");
    };
    AssetPath.getroleicon = function (id) {
        return Global_1.Global.getUrl(AssetPath.res + "skinicon/" + id + ".png");
    };
    AssetPath.getVerisonurl = function () {
        if (Global_1.Global.isdebug) {
            return Global_1.Global.getUrl(AssetPath.res + "version.json") + AssetPath.versionrandom;
        }
        return Global_1.Global.getUrl(AssetPath.res + "version" + Global_1.Global.resconfigVersion + ".json");
    };
    AssetPath.getGameVersion = function () {
        return Global_1.Global.getUrl("gameversion.json");
    };
    /**获取匹配人物头像icon */
    AssetPath.pipeiicon = function (id) {
        return Global_1.Global.getUrl(AssetPath.res + "icon/" + id + ".png");
    };
    AssetPath.res = "res/";
    AssetPath.resources = "resources/";
    // export var configs:string = "configs/";
    AssetPath.ui = "ui/";
    AssetPath.subpacksgeui = "character/ui/";
    AssetPath.music = "music/";
    AssetPath.versionrandom = "";
    AssetPath.prop = "prop/";
    AssetPath.skinicon = "skinicon/";
    return AssetPath;
}());
exports.AssetPath = AssetPath;
},{"../Global":39}],16:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AssetPath_1 = require("./AssetPath");
var Global_1 = require("../Global");
/*
* name;
*/
var RecConfigs = /** @class */ (function (_super) {
    __extends(RecConfigs, _super);
    function RecConfigs() {
        var _this = _super.call(this) || this;
        RecConfigs.ins = _this;
        return _this;
    }
    Object.defineProperty(RecConfigs, "Instance", {
        get: function () {
            if (RecConfigs.ins == null) {
                return new RecConfigs();
            }
            return RecConfigs.ins;
        },
        enumerable: true,
        configurable: true
    });
    RecConfigs.prototype.init = function () {
        this.ResDic = {};
    };
    /****************************************************************** */
    RecConfigs.prototype.loadUI = function () {
        Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
            var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "正常模式"));
            changeActionButton.size(160, 40);
            changeActionButton.labelBold = true;
            changeActionButton.labelSize = 30;
            changeActionButton.sizeGrid = "4,4,4,4";
            changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
            changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
            changeActionButton.on(Laya.Event.CLICK, this, function () {
                if (++this.curStateIndex % 2 == 1) {
                    this.sprite3D.active = false;
                    this.lineSprite3D.active = true;
                    changeActionButton.label = "网格模式";
                }
                else {
                    this.sprite3D.active = true;
                    this.lineSprite3D.active = false;
                    changeActionButton.label = "正常模式";
                }
            });
        }));
    };
    /****************************************************************** */
    RecConfigs.prototype.initRec = function (_res) {
        if (_res != null && !RecConfigs.inited) {
            RecConfigs.inited = true;
            var groupsArr = _res.groups;
            var resourcesArr = _res.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/", AssetPath_1.AssetPath.res);
                        childArr.push({ url: Global_1.Global.getUrl(urls), type: resourcesDict[strChild].type });
                    }
                }
                this.ResDic[groupchild.name] = childArr;
            }
            Laya.loader.clearRes(AssetPath_1.AssetPath.getResConfig());
        }
    };
    /**
     * 是否已经初始化
     */
    RecConfigs.inited = false;
    return RecConfigs;
}(Laya.EventDispatcher));
exports.RecConfigs = RecConfigs;
},{"../Global":39,"./AssetPath":15}],17:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AssetPath_1 = require("../Config/AssetPath");
/*
* name;
*/
var AudioControl = /** @class */ (function (_super) {
    __extends(AudioControl, _super);
    function AudioControl() {
        var _this = _super.call(this) || this;
        _this._isbgOpen = true;
        _this.open = true;
        _this._isAllOpen = true;
        _this._nowBgName = "";
        _this._isPlaybging = false;
        /**
         * 声音开关引用索引
         */
        _this._soundIndex = 0;
        AudioControl.ins = _this;
        return _this;
    }
    Object.defineProperty(AudioControl, "Instance", {
        get: function () {
            if (AudioControl.ins == null) {
                return new AudioControl();
            }
            return AudioControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    AudioControl.prototype.init = function () {
        Laya.SoundManager.autoReleaseSound = false;
        Laya.SoundManager.autoStopMusic = true;
    };
    Object.defineProperty(AudioControl.prototype, "gamesoundOpen", {
        set: function (value) {
            this.open = value;
            Laya.SoundManager.soundMuted = !value;
            if (value == true) {
                fairygui.UIConfig.buttonSoundVolumeScale = 1;
            }
            else {
                fairygui.UIConfig.buttonSoundVolumeScale = 0;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AudioControl.prototype, "GetSoundSwitch", {
        /**
         * 音效是否开启
         */
        get: function () {
            return this.open;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AudioControl.prototype, "isbgOpen", {
        /**
         * 背景音乐是否开启
         */
        get: function () {
            return this._isbgOpen;
        },
        set: function (value) {
            this._isbgOpen = value;
            Laya.SoundManager.musicMuted = !value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AudioControl.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
    });
    /**
     * 停止播放音效
     */
    AudioControl.prototype.stopGameSound = function () {
        Laya.SoundManager.stopAllSound();
    };
    /**
     * 停止所有声音
     */
    AudioControl.prototype.ClearAllSOUND = function () {
        this.stopGameSound();
        this.stopbgSound();
    };
    /**
     * 播放背景音乐
     * @param soundName 声音名
     */
    AudioControl.prototype.playbgSound = function (soundName) {
        this._nowBgName = soundName;
        if (this._isAllOpen && this._nowBgName != "" && this._soundIndex <= 0 && !this._isPlaybging) {
            this._isPlaybging = true;
            Laya.SoundManager.playMusic(AssetPath_1.AssetPath.getsound(this._nowBgName));
            this.bgSoundVolume = 0.4;
        }
    };
    /**
     * 停止背景音乐
     */
    AudioControl.prototype.stopbgSound = function () {
        this._isPlaybging = false;
        Laya.SoundManager.stopMusic();
    };
    Object.defineProperty(AudioControl.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(AudioControl.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（最大音量）。
     */
    AudioControl.prototype.setGameVolume = function (value) {
        this.bgSoundVolume = value;
        this.soundVolume = value;
    };
    /**
     * 播放音效
     * @param soundName 音效名
     * @param loop 播放次数
     */
    AudioControl.prototype.playGameSound = function (soundName, loop) {
        if (loop === void 0) { loop = 1; }
        if (this._isAllOpen && soundName != "" && Laya.SoundManager.soundVolume != 0) {
            Laya.SoundManager.playSound(AssetPath_1.AssetPath.getsound(soundName), loop);
        }
    };
    return AudioControl;
}(Laya.EventDispatcher));
exports.AudioControl = AudioControl;
},{"../Config/AssetPath":15}],18:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ResourceControl_1 = require("./ResourceControl");
var SkinItem_1 = require("../utils/SkinItem");
var CpaDownsView_1 = require("../Push/CpaDownsView");
var CpaItem_1 = require("../Push/CpaItem");
var BaoKuanGameView_1 = require("../Push/BaoKuanGameView");
var ShiwantuijianView_1 = require("../Push/ShiwantuijianView");
/*
* name;
*/
var ConnectControl = /** @class */ (function (_super) {
    __extends(ConnectControl, _super);
    function ConnectControl() {
        var _this = _super.call(this) || this;
        /****************************************************** */
        _this.motionCross = false;
        _this.blendType = 0;
        _this.motionIndex = 0;
        _this.motions = ["run", "run_2", "attack", "attack_1", "attack_2", "dead", "idle_2", "idle_3", "idle_4", "idle4", "reload", "replace", "replace_2", "stop"];
        return _this;
    }
    /**
     * 组件绑定
     */
    ConnectControl.ConnectComponent = function () {
        //main
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2pwlk1a", SkinItem_1.SkinItem);
        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);
        fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2uotu6h", CpaItem_1.default);
        // fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2ip616l", GiftView);
        // fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2k8c52d", TuijianView);
        // fairygui.UIObjectFactory.setPackageItemExtension("ui://lecxynh2kalr6k",FriendInviteView);
    };
    ConnectControl.prototype.sceneLoaded = function (scene) {
        Laya.stage.addChild(scene);
        var animator = scene.getChildAt(2).getComponent(Laya.Animator);
        this.addButton(100, 100, 160, 30, "动画过渡:否", 20, function (e) {
            this.motionCross = !this.motionCross;
            if (this.motionCross)
                e.target.label = "动画过渡:是";
            else
                e.target.label = "动画过渡:否";
        });
        this.addButton(100, 160, 160, 30, "混合模式:全身", 20, function (e) {
            this.blendType++;
            (this.blendType === 3) && (this.blendType = 0);
            switch (this.blendType) {
                case 0:
                    e.target.label = "混合模式:全身";
                    break;
                case 1:
                    e.target.label = "混合模式:上身";
                    break;
                case 2:
                    e.target.label = "混合模式:下身";
                    break;
            }
        });
        this.addButton(100, 220, 260, 40, "切换动作:attack_2", 28, function (e) {
            switch (this.blendType) {
                case 0:
                    if (this.motionCross) {
                        animator.crossFade(this.motions[this.motionIndex], 0.2, 0);
                        animator.crossFade(this.motions[this.motionIndex], 0.2, 1);
                    }
                    else {
                        animator.play(this.motions[this.motionIndex], 0);
                        animator.play(this.motions[this.motionIndex], 1);
                    }
                    break;
                case 1:
                    if (this.motionCross)
                        animator.crossFade(this.motions[this.motionIndex], 0.2, 0);
                    else
                        animator.play(this.motions[this.motionIndex], 0);
                    break;
                case 2:
                    if (this.motionCross)
                        animator.crossFade(this.motions[this.motionIndex], 0.2, 1);
                    else
                        animator.play(this.motions[this.motionIndex], 1);
                    break;
            }
            e.target.label = "切换动作:" + this.motions[this.motionIndex];
            this.motionIndex++;
            (this.motionIndex === this.motions.length) && (this.motionIndex = 0);
        });
    };
    ConnectControl.prototype.addButton = function (x, y, width, height, text, size, clickFun) {
        var thiss = this;
        Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(null, function () {
            var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", text));
            changeActionButton.size(width, height);
            changeActionButton.labelBold = true;
            changeActionButton.labelSize = size;
            changeActionButton.sizeGrid = "4,4,4,4";
            changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
            changeActionButton.pos(x, y);
            changeActionButton.on(Laya.Event.CLICK, thiss, clickFun);
        }));
    };
    /****************************************************** */
    /**
     * 数据绑定
     */
    ConnectControl.Connnect = function () {
        this.ConnectFairygui();
        this.ConnectComponent();
    };
    /**
     * ui框架的绑定
     */
    ConnectControl.ConnectFairygui = function () {
        fairygui.UIConfig.gameLoaderManager = ResourceControl_1.ResourceControl.Instance;
        //特效绑定( url 绑定组名，只有公共特效需要绑定 ) "ui://fqpgxr1kl6mw0":"effect1"
        fairygui.UIConfig.gameEffectDict = {};
    };
    return ConnectControl;
}(Laya.EventDispatcher));
exports.ConnectControl = ConnectControl;
},{"../Push/BaoKuanGameView":48,"../Push/CpaDownsView":50,"../Push/CpaItem":52,"../Push/ShiwantuijianView":54,"../utils/SkinItem":90,"./ResourceControl":26}],19:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LocalDataControl_1 = require("./LocalDataControl");
var TimeUtils_1 = require("../Time/TimeUtils");
var UserDataInfo_1 = require("../Data/UserDataInfo");
var TimesTamper_1 = require("../Time/TimesTamper");
var DateControl = /** @class */ (function () {
    function DateControl() {
        DateControl.ins = this;
    }
    Object.defineProperty(DateControl, "Instance", {
        get: function () {
            if (DateControl.ins == null) {
                return new DateControl();
            }
            return DateControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    /************************************************************** */
    DateControl.prototype.loadUI = function () {
        Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
            var button = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "关闭HDR"));
            button.size(200, 40);
            button.labelBold = true;
            button.labelSize = 30;
            button.sizeGrid = "4,4,4,4";
            button.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
            button.pos(Laya.stage.width / 2 - button.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 60 * Laya.Browser.pixelRatio);
            button.on(Laya.Event.CLICK, this, function () {
                var enableHDR = this.camera.enableHDR;
                if (enableHDR)
                    button.label = "开启HDR";
                else
                    button.label = "关闭HDR";
                this.camera.enableHDR = !enableHDR;
            });
        }));
    };
    /************************************************ */
    DateControl.prototype.SetSelf = function () {
        var lastday = LocalDataControl_1.LocalDataControl.Instance.getstr(UserDataInfo_1.UserDataInfo.lastDay);
        var nowday = TimeUtils_1.TimeUtils.formatYearMonthDate1(TimesTamper_1.TimesTamper.Instance.serverTime);
        if (lastday != nowday) {
            LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.lastDay, nowday);
            DateControl.Fresh = true;
        }
        else {
            DateControl.Fresh = false;
        }
    };
    return DateControl;
}());
exports.DateControl = DateControl;
},{"../Data/UserDataInfo":33,"../Time/TimeUtils":56,"../Time/TimesTamper":58,"./LocalDataControl":22}],20:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var JoystickModule_1 = require("../JoystickModule");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
var SceneControl_1 = require("../Control/SceneControl");
var PropManager_1 = require("../PrefabControl/PropManager");
var TimerService_1 = require("../Time/TimerService");
var GameCFG_1 = require("../CFG/GameCFG");
var AudioControl_1 = require("../Control/AudioControl");
var Sdk_1 = require("../WXSDK/Sdk");
var PanelResDic_1 = require("../PrefabControl/PanelResDic");
var AgencyUserMessage_1 = require("../Agency/AgencyUserMessage");
var AgencyTrial_1 = require("../Agency/AgencyTrial");
var AgencySkin_1 = require("../Agency/AgencySkin");
var RecordManager_1 = require("../WXSDK/RecordManager");
var GameStateControl = /** @class */ (function () {
    function GameStateControl() {
        /**
         * 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;
        GameStateControl.ins = this;
    }
    Object.defineProperty(GameStateControl, "Instance", {
        get: function () {
            if (GameStateControl.ins == null) {
                return new GameStateControl();
            }
            return GameStateControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    GameStateControl.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();
    };
    GameStateControl.prototype.initEvent = function () {
        DispatcherManager_1.DispatcherManager.addEventListener(GameState_1.GameState.lose, this, this.endGame);
        DispatcherManager_1.DispatcherManager.addEventListener(GameState_1.GameState.end, this, this.endGame);
        DispatcherManager_1.DispatcherManager.addEventListener(GameState_1.GameState.npcend, this, this.npcendGameHandler);
    };
    GameStateControl.prototype.npcendGameHandler = function (str) {
        this.endGamePlayerArr.push(str);
    };
    GameStateControl.prototype.setClickPanel = function (panel) {
        this._joystickModule = new JoystickModule_1.JoystickModule(panel);
        this._joystickModule.setEventCallback(this, this.ondownfun, this.onmovefun, this.onupfun);
    };
    GameStateControl.prototype.ondownfun = function () {
        this._lastAngle = 0;
        this._nowTime = Laya.Browser.now() / 1000;
    };
    GameStateControl.prototype.onmovefun = function (offsetX) {
        if (this.nowGameState == 1) {
            var disAngle = this._joystickModule.angle - this._lastAngle;
            this._lastAngle = this._joystickModule.angle;
            if (PropManager_1.PropManager.iscarmanpc) {
                PropManager_1.PropManager.npcscriptDict["npc_0"].Joy(offsetX > 0 ? this._huadongSpeedX : -this._huadongSpeedX, disAngle * this._zhuanxiangbeishu);
            }
            else {
                SceneControl_1.SceneControl.Instance.PlayerScript.Joy(offsetX > 0 ? this._huadongSpeedX : -this._huadongSpeedX, offsetX > 0 ? this._huadongClimbSpeedX : -this._huadongClimbSpeedX, disAngle * this._zhuanxiangbeishu);
            }
        }
    };
    GameStateControl.prototype.onupfun = function () {
        if (PropManager_1.PropManager.iscarmanpc) {
            PropManager_1.PropManager.npcscriptDict["npc_0"].Joy(0, 0);
        }
        else {
            if (this.nowGameState == 1) {
                SceneControl_1.SceneControl.Instance.PlayerScript.Joy(0, 0, 0);
            }
        }
    };
    GameStateControl.prototype.update = function (dt) {
        if (this.nowGameState == 1) {
            this._time = 0;
            var npcdict = PropManager_1.PropManager.npcscriptDict;
            this._nums = 0;
            this._all = 0;
            var s;
            var npcsp;
            for (s in npcdict) {
                npcsp = npcdict[s];
                if (npcsp.getAction() == 1) {
                    if (PropManager_1.PropManager.mainRole.transform.position.z < npcsp.getPostion().z) {
                        this._nums++;
                    }
                    this._all++;
                }
            }
            this.nowMingCi = this.endGamePlayerArr.length + ((this._all + 1) - this._nums);
            PropManager_1.PropManager.txt_mingci.text = "第" + this.nowMingCi + "名";
        }
    };
    GameStateControl.prototype.startGame = function () {
        var RoleData = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage).RoleData;
        var agencyskin = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencySkin_1.AgencySkin);
        var nohasskinArr = agencyskin.GainNoHaveSkin();
        if (nohasskinArr.length == 0) {
            this.entergame();
        }
        else {
            PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyTrial_1.AgencyTrial).openview(nohasskinArr);
        }
    };
    GameStateControl.prototype.entergame = function (jiasu) {
        RecordManager_1.RecordManager.Instance.RecordStart();
        this.nowMingCi = 0;
        this.endGamePlayerArr.length = 0;
        this.nowGameState = 1;
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
        this.update(500);
        if (jiasu) {
            DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.start, jiasu);
        }
        else {
            DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.start);
        }
        AudioControl_1.AudioControl.Instance.playbgSound("bgm");
        Sdk_1.WxApi.recordAldEvent("主界面点击开始游戏...");
    };
    GameStateControl.prototype.stopGame = function () {
        this.nowGameState = 2;
        this.onupfun();
    };
    GameStateControl.prototype.endGame = function () {
        if (PropManager_1.PropManager.jiantouArr && PropManager_1.PropManager.jiantouArr.length > 0) {
            var arr = PropManager_1.PropManager.jiantouArr;
            for (var i = arr.length - 1; i >= 0; i--) {
                arr[i].destroy();
                arr.splice(i, 1);
            }
        }
        PropManager_1.PropManager.jiantouArr.length = 0;
        this.nowGameState = 0;
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        var npcdict = PropManager_1.PropManager.npcscriptDict;
        if (npcdict) {
            for (var s in npcdict) {
                npcdict[s].stop();
            }
        }
        this.onupfun();
        AudioControl_1.AudioControl.Instance.stopbgSound();
    };
    return GameStateControl;
}());
exports.GameStateControl = GameStateControl;
},{"../Agency/AgencySkin":6,"../Agency/AgencyTrial":7,"../Agency/AgencyUserMessage":8,"../CFG/GameCFG":10,"../Control/AudioControl":17,"../Control/SceneControl":27,"../JoystickModule":41,"../PrefabControl/PanelResDic":46,"../PrefabControl/PropManager":47,"../Time/TimerService":57,"../WXSDK/RecordManager":74,"../WXSDK/Sdk":75,"../utils/DispatcherManager":83,"../utils/GameState":84}],21:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("../Global");
var LayOUT_1 = require("../utils/LayOUT");
/*
* name;
*/
var LayoutControl = /** @class */ (function (_super) {
    __extends(LayoutControl, _super);
    function LayoutControl() {
        var _this = _super.call(this) || this;
        _this._uilayerZorder = 0;
        _this._upuilayerZorder = 200;
        _this._tipslayerZorder = 1000;
        _this._guidelayerZorder = 600;
        /**
         * ui层
         */
        _this.uiLayer = new fairygui.GComponent();
        /**
         * 最定层
         */
        _this.topLayer = new fairygui.GComponent();
        /**
         * 背景层( 或者3D场景层 )
         */
        _this.background = new fairygui.GComponent();
        _this._position = new Laya.Vector3();
        _this._outPos = new Laya.Vector3();
        _this.scaleDelta = 0;
        LayoutControl.ins = _this;
        return _this;
    }
    Object.defineProperty(LayoutControl, "Instance", {
        get: function () {
            if (LayoutControl.ins == null) {
                return new LayoutControl();
            }
            return LayoutControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    LayoutControl.prototype.AddLayerByName = function (itemview, layer) {
        if (layer == LayOUT_1.LayOUT.BG) {
            LayoutControl.Instance.background.addChild(itemview);
        }
        else if (layer == LayOUT_1.LayOUT.UI) {
            this._uilayerZorder++;
            LayoutControl.Instance.uiLayer.addChild(itemview);
            itemview.sortingOrder = this._uilayerZorder;
        }
        else if (layer == LayOUT_1.LayOUT.UITop) {
            this._upuilayerZorder++;
            LayoutControl.Instance.uiLayer.addChild(itemview);
            itemview.sortingOrder = this._upuilayerZorder;
        }
        else if (layer == LayOUT_1.LayOUT.TIP) {
            // GameLayerManager.Instance.tipsLayer.addChild(itemview);
            this._tipslayerZorder++;
            LayoutControl.Instance.uiLayer.addChild(itemview);
            itemview.sortingOrder = this._tipslayerZorder;
        }
        else if (layer == LayOUT_1.LayOUT.GUIDE) {
            this._guidelayerZorder++;
            LayoutControl.Instance.uiLayer.addChild(itemview);
            itemview.sortingOrder = this._guidelayerZorder;
        }
    };
    //初始化层级
    LayoutControl.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);
    };
    LayoutControl.prototype.addHorizontalBox = function (x, y, z) {
        var box = this.scene.addChild(new Laya.MeshSprite3D(this.mesh2));
        box.meshRenderer.material = this.mat1;
        box.meshRenderer.castShadow = true;
        box.meshRenderer.receiveShadow = true;
        this.tmpVector.setValue(x, y, z);
        box.transform.position = this.tmpVector;
        var rigidBody = box.addComponent(Laya.Rigidbody3D);
        rigidBody.mass = 10;
        rigidBody.friction = 1.0;
        rigidBody.restitution = 0.2;
        var boxShape = new Laya.BoxColliderShape(2, 0.33, 0.5);
        rigidBody.colliderShape = boxShape;
    };
    /************************************************ */
    LayoutControl.prototype.ClearLayerByName = function (layer) {
        switch (layer) {
            case LayOUT_1.LayOUT.UI:
                this._uilayerZorder--;
                if (this._uilayerZorder < 0) {
                    this._uilayerZorder = 0;
                }
                break;
            case LayOUT_1.LayOUT.UITop:
                this._upuilayerZorder--;
                if (this._upuilayerZorder < 200) {
                    this._upuilayerZorder = 200;
                }
                break;
            case LayOUT_1.LayOUT.TIP:
                this._tipslayerZorder--;
                if (this._tipslayerZorder < 1000) {
                    this._tipslayerZorder = 1000;
                }
                break;
            case LayOUT_1.LayOUT.GUIDE:
                this._tipslayerZorder--;
                if (this._tipslayerZorder < 600) {
                    this._tipslayerZorder = 600;
                }
                break;
        }
    };
    LayoutControl.prototype.onComplete = function () {
        //加载三维地面
        var grid = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/staticModel/grid/plane.lh"));
        //加载二维猴子
        this.layaMonkey2D = Laya.stage.addChild(new Laya.Image("res/threeDimen/monkey.png"));
        //开启定时器循环
        Laya.timer.frameLoop(1, this, this.animate);
    };
    LayoutControl.prototype.animate = function () {
        //变换位置
        this._position.x = Math.sin(this.scaleDelta += 0.01);
        //计算位置
        this.camera.viewport.project(this._position, this.camera.projectionViewMatrix, this._outPos);
        this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY);
    };
    return LayoutControl;
}(Laya.EventDispatcher));
exports.LayoutControl = LayoutControl;
},{"../Global":39,"../utils/LayOUT":88}],22:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("../Global");
var PlatfromType_1 = require("../WXSDK/PlatfromType");
/*
* 本地数据缓存管理器
*/
var LocalDataControl = /** @class */ (function (_super) {
    __extends(LocalDataControl, _super);
    function LocalDataControl() {
        var _this = _super.call(this) || this;
        LocalDataControl.ins = _this;
        return _this;
    }
    Object.defineProperty(LocalDataControl, "Instance", {
        get: function () {
            if (LocalDataControl.ins == null) {
                return new LocalDataControl();
            }
            return LocalDataControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    LocalDataControl.prototype.init = function () {
    };
    /**
     * 添加本地缓存数据 object
     * @param key
     * @param value
     */
    LocalDataControl.prototype.AddData = function (key, value) {
        this.AddLocalData(key, value);
    };
    /**
     * 获取本地缓存数据 object
     * @param key
     */
    LocalDataControl.prototype.getObj = function (key) {
        return this.GetLocalCaCheData(key);
    };
    /**
     * 添加本地缓存数据 string
     * @param key
     * @param value
     */
    LocalDataControl.prototype.addstr = function (key, value) {
        this.addCacheStr(key, value);
    };
    LocalDataControl.prototype.addnum = function (key, value) {
        this.addCacheStr(key, value.toString());
    };
    /**
     * 获取本地缓存数据 string
     * @param key
     */
    LocalDataControl.prototype.getstr = function (key) {
        return this.getCachestr(key);
    };
    /**
     * 获取本地缓存数据 number
     * @param key
     */
    LocalDataControl.prototype.getnum = function (key) {
        return Number(this.getCachestr(key));
    };
    /**
     * 清理指定本地缓存数据
     * @param key
     */
    LocalDataControl.prototype.removeCache = function (key) {
        this.removeselectCache(key);
    };
    /**
     * 清理所有本地缓存数据
     */
    LocalDataControl.prototype.clearAll = function () {
        this.clearAllCache();
    };
    LocalDataControl.prototype.AddLocalData = function (key, value) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                this.setStorageSyncWX(key, value);
                break;
            default:
                Laya.LocalStorage.setJSON(key, value);
                break;
        }
    };
    LocalDataControl.prototype.GetLocalCaCheData = function (key) {
        var obj;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                obj = this.getStorageSyncWX(key);
                break;
            default:
                obj = Laya.LocalStorage.getJSON(key);
                break;
        }
        if (!obj) {
            obj = {};
        }
        return obj;
    };
    LocalDataControl.prototype.addCacheStr = function (key, value) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                this.setStorageSyncWX(key, value);
                break;
            default:
                Laya.LocalStorage.setItem(key, value);
                break;
        }
    };
    LocalDataControl.prototype.getCachestr = function (key) {
        var str = "0";
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                str = this.getStorageSyncWX(key);
                break;
            default:
                str = Laya.LocalStorage.getItem(key);
                break;
        }
        if (str == null || str == "") {
            str = "0";
        }
        return str;
    };
    LocalDataControl.prototype.removeselectCache = function (key) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                this.removeStorageWX(key);
                break;
            default:
                Laya.LocalStorage.removeItem(key);
                break;
        }
    };
    LocalDataControl.prototype.clearAllCache = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                this.clearStorageWX();
                break;
            default:
                Laya.LocalStorage.clear();
                break;
        }
    };
    /**
     * 本地存储
     * @param key
     * @param data
     */
    LocalDataControl.prototype.setStorageSyncWX = function (key, data) {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            wx.setStorageSync(key, data);
        }
    };
    /**
     * 获取本地存储
     * @param key
     */
    LocalDataControl.prototype.getStorageSyncWX = function (key) {
        var wx = Laya.Browser.window.wx;
        if (wx) {
            return wx.getStorageSync(key);
        }
        return null;
    };
    /**
     * 从本地缓存中移除指定 key
     * @param key
     */
    LocalDataControl.prototype.removeStorageWX = function (key) {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.removeStorage(key);
        }
    };
    /**
     * 清理存储数据
     */
    LocalDataControl.prototype.clearStorageWX = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.clearStorageSync();
        }
    };
    return LocalDataControl;
}(Laya.EventDispatcher));
exports.LocalDataControl = LocalDataControl;
},{"../Global":39,"../WXSDK/PlatfromType":72}],23:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ResDataControl_1 = require("../Control/ResDataControl");
var ResourceControl_1 = require("../Control/ResourceControl");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var PanelResDic_1 = require("../PrefabControl/PanelResDic");
var ViewAction_1 = require("../utils/ViewAction");
var ViewManager_1 = require("../View/ViewManager");
var ComponentEventData_1 = require("../Data/ComponentEventData");
var GamePool_1 = require("../PrefabControl/GamePool");
/*
* name;
*/
var PanelBaseControl = /** @class */ (function (_super) {
    __extends(PanelBaseControl, _super);
    /**
     * 界面初始化
     * @param pkgName 包名
     * @param resName 界面名
     * @param isAddpackage 是否添加包
     * @param ActionType 界面打开动画类型
     * @param clickBgIsColse 黑色背景 0:无背景 1:背景无关闭事件 2:背景有关闭事件
     * @param iscache 是否添加到缓存池（如是为true,则加入进缓存池定时根据是否引用清理。 若是为false，则不清理当前缓存，如若清理，请手动清理 ）
     */
    function PanelBaseControl(pkgName, resName, isAddpackage, ActionType, clickBgIsColse, iscache) {
        if (pkgName === void 0) { pkgName = ""; }
        if (resName === void 0) { resName = ""; }
        if (isAddpackage === void 0) { isAddpackage = false; }
        if (ActionType === void 0) { ActionType = ViewAction_1.ViewAction.ActionType_none; }
        if (clickBgIsColse === void 0) { clickBgIsColse = 0; }
        if (iscache === void 0) { iscache = true; }
        var _this = _super.call(this) || this;
        _this.isguideing = false;
        _this.PackageName = "";
        _this.ResourcesName = "";
        _this._iscache = true;
        _this._ActionType = ViewAction_1.ViewAction.ActionType_none;
        _this._clickBgIsColse = 0;
        /**
         * 事件容器
         */
        _this.EventResDic = {};
        /**
         * 全局事件容器
         */
        _this.EventGlobal = {};
        _this._iscache = iscache;
        _this.PackageName = pkgName;
        _this.ResourcesName = resName;
        _this._isAddpackage = isAddpackage;
        _this._ActionType = ActionType;
        _this._clickBgIsColse = clickBgIsColse;
        _this.showModalWait();
        return _this;
    }
    PanelBaseControl.prototype.ResolveUI = function (pkgname, resname, isaddpackage, ActionType, clickBgIsColse, iscache) {
        if (ActionType === void 0) { ActionType = ViewAction_1.ViewAction.ActionType_none; }
        if (clickBgIsColse === void 0) { clickBgIsColse = 0; }
        if (iscache === void 0) { iscache = true; }
        this.PackageName = pkgname;
        this.ResourcesName = resname;
        this._ActionType = ActionType;
        this._clickBgIsColse = clickBgIsColse;
        ResDataControl_1.ResDataControl.Instance.AddViewPackByName(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.ShowViewACTION();
    };
    /**
     * 加载ui
     * @param groupName 组名
     * @param target    作用域
     * @param onLoadedHandler 加载完成回调函数
     */
    PanelBaseControl.prototype.LoadViewUI = function (groupName, target, onLoadedHandler) {
        this._loadTarget = target;
        this._onLoadedHandler = onLoadedHandler;
        ResourceControl_1.ResourceControl.Instance.loadGroup(groupName, this, this.LoadComplete);
    };
    /******************************************************************* */
    PanelBaseControl.prototype.createLabel = function (color, strokeColor) {
        var STROKE_WIDTH = 4;
        var label = new Laya.Label();
        label.font = "Microsoft YaHei";
        label.text = "SAMPLE DEMO";
        label.fontSize = 30;
        label.color = color;
        if (strokeColor) {
            label.stroke = STROKE_WIDTH;
            label.strokeColor = strokeColor;
        }
        Laya.stage.addChild(label);
        return label;
    };
    /****************************************************************** */
    /**
     * 加载资源数组
     * @param urls 资源数组
     * @param target 作用域
     * @param onLoadedHandler 加载完成回调函数
     */
    PanelBaseControl.prototype.loadUibyArr = function (urls, target, onLoadedHandler) {
        // this.showModalWait();
        this._loadTarget = target;
        this._onLoadedHandler = onLoadedHandler;
        ResourceControl_1.ResourceControl.Instance.Loaders(urls, this, this.LoadComplete);
    };
    /********************************************************************* */
    PanelBaseControl.prototype.createRadioGroup = function (skin) {
        var rg = new Laya.RadioGroup();
        rg.skin = skin;
        rg.space = 70;
        rg.direction = "v";
        rg.labels = "Item1, Item2, Item3";
        rg.labelColors = "#787878,#d3d3d3,#FFFFFF";
        rg.labelSize = 20;
        rg.labelBold = true;
        rg.labelPadding = "5,0,0,5";
        rg.selectHandler = new Laya.Handler(this, this.onSelectChange);
        Laya.stage.addChild(rg);
        return rg;
    };
    PanelBaseControl.prototype.onSelectChange = function (index) {
        console.log("你选择了第 " + (index + 1) + " 项");
    };
    /********************************************************************* */
    PanelBaseControl.prototype.LoadComplete = function () {
        if (this._loadTarget && this._onLoadedHandler) {
            this._onLoadedHandler.call(this._loadTarget);
        }
    };
    PanelBaseControl.prototype.removeEffectPackage = function (packageName) {
        ResDataControl_1.ResDataControl.Instance.ClearPackByName(packageName, true);
    };
    PanelBaseControl.prototype.getpanelController = function (name) {
        if (this.item_panel) {
            return this.item_panel.getController(name);
        }
        return null;
    };
    /************************************************************ */
    PanelBaseControl.prototype.setup = function () {
        this.createLabel("#FFFFFF", null).pos(30, 50);
        this.createLabel("#00FFFF", null).pos(290, 50);
        this.createLabel("#FFFF00", "#FFFFFF").pos(30, 100);
        this.createLabel("#000000", "#FFFFFF").pos(290, 100);
        this.createLabel("#FFFFFF", "#00FFFF").pos(30, 150);
        this.createLabel("#0080FF", "#00FFFF").pos(290, 150);
    };
    /************************************************************ */
    PanelBaseControl.prototype.getpanelTransition = function (name) {
        if (this.item_panel) {
            return this.item_panel.getTransition(name);
        }
        return null;
    };
    PanelBaseControl.prototype.getChildformContentPanel = function (name) {
        if (this.contentPane) {
            return this.contentPane.getChild(name);
        }
        return null;
    };
    /*界面初始化*/
    PanelBaseControl.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
        if (this.PackageName != "" && this.ResourcesName != "") {
            this.ResolveUI(this.PackageName, this.ResourcesName, this._isAddpackage, this._ActionType, this._clickBgIsColse, this._iscache);
        }
    };
    //解析ui
    PanelBaseControl.prototype.initView = function () {
    };
    PanelBaseControl.prototype.initEvent = function () {
    };
    PanelBaseControl.prototype.ShowViewACTION = function () {
        switch (this._ActionType) {
            case ViewAction_1.ViewAction.ActionType_none:
                this.windowanmoend();
                break;
            case ViewAction_1.ViewAction.ActionType_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 ViewAction_1.ViewAction.ActionType_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 ViewAction_1.ViewAction.ActionType_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;
        }
    };
    /******************************************************** */
    PanelBaseControl.prototype.createCheckBox = function (skin) {
        var cb = new Laya.CheckBox(skin);
        Laya.stage.addChild(cb);
        cb.labelColors = "white";
        cb.labelSize = 20;
        cb.labelFont = "Microsoft YaHei";
        cb.labelPadding = "3,0,0,5";
        return cb;
    };
    PanelBaseControl.prototype.updateLabel = function (checkBox) {
        checkBox.label = checkBox.selected ? "已选中" : "未选中";
    };
    /******************************************************** */
    PanelBaseControl.prototype.windowanmoend = function () {
        Laya.timer.callLater(this, this.onShowView);
    };
    PanelBaseControl.prototype.onShowView = function () {
        this.closeModalWait();
        this.showClickBg();
    };
    PanelBaseControl.prototype.showClickBg = function () {
        if (this._clickBg) {
            this._clickBg.alpha = 0.55;
            if (this._clickBgIsColse == 2 && !this.hasClickListener()) {
                this._clickBg.onClick(this, this.ClickExitView);
            }
        }
    };
    /**点击关闭页面按钮 */
    PanelBaseControl.prototype.ClickExitView = function () {
        ViewManager_1.ViewManager.Instance.close(this.viewKey, true);
    };
    /*获取管理数据模块*/
    PanelBaseControl.prototype.getProxy = function (d) {
        return PanelResDic_1.PanelResDic.Instance.getSingleTon(d);
    };
    /**
     * 界面关闭事件
     */
    PanelBaseControl.prototype.ExitView = function (ActionType) {
        if (ActionType === void 0) { ActionType = ""; }
        if (this._clickBg) {
            this._clickBg.visible = false;
        }
        if (ActionType == "") {
            switch (this._ActionType) {
                case ViewAction_1.ViewAction.ActionType_none:
                    this.destory();
                    break;
                case ViewAction_1.ViewAction.ActionType_addmoveToMiddle:
                    Laya.Tween.to(this, { x: fairygui.GRoot.inst.width }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
                case ViewAction_1.ViewAction.ActionType_addmoveFromBottom:
                    Laya.Tween.to(this, { y: fairygui.GRoot.inst.height }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
                case ViewAction_1.ViewAction.ActionType_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 (ActionType) {
                case ViewAction_1.ViewAction.ActionType_none:
                    this.destory();
                    break;
                case ViewAction_1.ViewAction.ActionType_removescaleMaxToMin:
                    Laya.Tween.to(this, { scaleX: 0.01, scaleY: 0.01 }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
                case ViewAction_1.ViewAction.ActionType_removemoveToRight:
                    Laya.Tween.to(this, { x: fairygui.GRoot.inst.width }, 300, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.destory));
                    break;
            }
        }
    };
    PanelBaseControl.prototype.getTransitionByName = function (id) {
        return this.contentPane.getTransition(id);
    };
    /**注册事件 */
    PanelBaseControl.prototype.dispacheDatatrigger = function (type, data) {
        if (data === void 0) { data = null; }
        DispatcherManager_1.DispatcherManager.dispatchEvent(type, data);
    };
    /**
     * 注册全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    PanelBaseControl.prototype.addDataEvent = function (type, thisObject, listener) {
        if (!this.EventGlobal.hasOwnProperty(type)) {
            var vo = GamePool_1.GamePool.GetItem(ComponentEventData_1.ComponentEventData.ResDicValue);
            this.EventGlobal[type] = vo;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            DispatcherManager_1.DispatcherManager.addEventListener(type, thisObject, listener);
        }
    };
    /**
     * 移除全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    PanelBaseControl.prototype.ClearEventData = function (type, thisObject, listener) {
        if (this.EventGlobal[type]) {
            var vo = this.EventGlobal[type];
            DispatcherManager_1.DispatcherManager.removeEventListener(type, thisObject, listener);
            vo.clear();
            delete this.EventGlobal[type];
        }
    };
    /**
     * 移除组件事件
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    PanelBaseControl.prototype.ClearEventByType = function (target, type, thisObject, listener) {
        if (target && this.EventResDic[target.name]) {
            var arr = this.EventResDic[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;
                }
            }
        }
    };
    /**
     * 注册组件事件，调用此方法，界面关闭会自动移除
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    PanelBaseControl.prototype.AddEventByType = 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 = GamePool_1.GamePool.GetItem(ComponentEventData_1.ComponentEventData.ResDicValue);
            vo.target = target;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            if (!this.EventResDic.hasOwnProperty(target.name)) {
                this.EventResDic[target.name] = [];
            }
            var bo = this.JudgeIsHaveEvent(target, type);
            if (!bo) {
                target.on(type, thisObject, listener, args);
                this.EventResDic[target.name].push(vo);
            }
        }
    };
    /**判断是否含有事件 */
    PanelBaseControl.prototype.JudgeIsHaveEvent = function (target, type) {
        var eventArr;
        eventArr = this.EventResDic[target.name];
        var childvo;
        for (var s in eventArr) {
            childvo = eventArr[s];
            if (childvo && childvo.type == type) {
                return true;
            }
        }
        return false;
    };
    PanelBaseControl.prototype.getComById = function (id) {
        return this.contentPane.getChild(id).asCom;
    };
    PanelBaseControl.prototype.getControllerByBame = function (id) {
        return this.contentPane.getController(id);
    };
    /**
     * 移除所有组件事件
     */
    PanelBaseControl.prototype.ClearEvent = function () {
        if (this.EventResDic) {
            var s;
            var dict = this.EventResDic;
            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.EventResDic[s];
            }
        }
        this.EventResDic = {};
    };
    PanelBaseControl.prototype.clearEvent = function () {
    };
    /* 销毁*/
    PanelBaseControl.prototype.destory = function () {
        this.clearEvent();
        this.closeModalWait();
        this.ClearGlobalEvent();
        this.ClearEvent();
        this._loadTarget = null;
        this._onLoadedHandler = null;
        Laya.Tween.clearTween(this);
        ResDataControl_1.ResDataControl.Instance.ClearPackByName(this.PackageName, false);
        this.PackageName = null;
        this.ResourcesName = null;
        if (this._clickBg) {
            this._clickBg.offClick(this, this.ClickExitView);
            this._clickBg.dispose();
            this._clickBg = null;
        }
        this.viewKey = null;
        this.dispose();
    };
    PanelBaseControl.prototype.setclickBgIsColse = function () {
        if (this.isShowing && this._clickBgIsColse > 0 && this.contentPane) {
            if (!this._clickBg && PanelBaseControl.viewbgUrl != "") {
                this._clickBg = new fairygui.GLoader();
                this._clickBg.touchable = true;
                this._clickBg.setSize(fairygui.GRoot.inst.width, fairygui.GRoot.inst.height);
                this._clickBg.url = PanelBaseControl.viewbgUrl;
                this._clickBg.fill = fairygui.LoaderFillType.ScaleFree;
                this._clickBg.alpha = 0;
                this.contentPane.addChildAt(this._clickBg, 0);
            }
        }
    };
    /**
     * 移除所有全局事件
     */
    PanelBaseControl.prototype.ClearGlobalEvent = function () {
        if (this.EventGlobal) {
            var s;
            var dict = this.EventGlobal;
            for (s in dict) {
                var vo = dict[s];
                if (vo) {
                    this.ClearEventData(vo.type, vo.thisObject, vo.listener);
                }
            }
        }
        this.EventGlobal = {};
    };
    PanelBaseControl.viewbgUrl = "";
    return PanelBaseControl;
}(fairygui.Window));
exports.PanelBaseControl = PanelBaseControl;
},{"../Control/ResDataControl":25,"../Control/ResourceControl":26,"../Data/ComponentEventData":28,"../PrefabControl/GamePool":45,"../PrefabControl/PanelResDic":46,"../View/ViewManager":68,"../utils/DispatcherManager":83,"../utils/ViewAction":91}],24:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DispatcherManager_1 = require("../utils/DispatcherManager");
var PanelResDic_1 = require("../PrefabControl/PanelResDic");
var ComponentEventData_1 = require("../Data/ComponentEventData");
var GamePool_1 = require("../PrefabControl/GamePool");
var PanelChildControl = /** @class */ (function (_super) {
    __extends(PanelChildControl, _super);
    function PanelChildControl() {
        var _this = _super.call(this) || this;
        /**
         * 事件容器
         */
        _this.EventResDic = {};
        /**
         * 全局事件容器
         */
        _this.EventGlobal = {};
        /******************************************** */
        _this.DIALOG_WIDTH = 220;
        _this.DIALOG_HEIGHT = 275;
        _this.CLOSE_BTN_WIDTH = 43;
        _this.CLOSE_BTN_PADDING = 5;
        return _this;
    }
    /**
     * 移除所有组件事件
     */
    PanelChildControl.prototype.ClearEvent = function () {
        if (this.EventResDic) {
            var s;
            var dict = this.EventResDic;
            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.EventResDic[s];
            }
        }
        this.EventResDic = {};
    };
    PanelChildControl.prototype.dispose = function () {
        this.ClearGlobalEvent();
        this.ClearEvent();
        _super.prototype.dispose.call(this);
    };
    PanelChildControl.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();
    };
    PanelChildControl.prototype.onInit = function () {
    };
    /*获取管理数据模块*/
    PanelChildControl.prototype.getProxy = function (d) {
        return PanelResDic_1.PanelResDic.Instance.getSingleTon(d);
    };
    PanelChildControl.prototype.dispacheDatatrigger = function (type, data) {
        if (data === void 0) { data = null; }
        DispatcherManager_1.DispatcherManager.dispatchEvent(type, data);
    };
    PanelChildControl.prototype.hasDataEvent = function (type) {
        return DispatcherManager_1.DispatcherManager.hasEventListener(type);
    };
    /**
     * 注册全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    PanelChildControl.prototype.AddEventData = function (type, thisObject, listener) {
        if (!this.EventGlobal.hasOwnProperty(type)) {
            var vo = GamePool_1.GamePool.GetItem(ComponentEventData_1.ComponentEventData.ResDicValue);
            this.EventGlobal[type] = vo;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            DispatcherManager_1.DispatcherManager.addEventListener(type, thisObject, listener);
        }
    };
    PanelChildControl.prototype.onSkinLoadComplete = function () {
        var dialog = new Laya.Dialog();
        var bg = new Laya.Image(this.assets[0]);
        dialog.addChild(bg);
        var button = new Laya.Button(this.assets[1]);
        // button.name = Dialog.CLOSE;
        button.pos(this.DIALOG_WIDTH - this.CLOSE_BTN_WIDTH - this.CLOSE_BTN_PADDING, this.CLOSE_BTN_PADDING);
        dialog.addChild(button);
        dialog.dragArea = "0,0," + this.DIALOG_WIDTH + "," + this.DIALOG_HEIGHT;
        dialog.show();
    };
    /******************************************** */
    /**
     * 移除全局事件
     * @param type
     * @param thisObject
     * @param listener
     */
    PanelChildControl.prototype.removeDataEvent = function (type, thisObject, listener) {
        if (this.EventGlobal[type]) {
            var vo = this.EventGlobal[type];
            DispatcherManager_1.DispatcherManager.removeEventListener(type, thisObject, listener);
            vo.clear();
            delete this.EventGlobal[type];
        }
    };
    /**
     * 注册组件事件，调用此方法，界面关闭会自动移除
     * @param type 时间类型
     * @param callbackobj 作用域
     * @param callbackHandler 事件回调
     */
    PanelChildControl.prototype.AddEventByType = 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 = GamePool_1.GamePool.GetItem(ComponentEventData_1.ComponentEventData.ResDicValue);
            vo.target = target;
            vo.type = type;
            vo.thisObject = thisObject;
            vo.listener = listener;
            if (!this.EventResDic.hasOwnProperty(target.name)) {
                this.EventResDic[target.name] = [];
            }
            var bo = this.JudgeIsHaveEvent(target, type);
            if (!bo) {
                target.on(type, thisObject, listener, args);
                this.EventResDic[target.name].push(vo);
            }
        }
    };
    PanelChildControl.prototype.JudgeIsHaveEvent = function (target, type) {
        var eventArr;
        eventArr = this.EventResDic[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 事件回调
     */
    PanelChildControl.prototype.ClearEventByType = function (target, type, thisObject, listener) {
        if (target && this.EventResDic[target.name]) {
            var arr = this.EventResDic[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;
                }
            }
        }
    };
    /**
     * 移除所有全局事件
     */
    PanelChildControl.prototype.ClearGlobalEvent = function () {
        if (this.EventGlobal) {
            var s;
            var dict = this.EventGlobal;
            for (s in dict) {
                var vo = dict[s];
                if (vo) {
                    this.removeDataEvent(vo.type, vo.thisObject, vo.listener);
                }
            }
        }
        this.EventGlobal = {};
    };
    /***************************************************** */
    PanelChildControl.prototype.placeHScroller = function () {
        var hs = new Laya.HScrollBar();
        hs.skin = "res/ui/hscroll.png";
        hs.width = 300;
        hs.pos(50, 170);
        hs.min = 0;
        hs.max = 100;
        hs.changeHandler = new Laya.Handler(this, this.onChange);
        Laya.stage.addChild(hs);
    };
    PanelChildControl.prototype.placeVScroller = function () {
        var vs = new Laya.VScrollBar();
        vs.skin = "res/ui/vscroll.png";
        vs.height = 300;
        vs.pos(400, 50);
        vs.min = 0;
        vs.max = 100;
        vs.changeHandler = new Laya.Handler(this, this.onChange);
        Laya.stage.addChild(vs);
    };
    PanelChildControl.prototype.onChange = function (value) {
        console.log("滚动条的位置： value=" + value);
    };
    return PanelChildControl;
}(fairygui.GComponent));
exports.PanelChildControl = PanelChildControl;
},{"../Data/ComponentEventData":28,"../PrefabControl/GamePool":45,"../PrefabControl/PanelResDic":46,"../utils/DispatcherManager":83}],25:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ResourceControl_1 = require("./ResourceControl");
var LocalData_1 = require("../Data/LocalData");
var GamePool_1 = require("../PrefabControl/GamePool");
var AssetPath_1 = require("../Config/AssetPath");
var TimerService_1 = require("../Time/TimerService");
var Tab = Laya.Tab;
/*
* 资源管理器;
*/
var ResDataControl = /** @class */ (function () {
    function ResDataControl() {
        /************************************************ */
        this._time = 0;
        this.ClearInterval = 50000;
        this.CheckInterval = 20000;
        /******************************************************************* */
        this.skins = ["res/ui/tab1.png", "res/ui/tab2.png"];
        ResDataControl.ins = this;
    }
    Object.defineProperty(ResDataControl, "Instance", {
        get: function () {
            if (ResDataControl.ins == null) {
                return new ResDataControl();
            }
            return ResDataControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 添加包
     * @param path 路径（ 事例：res/ui/ ）
     * @param pkgname 包名
     * @param isaddpackage 是否添加
     * @param isCache 是否缓存
     */
    ResDataControl.prototype.AddPackByName = 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.AddLocalLiveData(pkgname, isCache);
    };
    ResDataControl.prototype.init = function () {
        GamePool_1.GamePool.Mark(LocalData_1.LocalData.ResDicValue, LocalData_1.LocalData);
        this.urlRes = {};
        this.packageRes = {};
        this.NoLiveData = { "loading": true, "main": true, "uicomponent": true };
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
    };
    /**
    * 清理资源缓存(Array)
    * @param urls 资源数组
    * @param packageName 包名
    */
    ResDataControl.prototype.RemoveResources = function (urls, packageName) {
        if (packageName === void 0) { packageName = ""; }
        if (packageName != "") {
            fairygui.UIPackage.removePackage(packageName);
        }
        for (var s in urls) {
            this.RemoveResourcesByurl(urls[s].url, true);
        }
    };
    /************************************************ */
    ResDataControl.prototype.placeHSlider = function () {
        var hs = new Laya.HSlider();
        hs.skin = "res/ui/hslider.png";
        hs.width = 300;
        hs.pos(50, 170);
        hs.min = 0;
        hs.max = 100;
        hs.value = 50;
        hs.tick = 1;
        Laya.stage.addChild(hs);
    };
    ResDataControl.prototype.placeVSlider = function () {
        var vs = new Laya.VSlider();
        vs.skin = "res/ui/vslider.png";
        vs.height = 300;
        vs.pos(400, 50);
        vs.min = 0;
        vs.max = 100;
        vs.value = 50;
        vs.tick = 1;
        Laya.stage.addChild(vs);
    };
    ResDataControl.prototype.update = function (dt) {
        this._time += dt;
        if (this._time > this.CheckInterval) //1分钟检查一次
         {
            if (ResourceControl_1.ResourceControl.Instance.running) //如果当前在加载中，延时1秒检测
             {
                this._time -= 1000;
                return;
            }
            this.RefreshGroupRes();
            this._time = 0;
        }
    };
    /**
     * 清理资源缓存(url)
     * @param url 要清理的资源url
     * @param isClear 对于缓存池中的数据，当引用为0时，是否直接强制清除（ 如果为false,则等待缓存定时刷新时候再去判断 ）
     */
    ResDataControl.prototype.RemoveResourcesByurl = function (url, isClear) {
        if (isClear === void 0) { isClear = false; }
        if (this.urlRes.hasOwnProperty(url)) {
            if (isClear) {
                Laya.loader.clearRes(url);
                delete this.urlRes[url];
            }
            else {
                this.urlRes[url]--;
            }
        }
        else {
            Laya.loader.clearRes(url);
        }
    };
    ResDataControl.prototype.ClearLiveDataByPackName = function (pkgName) {
        if (this.packageRes[pkgName]) {
            var vo = this.packageRes[pkgName];
            vo.clear();
            delete this.packageRes[pkgName];
        }
    };
    /**
     * 添加ui包
     * @param pkgname 包名
     * @param isaddpackage 是否创建uipackage
     * @param isCache 是否添加到组缓存中（ 如果添加，则参与定时清理的逻辑,常驻资源请勿设置为ture ）
     */
    ResDataControl.prototype.AddViewPackByName = function (pkgname, isaddpackage, isCache) {
        if (isaddpackage === void 0) { isaddpackage = true; }
        if (isCache === void 0) { isCache = true; }
        if (isaddpackage) {
            if (pkgname == "main") {
                fairygui.UIPackage.addPackage(AssetPath_1.AssetPath.res + AssetPath_1.AssetPath.subpacksgeui + pkgname, pkgname);
            }
            else {
                fairygui.UIPackage.addPackage(AssetPath_1.AssetPath.resources + AssetPath_1.AssetPath.ui + pkgname, pkgname);
            }
        }
        this.AddLocalLiveData(pkgname, isCache);
    };
    /**
     * 移除包
     * @param pkgname 包名
     * @param isclear 是否强制清除（ 如果为false则等待定时器判断清理，如果为true则强制清除 ）
     */
    ResDataControl.prototype.ClearPackByName = function (pkgname, isclear) {
        if (isclear === void 0) { isclear = false; }
        if (pkgname == "" || pkgname == null) {
            return;
        }
        if (isclear) {
            fairygui.UIPackage.removePackage(pkgname);
            if (this.packageRes.hasOwnProperty(pkgname)) {
                delete this.packageRes[pkgname];
            }
        }
        else {
            if (this.packageRes.hasOwnProperty(pkgname)) {
                var vo = this.packageRes[pkgname];
                if (vo) {
                    vo.ref--;
                }
            }
        }
    };
    ResDataControl.prototype.RefreshGroupRes = function () {
        var nowTime = Laya.Browser.now();
        var s;
        if (this.packageRes) {
            var vo;
            for (s in this.packageRes) {
                vo = this.packageRes[s];
                if (vo.ref <= 0 && (nowTime - vo.time) > this.ClearInterval) {
                    this.ClearPackByName(vo.packageName, true);
                    this.ClearLiveDataByPackName(vo.packageName);
                }
            }
        }
        //清理图片缓存
        if (this.urlRes) {
            var resourceurlPool = this.urlRes;
            for (s in resourceurlPool) {
                if (resourceurlPool[s] <= 0) {
                    this.RemoveResourcesByurl(s, true);
                }
            }
        }
    };
    ResDataControl.prototype.onSkinLoaded = function () {
        var tabA = this.createTab(this.skins[0]);
        tabA.pos(40, 120);
        tabA.labelColors = "#000000,#d3d3d3,#333333";
        var tabB = this.createTab(this.skins[1]);
        tabB.pos(40, 220);
        tabB.labelColors = "#FFFFFF,#8FB299,#FFFFFF";
    };
    ResDataControl.prototype.createTab = function (skin) {
        var tab = new Tab();
        tab.skin = skin;
        tab.labelBold = true;
        tab.labelSize = 20;
        tab.labelStrokeColor = "#000000";
        tab.labels = "Tab Control 1,Tab Control 2,Tab Control 3";
        tab.labelPadding = "0,0,0,0";
        tab.selectedIndex = 1;
        Laya.stage.addChild(tab);
        return tab;
    };
    /******************************************************************* */
    /**
     * 获取已经加载过的数据
     * @param url 资源url
     * @param isCache 是否存储在缓存池中，默认为true
     */
    ResDataControl.prototype.GainResources = function (url, isCache) {
        if (isCache === void 0) { isCache = true; }
        if (isCache) {
            if (this.urlRes[url] == null) {
                this.urlRes[url] = 0;
            }
            this.urlRes[url]++;
        }
        return Laya.loader.getRes(url);
    };
    ResDataControl.prototype.AddLocalLiveData = function (pkgname, isCache) {
        if (isCache && !this.NoLiveData.hasOwnProperty(pkgname)) {
            var vo;
            if (!this.packageRes.hasOwnProperty(pkgname)) {
                vo = GamePool_1.GamePool.GetItem(LocalData_1.LocalData.ResDicValue);
                vo.packageName = pkgname;
                this.packageRes[pkgname] = vo;
            }
            else {
                vo = this.packageRes[pkgname];
            }
            vo.ref++;
            vo.time = Laya.Browser.now();
        }
    };
    return ResDataControl;
}());
exports.ResDataControl = ResDataControl;
},{"../Config/AssetPath":15,"../Data/LocalData":30,"../PrefabControl/GamePool":45,"../Time/TimerService":57,"./ResourceControl":26}],26:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var Handler = Laya.Handler;
var DispatcherManager_1 = require("../utils/DispatcherManager");
var RecConfigs_1 = require("../Config/RecConfigs");
var ResourceControl = /** @class */ (function (_super) {
    __extends(ResourceControl, _super);
    function ResourceControl() {
        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;
        ResourceControl.ins = _this;
        return _this;
    }
    Object.defineProperty(ResourceControl, "Instance", {
        get: function () {
            if (ResourceControl.ins == null) {
                return new ResourceControl();
            }
            return ResourceControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    ResourceControl.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);
    };
    ResourceControl.prototype.onLoadConfigComplete = function () {
        if (this._onConfigCompleteTarget != null && this._onConfigComplete != null) {
            this._onConfigComplete.call(this._onConfigCompleteTarget);
        }
    };
    ResourceControl.prototype.errorsMsghandler = function (msg) {
        DispatcherManager_1.DispatcherManager.dispatchEvent("loadfailEvent", msg);
    };
    ResourceControl.prototype.gameerrorsMsghandler = function (msg) {
        DispatcherManager_1.DispatcherManager.dispatchEvent("gameserrosEvent", msg);
    };
    /**
     * 加载资源组
     * @param groupName 组名
     * @param onResourceLoadTarget 作用域
     * @param ResourceLoadComplete 完成事件
     * @param onResourceProgress   加载进度事件
     * @param isShow               是否显示加载状态
     */
    ResourceControl.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.RecConfigs.Instance.ResDic[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 是否显示加载状态
     */
    ResourceControl.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
     */
    ResourceControl.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
     */
    ResourceControl.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();
    };
    ResourceControl.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();
        }
    };
    ResourceControl.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();
        }
    };
    ResourceControl.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));
            }
        }
    };
    ResourceControl.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();
    };
    ResourceControl.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));
            }
        }
    };
    // 加载进度侦听器
    ResourceControl.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);
            }
        }
    };
    ResourceControl.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();
    };
    ResourceControl.prototype.onError = function (err) {
        fairygui.GRoot.inst.closeModalWait();
    };
    /**
     * 加载3D单个资源
     * @param url 资源url
     * @param type 资源类型
     * @param onResourceLoadTarget 作用域
     * @param ResourceLoadComplete 完成事件
     * @param onResourceProgress 加载进度事件
     * @param isShow 是否显示加载状态
     */
    ResourceControl.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               是否显示加载状态
     */
    ResourceControl.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; }
        var data = {};
        data.complete = ResourceLoadComplete;
        data.completeTarget = onResourceLoadTarget;
        data.progress = onResourceProgress;
        data.urls = RecConfigs_1.RecConfigs.Instance.ResDic[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
     */
    ResourceControl.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
     */
    ResourceControl.prototype.loadEffect = function (groupName, onResourceLoadTarget, ResourceLoadComplete, args) {
        if (args === void 0) { args = null; }
        var urls = RecConfigs_1.RecConfigs.Instance.ResDic[groupName];
        if (urls && urls.length > 0) {
            Laya.loader.load(urls, Handler.create(onResourceLoadTarget, ResourceLoadComplete, [args]));
        }
    };
    return ResourceControl;
}(Laya.EventDispatcher));
exports.ResourceControl = ResourceControl;
},{"../Config/RecConfigs":16,"../utils/DispatcherManager":83}],27:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LayoutControl_1 = require("./LayoutControl");
var AssetPath_1 = require("../Config/AssetPath");
var CameraManager_1 = require("../Game/CameraManager");
var PropManager_1 = require("../PrefabControl/PropManager");
var Player_1 = require("../Game/Player");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
var AgencyUserMessage_1 = require("../Agency/AgencyUserMessage");
var PanelResDic_1 = require("../PrefabControl/PanelResDic");
var GameUtils_1 = require("../utils/GameUtils");
var NpcCFG_1 = require("../CFG/NpcCFG");
var NpcScript_1 = require("../Game/NpcScript");
var ResourceControl_1 = require("./ResourceControl");
var GameCFG_1 = require("../CFG/GameCFG");
var CharacterState_1 = require("../PrefabControl/CharacterState");
var UserInfoEvent_1 = require("../Data/UserInfoEvent");
var CharacterPool_1 = require("../PrefabControl/CharacterPool");
var Sprite = Laya.Sprite;
var Event = Laya.Event;
var SceneControl = /** @class */ (function () {
    function SceneControl() {
        this._initPosY = 1;
        this.index = 0;
        this.preRadian = 0;
        SceneControl.ins = this;
    }
    Object.defineProperty(SceneControl, "Instance", {
        get: function () {
            if (SceneControl.ins == null) {
                return new SceneControl();
            }
            return SceneControl.ins;
        },
        enumerable: true,
        configurable: true
    });
    //创建主角
    SceneControl.prototype.CreatePlayer = function (rolecfg) {
        var iscreate = false;
        if (!PropManager_1.PropManager.mainRole) {
            iscreate = true;
        }
        else if (PropManager_1.PropManager.mainRole.name != "Character" + rolecfg.name) {
            iscreate = true;
            this.ClearMomentCharacter();
        }
        if (iscreate) {
            // var sp:Laya.Sprite3D = Laya.Loader.getRes(AssetPath.get3DRoleModel(RoleData.roleCfg.name)) as Laya.Sprite3D;
            // PropManager.mainRole = Laya.Sprite3D.instantiate(sp, PropManager.scene3D, false,new Laya.Vector3( 0,0,0 )) as Laya.Sprite3D;
            PropManager_1.PropManager.mainRole = CharacterPool_1.CharacterPool.AddCharacter(rolecfg.name, Player_1.Player, PropManager_1.PropManager.scene3D);
            PropManager_1.PropManager.mainRole.name = "Character" + rolecfg.name;
            this.PlayerScript = PropManager_1.PropManager.mainRole.getComponent(Player_1.Player);
            // this.mainRoleScript.resouseName = RoleData.roleCfg.name;
            // if(  )
            // this.mainRoleScript = PropManager.mainRole.addComponent( MainRAoleScript );
        }
        var agencyusermessage = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage);
        var RoleData = agencyusermessage.RoleData;
        var info = RoleData.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 == "startpanel") {
            posVec.x = PropManager_1.PropManager.startPlane.transform.position.x + offsetPos.x;
            posVec.y = PropManager_1.PropManager.startPlane.transform.position.y + offsetPos.y;
            posVec.z = PropManager_1.PropManager.startPlane.transform.position.z + offsetPos.z;
            selectVec = PropManager_1.PropManager.startPlane.getChildByName("child_pos").transform.position;
        }
        else {
            var childpos = PropManager_1.PropManager.getPosVecbyScene(RoleData.levelmapArr[0], info.initbuild);
            posVec.x = childpos.x + offsetPos.x;
            posVec.y = childpos.y + offsetPos.y;
            posVec.z = childpos.z + offsetPos.z;
            selectVec = childpos;
        }
        PropManager_1.PropManager.mainRole.transform.position = posVec;
        this.cameraScript.SetCameraPosition(PropManager_1.PropManager.mainRole.transform.position);
        this.PlayerScript.setnowSelectVec(selectVec);
        this.PlayerScript.nowAction = CharacterState_1.CharacterState.stand;
        this.PlayerScript.PlayAnimator(CharacterState_1.CharacterState.stand);
        // var UIPos = PropManager.mainRole.transform.position;
        // var NAMEUI = new Laya.Text();
        // NAMEUI.text = "自己";
        // NAMEUI.fontSize = 60;
        // NAMEUI.color = "#ffffff";
        // NAMEUI.scaleX = 0.5;
        // NAMEUI.scaleY = 0.5;
        // NAMEUI.align = "center";
        // NAMEUI.valign = "middle";
        // Laya.stage.addChild(NAMEUI);
        // Laya.timer.frameLoop(1, this, () => {
        //     let ScreenPos = new Laya.Vector3();
        //     PropManager.carma.worldToViewportPoint(UIPos, ScreenPos);
        //     NAMEUI.pos(ScreenPos.x, ScreenPos.y);
        // })
    };
    //创建npc
    SceneControl.prototype.createNpc = function () {
        console.log("CreatNpc---");
        this.ClearNpc();
        var agencyusermessage = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage);
        var RoleData = agencyusermessage.RoleData;
        var arr = RoleData.levelcfg.npc;
        var childdict;
        var index = 0;
        PropManager_1.PropManager.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(AssetPath_1.AssetPath.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 == "startpanel") {
                posVec.x = PropManager_1.PropManager.startPlane.transform.position.x + offsetPos.x;
                posVec.y = PropManager_1.PropManager.startPlane.transform.position.y + 1 + offsetPos.y;
                posVec.z = PropManager_1.PropManager.startPlane.transform.position.z + offsetPos.z;
                selectVec = PropManager_1.PropManager.startPlane.getChildByName("child_pos").transform.position;
            }
            else {
                var childpos = PropManager_1.PropManager.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 = CharacterPool_1.CharacterPool.AddCharacter(npccfg.name, NpcScript_1.NpcScript, PropManager_1.PropManager.scene3D);
            npcsp.name = "npc_" + index;
            npcsp.transform.position = posVec;
            var npcscript = npcsp.getComponent(NpcScript_1.NpcScript);
            npcscript.setnowSelectVec(selectVec);
            npcscript.npcinfo(npccfg);
            PropManager_1.PropManager.npcDict[npcsp.name] = npcsp;
            PropManager_1.PropManager.npcscriptDict[npcsp.name] = npcscript;
            npcscript.PlayAnimator(CharacterState_1.CharacterState.stand);
            index++;
            // this.ShowUI(npcsp);
        }
        console.log("CreatNpc2---");
    };
    SceneControl.prototype.ShowUI = function (_sprite) {
        var UIPos = _sprite.transform.position;
        var NAMEUI = new Laya.Text();
        var random = GameUtils_1.GameUtils.randRangeint(1, 30);
        NAMEUI.text = "npc_" + this.index;
        NAMEUI.fontSize = 60;
        NAMEUI.color = "#ffffff";
        NAMEUI.scaleX = 0.5;
        NAMEUI.scaleY = 0.5;
        NAMEUI.align = "center";
        NAMEUI.valign = "middle";
        Laya.stage.addChild(NAMEUI);
        Laya.timer.frameLoop(1, this, function () {
            var ScreenPos = new Laya.Vector3();
            PropManager_1.PropManager.carma.worldToViewportPoint(UIPos, ScreenPos);
            NAMEUI.pos(ScreenPos.x, ScreenPos.y + 20);
        });
        this.index++;
    };
    SceneControl.prototype.ShowTheGameScene = function () {
        var pathArr = [];
        var urlArr = [];
        this.cameraScript.iscanfollow = true;
        var roleData = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage).RoleData;
        var arr = roleData.levelmapArr;
        var i = 0;
        for (i = 0; i < arr.length; i++) {
            if (urlArr.indexOf(AssetPath_1.AssetPath.get3DModel(arr[i])) == -1) {
                urlArr.push(AssetPath_1.AssetPath.get3DModel(arr[i]));
            }
        }
        var npcArr = roleData.levelcfg.npc;
        for (i = 0; i < npcArr.length; i++) {
            if (urlArr.indexOf(AssetPath_1.AssetPath.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name)) == -1) {
                urlArr.push(AssetPath_1.AssetPath.get3DRoleModel(NpcCFG_1.default.dict[npcArr[i].id].name));
            }
        }
        for (i = 0; i < urlArr.length; i++) {
            pathArr.push({ url: urlArr[i] });
        }
        ResourceControl_1.ResourceControl.Instance.loader3DArr(pathArr, this, this.SceneCreatComplete, null, true);
    };
    SceneControl.prototype.SceneCreatComplete = function () {
        this.RefreshTerrain();
        var agencyusermessage = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage);
        var RoleData = agencyusermessage.RoleData;
        this.CreatePlayer(RoleData.roleCfg);
        this.createNpc();
    };
    SceneControl.prototype.ListenOnEvent = function () {
        DispatcherManager_1.DispatcherManager.addEventListener(GameState_1.GameState.start, this, this.EnterGame);
        DispatcherManager_1.DispatcherManager.addEventListener(GameState_1.GameState.jump, this, this.Jump);
        DispatcherManager_1.DispatcherManager.addEventListener(UserInfoEvent_1.UserInfoEvent.userinfoEvent_updateroleid, this, this.RefreshCharacterModel);
    };
    SceneControl.prototype.CharacterLoadEnd = function (url) {
        var agencyusermessage = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage);
        var RoleData = agencyusermessage.RoleData;
        if (AssetPath_1.AssetPath.get3DModel(RoleData.roleCfg.name) == url) {
            this.CreatePlayer(RoleData.roleCfg);
        }
    };
    SceneControl.prototype.Jump = function () {
        this.PlayerScript.TestJump();
    };
    /************************************************************** */
    SceneControl.prototype.setup = function () {
        this.createSprite();
        Laya.stage.on(Event.MOUSE_UP, this, this.onMouseUp);
        Laya.stage.on(Event.MOUSE_OUT, this, this.onMouseUp);
    };
    SceneControl.prototype.createSprite = function () {
        this.sp = new Sprite();
        var w = 200, h = 300;
        this.sp.graphics.drawRect(0, 0, w, h, "#FF7F50");
        this.sp.size(w, h);
        this.sp.pivot(w / 2, h / 2);
        this.sp.pos(Laya.stage.width / 2, Laya.stage.height / 2);
        Laya.stage.addChild(this.sp);
        this.sp.on(Event.MOUSE_DOWN, this, this.onMouseDown);
    };
    SceneControl.prototype.onMouseDown = function (e) {
        var touches = e.touches;
        if (touches && touches.length == 2) {
            this.preRadian = Math.atan2(touches[0].stageY - touches[1].stageY, touches[0].stageX - touches[1].stageX);
            Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove);
        }
    };
    SceneControl.prototype.onMouseMove = function (e) {
        var touches = e.touches;
        if (touches && touches.length == 2) {
            var nowRadian = Math.atan2(touches[0].stageY - touches[1].stageY, touches[0].stageX - touches[1].stageX);
            this.sp.rotation += 180 / Math.PI * (nowRadian - this.preRadian);
            this.preRadian = nowRadian;
        }
    };
    SceneControl.prototype.onMouseUp = function (e) {
        Laya.stage.off(Event.MOUSE_MOVE, this, this.onMouseMove);
    };
    /********************************** */
    SceneControl.prototype.EnterGame = function (jiasu) {
        this.PlayerScript.startRun(jiasu);
        var npcdict = PropManager_1.PropManager.npcscriptDict;
        for (var s in npcdict) {
            var npcscript = npcdict[s];
            npcscript.startRun();
        }
    };
    SceneControl.prototype.ClearMomentCharacter = function () {
        if (PropManager_1.PropManager.mainRole && this.PlayerScript) {
            CharacterPool_1.CharacterPool.ClearCharacter(PropManager_1.PropManager.mainRole, this.PlayerScript.resouseName, this.PlayerScript);
            this.PlayerScript = null;
            PropManager_1.PropManager.mainRole = null;
        }
    };
    SceneControl.prototype.SetScene = function () {
        var backgroundParent = LayoutControl_1.LayoutControl.Instance.background.displayObject;
        var scenebg = fairygui.UIPackage.createObject("main", "gambg");
        scenebg.setSize(fairygui.GRoot.inst.width, fairygui.GRoot.inst.height);
        LayoutControl_1.LayoutControl.Instance.background.addChild(scenebg);
        // UiManager.instance.add( GameBgView,null,LayerNotify.LAYER_BACKGROUND );
        //添加3D场景
        PropManager_1.PropManager.scene3D = backgroundParent.addChild(new Laya.Scene3D());
        PropManager_1.PropManager.scene3D.physicsSimulation.continuousCollisionDetection = true;
        //添加照相机
        PropManager_1.PropManager.carma = (PropManager_1.PropManager.scene3D.addChild(new Laya.Camera(0, 0.1, 70)));
        this.cameraScript = PropManager_1.PropManager.carma.addComponent(CameraManager_1.CameraManager);
        PropManager_1.PropManager.carma.clearFlag = Laya.BaseCamera.CLEARFLAG_DEPTHONLY;
        //添加方向光
        var directionLight = Laya.Loader.getRes(AssetPath_1.AssetPath.get3DModel("DirectionalLight")); //PropManager.scene3D.addChild(new Laya.DirectionLight()) as Laya.DirectionLight;
        PropManager_1.PropManager.scene3D.addChild(directionLight);
        // directionLight.transform.worldMatrix.setForward(new Laya.Vector3(1, -1, 0));
        // var directionLight: Laya.DirectionLight = PropManager.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));
        PropManager_1.PropManager.startPlane = Laya.Loader.getRes(AssetPath_1.AssetPath.get3DModel("startpanel"));
        PropManager_1.PropManager.scene3D.addChild(PropManager_1.PropManager.startPlane);
        PropManager_1.PropManager.endPlane = Laya.Loader.getRes(AssetPath_1.AssetPath.get3DModel("endpanel"));
        PropManager_1.PropManager.scene3D.addChild(PropManager_1.PropManager.endPlane);
        // PropManager.bgsprite3d = Laya.Loader.getRes(AssetPath.get3DModel("distantview"));
        // PropManager.scene3D.addChild(PropManager.bgsprite3d);
        //雾化代码
        PropManager_1.PropManager.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);
            PropManager_1.PropManager.scene3D.fogColor = new Laya.Vector3(Number(wucolor[0]), Number(wucolor[1]), Number(wucolor[2]));
        }
        else {
            PropManager_1.PropManager.scene3D.fogColor = new Laya.Vector3(0, 0, 0.6);
        }
        //设置雾化的起始位置，相对于相机的距离
        var valueArr = GameUtils_1.GameUtils.cutstrtoArr(GameCFG_1.default.dict[3].value);
        PropManager_1.PropManager.scene3D.fogStart = Number(valueArr[0]);
        //设置雾化最浓处的距离。
        PropManager_1.PropManager.scene3D.fogRange = Number(valueArr[1]);
        this.ShowTheGameScene();
        this.ListenOnEvent();
    };
    /**清除所有NPC */
    SceneControl.prototype.ClearNpc = function () {
        var npcdict = PropManager_1.PropManager.npcDict;
        var s;
        for (s in npcdict) {
            var sp = npcdict[s];
            var npcscript = PropManager_1.PropManager.npcscriptDict[s];
            var resousename = npcscript.resouseName;
            CharacterPool_1.CharacterPool.ClearCharacter(sp, resousename, npcscript);
            delete PropManager_1.PropManager.npcscriptDict[s];
            delete npcdict[s];
        }
    };
    SceneControl.prototype.Pattern = function (mapSprite3D) {
        console.log("Pattern1----");
        if (PropManager_1.PropManager.patternDict[mapSprite3D.name]) {
            delete PropManager_1.PropManager.patternDict[mapSprite3D.name];
        }
        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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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 (PropManager_1.PropManager.diePosY > buildSp.transform.position.y) {
                PropManager_1.PropManager.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++;
        }
        index = 0;
        var jumpchildSp;
        var iscreatejt = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage).RoleData.LevelID < 3 ? true : false;
        while (Props.getChildByName("JumpBoost_" + index)) {
            jumpchildSp = Props.getChildByName("JumpBoost_" + index);
            if (iscreatejt) {
                var pos = jumpchildSp.transform.position.clone();
                pos.y += 3;
                var jiantou = Laya.Sprite3D.instantiate(Laya.loader.getRes(AssetPath_1.AssetPath.get3DRoleModel("Arrow")), PropManager_1.PropManager.scene3D, false, pos);
                PropManager_1.PropManager.jiantouArr.push(jiantou);
            }
            index++;
        }
        PropManager_1.PropManager.patternDict[mapSprite3D.name] = chiddict;
        console.log("Pattern2----");
    };
    /***************************************************** */
    SceneControl.prototype.onSpriteClick = function (e) {
        var randomAngle = Math.random() * 180;
        //发送自定义事件
        // this.sp.event(Interaction_CustomEvent.ROTATE, [randomAngle]);
    };
    // 触发自定义的rotate事件
    SceneControl.prototype.onRotate = function (newAngle) {
        Laya.Tween.to(this.sp, { "rotation": newAngle }, 1000, Laya.Ease.elasticOut);
    };
    /***************************************************** */
    SceneControl.prototype.RefreshCharacterModel = function () {
        var agencyusermessage = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage);
        var RoleData = agencyusermessage.RoleData;
        var pathArr = [];
        pathArr.push({ url: AssetPath_1.AssetPath.get3DRoleModel(RoleData.roleCfg.name) });
        ResourceControl_1.ResourceControl.Instance.loader3DArr(pathArr, this, this.CharacterLoadEnd, null, true, AssetPath_1.AssetPath.get3DModel(RoleData.roleCfg.name));
    };
    /*********更新地形 */
    SceneControl.prototype.RefreshTerrain = function () {
        var agencyusermessage = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage);
        var RoleData = agencyusermessage.RoleData;
        var nowlevelcfg = RoleData.levelcfg;
        var mapArr = RoleData.levelmapArr;
        var mapSprite3D;
        var mapname;
        var _lastmapSprite3D;
        for (var s in PropManager_1.PropManager.nowmapDict) {
            PropManager_1.PropManager.nowmapDict[s].active = false;
        }
        for (var i = 0; i < mapArr.length; i++) {
            mapname = mapArr[i];
            console.log("mapname1----", mapname);
            if (PropManager_1.PropManager.nowmapDict[mapname]) {
                mapSprite3D = PropManager_1.PropManager.nowmapDict[mapname];
                mapSprite3D.active = true;
            }
            else {
                console.log("mapname2----", mapname);
                var sp = Laya.Loader.getRes(AssetPath_1.AssetPath.get3DModel(mapname));
                console.log("mapname3----", mapname);
                mapSprite3D = Laya.Sprite3D.instantiate(sp, PropManager_1.PropManager.scene3D, false, null);
                console.log("mapname4----", mapname);
                PropManager_1.PropManager.nowmapDict[mapname] = mapSprite3D;
                console.log("mapname5----", mapname);
            }
            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.Pattern(mapSprite3D);
            _lastmapSprite3D = mapSprite3D;
            var endPos1 = mapSprite3D.getChildByName("END").transform.position.clone();
            endPos1.z += Number(GameCFG_1.default.dict[6].value);
            PropManager_1.PropManager.endPlane.transform.position = endPos1;
            PropManager_1.PropManager.gamewinPosZ = endPos1.z;
            PropManager_1.PropManager.gamewinPosZ -= 2;
            // PropManager.bgsprite3d.transform.position = new Laya.Vector3( 0,-20,-40 );
        }
    };
    /*使用界面显示，0：砸蛋,1:宝箱*/
    SceneControl.EggGGroup = 0;
    return SceneControl;
}());
exports.SceneControl = SceneControl;
},{"../Agency/AgencyUserMessage":8,"../CFG/GameCFG":10,"../CFG/NpcCFG":13,"../Config/AssetPath":15,"../Data/UserInfoEvent":34,"../Game/CameraManager":36,"../Game/NpcScript":37,"../Game/Player":38,"../PrefabControl/CharacterPool":43,"../PrefabControl/CharacterState":44,"../PrefabControl/PanelResDic":46,"../PrefabControl/PropManager":47,"../utils/DispatcherManager":83,"../utils/GameState":84,"../utils/GameUtils":85,"./LayoutControl":21,"./ResourceControl":26}],28:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GamePool_1 = require("../PrefabControl/GamePool");
var ComponentEventData = /** @class */ (function () {
    function ComponentEventData() {
    }
    ComponentEventData.prototype.listenKeyboard = function () {
        this.keyDownList = [];
        //添加键盘按下事件,一直按着某按键则会不断触发
        Laya.stage.on(Laya.Event.KEY_DOWN, this, this.onKeyDown);
        //添加键盘抬起事件
        Laya.stage.on(Laya.Event.KEY_UP, this, this.onKeyUp);
    };
    /**键盘按下处理*/
    ComponentEventData.prototype.onKeyDown = function (e) {
        var keyCode = e["keyCode"];
        this.keyDownList[keyCode] = true;
    };
    ComponentEventData.prototype.clear = function () {
        this.target = null;
        this.type = null;
        this.thisObject = null;
        this.listener = null;
        GamePool_1.GamePool.RemoveItem(ComponentEventData.ResDicValue, this);
    };
    /**键盘抬起处理*/
    ComponentEventData.prototype.onKeyUp = function (e) {
        delete this.keyDownList[e["keyCode"]];
    };
    ComponentEventData.ResDicValue = "ComponentEventData";
    return ComponentEventData;
}());
exports.ComponentEventData = ComponentEventData;
},{"../PrefabControl/GamePool":45}],29:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* name;
*/
var DataInfoBase = /** @class */ (function (_super) {
    __extends(DataInfoBase, _super);
    function DataInfoBase() {
        return _super.call(this) || this;
    }
    /***********混淆********* */
    DataInfoBase.prototype.showApe = function () {
        var monkey1Path = "./res/apes/monkey1.png", monkey2Path = "./res/apes/monkey2.png";
        // 方法1：使用loadImage
        var ape = new Laya.Sprite();
        Laya.stage.addChild(ape);
        ape.loadImage(monkey1Path);
        // 方法2：使用drawTexture
        Laya.loader.load(monkey2Path, Laya.Handler.create(this, function () {
            var monkey2 = Laya.loader.getRes(monkey2Path);
            var ape2 = new Laya.Sprite();
            Laya.stage.addChild(ape2);
            ape2.graphics.drawTexture(monkey2, 100, 0);
        }));
    };
    /*********************** */
    DataInfoBase.prototype.DataInfo = 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 );
                // }
            }
        }
    };
    /*********混淆 */
    DataInfoBase.prototype.createButton = function (skin, name, cb, index) {
        var btn = new Laya.Button(skin, name);
        Laya.stage.addChild(btn);
        btn.on(Laya.Event.CLICK, this, cb);
        btn.size(147, 55);
        btn.name = name;
        btn.right = 10;
        btn.top = index * (btn.height + 10);
        return btn;
    };
    /***************** */
    DataInfoBase.prototype.dispatchEvent = function (type, data) {
        this.event(type, data);
    };
    return DataInfoBase;
}(Laya.EventDispatcher));
exports.DataInfoBase = DataInfoBase;
},{}],30:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GamePool_1 = require("../PrefabControl/GamePool");
var Sprite = Laya.Sprite;
var Event = Laya.Event;
/*
* name;
*/
var LocalData = /** @class */ (function (_super) {
    __extends(LocalData, _super);
    function LocalData() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * 引用次数
         */
        _this.ref = 0;
        /**
         * 最后一次被引用的时间
         */
        _this.time = 0;
        /**
         * 包名
         */
        _this.packageName = "";
        return _this;
    }
    LocalData.prototype.createCoralRect = function () {
        var coralRect = new Sprite();
        coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50");
        //设置名称
        coralRect.name = "珊瑚色容器";
        coralRect.size(Laya.stage.width, Laya.stage.height / 2);
        Laya.stage.addChild(coralRect);
        coralRect.on(Event.MOUSE_DOWN, this, this.onDown);
    };
    LocalData.prototype.createDeepSkyblueRect = function () {
        var deepSkyblueRect = new Sprite();
        deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, "#00BFFF");
        //设置名称
        deepSkyblueRect.name = "天蓝色矩形";
        //设置宽高（要接收鼠标事件必须设置宽高，否则不会被命中）  
        deepSkyblueRect.size(100, 100);
        deepSkyblueRect.pos(10, 10);
        Laya.stage.addChild(deepSkyblueRect);
        deepSkyblueRect.on(Event.MOUSE_DOWN, this, this.onDown);
    };
    LocalData.prototype.clear = function () {
        this.ref = 0;
        this.time = 0;
        this.packageName = "";
        GamePool_1.GamePool.RemoveItem(LocalData.ResDicValue, this);
    };
    /**侦听处理方法*/
    LocalData.prototype.onDown = function (e) {
        this.logger.text += "点击 - " + e.target.name + "\n";
    };
    LocalData.ResDicValue = "LocalData";
    return LocalData;
}(Laya.EventDispatcher));
exports.LocalData = LocalData;
},{"../PrefabControl/GamePool":45}],31:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DispatcherManager_1 = require("../utils/DispatcherManager");
var UserInfoEvent_1 = require("../Data/UserInfoEvent");
var LocalDataControl_1 = require("../Control/LocalDataControl");
var UserDataInfo_1 = require("../Data/UserDataInfo");
var RoleCFG_1 = require("../CFG/RoleCFG");
var LevelCFG_1 = require("../CFG/LevelCFG");
var GameUtils_1 = require("../utils/GameUtils");
var DataInfoBase_1 = require("./DataInfoBase");
var Templet = Laya.Templet;
var Event = Laya.Event;
var RoleData = /** @class */ (function (_super) {
    __extends(RoleData, _super);
    function RoleData() {
        var _this = _super.call(this) || this;
        /**
         * 金币
         */
        _this._Gold = 0;
        _this._roleid = 0;
        _this._leveid = 0;
        _this.mStartX = 400;
        _this.mStartY = 500;
        _this.mActionIndex = 0;
        _this.mCurrIndex = 0;
        _this.mCurrSkinIndex = 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;
        RoleData.ins = _this;
        return _this;
    }
    Object.defineProperty(RoleData, "Instance", {
        get: function () {
            if (RoleData.ins == null) {
                return new RoleData();
            }
            return RoleData.ins;
        },
        enumerable: true,
        configurable: true
    });
    RoleData.prototype.init = function () {
        var localdatacontrol = LocalDataControl_1.LocalDataControl.Instance;
        // var nowGold:number = Number(PlayerAccount.CurrentAccount.CurAccountData.GetUser(AccountUser.money));
        // this.Gold = nowGold;
        this.Money = localdatacontrol.getnum(UserDataInfo_1.UserDataInfo.gold);
        this._roleid = localdatacontrol.getnum(UserDataInfo_1.UserDataInfo.roleid);
        if (this.CharacterID == 0) {
            this.CharacterID = 1;
        }
        else {
            this.InitCharacterInfo();
        }
        this._leveid = localdatacontrol.getnum(UserDataInfo_1.UserDataInfo.levelid);
        if (this._leveid == 0) {
            this._leveid = 1;
        }
        this.RefreshLevel();
    };
    Object.defineProperty(RoleData.prototype, "nowlevel", {
        get: function () {
            return this._leveid;
        },
        enumerable: true,
        configurable: true
    });
    RoleData.prototype.getNowServerLevel = function () {
        return this._leveid;
    };
    RoleData.prototype.LevelUp = function () {
        this._leveid++;
        LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.levelid, this._leveid.toString());
        this.RefreshLevel();
    };
    /*********************************************************** */
    RoleData.prototype.startFun = function () {
        this.mAniPath = "res/spine/spineRes6/alien.sk";
        this.mFactory = new Templet();
        this.mFactory.on(Event.COMPLETE, this, this.parseComplete);
        this.mFactory.on(Event.ERROR, this, this.onError);
        this.mFactory.loadAni(this.mAniPath);
    };
    RoleData.prototype.onError = function () {
        console.log("error");
    };
    RoleData.prototype.parseComplete = function () {
        //创建模式为1，可以启用换装
        this.mArmature = this.mFactory.buildArmature(1);
        this.mArmature.x = this.mStartX;
        this.mArmature.y = this.mStartY;
        this.mArmature.scale(0.5, 0.5);
        Laya.stage.addChild(this.mArmature);
        this.mArmature.on(Event.LABEL, this, this.onEvent);
        this.play();
    };
    /******************************************************************** */
    RoleData.prototype.RefreshLevel = function () {
        var lv = this._leveid;
        var nowcfglv = 0;
        var allnums = LevelCFG_1.default.vec.length;
        if (lv > allnums) {
            var value = (lv - allnums) % (allnums - 2);
            if (value == 0) {
                nowcfglv = allnums;
            }
            else {
                nowcfglv = value + 2;
            }
        }
        else {
            nowcfglv = lv;
        }
        this.levelcfg = LevelCFG_1.default.dict[nowcfglv];
        this.levelmapArr = GameUtils_1.GameUtils.cutstrtoArr(this.levelcfg.road);
        DispatcherManager_1.DispatcherManager.dispatchEvent(UserInfoEvent_1.UserInfoEvent.userinfoEvent_levelid);
    };
    RoleData.prototype.play = function () {
        this.mCurrIndex++;
        if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
            this.mCurrIndex = 0;
        }
        this.mArmature.play(this.mCurrIndex, false);
    };
    RoleData.prototype.onEvent = function (e) {
        Laya.stage.addChild(this.mLabelSprite);
        this.mLabelSprite.x = this.mStartX;
        this.mLabelSprite.y = this.mStartY;
        this.mLabelSprite.graphics.clear();
    };
    RoleData.prototype.InitCharacterInfo = function () {
        this.roleCfg = RoleCFG_1.default.dict[this._roleid];
        this.movespeed = this.roleCfg.speed;
        this.frontjump = this.roleCfg.frontjump;
        this.leftjump = this.roleCfg.leftjump;
        this.rightjump = this.roleCfg.rightjump;
        this.upclimb = Number(this.roleCfg.upclimb);
        this.slideclimb = this.roleCfg.slideclimb;
        // 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.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(RoleData.prototype, "LevelID", {
        // 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( UserDataInfo.levelid,this._leveid.toString() );
        //         DispatcherManager.dispatchEvent( UserInfoEvent.userinfoEvent_updateroleid );
        //     }
        // }
        get: function () {
            return this._leveid;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RoleData.prototype, "CharacterID", {
        get: function () {
            return this._roleid;
        },
        set: function (value) {
            if (this._roleid != value) {
                this._roleid = value;
                this.InitCharacterInfo();
                LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.roleid, this._roleid.toString());
                DispatcherManager_1.DispatcherManager.dispatchEvent(UserInfoEvent_1.UserInfoEvent.userinfoEvent_updateroleid);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RoleData.prototype, "Money", {
        get: function () {
            return this._Gold;
        },
        set: function (value) {
            if (this._Gold != value) {
                this._Gold = value;
                LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.gold, this._Gold.toString());
                DispatcherManager_1.DispatcherManager.dispatchEvent(UserInfoEvent_1.UserInfoEvent.UserInfoEvent_updateUserData);
            }
        },
        enumerable: true,
        configurable: true
    });
    return RoleData;
}(DataInfoBase_1.DataInfoBase));
exports.RoleData = RoleData;
},{"../CFG/LevelCFG":11,"../CFG/RoleCFG":14,"../Control/LocalDataControl":22,"../Data/UserDataInfo":33,"../Data/UserInfoEvent":34,"../utils/DispatcherManager":83,"../utils/GameUtils":85,"./DataInfoBase":29}],32:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var SkinData = /** @class */ (function () {
    function SkinData() {
        /**
         * 0:未拥有，1：已经拥有
         */
        this.state = 0;
        this.hasnum = 0;
        /************************************ */
    }
    /************************************ */
    SkinData.prototype.createText = function () {
        var txt = new Laya.Text();
        txt.text = "Layabox是HTML5引擎技术提供商与优秀的游戏发行商，面向AS/JS/TS开发者提供HTML5开发技术方案！";
        txt.width = 300;
        txt.fontSize = 40;
        txt.color = "#ffffff";
        //设置文本为多行文本
        txt.wordWrap = true;
        txt.x = Laya.stage.width - txt.textWidth >> 1;
        txt.y = Laya.stage.height - txt.textHeight >> 1;
        Laya.stage.addChild(txt);
    };
    return SkinData;
}());
exports.SkinData = SkinData;
},{}],33:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Event = Laya.Event;
var UserDataInfo = /** @class */ (function () {
    function UserDataInfo() {
    }
    /******************************* */
    UserDataInfo.prototype.onCallLater = function () {
        console.log("onCallLater triggered");
        var text = new Laya.Text();
        text.font = "SimHei";
        text.fontSize = 30;
        text.color = "#FFFFFF";
        text.text = "打开控制台可见该函数仅触发了一次";
        text.size(Laya.stage.width, Laya.stage.height);
        text.wordWrap = true;
        text.valign = "middle";
        text.align = "center";
        Laya.stage.addChild(text);
    };
    UserDataInfo.prototype.onDecreaseAlpha1 = function (e) {
        //移除鼠标单击事件
        this.button1.off(Event.CLICK, this, this.onDecreaseAlpha1);
        //定时执行一次(间隔时间)
        Laya.timer.once(3000, this, this.onComplete1);
    };
    UserDataInfo.prototype.onDecreaseAlpha2 = function (e) {
        //移除鼠标单击事件
        this.button2.off(Event.CLICK, this, this.onDecreaseAlpha2);
        //定时执行一次(基于帧率)
        Laya.timer.frameOnce(60, this, this.onComplete2);
    };
    UserDataInfo.prototype.onComplete1 = function () {
        //spBtn1的透明度减少0.5
        this.button1.alpha -= 0.5;
    };
    UserDataInfo.prototype.onComplete2 = function () {
        //spBtn2的透明度减少0.5
        this.button2.alpha -= 0.5;
    };
    /******************************************************** */
    /**
     * 记录上次离开时间
     */
    UserDataInfo.lasttime = "lasttime";
    UserDataInfo.caplastflushtime = "captime";
    UserDataInfo.capstorageappids = "capappids";
    UserDataInfo.hasgetappids = "hasgetappids";
    /******************************* */
    /**
     * 角色信息
     */
    UserDataInfo.roleData = "roleData";
    /********************************************************************** */
    UserDataInfo.gold = "gold";
    UserDataInfo.roleid = "roleid";
    UserDataInfo.levelid = "levelid";
    /**
     * 皮肤
     */
    UserDataInfo.skin = "skin";
    UserDataInfo.lastDay = "lastDay";
    UserDataInfo.nowdayShare = "dayshare";
    UserDataInfo.nowdayVideo = "dayvideo";
    return UserDataInfo;
}());
exports.UserDataInfo = UserDataInfo;
},{}],34:[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";
    UserInfoEvent.updatePlayerInfo = "UserInfoEvent_updatePlayerInfo";
    return UserInfoEvent;
}());
exports.UserInfoEvent = UserInfoEvent;
},{}],35:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("./Global");
var PanelResDic_1 = require("./PrefabControl/PanelResDic");
var DispatcherManager_1 = require("./utils/DispatcherManager");
var ComponentEventData_1 = require("./Data/ComponentEventData");
var RecConfigs_1 = require("./Config/RecConfigs");
var TimesTamper_1 = require("./Time/TimesTamper");
var AssetPath_1 = require("./Config/AssetPath");
var TimerService_1 = require("./Time/TimerService");
var GlobalWaiting_1 = require("./GlobalWaiting");
var PanelBaseControl_1 = require("./Control/PanelBaseControl");
var GamePool_1 = require("./PrefabControl/GamePool");
var LayoutControl_1 = require("./Control/LayoutControl");
var ViewManager_1 = require("./View/ViewManager");
var ResourceControl_1 = require("./Control/ResourceControl");
var ResDataControl_1 = require("./Control/ResDataControl");
var AudioControl_1 = require("./Control/AudioControl");
var ConnectControl_1 = require("./Control/ConnectControl");
var pingtaiutils_1 = require("./WXSDK/pingtaiutils");
var AgencyLogin_1 = require("./Agency/AgencyLogin");
var AgencyUserMessage_1 = require("./Agency/AgencyUserMessage");
var AgencyMain_1 = require("./Agency/AgencyMain");
var AgencyInGame_1 = require("./Agency/AgencyInGame");
var AgencySkin_1 = require("./Agency/AgencySkin");
var AgencyTrial_1 = require("./Agency/AgencyTrial");
var AgencyLottery_1 = require("./Agency/AgencyLottery");
/*
* name;
*/
var GameContents = /** @class */ (function (_super) {
    __extends(GameContents, _super);
    function GameContents() {
        return _super.call(this) || this;
    }
    /**
     * 初始化游戏
     */
    GameContents.prototype.initGame = function () {
        RecConfigs_1.RecConfigs.Instance.init();
        DispatcherManager_1.DispatcherManager.init();
        TimerService_1.TimerService.Instance.init();
        LayoutControl_1.LayoutControl.Instance.initlayer();
        ViewManager_1.ViewManager.Instance.init();
        ResourceControl_1.ResourceControl.Instance.init();
        ResDataControl_1.ResDataControl.Instance.init();
        AudioControl_1.AudioControl.Instance.init();
        ConnectControl_1.ConnectControl.Connnect();
        TimesTamper_1.TimesTamper.Instance.init();
        pingtaiutils_1.pingtaiutils.Instance.init();
        this.initPoolObject();
        this.initProxy();
        this.initmapView();
        this.beginLoadHandler();
    };
    /**
     * 初始化对象池
     */
    GameContents.prototype.initPoolObject = function () {
        GamePool_1.GamePool.Mark(ComponentEventData_1.ComponentEventData.ResDicValue, ComponentEventData_1.ComponentEventData);
    };
    /**
     * 初始化模块代理类
     */
    GameContents.prototype.initProxy = function () {
        var mvcpool = PanelResDic_1.PanelResDic.Instance;
        mvcpool.AgencyAdd(AgencyLogin_1.AgencyLogin);
        mvcpool.AgencyAdd(AgencyUserMessage_1.AgencyUserMessage);
        mvcpool.AgencyAdd(AgencyMain_1.AgencyMain);
        mvcpool.AgencyAdd(AgencyInGame_1.AgencyInGame);
        mvcpool.AgencyAdd(AgencySkin_1.AgencySkin);
        mvcpool.AgencyAdd(AgencyTrial_1.AgencyTrial);
        mvcpool.AgencyAdd(AgencyLottery_1.AgencyLottery);
    };
    GameContents.prototype.initmapView = function () {
        var mvcpool = PanelResDic_1.PanelResDic.Instance;
        // mvcpool.mapView( MapViewType.DailyrewardView,DailyrewardView );
    };
    GameContents.prototype.beginLoadHandler = function () {
        var patharr = [];
        patharr.push({ url: AssetPath_1.AssetPath.getResConfig(), type: Laya.Loader.JSON });
        patharr.push({ url: AssetPath_1.AssetPath.getGameVersion(), type: Laya.Loader.JSON });
        ResourceControl_1.ResourceControl.Instance.Loaders(patharr, this, this.recloadComplete);
    };
    GameContents.prototype.recloadComplete = function () {
        var gameversion = ResDataControl_1.ResDataControl.Instance.GainResources(AssetPath_1.AssetPath.getGameVersion(), false);
        if (gameversion) {
            Global_1.Global.gameVersion = gameversion.version;
        }
        else {
            Global_1.Global.gameVersion = "1.0.0";
        }
        var configres = ResDataControl_1.ResDataControl.Instance.GainResources(AssetPath_1.AssetPath.getResConfig(), false);
        RecConfigs_1.RecConfigs.Instance.initRec(configres);
        ResourceControl_1.ResourceControl.Instance.loadGroup("loading", this, this.onPreLoaded, this.onPreprogress);
    };
    GameContents.prototype.onPreprogress = function (value) {
    };
    GameContents.prototype.onPreLoaded = function () {
        ResDataControl_1.ResDataControl.Instance.AddViewPackByName("loading", true, false);
        var globalwaiturl = fairygui.UIPackage.getItemURL("loading", "globalWaiting");
        PanelBaseControl_1.PanelBaseControl.viewbgUrl = fairygui.UIPackage.getItemURL("loading", "img_black");
        fairygui.UIObjectFactory.setPackageItemExtension(globalwaiturl, GlobalWaiting_1.GlobalWaiting);
        fairygui.UIConfig.globalModalWaiting = globalwaiturl;
        fairygui.UIConfig.windowModalWaiting = globalwaiturl;
        // CPAUtils.init();
        this.Login();
    };
    GameContents.prototype.Login = function () {
        PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyLogin_1.AgencyLogin).Login();
    };
    return GameContents;
}(Laya.EventDispatcher));
exports.GameContents = GameContents;
},{"./Agency/AgencyInGame":2,"./Agency/AgencyLogin":3,"./Agency/AgencyLottery":4,"./Agency/AgencyMain":5,"./Agency/AgencySkin":6,"./Agency/AgencyTrial":7,"./Agency/AgencyUserMessage":8,"./Config/AssetPath":15,"./Config/RecConfigs":16,"./Control/AudioControl":17,"./Control/ConnectControl":18,"./Control/LayoutControl":21,"./Control/PanelBaseControl":23,"./Control/ResDataControl":25,"./Control/ResourceControl":26,"./Data/ComponentEventData":28,"./Global":39,"./GlobalWaiting":40,"./PrefabControl/GamePool":45,"./PrefabControl/PanelResDic":46,"./Time/TimerService":57,"./Time/TimesTamper":58,"./View/ViewManager":68,"./WXSDK/pingtaiutils":80,"./utils/DispatcherManager":83}],36:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PropManager_1 = require("../PrefabControl/PropManager");
var GameUtils_1 = require("../utils/GameUtils");
var GameCFG_1 = require("../CFG/GameCFG");
var Sprite = Laya.Sprite;
var TiledMap = Laya.TiledMap;
var Point = Laya.Point;
var Rectangle = Laya.Rectangle;
var Handler = Laya.Handler;
var CameraManager = /** @class */ (function (_super) {
    __extends(CameraManager, _super);
    function CameraManager() {
        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;
    }
    CameraManager.prototype.onAwake = function () {
        //获取脚本所属对象
        this.camera = this.owner;
        this._toVec = new Laya.Vector3();
        this.camera.fieldOfView = 90;
    };
    CameraManager.prototype.onStart = function () {
        this._transform = this.camera.transform;
        //旋转摄像机角度
        this._transform.rotate(new Laya.Vector3(0, 0, 0), true, false);
        // this.camera.clearColor = null;
    };
    CameraManager.prototype.createMap = function () {
        this.tiledMap = new TiledMap();
        this.tiledMap.createMap("res/tiledMap/isometric_grass_and_water.json", new Rectangle(0, 0, Laya.stage.width, Laya.stage.height), Handler.create(this, this.mapLoaded), null, new Point(1600, 800));
    };
    CameraManager.prototype.onStageClick = function () {
        var p = new Point(0, 0);
        this.layer.getTilePositionByScreenPos(Laya.stage.mouseX, Laya.stage.mouseY, p);
        this.layer.getScreenPositionByTilePos(Math.floor(p.x), Math.floor(p.y), p);
        this.sprite.pos(p.x, p.y);
    };
    CameraManager.prototype.mapLoaded = function () {
        this.layer = this.tiledMap.getLayerByIndex(0);
        var radiusX = 32;
        var radiusY = Math.tan(180 / Math.PI * 30) * radiusX;
        var color = "#FF7F50";
        this.sprite = new Sprite();
        this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color);
        this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color);
        this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color);
        this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color);
        Laya.stage.addChild(this.sprite);
    };
    CameraManager.prototype.onUpdate = function () {
        if (this.iscanfollow) {
            if (PropManager_1.PropManager.iscarmanpc) {
                if (PropManager_1.PropManager.npcDict["npc_0"]) {
                    Laya.Vector3.add(PropManager_1.PropManager.npcDict["npc_0"].transform.position, this._disVector, this._toVec);
                    this._transform.position = this._toVec;
                    this._transform.position.x = PropManager_1.PropManager.npcDict["npc_0"].transform.position.x;
                    this._transform.lookAt(PropManager_1.PropManager.npcDict["npc_0"].transform.position, this._upvec);
                }
            }
            else {
                if (PropManager_1.PropManager.mainRole) {
                    Laya.Vector3.add(PropManager_1.PropManager.mainRole.transform.position, this._disVector, this._toVec);
                    // this._toVec.x = PropManager.mainRole.transform.position.x;
                    // this._transform.position = this._toVec;
                    // this._transform.lookAt( PropManager.mainRole.transform.position,this._upvec );
                    Laya.Vector3.lerp(this._transform.position, this._toVec, 16 / 1000 * this._slerpValue, this._toVec);
                    // this._toVec.z = PropManager.mainRole.transform.position.z+this._disVector.z;
                    // this._toVec.y = PropManager.mainRole.transform.position.y + this._disVector.y;
                    this._transform.position = this._toVec;
                    this._lookatVec.x = this._toVec.x;
                    this._lookatVec.y = PropManager_1.PropManager.mainRole.transform.position.y;
                    this._lookatVec.z = PropManager_1.PropManager.mainRole.transform.position.z;
                    this._transform.lookAt(this._lookatVec, this._upvec);
                }
            }
        }
    };
    CameraManager.prototype.GameEndRotate = function (targetPos, speed) {
        this.iscanfollow = false;
        this._transform.translate(speed, false);
        this._transform.lookAt(targetPos, this._upvec);
    };
    CameraManager.prototype.SetCameraPosition = 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 ) );
    };
    return CameraManager;
}(Laya.Script3D));
exports.CameraManager = CameraManager;
},{"../CFG/GameCFG":10,"../PrefabControl/PropManager":47,"../utils/GameUtils":85}],37:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TimerService_1 = require("../Time/TimerService");
var PropManager_1 = require("../PrefabControl/PropManager");
var CharacterState_1 = require("../PrefabControl/CharacterState");
var BuildCFG_1 = require("../CFG/BuildCFG");
var CameraManager_1 = require("./CameraManager");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
var GameUtils_1 = require("../utils/GameUtils");
var NpcScript = /** @class */ (function (_super) {
    __extends(NpcScript, _super);
    function NpcScript() {
        var _this = _super.call(this) || this;
        _this._nowAction = "";
        _this.resouseName = "";
        _this._shangpaVec = new Laya.Vector3;
        /**是否发生碰撞 */
        _this.haveCollision = false;
        _this._TargetCollision = "";
        _this._normalizeVec = new Laya.Vector3;
        _this.staybuild = "";
        _this.stayscene = "";
        /**
         * 0:未锁，1：锁左边，2：锁右边
         */
        _this._lockxstate = 0;
        /**
         * 状态，0：等待状态，1：开始状态，2：完成状态
         */
        _this._nowRoleState = 0;
        _this.movespeed = 0;
        _this.frontjumpspeed = new Laya.Vector3;
        _this.leftjumpspeed = new Laya.Vector3;
        _this.rightjumpspeed = new Laya.Vector3;
        _this.climbspeed = 0;
        _this.sideclimbspeed = new Laya.Vector3;
        _this._lockbyBuildname = "";
        /**
         * 0:未被锁，1：锁定左边，2：锁定右边，
         */
        _this._lockstate = 0;
        _this.LastAction = "";
        _this._moveTime = 0;
        _this._chixuTime = 0;
        _this._isActionNums = false;
        _this._isneedactionnum = 0;
        _this._needactiontime = 0;
        _this._moveVec = new Laya.Vector3;
        _this.jumpSpeed = new Laya.Vector3;
        _this.jumpHight = 0;
        _this._disy = 0;
        _this.Gravity_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.HaveForceJump = false;
        _this.quaternion = new Laya.Quaternion;
        return _this;
    }
    NpcScript.prototype.onAwake = function () {
        this._animator = this.owner.getComponent(Laya.Animator);
        PropManager_1.PropManager.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 () {
        if (this._nowNpcinfo.gravity) {
            this.Gravity_g = this._nowNpcinfo.gravity;
        }
        else {
            this.Gravity_g = 10;
        }
        this._checktime = 500;
        this._nowRoleState = 1;
        this._ending = false;
        this._changeMoveX = 0;
        this._initPosVec = this._transform.position.clone();
        this.staybuild = "";
        this.stayscene = "";
        this._nowAction = CharacterState_1.CharacterState.stand;
        this.nowAction = CharacterState_1.CharacterState.run;
        this._speedMoveV3.x = 0;
        this._speedMoveV3.y = 0;
        this._speedMoveV3.z = -this.movespeed;
        this._iscanMove = true;
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
    };
    NpcScript.prototype.npcinfo = function (cfg) {
        this._nowNpcinfo = cfg;
        this.movespeed = this._nowNpcinfo.speed;
        this.climbspeed = Number(this._nowNpcinfo.upclimb);
        this.frontjumpspeed = new Laya.Vector3(Number(this._nowNpcinfo.frontjump.x), Number(this._nowNpcinfo.frontjump.y), Number(this._nowNpcinfo.frontjump.z));
        this.leftjumpspeed = new Laya.Vector3(Number(this._nowNpcinfo.leftjump.x), Number(this._nowNpcinfo.leftjump.y), Number(this._nowNpcinfo.leftjump.z));
        this.rightjumpspeed = new Laya.Vector3(Number(this._nowNpcinfo.rightjump.x), Number(this._nowNpcinfo.rightjump.y), Number(this._nowNpcinfo.rightjump.z));
        this.sideclimbspeed = new Laya.Vector3(Number(this._nowNpcinfo.slideclimb.x), Number(this._nowNpcinfo.slideclimb.y), Number(this._nowNpcinfo.slideclimb.z));
        // this.frontjump.x = Number( this._nowNpcinfo.frontjump.x );
        // this.frontjump.y = Number( this._nowNpcinfo.frontjump.y );
        // this.frontjump.z = Number( this._nowNpcinfo.frontjump.z );
        // this.leftjump.x = Number( this._nowNpcinfo.leftjump.x );
        // this.leftjump.y = Number( this._nowNpcinfo.leftjump.y );
        // this.leftjump.z = Number( this._nowNpcinfo.leftjump.z );
        // this.rightjump.x = Number( this._nowNpcinfo.rightjump.x );
        // this.rightjump.y = Number( this._nowNpcinfo.rightjump.y );
        // this.rightjump.z = Number( this._nowNpcinfo.rightjump.z );
        // this.upclimb = Number( this._nowNpcinfo.upclimb );
        // this.slideclimb.x = Number( this._nowNpcinfo.slideclimb.x );
        // this.slideclimb.y = Number( this._nowNpcinfo.slideclimb.y );
        // this.slideclimb.z = Number( this._nowNpcinfo.slideclimb.z );
    };
    /**
     * 开始碰撞时执行
     */
    NpcScript.prototype.onCollisionEnter = function (collision) {
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.Calculate(contactPoint.normal, collision.other.owner);
        }
    };
    NpcScript.prototype.setnowSelectVec = function (pos) {
        this._nowselectVec = pos;
    };
    NpcScript.prototype.Calculate = function (normal, target) {
        if (target.name == "SliderBoost" || target.name.indexOf("npc") != -1 || target.name.indexOf("role") != -1) {
            return;
        }
        this._TargetCollision = target.name;
        var n = new Laya.Vector3;
        Laya.Vector3.normalize(normal, this._normalizeVec);
        if (this._TargetCollision.indexOf("build") != -1 || this._TargetCollision.indexOf("Scaffolding") != -1 ||
            this._TargetCollision.indexOf("irongauze") != -1) //碰到建筑，判断是上爬，左爬还是右爬
         {
            if (this._TargetCollision.indexOf("build") != -1) {
                this.staybuild = this._TargetCollision;
                this.stayscene = target.parent.parent.name;
            }
            if (this._TargetCollision.indexOf("irongauze") != -1) {
                this._nowselectVec = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
            }
            else {
                this._nowselectVec = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.name, this._TargetCollision);
            }
            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.nowAction = CharacterState_1.CharacterState.run;
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.climbup;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
            else if (this._normalizeVec.y == 1 || this._normalizeVec.y == -1) {
                this.nowAction = CharacterState_1.CharacterState.run;
            }
            else if (this._normalizeVec.x == -1) {
                if (this.nowAction == CharacterState_1.CharacterState.run) {
                    this._lockxstate = 1;
                }
                else if (this.nowAction == CharacterState_1.CharacterState.climbup) {
                    this._lockxstate = 1;
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.climbleft;
                }
            }
            else if (this._normalizeVec.x == 1) {
                if (this.nowAction == CharacterState_1.CharacterState.run) {
                    this._lockxstate = 2;
                }
                else if (this.nowAction == CharacterState_1.CharacterState.climbup) {
                    this._lockxstate = 2;
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.climbright;
                }
            }
            else {
                if (this._normalizeVec.z != 1) {
                    this.nowAction = CharacterState_1.CharacterState.climbupblock;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
        }
        else if (this._TargetCollision.indexOf("panel_jump") != -1) //加速板跳跃
         {
            this.nowAction = CharacterState_1.CharacterState.speedupjump;
            // this.setJump( this.nowAction );
        }
        else if (this._TargetCollision.indexOf("panel_downslip") != -1) {
            this.nowAction = CharacterState_1.CharacterState.downmove;
            // this.setJump( this.nowAction );
        }
        else if (this._TargetCollision.indexOf("box_Board") != -1 && this.nowAction != CharacterState_1.CharacterState.downmove) {
            if (this._normalizeVec.z == -1) //上爬
             {
                this.nowAction = CharacterState_1.CharacterState.climbup;
                this._shangpaVec = this._nowselectVec.clone();
            }
        }
        else if (this._TargetCollision.indexOf("box_sidejump") != -1) {
            this.nowAction = CharacterState_1.CharacterState.sidespeedup;
            // this.setJump( this.nowAction );
        }
        else if (this._TargetCollision.indexOf("box_Surmount") != -1) {
            this.nowAction = CharacterState_1.CharacterState.cross;
            // this.setJump( this.nowAction );
        }
        else if (this._TargetCollision.indexOf("irongauze") != -1) {
            this.nowAction = CharacterState_1.CharacterState.climbup;
            this._shangpaVec = this._nowselectVec.clone();
        }
    };
    /**
     * 持续碰撞时执行
     */
    NpcScript.prototype.onCollisionStay = function (collision) {
        // Debuger.log( "碰撞中" );
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            this.haveCollision = 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._TargetCollision = targetname;
            }
            if (this._TargetCollision.indexOf("build") != -1 || this._TargetCollision.indexOf("Scaffolding") != -1 ||
                this._TargetCollision.indexOf("irongauze") != -1) //碰到建筑，判断是上爬，左爬还是右爬
             {
                if (this._TargetCollision.indexOf("build") != -1) {
                    this.staybuild = this._TargetCollision;
                    this.stayscene = target.parent.parent.name;
                }
                if (this._TargetCollision.indexOf("irongauze") != -1) {
                    this._nowselectVec = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
                }
                else {
                    this._nowselectVec = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.name, this._TargetCollision);
                }
            }
        }
    };
    /**
     * 结束碰撞时执行
     */
    NpcScript.prototype.onCollisionExit = function (collision) {
        this.haveCollision = false;
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.CheckEnd(contactPoint.normal, collision.other.owner);
        }
    };
    NpcScript.prototype.CheckEnd = function (normal, target) {
        if (target.name == "SliderBoost" || target.name.indexOf("npc") != -1 || target.name.indexOf("role") != -1) {
            return;
        }
        if (this.HaveForceJump) {
            this.HaveForceJump = false;
            return;
        }
        if (this._lockxstate) {
            this._lockxstate = 0;
            return;
        }
        if (this._TargetCollision != target.name) {
            return;
        }
        if (target.name.indexOf("panel_jump") != -1) {
            return;
        }
        switch (this.nowAction) {
            case CharacterState_1.CharacterState.climbup:
            case CharacterState_1.CharacterState.climbupblock:
                if (this._TargetCollision.indexOf("box_Board") != -1) {
                    this.JumpAction(this._changeMoveX);
                }
                else {
                    if (this._changeMoveX > 0) {
                        this.nowAction = CharacterState_1.CharacterState.jumpright;
                    }
                    else if (this._changeMoveX < 0) {
                        this.nowAction = CharacterState_1.CharacterState.jumpleft;
                    }
                }
                break;
            case CharacterState_1.CharacterState.climbright:
            case CharacterState_1.CharacterState.climbleft:
                this.JumpAction(this._changeMoveX);
                break;
            case CharacterState_1.CharacterState.run:
                this.JumpAction(this._changeMoveX);
                break;
            case CharacterState_1.CharacterState.MoveX:
                this.JumpAction(this._speedMoveV3.x);
                break;
        }
    };
    NpcScript.prototype.JumpAction = function (value, isquanzhong) {
        if (isquanzhong === void 0) { isquanzhong = false; }
        if (value > 0) {
            this.nowAction = CharacterState_1.CharacterState.jumpright;
        }
        else if (value < 0) {
            this.nowAction = CharacterState_1.CharacterState.jumpleft;
        }
        else {
            if (isquanzhong) {
                if (this._TargetCollision.indexOf("build") != -1) {
                    var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                    var allvalue = 0;
                    var sort;
                    var selectdir = "";
                    if (this._TargetCollision.indexOf("leftright") != -1) {
                        allvalue = this._nowNpcinfo.jump_left + this._nowNpcinfo.jump_right;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcinfo.jump_left) {
                            selectdir = "left";
                        }
                        else {
                            selectdir = "right";
                        }
                    }
                    else if (this._TargetCollision.indexOf("frontright") != -1) {
                        allvalue = this._nowNpcinfo.start_ahead + this._nowNpcinfo.jump_right;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcinfo.start_ahead) {
                            selectdir = "front";
                        }
                        else {
                            selectdir = "right";
                        }
                    }
                    else if (this._TargetCollision.indexOf("frontleft") != -1) {
                        allvalue = this._nowNpcinfo.start_ahead + this._nowNpcinfo.jump_left;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcinfo.start_ahead) {
                            selectdir = "front";
                        }
                        else {
                            selectdir = "left";
                        }
                    }
                    else if (this._TargetCollision.indexOf("right") != -1) {
                        selectdir = "right";
                    }
                    else if (this._TargetCollision.indexOf("left") != -1) {
                        selectdir = "left";
                    }
                    else if (this._TargetCollision.indexOf("front") != -1) {
                        selectdir = "front";
                    }
                    else {
                        allvalue = this._nowNpcinfo.start_ahead + this._nowNpcinfo.jump_left + this._nowNpcinfo.jump_right;
                        sort = GameUtils_1.GameUtils.randRangeint(0, allvalue);
                        if (sort <= this._nowNpcinfo.start_ahead) {
                            selectdir = "front";
                        }
                        else if (sort <= this._nowNpcinfo.start_ahead + this._nowNpcinfo.jump_left) {
                            selectdir = "left";
                        }
                        else {
                            selectdir = "right";
                        }
                    }
                    switch (selectdir) {
                        case "left":
                            this.nowAction = CharacterState_1.CharacterState.jumpleft;
                            break;
                        case "right":
                            this.nowAction = CharacterState_1.CharacterState.jumpright;
                            break;
                        case "front":
                            this.nowAction = CharacterState_1.CharacterState.jump;
                            break;
                        default:
                            this.nowAction = CharacterState_1.CharacterState.jump;
                            break;
                    }
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.jump;
                }
            }
            else {
                this.nowAction = CharacterState_1.CharacterState.jump;
            }
        }
    };
    Object.defineProperty(NpcScript.prototype, "nowAction", {
        get: function () {
            return this._nowAction;
        },
        set: function (value) {
            if (this._nowRoleState == 1) {
                if (this._nowAction != value || this.LastAction == CharacterState_1.CharacterState.speedupjump || this.LastAction == CharacterState_1.CharacterState.jumpright) {
                    this.LastAction = this._nowAction;
                    this._nowAction = value;
                    this._moveTime = 0;
                    switch (this._nowAction) {
                        case CharacterState_1.CharacterState.stand:
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.stand);
                            break;
                        case CharacterState_1.CharacterState.run:
                            if (this.LastAction == CharacterState_1.CharacterState.jump || this.LastAction == CharacterState_1.CharacterState.jumpleft || this.LastAction == CharacterState_1.CharacterState.jumpright) {
                                this._isActionNums = true;
                                this._isneedactionnum = 1;
                                var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                                if (sort < 50) {
                                    this.PlayAnimator(CharacterState_1.CharacterState.land1);
                                }
                                else {
                                    this.PlayAnimator(CharacterState_1.CharacterState.land2);
                                }
                            }
                            else {
                                this._isActionNums = false;
                                this.PlayAnimator(CharacterState_1.CharacterState.run);
                            }
                            break;
                        case CharacterState_1.CharacterState.jump:
                            this.PlayAnimator(CharacterState_1.CharacterState.jump);
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.jumpSpeed.x = this.frontjumpspeed.x;
                            this.jumpSpeed.y = this.frontjumpspeed.y;
                            this.jumpSpeed.z = this.frontjumpspeed.z;
                            break;
                        case CharacterState_1.CharacterState.jumpleft:
                            this.jumpSpeed = this.leftjumpspeed;
                            // this.jumpSpeed.x = this.leftjumpspeed.x;
                            // this.jumpSpeed.y = this.leftjumpspeed.y;
                            // this.jumpSpeed.z = this.leftjumpspeed.z;
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.PlayAnimator(CharacterState_1.CharacterState.leftjump);
                            break;
                        case CharacterState_1.CharacterState.jumpright:
                            this.jumpSpeed = this.rightjumpspeed;
                            // this.jumpSpeed.x = this.rightjumpspeed.x;
                            // this.jumpSpeed.y = this.rightjumpspeed.y;
                            // this.jumpSpeed.z = this.rightjumpspeed.z;
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            this.PlayAnimator(CharacterState_1.CharacterState.rightjump);
                            break;
                        case CharacterState_1.CharacterState.speedupjump:
                            var buildcfg = BuildCFG_1.default.dict["panel_jump"];
                            this.jumpSpeed.x = buildcfg.buffx;
                            this.jumpSpeed.y = buildcfg.buffy;
                            if (this.LastAction == CharacterState_1.CharacterState.speedupjump) {
                                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.PlayAnimator(CharacterState_1.CharacterState.highjump1);
                            }
                            else {
                                this.PlayAnimator(CharacterState_1.CharacterState.highjump2);
                            }
                            break;
                        case CharacterState_1.CharacterState.downmove:
                            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.PlayAnimator(CharacterState_1.CharacterState.huachan);
                            break;
                        case CharacterState_1.CharacterState.cross:
                            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.PlayAnimator(CharacterState_1.CharacterState.hurdle);
                            break;
                        case CharacterState_1.CharacterState.climbup:
                        case CharacterState_1.CharacterState.climbupblock:
                            this.jumpSpeed.x = 0;
                            this.jumpSpeed.y = this.climbspeed;
                            this.jumpSpeed.z = 0;
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.climbwall);
                            break;
                        case CharacterState_1.CharacterState.climbleft:
                            this.jumpSpeed = new Laya.Vector3(0, this.sideclimbspeed.y, this.sideclimbspeed.z);
                            // this.jumpSpeed.x = 0;
                            // this.jumpSpeed.y = this.sideclimbspeed.y;
                            // this.jumpSpeed.z = this.sideclimbspeed.z;
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.runwallleft);
                            break;
                        case CharacterState_1.CharacterState.climbright:
                            this.jumpSpeed = new Laya.Vector3(0, this.sideclimbspeed.y, this.sideclimbspeed.z);
                            // this.jumpSpeed.x = 0;
                            // this.jumpSpeed.y = this.sideclimbspeed.y;
                            // this.jumpSpeed.z = this.sideclimbspeed.z;
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.runwallright);
                            break;
                        case CharacterState_1.CharacterState.ClimbMotion:
                            this._isActionNums = true;
                            this._isneedactionnum = 0;
                            this._needactiontime = 0.3;
                            this._moveTime = 0;
                            this.PlayAnimator(CharacterState_1.CharacterState.climbend);
                            break;
                    }
                }
            }
        },
        enumerable: true,
        configurable: true
    });
    NpcScript.prototype.update = function (dt) {
        if (this._nowRoleState == 1) {
            dt = 16;
            this._checktime += dt;
            if (PropManager_1.PropManager.iscarmanpc) {
            }
            else {
                if (this._checktime >= 500) {
                    this._checktime = 0;
                    if (this._nowNpcinfo && PropManager_1.PropManager.mainRole) {
                        if (this._transform.position.z + this._nowNpcinfo.distance < PropManager_1.PropManager.mainRole.transform.position.z) {
                            this._iscanMove = false;
                        }
                        else {
                            this._iscanMove = true;
                        }
                    }
                }
            }
            if (this._iscanMove) {
                var distime = dt / 1000;
                this._moveTime += distime;
                switch (this.nowAction) {
                    case CharacterState_1.CharacterState.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 CharacterState_1.CharacterState.climbup: //爬升
                        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.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                            }
                        }
                        else if (this._nowselectVec) {
                            if (this._transform.position.y + 1 > this._nowselectVec.y) {
                                this.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                            }
                        }
                        break;
                    case CharacterState_1.CharacterState.climbupblock:
                        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.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                            }
                        }
                        else if (this._transform.position.y + 1 > this._nowselectVec.y) {
                            this.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                        }
                        break;
                    case CharacterState_1.CharacterState.jump: //跳跃
                    case CharacterState_1.CharacterState.jumpleft:
                    case CharacterState_1.CharacterState.jumpright:
                        this._disy = this.jumpSpeed.y - this.Gravity_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 CharacterState_1.CharacterState.speedupjump:
                        this._disy = this.jumpSpeed.y - this.Gravity_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 CharacterState_1.CharacterState.climbleft:
                    case CharacterState_1.CharacterState.climbright:
                        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 CharacterState_1.CharacterState.MoveX:
                        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.nowAction = CharacterState_1.CharacterState.run;
                        }
                        break;
                    case CharacterState_1.CharacterState.downmove:
                        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.nowAction = CharacterState_1.CharacterState.run;
                        }
                        break;
                    case CharacterState_1.CharacterState.sidespeedup:
                        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.LastAction == CharacterState_1.CharacterState.climbleft || this.LastAction == CharacterState_1.CharacterState.climbright) {
                            this.nowAction = this.LastAction;
                        }
                        else {
                            this.nowAction = CharacterState_1.CharacterState.jump;
                            // this.setJump( this.nowAction );
                        }
                        break;
                    case CharacterState_1.CharacterState.cross:
                        this._disy = this.jumpSpeed.y - this.Gravity_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 CharacterState_1.CharacterState.ClimbMotion:
                        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.nowAction == CharacterState_1.CharacterState.run || this.nowAction == CharacterState_1.CharacterState.downmove) && !this.haveCollision) {
                    if (this._transform.position.z <= this._nowselectVec.z) {
                        if (this._changeMoveX > 0) {
                            this.nowAction = CharacterState_1.CharacterState.jumpright;
                        }
                        else if (this._changeMoveX < 0) {
                            this.nowAction = CharacterState_1.CharacterState.jumpleft;
                        }
                        else {
                            this.nowAction = CharacterState_1.CharacterState.jump;
                        }
                    }
                }
                if (this._transform.position.y < PropManager_1.PropManager.diePosY) //角色死亡
                 {
                    if (this.stayscene == "" || this.staybuild == "") {
                        this._transform.position = this._initPosVec.clone();
                    }
                    else {
                        this._transform.position = PropManager_1.PropManager.getPosVecbyScene(this.stayscene, this.staybuild).clone();
                    }
                    this.nowAction = CharacterState_1.CharacterState.run;
                }
                if (this._transform.position.z < PropManager_1.PropManager.gamewinPosZ) {
                    this.Win();
                }
                if (this._isActionNums) {
                    //如果当前播放state已经播放完了一次
                    if (this._isneedactionnum > 0) {
                        if (this._animator.getCurrentAnimatorPlayState().normalizedTime >= this._isneedactionnum) {
                            switch (this._nowActionName) {
                                case CharacterState_1.CharacterState.jump:
                                case CharacterState_1.CharacterState.leftjump:
                                case CharacterState_1.CharacterState.rightjump:
                                case CharacterState_1.CharacterState.highjump1:
                                case CharacterState_1.CharacterState.highjump2:
                                case CharacterState_1.CharacterState.hurdle:
                                    this._isActionNums = false;
                                    this.PlayAnimator(CharacterState_1.CharacterState.sky);
                                    break;
                                case CharacterState_1.CharacterState.huachan:
                                case CharacterState_1.CharacterState.climbend:
                                    this._isActionNums = false;
                                    this.PlayAnimator(CharacterState_1.CharacterState.run);
                                    this.nowAction = CharacterState_1.CharacterState.run;
                                    this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                                    break;
                                case CharacterState_1.CharacterState.land1:
                                case CharacterState_1.CharacterState.land2:
                                    this._isActionNums = false;
                                    this.PlayAnimator(CharacterState_1.CharacterState.run);
                                    break;
                            }
                        }
                    }
                    else if (this._needactiontime != 0 && this._moveTime > this._needactiontime) {
                        switch (this._nowActionName) {
                            case CharacterState_1.CharacterState.jump:
                            case CharacterState_1.CharacterState.leftjump:
                            case CharacterState_1.CharacterState.rightjump:
                            case CharacterState_1.CharacterState.highjump1:
                            case CharacterState_1.CharacterState.highjump2:
                            case CharacterState_1.CharacterState.hurdle:
                                this._isActionNums = false;
                                this.PlayAnimator(CharacterState_1.CharacterState.sky);
                                break;
                            case CharacterState_1.CharacterState.huachan:
                            case CharacterState_1.CharacterState.climbend:
                                this._isActionNums = false;
                                this.PlayAnimator(CharacterState_1.CharacterState.run);
                                this.nowAction = CharacterState_1.CharacterState.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.GameOver();
                    }
                    else {
                        this._endAnmoSpeed1.x = this._endAnmoSpeed.x * distime;
                        this._endAnmoSpeed1.y = this._endAnmoSpeed.y * distime;
                        this._endAnmoSpeed1.z = this._endAnmoSpeed.z * distime;
                        PropManager_1.PropManager.carma.getComponent(CameraManager_1.CameraManager).GameEndRotate(this._transform.position, this._endAnmoSpeed1);
                    }
                }
            }
        }
    };
    NpcScript.prototype.GameOver = function () {
        this._ending = false;
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.end);
    };
    NpcScript.prototype.Win = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        this._nowRoleState = 2;
        this.PlayAnimator(CharacterState_1.CharacterState.sky);
        DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.npcend, this.owner.name);
    };
    NpcScript.prototype.stop = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
    };
    NpcScript.prototype.destroy = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.destroy.call(this);
    };
    NpcScript.prototype.Joy = function (value, angle) {
        if (this.nowAction == CharacterState_1.CharacterState.run || this.nowAction == CharacterState_1.CharacterState.climbup || CharacterState_1.CharacterState.climbleft || CharacterState_1.CharacterState.climbright) {
            this._changeMoveX = value;
        }
        if (this.nowAction == CharacterState_1.CharacterState.climbleft && this._changeMoveX > 0) //强制跳跃
         {
            this.HaveForceJump = true;
            this.nowAction = CharacterState_1.CharacterState.jumpright;
        }
        else if (this.nowAction == CharacterState_1.CharacterState.climbright && this._changeMoveX < 0) {
            this.HaveForceJump = true;
            this.nowAction = CharacterState_1.CharacterState.jumpleft;
        }
        if (this.nowAction == CharacterState_1.CharacterState.jump ||
            this.nowAction == CharacterState_1.CharacterState.jumpleft ||
            this.nowAction == CharacterState_1.CharacterState.jumpright ||
            this.nowAction == CharacterState_1.CharacterState.speedupjump)
            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.PlayAnimator = function (actionName) {
        // this._nowActionName = actionName;
        var _actionname = this.TransitionActionName(actionName);
        this._nowActionName = actionName;
        if (this._animator) {
            if (this._nowActionName == CharacterState_1.CharacterState.climbend) {
                this._animator.speed = 1.5;
            }
            else {
                this._animator.speed = 1;
            }
            this._animator.play(_actionname, 0, 0);
        }
    };
    /**转换动作名称 */
    NpcScript.prototype.TransitionActionName = function (_actionname) {
        switch (_actionname) {
            case "rollover1":
                return "cefan1";
            case "rollover2":
                return "cefan2";
            case "runwallleft":
                return "paoqiangleft";
            case "rightjump":
                return "rightjump";
            case "runwallright":
                return "paoqiangright";
            case "leftjump":
                return "leftjump";
            case "climbwall":
                return "paqiang";
            case "climbend":
                return "climbend";
            case "stand":
                return "stand";
            case "sky":
                return "kongzhong";
            case "land1":
                return "luodi1";
            case "land2":
                return "luodi2";
            case "highjump1":
                return "datiao1";
            case "highjump2":
                return "datiao2";
            case "run":
                return "run";
            case "jump":
                return "jump";
            case "climbup":
                return "Climb";
            case "falldown":
                return "Freefalling";
            case "climbleft":
                return "left_climb";
            case "climbright":
                return "right_climb";
            case "jumpright":
                return "right_jump";
            case "jumpleft":
                return "left_jump";
            case "ClimbMotion":
                return "PlayPalouAction";
            case "huachan":
                return "huachan";
            case "hurdle":
                return "kualan";
            case "speedupjump":
                return "jiasuJump";
            case "MoveX":
                return "xshunyi";
            case "downmove":
                return "downSlide";
            case "sidespeedup":
                return "slidejiasu";
            case "cross":
                return "surmount";
            case "climbupblock":
                return "lockclimb";
        }
    };
    NpcScript.prototype.TestJump = function () {
        this.nowAction = CharacterState_1.CharacterState.jump;
    };
    NpcScript.prototype.getPostion = function () {
        return this._transform.position;
    };
    NpcScript.prototype.getAction = function () {
        return this._nowRoleState;
    };
    return NpcScript;
}(Laya.Script3D));
exports.NpcScript = NpcScript;
},{"../CFG/BuildCFG":9,"../PrefabControl/CharacterState":44,"../PrefabControl/PropManager":47,"../Time/TimerService":57,"../utils/DispatcherManager":83,"../utils/GameState":84,"../utils/GameUtils":85,"./CameraManager":36}],38:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TimerService_1 = require("../Time/TimerService");
var PropManager_1 = require("../PrefabControl/PropManager");
var CharacterState_1 = require("../PrefabControl/CharacterState");
var PanelResDic_1 = require("../PrefabControl/PanelResDic");
var AgencyUserMessage_1 = require("../Agency/AgencyUserMessage");
var BuildCFG_1 = require("../CFG/BuildCFG");
var CameraManager_1 = require("./CameraManager");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
var GameUtils_1 = require("../utils/GameUtils");
var GameStateControl_1 = require("../Control/GameStateControl");
var AudioControl_1 = require("../Control/AudioControl");
var WXGamePlatform_1 = require("../WXSDK/WXGamePlatform");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var Player = /** @class */ (function (_super) {
    __extends(Player, _super);
    function Player() {
        var _this = _super.call(this) || this;
        _this._isActionNums = false;
        _this._isneedactionnum = 0;
        _this._needactiontime = 0;
        _this._nowActionState = "";
        _this._multiple = new Laya.Vector3(1, 1, 1);
        _this.LastActionState = "";
        _this._moveTime = 0;
        /**
         * 加速buffvec
         */
        _this._lastjiasuState = "";
        _this.buff_speeduptime = 0;
        _this.canshake = false;
        _this.shaketime = 0;
        _this.doublespeedup = false;
        _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._moveVec = new Laya.Vector3;
        _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;
        Player.ins = _this;
        return _this;
    }
    Object.defineProperty(Player, "Instance", {
        get: function () {
            if (Player.ins == null) {
                return new Player();
            }
            return Player.ins;
        },
        enumerable: true,
        configurable: true
    });
    Player.prototype.onAwake = function () {
        this._animator = this.owner.getComponent(Laya.Animator);
        PropManager_1.PropManager.setAnimator(this._animator);
        this._speedMoveV3 = new Laya.Vector3(0, 0, 0);
        var sp = this.owner;
        this._transform = sp.transform;
        this._RoleData = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencyUserMessage_1.AgencyUserMessage).RoleData;
        sp.getComponent(Laya.Rigidbody3D).ccdMotionThreshold = 0.001;
        this.LeftTrial = sp.getChildByName("lefttrail");
        this.RightTrial = sp.getChildByName("righttrail");
    };
    Player.prototype.startRun = function (jiasu) {
        var _this = this;
        if (this._RoleData.roleCfg.gravity) {
            this.g = this._RoleData.roleCfg.gravity;
        }
        else {
            this.g = 10;
        }
        this._multiple.x = 1;
        this._multiple.y = 1;
        this._multiple.z = 1;
        this.buff_speeduptime = 0;
        this.doublespeedup = false;
        this._lastjiasuState = "";
        this._ending = false;
        this._changeMoveX = 0;
        this._initPosVec = this._transform.position.clone();
        console.log("玩家的初始位置----", this._initPosVec);
        this._nowbuildname = "";
        this._nowscenename = "";
        this.nowAction = CharacterState_1.CharacterState.run;
        this._speedMoveV3.x = 0;
        this._speedMoveV3.y = 0;
        if (jiasu) {
            this._speedMoveV3.z = -this._RoleData.movespeed * 2;
            Laya.timer.once(3000, this, function () {
                _this._speedMoveV3.z = -_this._RoleData.movespeed;
            });
        }
        else {
            this._speedMoveV3.z = -this._RoleData.movespeed;
        }
        this._iscanMove = true;
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
    };
    // private pzdict:any = {};
    // private pzarr:Array<any> = [];
    /**
     * 开始碰撞时执行
     */
    Player.prototype.onCollisionEnter = function (collision) {
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.Calculate(contactPoint.normal, collision.other.owner, contactPoint.positionOnB);
        }
    };
    /**
     * 持续碰撞时执行
     */
    Player.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 = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
                }
                else {
                    this._nowselectVec = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.name, this._nowCollTargetName);
                }
            }
        }
    };
    /**
     * 结束碰撞时执行
     */
    Player.prototype.onCollisionExit = function (collision) {
        this._isColling = false;
        if (collision && collision.contacts && collision.contacts.length > 0 && collision.other) {
            var contactPoint = collision.contacts[0];
            this.CheckEnd(contactPoint.normal, collision.other.owner);
        }
    };
    /**检测结束碰撞 */
    Player.prototype.CheckEnd = function (normal, target) {
        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;
        }
        switch (this.nowAction) {
            case CharacterState_1.CharacterState.climbup:
            case CharacterState_1.CharacterState.climbupblock:
                if (this._nowCollTargetName.indexOf("box_Board") != -1) {
                    this.JumpAction(this._changeMoveX);
                }
                else {
                    if (this._changeMoveX > 0) {
                        this.nowAction = CharacterState_1.CharacterState.jumpright;
                    }
                    else if (this._changeMoveX < 0) {
                        this.nowAction = CharacterState_1.CharacterState.jumpleft;
                    }
                }
                break;
            case CharacterState_1.CharacterState.climbright:
            case CharacterState_1.CharacterState.climbleft:
                this.JumpAction(this._changeMoveX);
                break;
            case CharacterState_1.CharacterState.run:
                this.JumpAction(this._changeMoveX);
                break;
            case CharacterState_1.CharacterState.MoveX:
                this.JumpAction(this._speedMoveV3.x);
                break;
        }
    };
    Player.prototype.setnowSelectVec = function (pos) {
        this._nowselectVec = pos;
    };
    /**计算碰撞 */
    Player.prototype.Calculate = 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);
        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 = PropManager_1.PropManager.getPosVecbyScene(target.parent.parent.parent.name, target.parent.name);
            }
            else {
                this._nowselectVec = PropManager_1.PropManager.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.nowAction = CharacterState_1.CharacterState.run;
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.climbup;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
            else if (this._normalizeVec.y == 1 || this._normalizeVec.y == -1) {
                this.nowAction = CharacterState_1.CharacterState.run;
            }
            else if (this._normalizeVec.x == -1) {
                if (this.nowAction == CharacterState_1.CharacterState.run) {
                    this._lockxstate = 1;
                }
                else if (this.nowAction == CharacterState_1.CharacterState.climbup) {
                    this._lockxstate = 1;
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.climbleft;
                }
            }
            else if (this._normalizeVec.x == 1) {
                if (this.nowAction == CharacterState_1.CharacterState.run) {
                    this._lockxstate = 2;
                }
                else if (this.nowAction == CharacterState_1.CharacterState.climbup) {
                    this._lockxstate = 2;
                }
                else {
                    this.nowAction = CharacterState_1.CharacterState.climbright;
                }
            }
            else {
                if (this._normalizeVec.z != 1) {
                    this.nowAction = CharacterState_1.CharacterState.climbupblock;
                    this._shangpaVec = this._nowselectVec.clone();
                }
            }
        }
        else if (this._nowCollTargetName.indexOf("panel_jump") != -1) //加速板跳跃
         {
            this.nowAction = CharacterState_1.CharacterState.speedupjump;
        }
        else if (this._nowCollTargetName.indexOf("panel_downslip") != -1) {
            this.nowAction = CharacterState_1.CharacterState.downmove;
        }
        else if (this._nowCollTargetName.indexOf("box_Board") != -1 && this.nowAction != CharacterState_1.CharacterState.downmove) {
            if (this._normalizeVec.z == -1) //上爬
             {
                this.nowAction = CharacterState_1.CharacterState.climbup;
                this._shangpaVec = this._nowselectVec.clone();
            }
        }
        else if (this._nowCollTargetName.indexOf("box_sidejump") != -1) {
            this.nowAction = CharacterState_1.CharacterState.sidespeedup;
        }
        else if (this._nowCollTargetName.indexOf("box_Surmount") != -1) {
            this.nowAction = CharacterState_1.CharacterState.cross;
        }
        else if (this._nowCollTargetName.indexOf("irongauze") != -1) {
            this.nowAction = CharacterState_1.CharacterState.climbup;
            this._shangpaVec = this._nowselectVec.clone();
        }
    };
    Player.prototype.JumpAction = function (value) {
        if (value > 0) {
            this.nowAction = CharacterState_1.CharacterState.jumpright;
            // this.setJump( this.nowAction );
        }
        else if (value < 0) {
            this.nowAction = CharacterState_1.CharacterState.jumpleft;
            // this.setJump( this.nowAction );
        }
        else {
            this.nowAction = CharacterState_1.CharacterState.jump;
            // this.setJump( this.nowAction );
        }
    };
    Player.prototype.PlayAnimator = function (actionName) {
        var _actionname = this.TransitionActionName(actionName);
        this._StateName = actionName;
        if (this._animator) {
            if (this._StateName == CharacterState_1.CharacterState.climbend || this._StateName == CharacterState_1.CharacterState.land1 || this._StateName == CharacterState_1.CharacterState.land2) {
                this._animator.speed = 1.5;
            }
            else {
                this._animator.speed = 1;
            }
            this._animator.play(_actionname, 0, 0);
        }
    };
    /**转换动作名称 */
    Player.prototype.TransitionActionName = function (_actionname) {
        switch (_actionname) {
            case "rollover1":
                return "cefan1";
            case "rollover2":
                return "cefan2";
            case "runwallleft":
                return "paoqiangleft";
            case "rightjump":
                return "rightjump";
            case "runwallright":
                return "paoqiangright";
            case "leftjump":
                return "leftjump";
            case "climbwall":
                return "paqiang";
            case "climbend":
                return "climbend";
            case "stand":
                return "stand";
            case "sky":
                return "kongzhong";
            case "land1":
                return "luodi1";
            case "land2":
                return "luodi2";
            case "highjump1":
                return "datiao1";
            case "highjump2":
                return "datiao2";
            case "run":
                return "run";
            case "jump":
                return "jump";
            case "climbup":
                return "Climb";
            case "falldown":
                return "Freefalling";
            case "climbleft":
                return "left_climb";
            case "climbright":
                return "right_climb";
            case "jumpright":
                return "right_jump";
            case "jumpleft":
                return "left_jump";
            case "ClimbMotion":
                return "PlayPalouAction";
            case "huachan":
                return "huachan";
            case "hurdle":
                return "kualan";
            case "speedupjump":
                return "jiasuJump";
            case "MoveX":
                return "xshunyi";
            case "downmove":
                return "downSlide";
            case "sidespeedup":
                return "slidejiasu";
            case "cross":
                return "surmount";
            case "climbupblock":
                return "lockclimb";
        }
    };
    Object.defineProperty(Player.prototype, "nowAction", {
        get: function () {
            return this._nowActionState;
        },
        set: function (value) {
            if (this._nowActionState != value || this.LastActionState == CharacterState_1.CharacterState.speedupjump || this._nowActionState == CharacterState_1.CharacterState.speedupjump) {
                this.LastActionState = this._nowActionState;
                this._nowActionState = value;
                this._moveTime = 0;
                this.canshake = false;
                this.ChangeTrial(true);
                switch (this._nowActionState) {
                    case CharacterState_1.CharacterState.stand:
                        this._isActionNums = false;
                        this.PlayAnimator(CharacterState_1.CharacterState.stand);
                        break;
                    case CharacterState_1.CharacterState.run:
                        if (this.LastActionState == CharacterState_1.CharacterState.jump || this.LastActionState == CharacterState_1.CharacterState.jumpleft || this.LastActionState == CharacterState_1.CharacterState.jumpright) {
                            this._isActionNums = true;
                            this._isneedactionnum = 1;
                            var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                            if (sort < 50) {
                                this.PlayAnimator(CharacterState_1.CharacterState.land1);
                            }
                            else {
                                this.PlayAnimator(CharacterState_1.CharacterState.land2);
                            }
                        }
                        else {
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.run);
                        }
                        break;
                    case CharacterState_1.CharacterState.jump:
                        this.PlayAnimator(CharacterState_1.CharacterState.jump);
                        PropManager_1.PropManager.Instance.SetEffectColor("color_white", this._transform.position);
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.jumpSpeed.x = this._RoleData.frontjump.x;
                        this.jumpSpeed.y = this._RoleData.frontjump.y;
                        this.jumpSpeed.z = this._RoleData.frontjump.z;
                        AudioControl_1.AudioControl.Instance.playGameSound("tiao");
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        break;
                    case CharacterState_1.CharacterState.jumpleft:
                        PropManager_1.PropManager.Instance.SetEffectColor("color_white", this._transform.position);
                        this.jumpSpeed.x = this._RoleData.leftjump.x;
                        this.jumpSpeed.y = this._RoleData.leftjump.y;
                        this.jumpSpeed.z = this._RoleData.leftjump.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.PlayAnimator(CharacterState_1.CharacterState.leftjump);
                        AudioControl_1.AudioControl.Instance.playGameSound("tiao");
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        break;
                    case CharacterState_1.CharacterState.jumpright:
                        PropManager_1.PropManager.Instance.SetEffectColor("color_white", this._transform.position);
                        this.jumpSpeed.x = this._RoleData.rightjump.x;
                        this.jumpSpeed.y = this._RoleData.rightjump.y;
                        this.jumpSpeed.z = this._RoleData.rightjump.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.PlayAnimator(CharacterState_1.CharacterState.rightjump);
                        AudioControl_1.AudioControl.Instance.playGameSound("tiao");
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        break;
                    case CharacterState_1.CharacterState.speedupjump:
                        var buildcfg = BuildCFG_1.default.dict["panel_jump"];
                        if (this.buff_speeduptime > 0) {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz * buildcfg.buffz;
                            this.doublespeedup = true;
                        }
                        else {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz;
                        }
                        this.buff_speeduptime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._multiple.x;
                        this.jumpSpeed.y = buildcfg.buffy;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._multiple.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
                        if (sort < 50) {
                            this.PlayAnimator(CharacterState_1.CharacterState.highjump1);
                        }
                        else {
                            this.PlayAnimator(CharacterState_1.CharacterState.highjump2);
                        }
                        AudioControl_1.AudioControl.Instance.playGameSound("tiao");
                        Laya.timer.clear(this, this.playspeedSound);
                        Laya.timer.once(200, this, this.playspeedSound);
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        break;
                    case CharacterState_1.CharacterState.downmove:
                        var buildcfg = BuildCFG_1.default.dict["panel_downslip"];
                        if (this.buff_speeduptime > 0) {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz * buildcfg.buffz;
                            this.doublespeedup = true;
                        }
                        else {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz;
                        }
                        this.buff_speeduptime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._multiple.x;
                        this.jumpSpeed.y = buildcfg.buffy * this._multiple.y;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._multiple.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.PlayAnimator(CharacterState_1.CharacterState.huachan);
                        this.playspeedSound();
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        break;
                    case CharacterState_1.CharacterState.sidespeedup:
                        var buildcfg = BuildCFG_1.default.dict["box_sidejump"];
                        if (this.buff_speeduptime > 0) {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz * buildcfg.buffz;
                            this.doublespeedup = true;
                        }
                        else {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz;
                        }
                        this.buff_speeduptime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._multiple.x;
                        this.jumpSpeed.y = buildcfg.buffy * this._multiple.y;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._multiple.z;
                        this._isActionNums = false;
                        this.playspeedSound();
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        // this.PlayAnimator( CharacterState. );
                        break;
                    case CharacterState_1.CharacterState.cross:
                        var buildcfg = BuildCFG_1.default.dict["box_Surmount"];
                        if (this.buff_speeduptime > 0) {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz * buildcfg.buffz;
                            this.doublespeedup = true;
                        }
                        else {
                            this._multiple.x = 1;
                            this._multiple.y = 1;
                            this._multiple.z = buildcfg.buffz;
                        }
                        this.buff_speeduptime = buildcfg.time;
                        this.jumpSpeed.x = buildcfg.buffx * this._multiple.x;
                        this.jumpSpeed.y = (buildcfg.buffy + 0.5) * this._multiple.y;
                        this.jumpSpeed.z = this._speedMoveV3.z * buildcfg.buffz * this._multiple.z;
                        this._isActionNums = true;
                        this._isneedactionnum = 1;
                        this.PlayAnimator(CharacterState_1.CharacterState.hurdle);
                        break;
                    case CharacterState_1.CharacterState.climbup:
                    case CharacterState_1.CharacterState.climbupblock:
                        this.jumpSpeed.x = 0;
                        this.jumpSpeed.y = this._RoleData.upclimb;
                        this.jumpSpeed.z = 0;
                        this._isActionNums = false;
                        this.PlayAnimator(CharacterState_1.CharacterState.climbwall);
                        WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                        this.canshake = true;
                        this.shaketime = 0;
                        this.ChangeTrial(false);
                        break;
                    case CharacterState_1.CharacterState.climbleft:
                        this.jumpSpeed.x = 0;
                        this.jumpSpeed.y = this._RoleData.slideclimb.y;
                        this.jumpSpeed.z = this._RoleData.slideclimb.z;
                        this._isActionNums = false;
                        this.PlayAnimator(CharacterState_1.CharacterState.runwallleft);
                        this.ChangeTrial(false);
                        break;
                    case CharacterState_1.CharacterState.climbright:
                        this.jumpSpeed.x = 0;
                        this.jumpSpeed.y = this._RoleData.slideclimb.y;
                        this.jumpSpeed.z = this._RoleData.slideclimb.z;
                        this._isActionNums = false;
                        this.PlayAnimator(CharacterState_1.CharacterState.runwallright);
                        this.ChangeTrial(false);
                        break;
                    case CharacterState_1.CharacterState.ClimbMotion:
                        this._isActionNums = true;
                        this._isneedactionnum = 0;
                        this._needactiontime = 0.3;
                        this._moveTime = 0;
                        this.PlayAnimator(CharacterState_1.CharacterState.climbend);
                        break;
                }
            }
        },
        enumerable: true,
        configurable: true
    });
    Player.prototype.playspeedSound = function () {
        AudioControl_1.AudioControl.Instance.playGameSound("speedup");
    };
    Player.prototype.ChangeTrial = function (bo) {
        if (this.LeftTrial && this.RightTrial && this.LeftTrial.active != bo) {
            this.LeftTrial.active = bo;
            this.RightTrial.active = bo;
        }
    };
    Player.prototype.Joy = function (value, value1, angle) {
        if (this.nowAction == CharacterState_1.CharacterState.run) {
            this._changeMoveX = value;
        }
        else if (this.nowAction == CharacterState_1.CharacterState.climbup || CharacterState_1.CharacterState.climbleft || CharacterState_1.CharacterState.climbright) {
            this._changeMoveX = value1;
        }
        if (this.nowAction == CharacterState_1.CharacterState.climbleft && this._changeMoveX > 0) //强制跳跃
         {
            this.isforceJump = true;
            this.nowAction = CharacterState_1.CharacterState.jumpright;
        }
        else if (this.nowAction == CharacterState_1.CharacterState.climbright && this._changeMoveX < 0) {
            this.isforceJump = true;
            this.nowAction = CharacterState_1.CharacterState.jumpleft;
        }
        if (this.nowAction == CharacterState_1.CharacterState.jump ||
            this.nowAction == CharacterState_1.CharacterState.jumpleft ||
            this.nowAction == CharacterState_1.CharacterState.jumpright ||
            this.nowAction == CharacterState_1.CharacterState.speedupjump) {
            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;
        }
    };
    Player.prototype.update = function (dt) {
        dt = 16;
        if (this._iscanMove) {
            var distime = dt / 1000;
            this._moveTime += distime;
            switch (this.nowAction) {
                case CharacterState_1.CharacterState.run: //跑动
                    this._moveVec.y = 0;
                    this._moveVec.z = distime * (this._speedMoveV3.z * this._multiple.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 CharacterState_1.CharacterState.climbup: //爬升
                    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.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                        }
                    }
                    else if (this._nowselectVec) {
                        if (this._transform.position.y + 1 > this._nowselectVec.y) {
                            this.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                        }
                    }
                    break;
                case CharacterState_1.CharacterState.climbupblock:
                    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.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                        }
                    }
                    else if (this._transform.position.y + 1 > this._nowselectVec.y) {
                        this.nowAction = CharacterState_1.CharacterState.ClimbMotion;
                    }
                    break;
                case CharacterState_1.CharacterState.jump: //跳跃
                case CharacterState_1.CharacterState.jumpleft:
                case CharacterState_1.CharacterState.jumpright:
                    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 CharacterState_1.CharacterState.speedupjump:
                    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 CharacterState_1.CharacterState.climbleft:
                case CharacterState_1.CharacterState.climbright:
                    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 CharacterState_1.CharacterState.MoveX:
                    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.nowAction = CharacterState_1.CharacterState.run;
                    }
                    break;
                case CharacterState_1.CharacterState.downmove:
                    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 CharacterState_1.CharacterState.sidespeedup:
                    this._moveVec.y = 0;
                    this._moveVec.x = 0;
                    this._moveVec.z = this.jumpSpeed.z * distime;
                    this._transform.translate(this._moveVec, false);
                    if (this.buff_speeduptime <= 0 && this.LastActionState == CharacterState_1.CharacterState.climbleft || this.LastActionState == CharacterState_1.CharacterState.climbright) {
                        this.nowAction = this.LastActionState;
                    }
                    else {
                        this.nowAction = CharacterState_1.CharacterState.jump;
                    }
                    break;
                case CharacterState_1.CharacterState.cross:
                    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 CharacterState_1.CharacterState.ClimbMotion:
                    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.nowAction == CharacterState_1.CharacterState.run || this.nowAction == CharacterState_1.CharacterState.downmove) && !this._isColling) {
                if (this._transform.position.z <= this._nowselectVec.z) {
                    if (this._changeMoveX > 0) {
                        this.nowAction = CharacterState_1.CharacterState.jumpright;
                    }
                    else if (this._changeMoveX < 0) {
                        this.nowAction = CharacterState_1.CharacterState.jumpleft;
                    }
                    else {
                        this.nowAction = CharacterState_1.CharacterState.jump;
                    }
                }
            }
            if (this._transform.position.y < PropManager_1.PropManager.diePosY - PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.DieDistance) //角色死亡
             {
                if (this._nowscenename == "" || this._nowbuildname == "") {
                    if (GameState_1.GameState.fuhuocishu > 0) {
                        this.Revive();
                    }
                    else {
                        this.Lose();
                    }
                }
                else {
                    if (GameState_1.GameState.fuhuocishu > 0) {
                        this.Revive();
                    }
                    else {
                        this.Lose();
                    }
                }
                this.nowAction = CharacterState_1.CharacterState.stand;
            }
            if (this._transform.position.z < PropManager_1.PropManager.gamewinPosZ) //到达终点
             {
                this.Win();
            }
            else {
                PropManager_1.PropManager.pro_jindu.value = this._transform.position.z / PropManager_1.PropManager.gamewinPosZ * 100;
            }
            if (this._isActionNums) {
                if (this._isneedactionnum > 0) {
                    if (this._animator.getCurrentAnimatorPlayState().normalizedTime >= this._isneedactionnum) {
                        switch (this._StateName) {
                            case CharacterState_1.CharacterState.jump:
                            case CharacterState_1.CharacterState.leftjump:
                            case CharacterState_1.CharacterState.rightjump:
                            case CharacterState_1.CharacterState.highjump1:
                            case CharacterState_1.CharacterState.highjump2:
                            case CharacterState_1.CharacterState.hurdle:
                                this._isActionNums = false;
                                this.PlayAnimator(CharacterState_1.CharacterState.sky);
                                break;
                            case CharacterState_1.CharacterState.huachan:
                            case CharacterState_1.CharacterState.climbend:
                                this._isActionNums = false;
                                this.PlayAnimator(CharacterState_1.CharacterState.run);
                                this.nowAction = CharacterState_1.CharacterState.run;
                                this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                                break;
                            case CharacterState_1.CharacterState.land1:
                            // this._isActionNums = false;
                            // this.PlayAnimator( CharacterState.run );
                            case CharacterState_1.CharacterState.land2:
                                this._isActionNums = false;
                                this.PlayAnimator(CharacterState_1.CharacterState.run);
                                break;
                            case CharacterState_1.CharacterState.huachan:
                                this.nowAction = CharacterState_1.CharacterState.run;
                                break;
                        }
                    }
                }
                else if (this._needactiontime != 0 && this._moveTime > this._needactiontime) {
                    switch (this._StateName) {
                        case CharacterState_1.CharacterState.jump:
                        case CharacterState_1.CharacterState.leftjump:
                        case CharacterState_1.CharacterState.rightjump:
                        case CharacterState_1.CharacterState.highjump1:
                        case CharacterState_1.CharacterState.highjump2:
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.sky);
                            this._changeMoveX = 0;
                            break;
                        case CharacterState_1.CharacterState.hurdle:
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.sky);
                            break;
                        case CharacterState_1.CharacterState.huachan:
                        case CharacterState_1.CharacterState.climbend:
                            this._isActionNums = false;
                            this.PlayAnimator(CharacterState_1.CharacterState.run);
                            this.nowAction = CharacterState_1.CharacterState.run;
                            this._transform.position = new Laya.Vector3(this._transform.position.x, this._nowselectVec.y, this._transform.position.z);
                            break;
                    }
                }
            }
            if (this.buff_speeduptime > 0) {
                this.buff_speeduptime -= distime;
                PropManager_1.PropManager.Instance.SpeedUpEffect("jiasulizi", this._transform.position);
                if (this.doublespeedup) {
                    PropManager_1.PropManager.Instance.SpeedUpEffect1("jiasulizi", this._transform.position);
                }
            }
            else {
                this._multiple.x = 1;
                this._multiple.y = 1;
                this._multiple.z = 1;
                this.doublespeedup = false;
                PropManager_1.PropManager.Instance.CloseSpeedUpEffect();
                PropManager_1.PropManager.Instance.CloseSpeedUpEffect1();
            }
            if (this.canshake) {
                this.shaketime += distime;
                if (this.shaketime >= 0.5) {
                    this.shaketime = 0;
                    WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                }
            }
        }
        else {
            if (this._ending) {
                var distime = dt / 1000;
                this._moveTime += distime;
                if (this._moveTime >= this._endanmotime) {
                    this.GameOver();
                }
                else {
                    this._endAnmoSpeed1.x = this._endAnmoSpeed.x * distime;
                    this._endAnmoSpeed1.y = this._endAnmoSpeed.y * distime;
                    this._endAnmoSpeed1.z = this._endAnmoSpeed.z * distime;
                    PropManager_1.PropManager.carma.getComponent(CameraManager_1.CameraManager).GameEndRotate(this._transform.position, this._endAnmoSpeed1);
                }
            }
        }
    };
    Player.prototype.Win = function () {
        AudioControl_1.AudioControl.Instance.playGameSound("over");
        DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.end);
        var carmaTrans = PropManager_1.PropManager.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.PlayAnimator(CharacterState_1.CharacterState.sky);
        PropManager_1.PropManager.Instance.GameOverEffecf("yanhua", this._transform.position, GameStateControl_1.GameStateControl.Instance.endGamePlayerArr.length == 0 ? true : false);
    };
    /**出现复活界面 */
    Player.prototype.Revive = function () {
        AudioControl_1.AudioControl.Instance.playGameSound("over");
        GameState_1.GameState.isdie = true;
        DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.revive);
        this._iscanMove = false;
        this.PlayAnimator(CharacterState_1.CharacterState.stand);
        // this._ending = true;
    };
    Player.prototype.Lose = function () {
        AudioControl_1.AudioControl.Instance.playGameSound("over");
        GameState_1.GameState.isdie = true;
        DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.lose);
        this._iscanMove = false;
        this.PlayAnimator(CharacterState_1.CharacterState.stand);
        this._ending = true;
    };
    Player.prototype.GameOver = function () {
        this._ending = false;
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
    };
    Player.prototype.TestJump = function () {
        this.nowAction = CharacterState_1.CharacterState.jump;
    };
    Player.prototype.destroy = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.destroy.call(this);
    };
    Player.prototype.XMove = function (state) {
        if (this.nowAction == CharacterState_1.CharacterState.run) {
            this._moveTime = 0;
            this._speedMoveV3.x = state * 20;
            this.nowAction = CharacterState_1.CharacterState.MoveX;
        }
    };
    Player.prototype.dispose = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
    };
    return Player;
}(Laya.Script3D));
exports.Player = Player;
},{"../Agency/AgencyUserMessage":8,"../CFG/BuildCFG":9,"../Control/AudioControl":17,"../Control/GameStateControl":20,"../PrefabControl/CharacterState":44,"../PrefabControl/PanelResDic":46,"../PrefabControl/PropManager":47,"../Time/TimerService":57,"../WXSDK/PlayerAccount":73,"../WXSDK/WXGamePlatform":79,"../utils/DispatcherManager":83,"../utils/GameState":84,"../utils/GameUtils":85,"./CameraManager":36}],39:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global = /** @class */ (function () {
    function Global() {
    }
    Global.curHeight = function () {
        return Laya.stage.height;
    };
    Global.curWidth = function () {
        return Laya.stage.width;
    };
    Global.setVars = function () {
        Global.stage = Laya.stage;
        Global.sethttpurl();
    };
    Global.getUrl = function (url) {
        if (url.indexOf("wxlocal") == -1) {
            return Global.resourcehtttp + url + Global.versions;
        }
        return url;
    };
    Global.sethttpurl = function () {
        if (Global.isdebug) {
            Global.httpurl = "https://wxgamedev.51yoyoyo.com/";
        }
        else {
            Global.httpurl = "https://minport.51yoyoyo.com/";
        }
    };
    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;
    return Global;
}());
exports.Global = Global;
},{}],40:[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.GlobalWaiting = GlobalWaiting;
},{}],41:[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.mLastMouseX = 0;
        _this.mLastMouseY = 0;
        _this.mX = 0;
        _this.mY = 0;
        _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.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.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.createMap = function () {
        //创建地图对象
        this.tiledMap = new Laya.TiledMap();
        this.mX = this.mY = 0;
        //创建地图，适当的时候调用destory销毁地图
        this.tiledMap.createMap("res/tiledMap/desert.json", new Laya.Rectangle(0, 0, Laya.Browser.width, Laya.Browser.height), new Laya.Handler(this, this.completeHandler));
    };
    /**
     * 地图加载完成的回调
     */
    JoystickModule.prototype.completeHandler = function () {
        console.log("地图创建完成");
        console.log("ClientW:" + Laya.Browser.clientWidth + " ClientH:" + Laya.Browser.clientHeight);
    };
    /************************************************* */
    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;
},{}],42:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Global_1 = require("./Global");
var Stage = Laya.Stage;
var AssetPath_1 = require("./Config/AssetPath");
var GameContents_1 = require("./GameContents");
var Sdk_1 = require("./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.window.tt) {
            // 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();
        AssetPath_1.AssetPath.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();
},{"./Config/AssetPath":15,"./GameContents":35,"./Global":39,"./WXSDK/Sdk":75}],43:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AssetPath_1 = require("../Config/AssetPath");
var CharacterPool = /** @class */ (function () {
    function CharacterPool() {
    }
    CharacterPool.AddCharacter = function (resouceName, clas, parent) {
        var skinnedmesh;
        var arr = CharacterPool.roledict[resouceName];
        if (arr && arr.length > 0) {
            skinnedmesh = arr.shift();
            skinnedmesh.active = true;
            parent.addChild(skinnedmesh);
        }
        else {
            var sp = Laya.Loader.getRes(AssetPath_1.AssetPath.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;
    };
    CharacterPool.ClearCharacter = function (sp, resouceName, cla) {
        if (!CharacterPool.roledict[resouceName]) {
            CharacterPool.roledict[resouceName] = [];
        }
        if (cla) {
            cla.destroy();
        }
        sp.active = false;
        sp.removeSelf();
        CharacterPool.roledict[resouceName].push(sp);
    };
    CharacterPool.roledict = {};
    return CharacterPool;
}());
exports.CharacterPool = CharacterPool;
},{"../Config/AssetPath":15}],44:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CharacterState = /** @class */ (function () {
    function CharacterState() {
    }
    /**侧翻  cefan1 */
    CharacterState.rollover1 = "rollover1";
    /**侧翻  cefan2 */
    CharacterState.rollover2 = "rollover2";
    /**跑墙左  paoqiangleft */
    CharacterState.runwallleft = "runwallleft";
    /**右跳  rightjump */
    CharacterState.rightjump = "rightjump";
    /**跑墙右  paoqiangright */
    CharacterState.runwallright = "runwallright";
    /**左跳  leftjump*/
    CharacterState.leftjump = "leftjump";
    /**爬墙  paqiang */
    CharacterState.climbwall = "climbwall";
    /** ？   climbend */
    CharacterState.climbend = "climbend";
    /**站立  stand*/
    CharacterState.stand = "stand";
    /**空中  kongzhong */
    CharacterState.sky = "sky";
    /**落地  luodi1 */
    CharacterState.land1 = "land1";
    /**落地  luodi2 */
    CharacterState.land2 = "land2";
    /**大跳  datiao1 */
    CharacterState.highjump1 = "highjump1";
    /**大跳  datiao2 */
    CharacterState.highjump2 = "highjump2";
    /**跑动 run */
    CharacterState.run = "run";
    /**跳跃 jump*/
    CharacterState.jump = "jump";
    /**爬升  Climb */
    CharacterState.climbup = "climbup";
    /**自由落体 Freefalling */
    CharacterState.falldown = "falldown";
    /**左爬  left_climb */
    CharacterState.climbleft = "climbleft";
    /**右爬  right_climb*/
    CharacterState.climbright = "climbright";
    /**右跳 right_jump */
    CharacterState.jumpright = "jumpright";
    /**左跳 left_jump */
    CharacterState.jumpleft = "jumpleft";
    /** PlayPalouAction*/
    CharacterState.ClimbMotion = "ClimbMotion";
    /** ？  huachan */
    CharacterState.huachan = "huachan";
    /**跨栏  kualan */
    CharacterState.hurdle = "hurdle";
    /**
     * 加速板跳跃 jiasuJump
     */
    CharacterState.speedupjump = "speedupjump";
    /**
     * x方向瞬移  xshunyi
     */
    CharacterState.MoveX = "MoveX";
    /**
     * 下滑位移 downSlide
     */
    CharacterState.downmove = "downmove";
    /**
     * 侧面加速  slidejiasu
     */
    CharacterState.sidespeedup = "sidespeedup";
    /**
     * 翻越  surmount
     */
    CharacterState.cross = "cross";
    /**
     * 锁定爬升  lockclimb
     */
    CharacterState.climbupblock = "climbupblock";
    return CharacterState;
}());
exports.CharacterState = CharacterState;
},{}],45:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*
* 对象池类
*/
var Animation = Laya.Animation;
var GamePool = /** @class */ (function (_super) {
    __extends(GamePool, _super);
    function GamePool() {
        var _this = _super.call(this) || this;
        _this.AniConfPath = "res/fighter/fighter.json";
        return _this;
    }
    GamePool.RemoveItem = function (key, obj) {
        if (GamePool.contain[key]) {
            var index = GamePool.contain[key].indexOf(obj);
            if (index == -1) {
                GamePool.contain[key].push(obj);
            }
        }
    };
    GamePool.GetItem = function (key) {
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        if (GamePool.contain[key]) {
            var arr = GamePool.contain[key];
            if (arr.length == 0) {
                var calssobj = GamePool.sprite3DArray[key];
                var vo = new calssobj();
                return vo;
            }
            return GamePool.contain[key].shift();
        }
        else {
            console.log("此key值对应的类未被注册");
            return null;
        }
    };
    /******************************************* */
    GamePool.prototype.createAnimation = function () {
        var ani = new Animation();
        ani.loadAtlas(this.AniConfPath); // 加载图集动画
        ani.interval = 30; // 设置播放间隔（单位：毫秒）
        ani.index = 1; // 当前播放索引
        ani.play(); // 播放图集动画
        // 获取动画的边界信息
        var bounds = ani.getGraphicBounds();
        ani.pivot(bounds.width / 2, bounds.height / 2);
        ani.pos(Laya.stage.width / 2, Laya.stage.height / 2);
        Laya.stage.addChild(ani);
    };
    /******************************************* */
    GamePool.GetItemFairyGUI = function (url) {
        if (!GamePool.contain[url]) {
            GamePool.contain[url] = [];
        }
        var arr = GamePool.contain[url];
        if (arr.length == 0) {
            var vo = fairygui.UIPackage.createObjectFromURL(url);
            return vo;
        }
        return GamePool.contain[url].shift();
    };
    GamePool.Mark = function (key, classarg) {
        GamePool.sprite3DArray[key] = classarg;
        GamePool.contain[key] = [];
    };
    GamePool.sprite3DArray = {};
    GamePool.contain = {};
    return GamePool;
}(Laya.EventDispatcher));
exports.GamePool = GamePool;
},{}],46:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Singleton_1 = require("../utils/Singleton");
/*
* name;
*/
var PanelResDic = /** @class */ (function (_super) {
    __extends(PanelResDic, _super);
    function PanelResDic() {
        var _this = _super.call(this) || this;
        PanelResDic.ins = _this;
        return _this;
    }
    Object.defineProperty(PanelResDic, "Instance", {
        get: function () {
            if (PanelResDic.ins == null) {
                return new PanelResDic();
            }
            return PanelResDic.ins;
        },
        enumerable: true,
        configurable: true
    });
    PanelResDic.getView = function (viewkey) {
        if (!PanelResDic._mapviewDict[viewkey]) {
            throw "err0 未绑定的viewkey:" + viewkey;
        }
        return PanelResDic._mapviewDict[viewkey];
    };
    PanelResDic.prototype.getSingleTon = function (ref) {
        return Singleton_1.Singleton.Instance(ref);
    };
    PanelResDic.prototype.mapView = function (viewkey, ref) {
        if (!PanelResDic._mapviewDict[viewkey]) {
            PanelResDic._mapviewDict[viewkey] = ref;
            ref.key = viewkey;
        }
    };
    PanelResDic.prototype.AgencyAdd = function (ref) {
        Singleton_1.Singleton.create(ref);
    };
    PanelResDic.prototype.AgencyClear = function (ref) {
        Singleton_1.Singleton.remove(ref);
    };
    PanelResDic._mapviewDict = {};
    return PanelResDic;
}(Laya.EventDispatcher));
exports.PanelResDic = PanelResDic;
},{"../utils/Singleton":89}],47:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AssetPath_1 = require("../Config/AssetPath");
var GameUtils_1 = require("../utils/GameUtils");
var PropManager = /** @class */ (function () {
    function PropManager() {
        this._outQUaternion4 = new Laya.Quaternion;
        this._outQUaternion = new Laya.Quaternion;
        PropManager.ins = this;
    }
    Object.defineProperty(PropManager, "Instance", {
        get: function () {
            if (PropManager.ins == null) {
                return new PropManager();
            }
            return PropManager.ins;
        },
        enumerable: true,
        configurable: true
    });
    PropManager.getPosVecbyScene = function (sceneName, buildname) {
        if (PropManager.patternDict[sceneName]) {
            return PropManager.patternDict[sceneName][buildname];
        }
        return null;
    };
    /**
     * @param animator
     * @param animatorDict
     */
    PropManager.setAnimator = function (animator) {
        var chiddict;
        for (var s in PropManager.actionDict) {
            if (!animator.getControllerLayer().getAnimatorState(s)) {
                chiddict = PropManager.actionDict[s];
                //创建一个动画动作状态
                var state1 = new Laya.AnimatorState();
                //设置动作状态的名称
                state1.name = s;
                //设置动作状态播放的起始时间（起始时间与结束时间的设置为0-1的百分比数值）  要截取的时间点 / 动画的总时长
                state1.clipStart = chiddict.s / PropManager.actionnums;
                //设置动作状态播放的结束时间
                state1.clipEnd = chiddict.e / PropManager.actionnums;
                //得到默认动画赋值给Clip（getDefaultState默认动画为Unity中animation的数组顺序0下标的动画）
                state1.clip = animator.getDefaultState().clip;
                //动画播放是否循环
                state1.clip.islooping = chiddict.islooping;
                //添加动画状态到动画组件里
                animator.addState(state1);
            }
        }
    };
    PropManager.prototype.InitEffect = function () {
        var lizi = PropManager.getlizibyName("speedupeffect");
        lizi.particleSystem.play();
        lizi.active = false;
        var lizi = PropManager.getlizibyName("color_white");
        lizi.particleSystem.play();
        lizi.active = false;
        var lizi = PropManager.getlizibyName("color_yellow");
        lizi.particleSystem.play();
        lizi.active = false;
    };
    PropManager.prototype.SetEffectColor = function (name, pos) {
        var closetime = 0;
        Laya.timer.clear(this, this.EffectEnd);
        this.EffectEndColor();
        if (name == "color_white") {
            var sort = GameUtils_1.GameUtils.randRangeint(0, 100);
            if (sort > 50) {
                name = "color_yellow";
            }
        }
        closetime = 500;
        this._tanselizi = PropManager.getlizibyName(name);
        this._tanselizi.transform.position = pos;
        this._tanselizi.particleSystem.play();
        if (closetime != 0) {
            Laya.timer.once(closetime, this, this.EffectEndColor);
        }
    };
    PropManager.prototype.EffectEndColor = function () {
        if (this._tanselizi) {
            this._tanselizi.particleSystem.stop();
            this._tanselizi.active = false;
        }
    };
    PropManager.prototype.SpeedUpEffect1 = function (name, pos) {
        if (!this._engamelizi4 || (this._engamelizi4 && !this._engamelizi4.active)) {
            this._engamelizi4 = PropManager.getlizibyName("speedupeffect");
            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;
    };
    PropManager.prototype.CloseSpeedUpEffect1 = function () {
        if (this._engamelizi4 && this._engamelizi4.active) {
            this._engamelizi4.active = false;
        }
    };
    PropManager.prototype.SpeedUpEffect = function (name, pos) {
        if (!this._engamelizi3 || (this._engamelizi3 && !this._engamelizi3.active)) {
            this._engamelizi3 = PropManager.getlizibyName("speedupeffect");
            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;
    };
    PropManager.prototype.CloseSpeedUpEffect = function () {
        if (this._engamelizi3 && this._engamelizi3.active) {
            this._engamelizi3.active = false;
        }
    };
    PropManager.prototype.GameOverEffecf = function (name, pos, iswin) {
        this._engamelizi1 = PropManager.getlizibyName("fireworks");
        this._engamelizi1.transform.position = pos;
        this._engamelizi1.particleSystem.play();
        if (iswin) {
            this._engamelizi2 = PropManager.getlizibyName("winline");
            this._engamelizi2.transform.position = pos;
            this._engamelizi2.particleSystem.play();
        }
    };
    PropManager.prototype.CloseGameOverEffect = 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 = PropManager.getlizibyName( name );
    //     lizi.transform.position = pos;
    //     lizi.particleSystem.play();
    //     if( closetime != 0 )
    //     {
    //         Laya.timer.once( closetime,this,this.liziend,[lizi] );
    //     }
    // }
    PropManager.prototype.EffectEnd = function (lizi) {
        if (lizi) {
            lizi.particleSystem.stop();
            lizi.active = false;
        }
    };
    PropManager.getlizibyName = function (name) {
        var lizisp;
        if (PropManager.liziDict[name]) {
            lizisp = PropManager.liziDict[name];
        }
        else {
            lizisp = Laya.Sprite3D.instantiate(Laya.Loader.getRes(AssetPath_1.AssetPath.get3DModel(name)));
            PropManager.liziDict[name] = lizisp;
            PropManager.scene3D.addChild(lizisp);
        }
        lizisp.active = true;
        return lizisp;
    };
    PropManager.nowmapDict = {};
    PropManager.diePosY = 0;
    PropManager.gamewinPosZ = 0;
    PropManager.patternDict = {};
    PropManager.npcDict = {};
    PropManager.npcscriptDict = {};
    PropManager.npcnum = 0;
    PropManager.iscarmanpc = false;
    PropManager.liziDict = {};
    PropManager.jiantouArr = [];
    // /**
    //  * 判断是否爬到顶端
    //  */
    // static checkisClimbTop( sceneName:string,buildname:string, pos:Laya.Vector3 ):boolean
    // {
    //     var vec:Laya.Vector3 = PropManager.getPosVecbyScene( sceneName,buildname );
    //     if( vec && Math.abs(vec.y - pos.y) < 1.5 )
    //     {
    //         return true;
    //     }
    //     return false;
    // }
    PropManager.actionnums = 575;
    PropManager.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 PropManager;
}());
exports.PropManager = PropManager;
},{"../Config/AssetPath":15,"../utils/GameUtils":85}],48:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelChildControl_1 = require("../Control/PanelChildControl");
var CpaEvent_1 = require("./CpaEvent");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var RecommendView_1 = require("./RecommendView");
var TimerService_1 = require("../Time/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 () {
        console.log("监听互推事件---BaokuanGame0");
        this.AddEventData(CpaEvent_1.default.YQHomeData, this, this.yqhomedataHandler);
    };
    BaoKuanGameView.prototype.yqhomedataHandler = function () {
        console.log("监听互推事件---BaokuanGame1");
        this.RefreshBKYX();
        TimerService_1.TimerService.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;
        console.log("监听互推事件---BaokuanGame2");
        this.c_state.selectedIndex = 1;
        var datas = RecommendView_1.Recommend.cainixihuanData;
        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, true);
            if (curdata == null)
                continue;
        }
        this.key += 4;
        if (this.key >= datas.length - 1) {
            this.key = 0;
        }
        this._istart = true;
        if (isanmo) {
            this.t0.play(null, 1);
        }
    };
    return BaoKuanGameView;
}(PanelChildControl_1.PanelChildControl));
exports.default = BaoKuanGameView;
},{"../Control/PanelChildControl":24,"../Time/TimerService":57,"../WXSDK/PlayerAccount":73,"./CpaEvent":51,"./RecommendView":53}],49:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var RecommendView_1 = require("./RecommendView");
var ViewManager_1 = require("../View/ViewManager");
var TimerService_1 = require("../Time/TimerService");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
var CompletePanel_1 = require("../View/CompletePanel");
var RoleData_1 = require("../Data/RoleData");
var ChoutiPanView = /** @class */ (function (_super) {
    __extends(ChoutiPanView, _super);
    function ChoutiPanView(end) {
        var _this = _super.call(this, "main", "choutipanView") || this;
        _this._iscanmove = false;
        _this.isend = 0;
        _this._movetime = 0;
        _this._flushtime = 0;
        _this.dir = true;
        _this._nowvalue = 0;
        _this.isend = end;
        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.TimerService.Instance.addUpdateTarget(this);
    };
    ChoutiPanView.prototype.initEvent = function () {
        this.AddEventByType(this.btn_return, Laya.Event.CLICK, this, this.onclosefun);
        this.AddEventByType(this.btn_jixugame, Laya.Event.CLICK, this, this.onclosefun);
        this.AddEventByType(this.list_1, Laya.Event.MOUSE_DOWN, this, this.downclick);
        this.AddEventByType(this.list_1, Laya.Event.MOUSE_UP, this, this.upclick);
        this.AddEventByType(this.list_1, 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_1.scrollPane.percY;
            Laya.timer.once(2000, this, this.timeoutCallback);
        }
    };
    ChoutiPanView.prototype.update = function (dt) {
        if (this._isStart) {
            if (this.list_1.scrollPane && this._nowList1 && 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_1.scrollPane.setPercY(this._nowvalue);
            }
        }
    };
    ChoutiPanView.prototype.onclosefun = function () {
        if (this.isend == 1) {
            ViewManager_1.ViewManager.Instance.close(ChoutiPanView);
            DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.lose);
        }
        else if (this.isend == 2) {
            var gold = RoleData_1.RoleData.Instance.levelcfg.winGold;
            ViewManager_1.ViewManager.Instance.close(ChoutiPanView);
            ViewManager_1.ViewManager.Instance.add(CompletePanel_1.CompletePanel, gold);
        }
        else {
            ViewManager_1.ViewManager.Instance.close(ChoutiPanView);
        }
    };
    ChoutiPanView.prototype.destory = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.destory.call(this);
    };
    ChoutiPanView.key = "ChoutiPanView";
    return ChoutiPanView;
}(PanelBaseControl_1.PanelBaseControl));
exports.default = ChoutiPanView;
},{"../Control/PanelBaseControl":23,"../Data/RoleData":31,"../Time/TimerService":57,"../View/CompletePanel":59,"../View/ViewManager":68,"../utils/DispatcherManager":83,"../utils/GameState":84,"./RecommendView":53}],50:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelChildControl_1 = require("../Control/PanelChildControl");
var CpaEvent_1 = require("./CpaEvent");
var RecommendView_1 = require("./RecommendView");
var TimerService_1 = require("../Time/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.AddEventData(CpaEvent_1.default.YQHomeData, this, this.yqhomedataHandler);
        this.AddEventByType(this.list_0, Laya.Event.MOUSE_DOWN, this, this.downclick);
        this.AddEventByType(this.list_0, Laya.Event.MOUSE_UP, this, this.upclick);
        this.AddEventByType(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);
        // ttad.CreateMoreGameBtn();
    };
    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], true);
        }
    };
    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._isStart = true;
        this._iscanmove = true;
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
    };
    CpaDownsView.prototype.dispose = function () {
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.dispose.call(this);
    };
    return CpaDownsView;
}(PanelChildControl_1.PanelChildControl));
exports.default = CpaDownsView;
},{"../Control/PanelChildControl":24,"../Time/TimerService":57,"./CpaEvent":51,"./RecommendView":53}],51:[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;
},{}],52:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelChildControl_1 = require("../Control/PanelChildControl");
var GameUtils_1 = require("../utils/GameUtils");
var FYHD_Sdk_1 = require("../WXSDK/FYHD_Sdk");
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.AddEventByType(this, Laya.Event.CLICK, this, this.onbtnclick);
    };
    CpaItem.prototype.onbtnclick = function () {
        if (this._vo) {
            var data = this._vo;
            FYHD_Sdk_1.FYHD_Sdk.ShowHuTuiJump(data, this.ispenchoutipan);
            // var appid = data.to_appid;
            // var path = data.jump_path;
            // let param = {"appId":appid.toString(),"path":path.toString()};
            // if(Laya.Browser.onMobile)
            // {
            //     Laya.Browser.window.wx.navigateToMiniProgram(
            //     {
            //         appId:appid.toString(),
            //         path:path.toString(),
            //         success:res=>
            //         {
            //             WxApi.recordAldEvent("跳转到游戏失成功","1");
            //         },
            //         fail:res=>
            //         {
            //             if( this.ispenchoutipan )
            //             {
            //                 ViewManager.Instance.add( ChoutiPanView );
            //             }
            //         }
            //     });
            // }
        }
    };
    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.icon;
            if (this.txt_word) {
                this.txt_word.text = data.togame_name;
            }
            if (this.img_tip) {
                this.img_tip.visible = Math.random() > 0.5 ? true : false;
            }
            if (this.txt_word1) {
                this.txt_word1.text = GameUtils_1.GameUtils.randRangeint(235470, 1561430).toString() + "人玩";
            }
        }
    };
    return CpaItem;
}(PanelChildControl_1.PanelChildControl));
exports.default = CpaItem;
},{"../Control/PanelChildControl":24,"../WXSDK/FYHD_Sdk":69,"../utils/GameUtils":85}],53:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DispatcherManager_1 = require("../utils/DispatcherManager");
var CpaEvent_1 = require("./CpaEvent");
var FYHD_Sdk_1 = require("../WXSDK/FYHD_Sdk");
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 FYHD_Sdk_1.FYHD_Sdk.pushData) {
            Recommend.recommendDic[FYHD_Sdk_1.FYHD_Sdk.pushData[key].location_flg] = new recommendPan(FYHD_Sdk_1.FYHD_Sdk.pushData[key]);
        }
        Recommend.getdata = true;
        DispatcherManager_1.DispatcherManager.dispatchEvent(CpaEvent_1.default.YQHomeData);
        console.log("互推数据初始化recommend--------------");
    };
    Recommend.GetSSDatas = function () {
        var items = [];
        if (!FYHD_Sdk_1.FYHD_Sdk.pushData)
            return items;
        for (var i = 0; i < FYHD_Sdk_1.FYHD_Sdk.pushData.length; i++) {
            items.push(new RecommendItem(FYHD_Sdk_1.FYHD_Sdk.pushData[i]));
        }
        return items;
    };
    Recommend.GetCaiNiXiaHuanDatas = function () {
        var items = [];
        if (!FYHD_Sdk_1.FYHD_Sdk.pushData)
            return items;
        for (var i = 0; i < FYHD_Sdk_1.FYHD_Sdk.pushData.length; i++) {
            items.push(new RecommendItem(FYHD_Sdk_1.FYHD_Sdk.pushData[i]));
        }
        return items;
    };
    Recommend.GetMoreDatas = function () {
        var items = [];
        if (!FYHD_Sdk_1.FYHD_Sdk.pushData)
            return items;
        for (var i = 0; i < FYHD_Sdk_1.FYHD_Sdk.pushData.length; i++) {
            items.push(new RecommendItem(FYHD_Sdk_1.FYHD_Sdk.pushData[i]));
        }
        return items;
    };
    Recommend.GetBaoKuanYouXiDatas = function () {
        var items = [];
        if (!FYHD_Sdk_1.FYHD_Sdk.pushData)
            return items;
        for (var i = 0; i < FYHD_Sdk_1.FYHD_Sdk.pushData.length; i++) {
            items.push(new RecommendItem(FYHD_Sdk_1.FYHD_Sdk.pushData[i]));
        }
        return items;
    };
    Recommend.GetJIeSuanDatas = function () {
        var items = [];
        if (!FYHD_Sdk_1.FYHD_Sdk.pushData)
            return items;
        for (var i = 0; i < FYHD_Sdk_1.FYHD_Sdk.pushData.length; i++) {
            items.push(new RecommendItem(FYHD_Sdk_1.FYHD_Sdk.pushData[i]));
        }
        return items;
    };
    Recommend.GetGDYXDatas = function () {
        var items = [];
        if (!FYHD_Sdk_1.FYHD_Sdk.pushData)
            return items;
        for (var i = 0; i < FYHD_Sdk_1.FYHD_Sdk.pushData.length; i++) {
            items.push(new RecommendItem(FYHD_Sdk_1.FYHD_Sdk.pushData[i]));
        }
        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.icon = Data["icon"];
        this.to_appid = Data["to_appid"];
        this.togame_name = Data["togame_name"];
        this.jump_path = Data["jump_path"];
        this.jump_type = Data["jump_type"];
        this.panel = Data["panel"];
        this.qrcode = Data["qrcode"];
    }
    return RecommendItem;
}());
exports.RecommendItem = RecommendItem;
var RecommendView = /** @class */ (function () {
    function RecommendView() {
    }
    return RecommendView;
}());
exports.default = RecommendView;
},{"../WXSDK/FYHD_Sdk":69,"../utils/DispatcherManager":83,"./CpaEvent":51}],54:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelChildControl_1 = require("../Control/PanelChildControl");
var RecommendView_1 = require("./RecommendView");
var TimerService_1 = require("../Time/TimerService");
// import { ttad } from "../ttad";
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._isStart = true;
            this._iscanmove = true;
            TimerService_1.TimerService.Instance.addUpdateTarget(this);
        }
        else {
            this.visible = false;
        }
    };
    ShiwantuijianView.prototype.initEvent = function () {
        this.AddEventByType(this.list_0, Laya.Event.MOUSE_DOWN, this, this.downclick);
        this.AddEventByType(this.list_0, Laya.Event.MOUSE_UP, this, this.upclick);
        this.AddEventByType(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);
        // ttad.CreateMoreGameBtn();
    };
    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.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.dispose.call(this);
    };
    return ShiwantuijianView;
}(PanelChildControl_1.PanelChildControl));
exports.default = ShiwantuijianView;
},{"../Control/PanelChildControl":24,"../Time/TimerService":57,"./RecommendView":53}],55:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RecommendView_1 = require("./RecommendView");
var ViewManager_1 = require("../View/ViewManager");
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var GameUtils_1 = require("../utils/GameUtils");
var FYHD_Sdk_1 = require("../WXSDK/FYHD_Sdk");
var TuijianView = /** @class */ (function (_super) {
    __extends(TuijianView, _super);
    function TuijianView() {
        return _super.call(this, "main", "tuijianView") || this;
    }
    TuijianView.prototype.initView = function () {
        this.list_1.setVirtual();
        this.list_1.itemRenderer = Laya.Handler.create(this, this.itemrenderlist1, null, false);
        this.list_2.setVirtual();
        this.list_2.itemRenderer = Laya.Handler.create(this, this.itemrenderlist2, null, false);
        this._nowlist1 = RecommendView_1.Recommend.gdyxData;
        this._nowlist2 = RecommendView_1.Recommend.gdyxData;
        this.list_1.numItems = 7;
        this.list_2.numItems = this._nowlist2.length;
    };
    TuijianView.prototype.initEvent = function () {
        this.AddEventByType(this.btn_close, Laya.Event.CLICK, this, this.onclosefun);
        this.AddEventByType(this.more, Laya.Event.CLICK, this, this.JumpApp);
    };
    TuijianView.prototype.itemrenderlist1 = function (index, item) {
        if (index < 7) {
            item.showData(this._nowlist1[index]);
        }
    };
    TuijianView.prototype.itemrenderlist2 = function (index, item) {
        if (index < this._nowlist2.length) {
            item.showData(this._nowlist2[index]);
        }
    };
    TuijianView.prototype.onclosefun = function () {
        ViewManager_1.ViewManager.Instance.close(TuijianView);
    };
    //随机跳转游戏
    TuijianView.prototype.JumpApp = function () {
        var ran = GameUtils_1.GameUtils.randRangeint(0, this._nowlist1.length - 1);
        FYHD_Sdk_1.FYHD_Sdk.ShowHuTuiJump(this._nowlist1[ran], false);
    };
    TuijianView.key = "TuijianView";
    return TuijianView;
}(PanelBaseControl_1.PanelBaseControl));
exports.default = TuijianView;
},{"../Control/PanelBaseControl":23,"../View/ViewManager":68,"../WXSDK/FYHD_Sdk":69,"../utils/GameUtils":85,"./RecommendView":53}],56:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TimeUtils = /** @class */ (function () {
    function TimeUtils() {
    }
    /**
     * 月/日 小时:分钟
     * @param value
     */
    TimeUtils.formatData = function (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;
    };
    /**
     * 月/日
     * @param value
     */
    TimeUtils.formatData1 = function (value) {
        var str = "";
        var date = new Date(value * 1000);
        str = (date.getMonth() + 1) + "月" + date.getDate() + "日";
        return str;
    };
    /**
     * 年月日
     * @param value
     */
    TimeUtils.formatYearMonthDate = function (value) {
        var str = "";
        var date = new Date(value * 1000);
        str = date.getFullYear() + "." + (date.getMonth() + 1) + "." + date.getDate();
        return str;
    };
    /**
     * 年-月-日
     * @param value
     */
    TimeUtils.formatYearMonthDate1 = function (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.LXandJXTimeType = function (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;
    };
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回24:59:59
     */
    TimeUtils.formatTime = function (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;
    };
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回24小时59分59秒
     */
    TimeUtils.formatTime1 = function (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;
    };
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回1小时24分10秒
     */
    TimeUtils.formatTime5 = function (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;
    };
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回1天24小时59分59秒
     */
    TimeUtils.formatTime2 = function (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;
    };
    /**
     * 格式化时间
     * @param time 秒
     * @return 返回1天24小时（ 只保留两个 ）
     */
    TimeUtils.formatTime6 = function (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;
    };
    /**
 * 格式化时间
 * @param time 秒
 * @return 返回1天24小时59分
 */
    TimeUtils.formatTime3 = function (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;
    };
    /**
* 格式化时间
* @param time 秒
* @return 返回1天24小时59分
*/
    TimeUtils.formatTime4 = function (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;
    };
    /**
* 格式化时间
* @param time 秒
* @return 返回1天24小时59分
*/
    TimeUtils.formatTime4Arr = function (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.getTwo = function (value) {
        var str = String(value);
        if (str.length < 2) {
            str = "0" + str;
        }
        return str;
    };
    /**
     * 日期转时间戳
     * @param str 2018-1-1
     */
    TimeUtils.datetoTime = function (str) {
        return Date.parse(str) / 1000;
    };
    return TimeUtils;
}());
exports.TimeUtils = TimeUtils;
},{}],57:[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 = [];
        TimerService.ins = _this;
        return _this;
    }
    Object.defineProperty(TimerService, "Instance", {
        get: function () {
            if (TimerService.ins == null) {
                return new TimerService();
            }
            return TimerService.ins;
        },
        enumerable: true,
        configurable: true
    });
    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.TimerService = TimerService;
},{}],58:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var UserDataInfo_1 = require("../Data/UserDataInfo");
var LocalDataControl_1 = require("../Control/LocalDataControl");
var TimesTamper = /** @class */ (function () {
    function TimesTamper() {
        this.lastgameTime = 0;
        /**
         * 同步服务器时间(秒)
         */
        this._serverTime = 0;
        this.iscan = false;
        this._onlinedistime = 0;
        this._time = 0;
        this._onlinetime = 0;
    }
    Object.defineProperty(TimesTamper, "Instance", {
        get: function () {
            if (TimesTamper.ins == null) {
                return new TimesTamper();
            }
            return TimesTamper.ins;
        },
        enumerable: true,
        configurable: true
    });
    TimesTamper.prototype.init = function () {
        this.lastgameTime = LocalDataControl_1.LocalDataControl.Instance.getnum(UserDataInfo_1.UserDataInfo.lasttime);
        Laya.timer.frameLoop(1, this, this.update);
    };
    TimesTamper.prototype.updateServiceTime = function (serverTime) {
        this._serverTime = Number(serverTime);
        this.iscan = true;
        this._onlinedistime = this._serverTime;
        LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.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;
                LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.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;
        }
    };
    Object.defineProperty(TimesTamper.prototype, "serverTime", {
        /**
         * 服务器时间 ( 秒 )
         * @return
         *
         */
        get: function () {
            return this._serverTime;
        },
        enumerable: true,
        configurable: true
    });
    return TimesTamper;
}());
exports.TimesTamper = TimesTamper;
},{"../Control/LocalDataControl":22,"../Data/UserDataInfo":33}],59:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var ViewAction_1 = require("../utils/ViewAction");
var GameStateControl_1 = require("../Control/GameStateControl");
var AgencyUserMessage_1 = require("../Agency/AgencyUserMessage");
var AgencyInGame_1 = require("../Agency/AgencyInGame");
var ViewManager_1 = require("../View/ViewManager");
var GuangGao_1 = require("../WXSDK/GuangGao");
var GameState_1 = require("../utils/GameState");
var Player_1 = require("../Game/Player");
var PropManager_1 = require("../PrefabControl/PropManager");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var CharacterState_1 = require("../PrefabControl/CharacterState");
var RecordManager_1 = require("../WXSDK/RecordManager");
var ttad_1 = require("../WXSDK/ttad");
// import ChoutiPanView from "../Push/ChoutiPanView";
var CompletePanel = /** @class */ (function (_super) {
    __extends(CompletePanel, _super);
    function CompletePanel(gold) {
        var _this = _super.call(this, "main", "gameresult", false, ViewAction_1.ViewAction.ActionType_none, 1) || this;
        _this.getgold = 0;
        _this._position = new Laya.Vector3();
        _this._outPos = new Laya.Vector3();
        _this.scaleDelta = 0;
        _this.scale = new Laya.Vector3(0.1, 0.1, 0.1);
        _this.time = 9;
        _this.count = false;
        _this.fuhuo = false;
        _this.getgold = gold;
        return _this;
    }
    /*************************************************************** */
    CompletePanel.prototype.loadScene = function () {
        Laya.Scene3D.load("res/threeDimen/scene/ParticleScene/Example_01.ls", Laya.Handler.create(this, function (scene) {
            this.scene = Laya.stage.addChildAt(scene, 0);
            var camera = this.scene.addChild(new Laya.Camera(0, 0.1, 100));
            camera.transform.translate(new Laya.Vector3(0, 1, 0));
        }));
    };
    CompletePanel.prototype.garbageCollection = function () {
        this.scene.destroy(); //销毁场景
        this.scene = null;
        Laya.Resource.destroyUnusedResources(); //销毁无用资源(没有被场景树引用,并且没有加资源锁的)
    };
    /*************************************************************** */
    CompletePanel.prototype.btn1click = function () {
        if (this.c_state.selectedIndex == 0) {
            this.getProxy(AgencyUserMessage_1.AgencyUserMessage).GoldUp(this.getgold);
            this.getProxy(AgencyUserMessage_1.AgencyUserMessage).LevelUp();
            this._gameProxy.returnmainview(true);
        }
        else if (this.c_state.selectedIndex == 1) {
            this.getProxy(AgencyUserMessage_1.AgencyUserMessage).GoldUp(this.getgold);
            this._gameProxy.returnmainview();
            // ViewManager.Instance.add( ChoutiPanView );
        }
        else if (this.c_state.selectedIndex == 2) {
            // ShareUtil.shareImage("分享复活----",this.sharerevive,"1")
            this.sharerevive();
        }
    };
    CompletePanel.prototype.onComplete = function () {
        Laya.Sprite3D.load("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh", Laya.Handler.create(this, function (layaMonkey3D) {
            this.layaMonkey3D = layaMonkey3D;
            this.scene.addChild(layaMonkey3D);
            this.layaMonkey2D = Laya.stage.addChild(new Laya.Image("res/threeDimen/monkey.png"));
            Laya.timer.frameLoop(1, this, this.animate);
        }));
    };
    CompletePanel.prototype.animate = function () {
        this._position.x = Math.sin(this.scaleDelta += 0.01);
        this.layaMonkey3D.transform.position = this._position;
        this.layaMonkey3D.transform.scale = this.scale;
        //转换坐标
        this.camera.viewport.project(this.layaMonkey3D.transform.position, this.camera.projectionViewMatrix, this._outPos);
        //赋值给2D
        this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY);
    };
    /******************************************** */
    CompletePanel.prototype.btn0click = function () {
        if (this.c_state.selectedIndex == 0) {
            this.playvideocallback();
            // pingtaiutils.Instance.playVideo( "",this,this.playvideocallback );
        }
        else if (this.c_state.selectedIndex == 1) {
            this.getProxy(AgencyUserMessage_1.AgencyUserMessage).GoldUp(this.getgold);
            this._gameProxy.returnmainview();
            // ViewManager.Instance.add( ChoutiPanView );
        }
        else if (this.c_state.selectedIndex == 2) {
            this.count = false;
            // pingtaiutils.Instance.playVideo("",this,this.playvideorevive);
            this.playvideorevive();
        }
    };
    /**看视频复活成功 */
    CompletePanel.prototype.playvideorevive = function () {
        var _this = this;
        ttad_1.ttad.ShowVideo((function (isLoad) {
            if (isLoad) {
                // ViewManager.Instance.add(ChoutiPanView);
                GameState_1.GameState.fuhuocishu--;
                ViewManager_1.ViewManager.Instance.close(CompletePanel);
                GameState_1.GameState.isdie = false;
                Player_1.Player.Instance._iscanMove = true;
                // Player.Instance.PlayAnimator( CharacterState.run );
                Player_1.Player.Instance.nowAction = CharacterState_1.CharacterState.run;
                if (Player_1.Player.Instance._nowscenename == "" || Player_1.Player.Instance._nowbuildname == "") {
                    console.log("玩家位置----", Player_1.Player.Instance._initPosVec);
                    console.log("玩家速度_moveVec", Player_1.Player.Instance._moveVec);
                    Player_1.Player.Instance._transform.position = new Laya.Vector3(0, 1, 3);
                }
                else {
                    console.log("当前场景名字---", Player_1.Player.Instance._nowscenename);
                    console.log("当前建筑名字---", Player_1.Player.Instance._nowbuildname);
                    console.log("建筑物位置----", PropManager_1.PropManager.getPosVecbyScene(Player_1.Player.Instance._nowscenename, Player_1.Player.Instance._nowbuildname));
                    Player_1.Player.Instance._transform.position = PropManager_1.PropManager.getPosVecbyScene(Player_1.Player.Instance._nowscenename, Player_1.Player.Instance._nowbuildname).clone();
                }
                Player_1.Player.Instance._speedMoveV3.z = -Player_1.Player.Instance._RoleData.movespeed * 2;
                Laya.timer.once(3000, _this, function () {
                    Player_1.Player.Instance._speedMoveV3.z = -Player_1.Player.Instance._RoleData.movespeed;
                });
            }
            else {
                _this.count = true;
            }
        }));
    };
    /**分享复活成功 */
    CompletePanel.prototype.sharerevive = function () {
        var _this = this;
        RecordManager_1.RecordManager.Instance.ShareVideo(function (isLoad) {
            if (isLoad) {
                RecordManager_1.RecordManager.Instance.RecordStart();
                GameState_1.GameState.fuhuocishu--;
                // GameState.recordscree = true;
                ViewManager_1.ViewManager.Instance.close(CompletePanel);
                GameState_1.GameState.isdie = false;
                Player_1.Player.Instance._iscanMove = true;
                // Player.Instance.PlayAnimator( CharacterState.run );
                Player_1.Player.Instance.nowAction = CharacterState_1.CharacterState.run;
                if (Player_1.Player.Instance._nowscenename == "" || Player_1.Player.Instance._nowbuildname == "") {
                    console.log("玩家位置----", Player_1.Player.Instance._initPosVec);
                    Player_1.Player.Instance._transform.position = new Laya.Vector3(0, 1, 3);
                }
                else {
                    console.log("当前场景名字---", Player_1.Player.Instance._nowscenename);
                    console.log("当前建筑名字---", Player_1.Player.Instance._nowbuildname);
                    console.log("建筑物位置----", PropManager_1.PropManager.getPosVecbyScene(Player_1.Player.Instance._nowscenename, Player_1.Player.Instance._nowbuildname));
                    Player_1.Player.Instance._transform.position = PropManager_1.PropManager.getPosVecbyScene(Player_1.Player.Instance._nowscenename, Player_1.Player.Instance._nowbuildname).clone();
                }
                // GlobalTip.Instance.showWordTips("复活加速成功");
                Player_1.Player.Instance._speedMoveV3.z = -Player_1.Player.Instance._RoleData.movespeed * 2;
                Laya.timer.once(3000, _this, function () {
                    Player_1.Player.Instance._speedMoveV3.z = -Player_1.Player.Instance._RoleData.movespeed;
                });
            }
            else {
                _this.count = true;
            }
        });
        // if(_success){
        //     // ViewManager.Instance.add(ChoutiPanView);
        //         GameState.fuhuocishu --;
        //         ViewManager.Instance.close( CompletePanel );
        //         GameState.isdie = false;
        //         Player.Instance._iscanMove = true;
        //         // Player.Instance.PlayAnimator( CharacterState.run );
        //         Player.Instance.nowAction = CharacterState.run;
        //         if (Player.Instance._nowscenename == "" || Player.Instance._nowbuildname == "")  {
        //             console.log("玩家位置----",Player.Instance._initPosVec);
        //             Player.Instance._transform.position = Player.Instance._initPosVec.clone()
        //         }
        //         else  {
        //             console.log("当前场景名字---",Player.Instance._nowscenename);
        //             console.log("当前建筑名字---",Player.Instance._nowbuildname);
        //             console.log("建筑物位置----",PropManager.getPosVecbyScene(Player.Instance._nowscenename, Player.Instance._nowbuildname));
        //             Player.Instance._transform.position = PropManager.getPosVecbyScene(Player.Instance._nowscenename, Player.Instance._nowbuildname).clone();
        //         }
        //             // GlobalTip.Instance.showWordTips("复活加速成功");
        //             Player.Instance._speedMoveV3.z = -Player.Instance._RoleData.movespeed*2;
        //             Laya.timer.once(3000,this,()=>{
        //                 Player.Instance._speedMoveV3.z = -Player.Instance._RoleData.movespeed;
        //             })
        // }
        // else{
        //     this.count = true;
        // }
    };
    CompletePanel.prototype.playvideocallback = function () {
        var _this = this;
        RecordManager_1.RecordManager.Instance.ShareVideo((function (isLoad) {
            if (isLoad) {
                _this.getProxy(AgencyUserMessage_1.AgencyUserMessage).GoldUp(_this.getgold * 3);
                _this._gameProxy.returnmainview(true);
            }
        }));
        // ttad.ShowVideo((isLoad=>{
        //     if(isLoad){
        //         ( this.getProxy( AgencyUserMessage ) as AgencyUserMessage ).GoldUp( this.getgold*3 );
        //         this._gameProxy.returnmainview(true);
        //     }
        // }))
    };
    CompletePanel.prototype.destory = function () {
        Laya.timer.clear(this, this.CountTime);
        // Laya.timer.clear(this,this.playanimator);
        // GuangGao.Clear();
        ttad_1.ttad.Clear();
        _super.prototype.destory.call(this);
    };
    CompletePanel.prototype.initView = function () {
        this.tianjia.visible = false;
        this.TianJiaAni = this.getTransitionByName("tianjiaani");
        this.TianJiaAni.stop();
        // Laya.timer.loop(2000,this,this.playanimator);
        this.count = true;
        this._gameProxy = this.getProxy(AgencyInGame_1.AgencyInGame);
        this.c_state = this.getControllerByBame("c_state");
        this.txt_gold.text = this.getgold.toString();
        if (GameState_1.GameState.recordscree) {
            this.BattleBtn.visible = false;
        }
        else {
            this.BattleBtn.visible = true;
        }
        // this.BattleBtn.visible = !GameState.recordscree;
        if (!GameState_1.GameState.isdie) { //玩家未死亡的状态
            if (GameStateControl_1.GameStateControl.Instance.endGamePlayerArr.length == 0) {
                this.c_state.selectedIndex = 0;
            }
            else {
                this.c_state.selectedIndex = 1;
            }
        }
        else {
            if (GameState_1.GameState.fuhuocishu > 0) {
                this.c_state.selectedIndex = 2;
                Laya.timer.loop(1000, this, this.CountTime);
            }
            else {
                this.c_state.selectedIndex = 1;
            }
        }
        GuangGao_1.GuangGao.CheatBanner(this.btn_1);
    };
    CompletePanel.prototype.playanimator = function () {
        this.TianJiaAni.play(null, 1);
    };
    CompletePanel.prototype.initEvent = function () {
        this.AddEventByType(this.btn_0, Laya.Event.CLICK, this, this.btn0click);
        this.AddEventByType(this.btn_1, Laya.Event.CLICK, this, this.btn1click);
        this.AddEventByType(this.BattleBtn, Laya.Event.CLICK, this, this.ShareBattle);
    };
    //倒计时
    CompletePanel.prototype.CountTime = function () {
        if (this.count && this.time > 0) {
            this.time -= 1;
            this.timenum.text = this.time.toString();
            if (this.time < 1) {
                Laya.timer.clear(this, this.CountTime);
                GameState_1.GameState.fuhuocishu--;
                // Laya.timer.clear(this,this.playanimator);
                ViewManager_1.ViewManager.Instance.close(CompletePanel);
                DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.lose);
            }
        }
    };
    //录屏分享
    CompletePanel.prototype.ShareBattle = function () {
        var _this = this;
        RecordManager_1.RecordManager.Instance.ShareVideo(function (isLoad) {
            if (isLoad) {
                _this.BattleBtn.visible = false;
            }
        });
        //  RecordManager.Instance.ShareVideo((isLoad=>{
        //      if(isLoad){
        //          this.BattleBtn.visible = false;
        //      }
        //  }))
    };
    CompletePanel.key = "CompletePanel";
    return CompletePanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.CompletePanel = CompletePanel;
},{"../Agency/AgencyInGame":2,"../Agency/AgencyUserMessage":8,"../Control/GameStateControl":20,"../Control/PanelBaseControl":23,"../Game/Player":38,"../PrefabControl/CharacterState":44,"../PrefabControl/PropManager":47,"../View/ViewManager":68,"../WXSDK/GuangGao":70,"../WXSDK/RecordManager":74,"../WXSDK/ttad":81,"../utils/DispatcherManager":83,"../utils/GameState":84,"../utils/ViewAction":91}],60:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var GameUtils_1 = require("../utils/GameUtils");
var TimerService_1 = require("../Time/TimerService");
var GuangGao_1 = require("../WXSDK/GuangGao");
var ViewAction_1 = require("../utils/ViewAction");
var ViewManager_1 = require("./ViewManager");
var SceneControl_1 = require("../Control/SceneControl");
var GameStateControl_1 = require("../Control/GameStateControl");
var GlobalTip_1 = require("../utils/GlobalTip");
var ttad_1 = require("../WXSDK/ttad");
var EggPanel = /** @class */ (function (_super) {
    __extends(EggPanel, _super);
    function EggPanel() {
        var _this = _super.call(this, "main", "eggview", false, ViewAction_1.ViewAction.ActionType_none, 1) || this;
        _this._isComplete = false;
        _this._isShowBanner = false;
        _this._bannerVal = 0.5;
        _this._maxClickCnt = 18;
        _this._clickCnt = 0;
        _this._interval = 100;
        _this._decrement = 1;
        _this._time = 0;
        return _this;
    }
    EggPanel.prototype.initView = function () {
        this.hitani = this.getTransitionByName("hitani");
        this.pro_0.value = 1;
        this._bannerVal = GameUtils_1.GameUtils.randRangefloat(0.2, 0.4);
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
        // GuangGao.CheatBanner(this.btn_1);
        // GuangGao.Clear();//h["default"].Clear()r["default"]
        ttad_1.ttad.Clear();
        var sceneheight = Laya.stage.height;
        this.btn_1.y = sceneheight - this.btn_1.height - 15;
        this.getrewardbtn.y = this.btn_1.y;
        this.getrewardbtn.visible = false;
        if (SceneControl_1.SceneControl.EggGGroup == 0) {
            this.n6.visible = true;
        }
    };
    EggPanel.prototype.bannercallback = function () {
    };
    EggPanel.prototype.initEvent = function () {
        this.AddEventByType(this.btn_1, Laya.Event.CLICK, this, this.qiaoDa);
        this.AddEventByType(this.btn_close, Laya.Event.CLICK, this, EggPanel.onclosefun);
        this.AddEventByType(this.getrewardbtn, Laya.Event.CLICK, this, EggPanel.VideoGetReward);
    };
    EggPanel.prototype.update = function (dt) {
        this._time += dt;
        if (this._time >= this._interval) {
            this._time = 0;
            this.Daojishi();
        }
    };
    EggPanel.prototype.Daojishi = function () {
        var pv = this.pro_0.value;
        pv -= this._decrement;
        if (pv <= 0)
            pv = 1;
        this.pro_0.value = pv;
        this._clickCnt = Math.ceil(pv * this._maxClickCnt / 100);
    };
    EggPanel.prototype.qiaoDa = function () {
        var _this = this;
        if (!this._isComplete) {
            if (this.hitani != null && !this.hitani.playing) {
                this.hitani.play(null, 1);
            }
            this._clickCnt++;
            if (this._clickCnt > this._maxClickCnt)
                this._clickCnt = this._maxClickCnt;
            var pv = this._clickCnt / this._maxClickCnt;
            if (pv > 1) {
                pv = 1;
            }
            this.pro_0.value = pv * 100;
            if (pv >= this._bannerVal && !this._isShowBanner) {
                this._isShowBanner = true;
                this.getrewardbtn.visible = true;
                // GuangGao.OpenBanner();
                Laya.timer.once(2000, this, function () {
                    _this.getrewardbtn.visible = false;
                });
            }
            if (pv >= 1) {
                this._isComplete = true;
                EggPanel.getreward();
            }
        }
    };
    EggPanel.getreward = function () {
        // var zpproxy:AgencyLottery = this.getProxy( AgencyLottery ) as AgencyLottery;
        // var index = ( this.getProxy( AgencyLottery ) as AgencyLottery ).GetReward();
        // var selectcfg:LotteryCFG = LotteryCFG.vec[ index ];
        // zpproxy.getreward( selectcfg );
        // TimerService.Instance.removeUpdateTarget( this );
        GlobalTip_1.GlobalTip.Instance.showWordTips("获得开局加速");
        EggPanel.onclosefun();
    };
    //看视频得奖励
    EggPanel.VideoGetReward = function () {
        ttad_1.ttad.ShowVideo((function (isLoad) {
            if (isLoad) {
                GlobalTip_1.GlobalTip.Instance.showWordTips("获得开局加速");
                EggPanel.onclosefun();
            }
            else {
                EggPanel.onclosefun();
            }
        }));
    };
    EggPanel.prototype.hidebanner = function () {
        // PlatformTool.getInstance().hideBanner("EggView");
        GuangGao_1.GuangGao.hidebanner();
    };
    EggPanel.onclosefun = function () {
        ViewManager_1.ViewManager.Instance.close(EggPanel);
    };
    EggPanel.prototype.destory = function () {
        // PlatformTool.getInstance().hideBanner("EggView");
        // GuangGao.hidebanner();
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.destory.call(this);
        GameStateControl_1.GameStateControl.Instance.entergame(true);
    };
    EggPanel.key = "EggPanel";
    return EggPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.default = EggPanel;
},{"../Control/GameStateControl":20,"../Control/PanelBaseControl":23,"../Control/SceneControl":27,"../Time/TimerService":57,"../WXSDK/GuangGao":70,"../WXSDK/ttad":81,"../utils/GameUtils":85,"../utils/GlobalTip":86,"../utils/ViewAction":91,"./ViewManager":68}],61:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var GameUtils_1 = require("../utils/GameUtils");
var TimerService_1 = require("../Time/TimerService");
var GuangGao_1 = require("../WXSDK/GuangGao");
var ViewManager_1 = require("./ViewManager");
var GlobalTip_1 = require("../utils/GlobalTip");
var PlayerAccount_1 = require("../WXSDK/PlayerAccount");
var RoleData_1 = require("../Data/RoleData");
var ttad_1 = require("../WXSDK/ttad");
var GiftView = /** @class */ (function (_super) {
    __extends(GiftView, _super);
    function GiftView() {
        var _this = _super.call(this, "main", "giftcheatview") || this;
        _this._isComplete = false;
        _this._isShowBanner = false;
        _this._bannerVal = 0.5;
        _this._maxClickCnt = 18;
        _this._clickCnt = 0;
        _this._interval = 100;
        _this._decrement = 1;
        _this._time = 0;
        return _this;
    }
    GiftView.prototype.initView = function () {
        this.anniu = this.item.asCom.getChildAt(2);
        this.kuaisudianji = this.item.asCom.getChildAt(0);
        this.shou = this.item.asCom.getChildAt(3);
        this.di = this.item.asCom.getChildAt(1);
        this.getrewardbtn = this.item.asCom.getChildAt(4);
        this.getrewardbtn.visible = false;
        this.clickani = this.item.getTransition("clickbtnani");
        this.jindu.value = 1;
        this._bannerVal = GameUtils_1.GameUtils.randRangefloat(0.2, 0.4);
        TimerService_1.TimerService.Instance.addUpdateTarget(this);
        // GuangGao.Clear();
        ttad_1.ttad.Clear();
        Laya.timer.loop(2000, this, this.playAnimator);
        // var sceneheight = Laya.stage.height;
        // this.btnbox.y=sceneheight-this.btnbox.y-15;
    };
    GiftView.prototype.playAnimator = function () {
        this.clickani.play(null, 1);
    };
    GiftView.prototype.initEvent = function () {
        this.AddEventByType(this.anniu, Laya.Event.CLICK, this, this.qiaoDa);
        this.AddEventByType(this.getrewardbtn, Laya.Event.CLICK, this, this.VideoGetReward);
    };
    GiftView.prototype.update = function (dt) {
        this._time += dt;
        if (this._time >= this._interval) {
            this._time = 0;
            this.Daojishi();
        }
    };
    GiftView.prototype.Daojishi = function () {
        var pv = this.jindu.value;
        pv -= this._decrement;
        if (pv <= 0)
            pv = 1;
        this.jindu.value = pv;
        this._clickCnt = Math.ceil(pv * this._maxClickCnt / 100);
    };
    GiftView.prototype.qiaoDa = function () {
        var _this = this;
        if (this.shou.visible) {
            this.shou.visible = false;
            this.kuaisudianji.visible = false;
            Laya.timer.clear(this, this.playAnimator);
        }
        if (!this._isComplete) {
            this._clickCnt++;
            if (this._clickCnt > this._maxClickCnt)
                this._clickCnt = this._maxClickCnt;
            var pv = this._clickCnt / this._maxClickCnt;
            if (pv > 1) {
                pv = 1;
            }
            this.jindu.value = pv * 100;
            if (pv >= this._bannerVal && !this._isShowBanner) {
                this._isShowBanner = true;
                this.getrewardbtn.visible = true;
                Laya.timer.once(2000, this, function () {
                    _this.getrewardbtn.visible = false;
                });
            }
            if (pv >= 1) {
                this._isComplete = true;
                GiftView.getreward();
            }
        }
    };
    GiftView.getreward = function () {
        RoleData_1.RoleData.Instance.Money += PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.CheatReward;
        // ( this.getProxy( AgencyUserMessage ) as AgencyUserMessage ).GoldUp( PlayerAccount.CurrentAccount.CurAccountData.CheatReward );
        // var index = ( this.getProxy( AgencyLottery ) as AgencyLottery ).GetReward();
        // var selectcfg:LotteryCFG = LotteryCFG.vec[ index ];
        // zpproxy.getreward( selectcfg );
        // TimerService.Instance.removeUpdateTarget( this );
        GlobalTip_1.GlobalTip.Instance.showWordTips("获得" + PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.CheatReward + "金币");
        GiftView.onclosefun();
    };
    //看视频得奖励
    GiftView.prototype.VideoGetReward = function () {
        ttad_1.ttad.ShowVideo((function (isLoad) {
            if (isLoad) {
                RoleData_1.RoleData.Instance.Money += PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.CheatReward;
                GlobalTip_1.GlobalTip.Instance.showWordTips("获得" + PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.CheatReward + "金币");
                GiftView.onclosefun();
            }
            else {
                GiftView.onclosefun();
            }
        }));
    };
    GiftView.prototype.hidebanner = function () {
        GuangGao_1.GuangGao.hidebanner();
    };
    GiftView.onclosefun = function () {
        ViewManager_1.ViewManager.Instance.close(GiftView);
    };
    GiftView.prototype.destory = function () {
        GuangGao_1.GuangGao.hidebanner();
        TimerService_1.TimerService.Instance.removeUpdateTarget(this);
        _super.prototype.destory.call(this);
    };
    GiftView.key = "GiftView";
    return GiftView;
}(PanelBaseControl_1.PanelBaseControl));
exports.default = GiftView;
},{"../Control/PanelBaseControl":23,"../Data/RoleData":31,"../Time/TimerService":57,"../WXSDK/GuangGao":70,"../WXSDK/PlayerAccount":73,"../WXSDK/ttad":81,"../utils/GameUtils":85,"../utils/GlobalTip":86,"./ViewManager":68}],62:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
/*
* name;
*/
var WordTipsPanel = /** @class */ (function (_super) {
    __extends(WordTipsPanel, _super);
    function WordTipsPanel() {
        var _this = _super.call(this, "loading", "wordTips") || this;
        _this.nowword = "";
        return _this;
    }
    /****************************************** */
    WordTipsPanel.prototype.showText = function () {
        var text = new Laya.Text();
        text.text = "Orientation-Portrait";
        text.color = "gray";
        text.font = "Impact";
        text.fontSize = 50;
        text.x = Laya.stage.width - text.width >> 1;
        text.y = Laya.stage.height - text.height >> 1;
        Laya.stage.addChild(text);
    };
    /****************************************** */
    WordTipsPanel.prototype.showWord = function (word) {
        this.nowword = word;
        this.text_word.text = word;
        this.t1.play(Laya.Handler.create(this, this.playEndCallback), 1);
    };
    WordTipsPanel.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
        this.t1 = this.getpanelTransition("t1");
    };
    WordTipsPanel.prototype.createCantralRect = function () {
        this.rect = new Laya.Sprite();
        this.rect.graphics.drawRect(-100, -100, 200, 200, "gray");
        Laya.stage.addChild(this.rect);
        this.updateRectPos();
    };
    WordTipsPanel.prototype.updateRectPos = function () {
        this.rect.x = Laya.stage.width / 2;
        this.rect.y = Laya.stage.height / 2;
    };
    /*************************************************** */
    WordTipsPanel.prototype.playEndCallback = function () {
        DispatcherManager_1.DispatcherManager.dispatchEvent(GameState_1.GameState.removeselect, this);
    };
    WordTipsPanel.key = "WordTipsPanel";
    return WordTipsPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.WordTipsPanel = WordTipsPanel;
},{"../Control/PanelBaseControl":23,"../utils/DispatcherManager":83,"../utils/GameState":84}],63:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var LoadingPanel = /** @class */ (function (_super) {
    __extends(LoadingPanel, _super);
    function LoadingPanel() {
        return _super.call(this, "loading", "loading") || this;
    }
    LoadingPanel.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
    };
    LoadingPanel.prototype.showWord = function (value) {
        this.pro.value = value;
    };
    LoadingPanel.prototype.onBoyClick = function (e) {
        //点击后小人会放大缩小
        var boy = e.target;
        if (boy.scaleX === 1) {
            boy.scale(1.2, 1.2);
        }
        else {
            boy.scale(1, 1);
        }
    };
    LoadingPanel.prototype.onTxtClick = function (e) {
        //点击后切换适配模式
        e.stopPropagation();
    };
    LoadingPanel.prototype.destory = function () {
        this.clearEvent();
        _super.prototype.destory.call(this);
    };
    LoadingPanel.key = "LoadingPanel";
    return LoadingPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.LoadingPanel = LoadingPanel;
},{"../Control/PanelBaseControl":23}],64:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var ViewAction_1 = require("../utils/ViewAction");
var ViewManager_1 = require("../View/ViewManager");
var LotteryCFG_1 = require("../CFG/LotteryCFG");
var AssetPath_1 = require("../Config/AssetPath");
var RoleCFG_1 = require("../CFG/RoleCFG");
var AgencyLottery_1 = require("../Agency/AgencyLottery");
var GuangGao_1 = require("../WXSDK/GuangGao");
var ttad_1 = require("../WXSDK/ttad");
var LotteryPanel = /** @class */ (function (_super) {
    __extends(LotteryPanel, _super);
    function LotteryPanel() {
        return _super.call(this, "main", "LotteryView", false, ViewAction_1.ViewAction.ActionType_none, 1) || this;
    }
    LotteryPanel.prototype.showLogger = function () {
        this.logger = new Laya.Text();
        this.logger.fontSize = 30;
        this.logger.color = "#FFFFFF";
        this.logger.align = 'center';
        this.logger.valign = 'middle';
        this.logger.size(Laya.stage.width, Laya.stage.height);
        this.logger.text = "等待响应...\n";
        Laya.stage.addChild(this.logger);
    };
    /************************************* */
    LotteryPanel.prototype.onHttpRequestError = function (e) {
        console.log(e);
    };
    LotteryPanel.prototype.initEvent = function () {
        this.AddEventByType(this.backbtn, Laya.Event.CLICK, this, this.onclosefun);
        this.AddEventByType(this.lotterybtn, Laya.Event.CLICK, this, this.choujiangclick);
    };
    LotteryPanel.prototype.playComplte = function () {
        if (this.tw) {
            this.tw.clear();
            this.tw = null;
        }
        this.backbtn.enabled = true;
        this.lotterybtn.enabled = true;
        this.agencylottery.getreward(this._selectcfg);
    };
    LotteryPanel.prototype.onclosefun = function () {
        if (this.tw) {
            this.tw.clear();
            this.tw = null;
        }
        GuangGao_1.GuangGao.Clear();
        ViewManager_1.ViewManager.Instance.close(LotteryPanel);
    };
    LotteryPanel.prototype.initView = function () {
        this.agencylottery = this.getProxy(AgencyLottery_1.AgencyLottery);
        var vec = LotteryCFG_1.default.vec;
        for (var i = 0; i < vec.length; i++) {
            var cfg = vec[i];
            if (cfg.type == 1) {
                this["icon_" + i].url = fairygui.UIPackage.getItemURL("main", "img_gold");
                this["txt_" + i].text = "X" + cfg.value;
            }
            else {
                var rolecfg = RoleCFG_1.default.dict[cfg.value];
                this["icon_" + i].url = AssetPath_1.AssetPath.getroleicon(rolecfg.icon);
                this["txt_" + i].text = rolecfg.rolename;
            }
        }
        GuangGao_1.GuangGao.CheatBanner(this.lotterybtn);
    };
    /**************************************** */
    LotteryPanel.prototype.onSocketClose = function () {
        console.log("Socket closed");
    };
    LotteryPanel.prototype.onMessageReveived = function (message) {
        console.log("Message from server:");
        if (typeof message == "string") {
            console.log(message);
        }
        else if (message instanceof ArrayBuffer) {
        }
    };
    /**************************************** */
    LotteryPanel.prototype.choujiangclick = function () {
        this.videocallback();
        // pingtaiutils.Instance.playVideo( "",this,this.videocallback );
    };
    LotteryPanel.prototype.videocallback = function () {
        var _this = this;
        ttad_1.ttad.ShowVideo((function (isLoad) {
            if (isLoad) {
                _this.startPlay();
            }
        }));
    };
    LotteryPanel.prototype.startPlay = function () {
        var index = this.agencylottery.GetReward();
        this._selectcfg = LotteryCFG_1.default.vec[index];
        this.backbtn.enabled = false;
        this.lotterybtn.enabled = false;
        this._nowgetIndex = index;
        var angle = 360 * 6 + (this._nowgetIndex) * 45 - 15;
        if (this.item_panel.rotation == 0) {
            this._tweeObject = { value: 0 };
        }
        else {
            this._tweeObject = { value: this._preIndex * 45 - 15 };
        }
        this._preIndex = this._nowgetIndex;
        this.tw = laya.utils.Tween.to(this._tweeObject, { value: angle }, 3000, laya.utils.Ease.quadInOut, Laya.Handler.create(this, this.playComplte));
        this.tw.update = Laya.Handler.create(this, function () {
            var value = this._tweeObject.value % 360;
            this.item_panel.rotation = value;
        }, null, false);
    };
    LotteryPanel.key = "LotteryPanel";
    return LotteryPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.LotteryPanel = LotteryPanel;
},{"../Agency/AgencyLottery":4,"../CFG/LotteryCFG":12,"../CFG/RoleCFG":14,"../Config/AssetPath":15,"../Control/PanelBaseControl":23,"../View/ViewManager":68,"../WXSDK/GuangGao":70,"../WXSDK/ttad":81,"../utils/ViewAction":91}],65:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var GameStateControl_1 = require("../Control/GameStateControl");
var GameState_1 = require("../utils/GameState");
var PropManager_1 = require("../PrefabControl/PropManager");
var AgencyUserMessage_1 = require("../Agency/AgencyUserMessage");
var UserInfoEvent_1 = require("../Data/UserInfoEvent");
var AgencySkin_1 = require("../Agency/AgencySkin");
var AgencyInGame_1 = require("../Agency/AgencyInGame");
var ViewManager_1 = require("../View/ViewManager");
var AgencyLottery_1 = require("../Agency/AgencyLottery");
var TuijianView_1 = require("../Push/TuijianView");
var ttad_1 = require("../WXSDK/ttad");
var MainPanel = /** @class */ (function (_super) {
    __extends(MainPanel, _super);
    function MainPanel() {
        var _this = _super.call(this, "main", "mainview") || this;
        /****************************************** */
        // 一只凤凰的分辨率是550 * 400
        _this.phoenixWidth = 550;
        _this.phoenixHeight = 400;
        _this.bgColorTweener = new Laya.Tween();
        _this.gradientInterval = 2000;
        _this.bgColorChannels = { r: 99, g: 0, b: 0xFF };
        return _this;
    }
    MainPanel.prototype.updateUserDataHandler = function () {
        this.txt_gold.text = this.agencyusermessage.RoleData.Money.toString();
    };
    MainPanel.prototype.returnmainHandler = function () {
        var RoleData = this.agencyusermessage.RoleData;
        // if( RoleData.nowlevel <= 2 )
        // {
        //     this.c_state.selectedIndex = 0;
        // }
        // else
        // {
        this.c_state.selectedIndex = 1;
        // }
    };
    MainPanel.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
    };
    MainPanel.prototype.createPhoenixes = function () {
        var scaleFactor = Math.min(Laya.stage.width / (this.phoenixWidth * 2), Laya.stage.height / this.phoenixHeight);
        // 加了混合模式的凤凰
        var blendedPhoenix;
        blendedPhoenix.blendMode = "lighter";
        blendedPhoenix.scale(scaleFactor, scaleFactor);
        blendedPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
        // 正常模式的凤凰
        var normalPhoenix;
        normalPhoenix.scale(scaleFactor, scaleFactor);
        normalPhoenix.x = this.phoenixWidth * scaleFactor;
        normalPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
    };
    /****************************************** */
    MainPanel.prototype.initView = function () {
        this.ExitBtn.visible = false;
        this.MoreFunBtn.visible = false;
        this.MoreGameBtn.visible = false;
        ttad_1.ttad.Showbanner();
        // Laya.timer.once(500,this,()=>{
        //     console.log("main界面白名单----",FYHD_Sdk.iswhite);
        //     if(FYHD_Sdk.iswhite){
        //         this.ExitBtn.visible = true;
        //     }
        //     else{
        //         this.ExitBtn.visible = false;
        //     }
        // })
        this.MoreFunBtnScale = this.getTransitionByName("morefunbtnscale");
        Laya.timer.loop(1000, this, this.playanimator2);
        this.SkinAni = this.SkinBtn.getTransition("skinani");
        this.LotteryAni = this.LotteryBtn.getTransition("lotteryani");
        this.MoreAni = this.MoreGameBtn.getTransition("moreani");
        Laya.timer.loop(3000, this, this.playanimator);
        this.agencyusermessage = this.getProxy(AgencyUserMessage_1.AgencyUserMessage);
        PropManager_1.PropManager.pro_jindu = this.pro_dis;
        PropManager_1.PropManager.txt_mingci = this.txt_mingci;
        this.c_state = this.getControllerByBame("c_state");
        GameStateControl_1.GameStateControl.Instance.setClickPanel(this.load_clickpanel);
        this.returnmainHandler();
        this.updateUserDataHandler();
    };
    MainPanel.prototype.playanimator = function () {
        this.SkinAni.play(null, 1);
        this.LotteryAni.play(null, 1);
        this.MoreAni.play(null, 1);
    };
    MainPanel.prototype.playanimator2 = function () {
        this.MoreFunBtnScale.play(null, 1);
    };
    MainPanel.prototype.choujiangclick = function () {
        ttad_1.ttad.Clear();
        this.getProxy(AgencyLottery_1.AgencyLottery).openView();
    };
    MainPanel.prototype.tuijianclick = function () {
        ViewManager_1.ViewManager.Instance.add(TuijianView_1.default);
    };
    MainPanel.prototype.skinclick = function () {
        ttad_1.ttad.Clear();
        this.getProxy(AgencySkin_1.AgencySkin).openview();
    };
    MainPanel.prototype.moreclick = function () {
        // ViewManager.Instance.add( ChoutiPanView );
        ttad_1.ttad.CreateMoreGameBtn();
    };
    MainPanel.prototype.btnclick = function () {
        ttad_1.ttad.Clear();
        this.c_state.selectedIndex = 2;
        this.txt_lv.text = this.agencyusermessage.RoleData.getNowServerLevel().toString();
        this.getProxy(AgencyInGame_1.AgencyInGame).startGame();
    };
    MainPanel.prototype.setclick = function () {
    };
    MainPanel.prototype.mapLoaded = function () {
        this.layer = this.tiledMap.getLayerByIndex(0);
        var radiusX = 32;
        var radiusY = Math.tan(180 / Math.PI * 30) * radiusX;
        var color = "#FF7F50";
        this.sprite = new Laya.Sprite();
        this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color);
        this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color);
        this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color);
        this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color);
        Laya.stage.addChild(this.sprite);
    };
    /*************************************** */
    MainPanel.prototype.initEvent = function () {
        this.AddEventByType(this.load_start, Laya.Event.CLICK, this, this.btnclick);
        this.AddEventByType(this.SkinBtn, Laya.Event.CLICK, this, this.skinclick);
        // this.AddEventByType( this.MoreGameBtn,Laya.Event.CLICK,this,this.moreclick );
        // this.AddEventByType( this.MoreFunBtn,Laya.Event.CLICK,this,this.moreclick );
        // this.AddEventByType( this.ExitBtn,Laya.Event.CLICK,this,this.tuijianclick );
        this.addDataEvent(GameState_1.GameState.returnMainView, this, this.returnmainHandler);
        this.AddEventByType(this.LotteryBtn, Laya.Event.CLICK, this, this.choujiangclick);
        this.addDataEvent(UserInfoEvent_1.UserInfoEvent.UserInfoEvent_updateUserData, this, this.updateUserDataHandler);
    };
    MainPanel.key = "MainPanel";
    return MainPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.MainPanel = MainPanel;
},{"../Agency/AgencyInGame":2,"../Agency/AgencyLottery":4,"../Agency/AgencySkin":6,"../Agency/AgencyUserMessage":8,"../Control/GameStateControl":20,"../Control/PanelBaseControl":23,"../Data/UserInfoEvent":34,"../PrefabControl/PropManager":47,"../Push/TuijianView":55,"../View/ViewManager":68,"../WXSDK/ttad":81,"../utils/GameState":84}],66:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var ViewAction_1 = require("../utils/ViewAction");
var AgencySkin_1 = require("../Agency/AgencySkin");
var GameState_1 = require("../utils/GameState");
var UserInfoEvent_1 = require("../Data/UserInfoEvent");
var ResourceControl_1 = require("../Control/ResourceControl");
var AssetPath_1 = require("../Config/AssetPath");
var CharacterState_1 = require("../PrefabControl/CharacterState");
var ViewManager_1 = require("../View/ViewManager");
var CharacterPool_1 = require("../PrefabControl/CharacterPool");
var Player_1 = require("../Game/Player");
var SkinPanel = /** @class */ (function (_super) {
    __extends(SkinPanel, _super);
    function SkinPanel() {
        var _this = _super.call(this, "main", "skinview", false, ViewAction_1.ViewAction.ActionType_none, 0) || this;
        _this._isdestorys = false;
        _this._out = new Laya.Quaternion;
        return _this;
    }
    SkinPanel.prototype.initView = function () {
        this._isdestorys = false;
        this.c_title = this.getControllerByBame("c_title");
        this.agencyskin = this.getProxy(AgencySkin_1.AgencySkin);
        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 = PropManager.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();
    };
    SkinPanel.prototype.initEvent = function () {
        this.AddEventByType(this.btn_close, Laya.Event.CLICK, this, this.onclosefun);
        this.AddEventByType(this.c_title, fairygui.Events.STATE_CHANGED, this, this.onchange);
        this.addDataEvent(GameState_1.GameState.updateSKinView, this, this.onchange);
        this.addDataEvent(UserInfoEvent_1.UserInfoEvent.userinfoEvent_updateroleid, this, this.updateroleHandler);
    };
    SkinPanel.prototype.ClearCharacter = function () {
        if (this._rolemo) {
            var script = this._rolemo.getComponent(Player_1.Player);
            CharacterPool_1.CharacterPool.ClearCharacter(this._rolemo, script.resouseName, script);
            this._rolemo = null;
        }
    };
    SkinPanel.prototype.onclosefun = function () {
        ViewManager_1.ViewManager.Instance.close(SkinPanel);
    };
    SkinPanel.prototype.destory = function () {
        this._isdestorys = true;
        this.ClearCharacter();
        if (this._uicarma3D) {
            this._uicarma3D.destroy();
            this._uicarma3D = null;
        }
        if (this._ui3DScene) {
            this._ui3DScene.destroy();
            this._ui3DScene = null;
        }
        _super.prototype.destory.call(this);
    };
    SkinPanel.prototype.onchange = function () {
        if (this.c_title.selectedIndex == 0) {
            this.list_0.numItems = this.agencyskin.pifuArr.length;
        }
        else {
            this.list_0.numItems = 0;
        }
    };
    SkinPanel.prototype.itemlistrender = function (index, item) {
        if (this.c_title.selectedIndex == 0) {
            if (index < this.agencyskin.pifuArr.length) {
                item.showData(this.agencyskin.pifuArr[index]);
            }
        }
    };
    SkinPanel.prototype.updateroleHandler = function () {
        var RoleData = this.agencyskin.RoleData;
        this.ClearCharacter();
        var pathArr = [];
        pathArr.push({ url: AssetPath_1.AssetPath.get3DRoleModel(RoleData.roleCfg.name) });
        ResourceControl_1.ResourceControl.Instance.loader3DArr(pathArr, this, this.loadcomplete, null, true, RoleData.roleCfg.name);
    };
    SkinPanel.prototype.loadcomplete = function (resousename) {
        var RoleData = this.agencyskin.RoleData;
        if (!this._isdestorys && this._ui3DScene && resousename == RoleData.roleCfg.name) {
            this._rolemo = CharacterPool_1.CharacterPool.AddCharacter(resousename, Player_1.Player, 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(Player_1.Player).PlayAnimator(CharacterState_1.CharacterState.stand);
        }
    };
    SkinPanel.key = "SkinPanel";
    return SkinPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.SkinPanel = SkinPanel;
},{"../Agency/AgencySkin":6,"../Config/AssetPath":15,"../Control/PanelBaseControl":23,"../Control/ResourceControl":26,"../Data/UserInfoEvent":34,"../Game/Player":38,"../PrefabControl/CharacterPool":43,"../PrefabControl/CharacterState":44,"../View/ViewManager":68,"../utils/GameState":84,"../utils/ViewAction":91}],67:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PanelBaseControl_1 = require("../Control/PanelBaseControl");
var ViewAction_1 = require("../utils/ViewAction");
var GameUtils_1 = require("../utils/GameUtils");
var AssetPath_1 = require("../Config/AssetPath");
var AgencyTrial_1 = require("../Agency/AgencyTrial");
var GuangGao_1 = require("../WXSDK/GuangGao");
var ttad_1 = require("../WXSDK/ttad");
var TrialPanel = /** @class */ (function (_super) {
    __extends(TrialPanel, _super);
    function TrialPanel(arr) {
        var _this = _super.call(this, "main", "shiyongView", false, ViewAction_1.ViewAction.ActionType_none, 1) || this;
        _this.skinarr = arr;
        return _this;
    }
    TrialPanel.prototype.onInit = function () {
        _super.prototype.onInit.call(this);
    };
    TrialPanel.prototype.initView = function () {
        this.agencytrial = this.getProxy(AgencyTrial_1.AgencyTrial);
        var index = GameUtils_1.GameUtils.randRangeint(0, this.skinarr.length - 1);
        this._selectvo = this.skinarr[index];
        this.load_icon.url = AssetPath_1.AssetPath.getroleicon(this._selectvo.roleCFG.icon);
        // pingtaiutils.Instance.createBanner( "ShiYongView" );
        GuangGao_1.GuangGao.CheatBanner(this.btn_close);
    };
    TrialPanel.prototype.initEvent = function () {
        this.AddEventByType(this.btn_close, Laya.Event.CLICK, this, this.onclosefun);
        this.AddEventByType(this.btn_video, Laya.Event.CLICK, this, this.videofun);
    };
    TrialPanel.prototype.videofun = function () {
        // pingtaiutils.Instance.playVideo( "",this,this.videocallback );
        this.videocallback();
    };
    TrialPanel.prototype.videocallback = function () {
        var _this = this;
        ttad_1.ttad.ShowVideo((function (isLoad) {
            if (isLoad) {
                _this.agencytrial.ExitPanel(_this._selectvo);
            }
        }));
    };
    TrialPanel.prototype.onclosefun = function () {
        this.agencytrial.ExitPanel(null);
    };
    TrialPanel.prototype.destory = function () {
        // GuangGao.Clear();
        ttad_1.ttad.Clear();
        _super.prototype.destory.call(this);
    };
    TrialPanel.key = "TrialPanel";
    return TrialPanel;
}(PanelBaseControl_1.PanelBaseControl));
exports.TrialPanel = TrialPanel;
},{"../Agency/AgencyTrial":7,"../Config/AssetPath":15,"../Control/PanelBaseControl":23,"../WXSDK/GuangGao":70,"../WXSDK/ttad":81,"../utils/GameUtils":85,"../utils/ViewAction":91}],68:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LayOUT_1 = require("../utils/LayOUT");
var LayoutControl_1 = require("../Control/LayoutControl");
/**
 *
 * @author
 *
 */
var ViewManager = /** @class */ (function (_super) {
    __extends(ViewManager, _super);
    function ViewManager() {
        var _this = _super.call(this) || this;
        ViewManager.ins = _this;
        return _this;
    }
    Object.defineProperty(ViewManager, "Instance", {
        get: function () {
            if (ViewManager.ins == null) {
                return new ViewManager();
            }
            return ViewManager.ins;
        },
        enumerable: true,
        configurable: true
    });
    ViewManager.prototype.init = function () {
        this._views = {};
        this.initEvent();
    };
    ViewManager.prototype.initEvent = function () {
    };
    /**
     *  view 视图对象类
     *  data 绑定数据 （ data 如果不为空，代表构造函数传参 ）
     *  layer 层级
     */
    ViewManager.prototype.add = function (view, data, layer) {
        if (data === void 0) { data = null; }
        if (layer === void 0) { layer = LayOUT_1.LayOUT.UI; }
        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;
        LayoutControl_1.LayoutControl.Instance.AddLayerByName(d, layer);
        this._views[type] = d;
        return d;
    };
    /**
     * 关闭界面
     * @param view 界面
     * @param isbgclose 是否是点击背景关闭的状态
     * @param isplayAnmo 是否播放关闭动画（ 主要用于强制关闭 ）
     */
    ViewManager.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;
        }
        LayoutControl_1.LayoutControl.Instance.ClearLayerByName(item.gameLayer);
        if (isplayAnmo) {
            item.ExitView();
        }
        else {
            item.destory();
        }
        delete this._views[type];
    };
    ViewManager.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);
            }
        }
    };
    ViewManager.prototype.getView = function (view) {
        var type = view.key;
        return this._views[type];
    };
    return ViewManager;
}(Laya.EventDispatcher));
exports.ViewManager = ViewManager;
},{"../Control/LayoutControl":21,"../utils/LayOUT":88}],69:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RecommendView_1 = require("../Push/RecommendView");
var ViewManager_1 = require("../View/ViewManager");
var ChoutiPanView_1 = require("../Push/ChoutiPanView");
// import { Main } from "../Main";
// import ListItem from "../GameTools/ListItem";
// import { PanelManager, PanelType } from "../View/PanelManager";
// import GuangGao from "./GuangGao";
// import { WXSDK } from "./WXSDK";
var FYHD_Sdk = /** @class */ (function () {
    function FYHD_Sdk() {
    }
    //初始化sdk
    FYHD_Sdk.InitSdk = function () {
        Laya.Browser.window.sdk.getFyhd().startSdk();
        FYHD_Sdk.UserInfoAuth();
        // let white = Laya.LocalStorage.getItem("is_white");
        // if(white){
        //     FYHD_Sdk.iswhite = true;
        // }
        // else{
        //     FYHD_Sdk.getWhiteConfig();
        // }
        // let newuser = Laya.LocalStorage.getItem("is_newuser");
        // if(!newuser){
        //     FYHD_Sdk.isnewuser = true;
        //     Laya.LocalStorage.setItem("is_newuser","1");
        // }
        // else{
        //     FYHD_Sdk.isnewuser = false;
        // }
        // FYHD_Sdk.PushData();
    };
    //用户授权
    FYHD_Sdk.UserInfoAuth = function () {
        if (!Laya.Browser.onWeiXin)
            return;
        Laya.Browser.window.sdk.getFyhd().getFyhdUserInfo(null, false, function (data) {
            console.log("无授权回调:" + JSON.stringify(data));
            if (data.result.user) {
                FYHD_Sdk.openid = data.result.user.openid;
                FYHD_Sdk.AuthInfo();
            }
        });
    };
    FYHD_Sdk.AuthInfo = function () {
        var args = {
            openid: FYHD_Sdk.openid,
        };
        Laya.Browser.window.sdk.getFyhd().loginData(args, function (data) {
            console.log("授权上报回调:" + JSON.stringify(data));
            FYHD_Sdk.ValueUser();
        });
    };
    FYHD_Sdk.ValueUser = function () {
        var args = {
            openid: FYHD_Sdk.openid,
        };
        Laya.Browser.window.sdk.getFyhd().valueuser(args, function (data) {
            console.log("有效用户上报:" + JSON.stringify(data));
        });
    };
    FYHD_Sdk.getWhiteConfig = function () {
        Laya.Browser.window.sdk.getFyhd().whiteConfig(function (e) {
            FYHD_Sdk.iswhite = e.data.is_white;
            if (FYHD_Sdk.iswhite) {
                Laya.LocalStorage.setItem("is_white", "1");
            }
            console.log("白名单---", e);
        });
    };
    FYHD_Sdk.SetHuTuiList = function (list, scrol, type) {
        if (scrol === void 0) { scrol = 1; }
        if (type === void 0) { type = ""; }
        var arr = this.pushData;
        if (!arr || arr.length == 0)
            return;
        list.selectEnable = false;
        scrol == 1 ? list.vScrollBarSkin = "" : list.hScrollBarSkin = "";
        list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false);
        list.array = arr;
        list.refresh();
    };
    FYHD_Sdk.updateItem = function (type, cell, index) {
        // var aditem = cell.getComponent(ListItem) as ListItem;
        // aditem.Refresh(type);
    };
    //点击事件上报
    FYHD_Sdk.ClickAd = function (ad_type) {
        console.log("上报类型---", ad_type);
        if (!Laya.Browser.onWeiXin)
            return;
        var param = {
            ad_type: ad_type,
            //此处添加openid
            openid: FYHD_Sdk.openid
        };
        console.log("点击参数:" + param);
        Laya.Browser.window.sdk.getFyhd().advertisement(param, function (data) {
            console.log("点击结果:" + JSON.stringify(data));
        });
    };
    //互推信息
    FYHD_Sdk.PushData = function () {
        //console.log("pushdata--",Main.WX);
        if (!Laya.Browser.onWeiXin)
            return;
        var param = {};
        Laya.Browser.window.sdk.getFyhd().shareRecommend(param, function (data) {
            console.log("热门游戏数据--", data);
            if (data.data) {
                FYHD_Sdk.pushData = data.data;
                FYHD_Sdk.pushData.sort(FYHD_Sdk.ListSort);
                FYHD_Sdk.isHaveDate = true;
                //此处派发事件，展示互推
                //EventManager.event(FYHD_Sdk.ShowAd);
            }
            console.log("获取互推信息:" + JSON.stringify(FYHD_Sdk.pushData));
            new RecommendView_1.Recommend();
        });
    };
    FYHD_Sdk.ShowHuTuiJump = function (data, open) {
        if (!Laya.Browser.onWeiXin)
            return;
        if (data.jump_type == 2) //二维码跳转方法
         {
            Laya.Browser.window.wx.previewImage({ current: data.qrcode, urls: [data.qrcode] });
        }
        else if (data.jump_type == 1) //直跳方法
         {
            Laya.Browser.window.wx.navigateToMiniProgram({
                appId: data.to_appid,
                path: data.jump_path,
                success: function (res) {
                    // 打开成功
                    console.log("上报成功:" + JSON.stringify(res));
                    FYHD_Sdk.PushClick(data.to_appid);
                },
                fail: function (res) {
                    if (open) {
                        ViewManager_1.ViewManager.Instance.add(ChoutiPanView_1.default);
                    }
                }
            });
        }
        else if (data.jump_type == 0) //平台跳转方法
         {
            Laya.Browser.window.wx.navigateToMiniProgram({
                appId: data.platform_appid,
                path: data.jump_path,
                success: function (res) {
                    // 打开成功
                    console.log("上报成功:" + JSON.stringify(res));
                    FYHD_Sdk.PushClick(data.to_appid);
                },
                fail: function (res) {
                    if (open) {
                        ViewManager_1.ViewManager.Instance.add(ChoutiPanView_1.default);
                    }
                }
            });
        }
    };
    //互推点击
    FYHD_Sdk.PushClick = function (to_appid) {
        if (!Laya.Browser.onWeiXin)
            return;
        var param = {
            openid: FYHD_Sdk.openid,
            to_appid: to_appid,
        };
        Laya.Browser.window.sdk.getFyhd().sharePlay(param, function (data) {
            console.log("点击上报结果:" + JSON.stringify(data));
        });
    };
    FYHD_Sdk.ListSort = function (a, b) {
        if (Number(a["panel"]) < Number(b["panel"])) {
            return -1;
        }
        if (Number(a["panel"]) == Number(b["panel"])) {
            return 0;
        }
        if (Number(a["panel"]) > Number(b["panel"])) {
            return 1;
        }
    };
    FYHD_Sdk.Ad_ClickType = {
        Video: "video_click",
        Watch: "watch",
        Share: "share",
        Banner: "banner",
        Push: "push",
        PushClick: "icon_click"
    };
    FYHD_Sdk.pushData = [];
    FYHD_Sdk.isHaveDate = false;
    FYHD_Sdk.ShowAd = "ShowAd";
    return FYHD_Sdk;
}());
exports.FYHD_Sdk = FYHD_Sdk;
},{"../Push/ChoutiPanView":49,"../Push/RecommendView":53,"../View/ViewManager":68}],70:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlayerAccount_1 = require("./PlayerAccount");
var ttad_1 = require("./ttad");
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() {
        this.isVideoLoadCom = false;
    }
    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) {
                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.shareImage("视频没有分享", callback
                //     , "1");
            }
        }
        else {
            callback(false);
            // 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) {
        // if (!this.hasbanner)
        // {
        //     callVack(null);
        //     return;
        // } 
        var _this = this;
        if (gap === void 0) { gap = 0; }
        if (callVack === void 0) { callVack = null; }
        if (iswait === void 0) { iswait = false; }
        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 () {
        GuangGao.clearTween();
        Laya.timer.clearAll(this);
        Laya.Tween.clearAll(this);
        this.canshowbanner = false;
        if (this.curbanner)
            this.curbanner.hide();
        // 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();
    };
    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) {
                return true;
            }
            else {
                return false;
            }
            // if(!PlayerAccount.CurrentAccount.CurAccountData.cheat)
            // {
            //     console.log("cheat:false-> CurAccountData.cheat != 1");
            //     return false;
            // }
            // var checkscence = PlayerAccount.CurrentAccount.CurAccountData.checkscence;
            // if (checkscence == false)
            // {
            //     console.log("cheat:true-> " + WxApi.sceneValue);
            //     return true;
            // }
            // if (WxApi.sceneValue == "1037" || WxApi.sceneValue == "1058"|| WxApi.sceneValue == "1067" || WxApi.sceneValue == "1095") 
            // {
            //     console.log("cheat:true-> " + WxApi.sceneValue);
            //     return true;
            // }
            // console.log("cheat:false-> " + 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) {
        if (complete === void 0) { complete = null; }
        if (gap === void 0) { gap = 0; }
        ttad_1.ttad.Showbanner();
        // if(!GuangGao.cancheat)
        // {
        //     console.log("ignorecheat");
        //     GuangGao.OpenBanner(0,(height) =>
        //     {
        //         if(height == null)
        //         {
        //         }
        //     });
        // }
        // else
        // {
        //     btn.y = Laya.stage.height-btn.height - 100;
        //     GuangGao.OpenBanner(gap,(height) => 
        //     {
        //         if(height == null)
        //         {
        //         }
        //         else
        //         {
        //             console.log("cheatstart","bottom:100");
        //             // btn.mouseEnabled = false;
        //             var end=Laya.stage.height-height-btn.height - 80;
        //             console.log("y:" + end);
        //             Laya.timer.once(PlayerAccount.CurrentAccount.CurAccountData.cheattime*1000,this,()=>
        //             {
        //                 // btn.mouseEnabled = true;
        //                 this.showbanner();
        //                 GuangGao.clearTween();
        //                  GuangGao.tween = Laya.Tween.to(btn,{y:end},200,null,Laya.Handler.create(this,()=>
        //                 {
        //                     if(complete != null)
        //                     {
        //                         complete();
        //                     }
        //                 }))
        //             })
        //         }
        //     },true);
        // }
    };
    GuangGao.clearTween = function () {
        if (GuangGao.tween) {
            GuangGao.tween.clear();
            GuangGao.tween = null;
        }
    };
    GuangGao.prototype.loadVideo = function (cb) {
        var _this = this;
        if (!Laya.Browser.onWeiXin) {
            if (cb)
                cb(true);
            return;
        }
        ;
        this._onLoadVideo = cb;
        if (!this._rewardedVideoAd) {
            var index = GuangGao.videlAdUnitId;
            this._rewardedVideoAd = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: index });
            var isc = false;
            this._rewardedVideoAd.onLoad(function () {
                console.log("[LOG] 激励视频广告加载成功");
                _this.isVideoLoadCom = true;
                if (isc)
                    return;
                isc = true;
                _this._onLoadVideo && _this._onLoadVideo(true);
                _this._onLoadVideo = null;
            });
            this._rewardedVideoAd.onError(function (err) {
                console.log("[LOG] 激励视频广告加载失败");
                console.log(err);
                _this.isVideoLoadCom = false;
                _this._onLoadVideo && _this._onLoadVideo(false);
                _this._onLoadVideo = null;
            });
            this._rewardedVideoAd.onClose(function (res) {
                if (!res || res.isEnded) {
                    _this._onVideoClose && _this._onVideoClose(true);
                    _this._onVideoClose = null;
                }
                else {
                    _this._onVideoClose && _this._onVideoClose(false);
                    _this._onVideoClose = null;
                }
            });
        }
        else {
            if (this.isVideoLoadCom) {
                this._onLoadVideo && this._onLoadVideo(true);
                this._onLoadVideo = null;
            }
            else {
                this._onLoadVideo && this._onLoadVideo(false);
                this._onLoadVideo = null;
            }
        }
    };
    GuangGao.prototype.showVideo = function (cb) {
        var _this = this;
        if (!Laya.Browser.onWeiXin) {
            if (cb)
                cb(true);
            return;
        }
        ;
        this._onVideoClose = cb;
        this._rewardedVideoAd.show().catch(function (err) {
            _this._rewardedVideoAd.load().then(function () {
                _this._rewardedVideoAd.show();
            });
        });
    };
    GuangGao.videlAdUnitId = "adunit-0c687084c908ee89";
    GuangGao.bannerAdUnitId = "adunit-8c2d586135fa6d4f";
    GuangGao.afsfsaafsfsa = false;
    //视屏广告是否加载成功
    GuangGao.asfasfsaffsa = false;
    GuangGao.canshowbanner = true;
    GuangGao.bannerhigt = 0;
    return GuangGao;
}());
exports.GuangGao = GuangGao;
},{"./PlayerAccount":73,"./ttad":81}],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("./PlayerAccount");
var Sdk_1 = require("./Sdk");
var TimesTamper_1 = require("../Time/TimesTamper");
var Global_1 = require("../Global");
// const PROTOCOL_URL:string = "https://pipelineapi.xwxgame.com/";
var PROTOCOL_URL = "https://parkourracetoutiao2api.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.Instance.updateServiceTime(Number(data["t"]));
        Sdk_1.WxApi.recordAldEvent("登录正式成功");
        PlayerAccount_1.PlayerAccount.CurrentAccount.SetAccountData(data, completecb);
        // 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);
            if (succeedcb != null) {
                succeedcb.runWith(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":39,"../Time/TimesTamper":58,"./PlayerAccount":73,"./Sdk":75}],72:[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.PlatfromType = PlatfromType;
},{}],73:[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 DispatcherManager_1 = require("../utils/DispatcherManager");
var UserInfoEvent_1 = require("../Data/UserInfoEvent");
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, "DieDistance", {
        // public m_skinDic:Dictionary<number,SkinData> = new Dictionary();
        //获取玩家落入空中死亡距离
        get: function () {
            return Number(this.m_app_setting["diedistance"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "HitEgg", {
        //获取开局砸蛋几率
        get: function () {
            return Number(this.m_app_setting["hitegg"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "EndCheat", {
        //获取结算后砸蛋出现几率
        get: function () {
            return Number(this.m_app_setting["endcheat"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "CheatReward", {
        //获取误触奖励金币数
        get: function () {
            return Number(this.m_app_setting["cheatreward"]);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "WhiteUser", {
        //白名单用户
        get: function () {
            return this.m_app_setting["WhiteUser"] == "1";
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AccountData.prototype, "lotterytime", {
        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;
            }
        }
        DispatcherManager_1.DispatcherManager.dispatchEvent(UserInfoEvent_1.UserInfoEvent.updatePlayerInfo);
    };
    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;
},{"../Data/UserInfoEvent":34,"../WXSDK/Sdk":75,"../utils/DispatcherManager":83,"../utils/GameUtils":85,"./NetworkManager":71}],74:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RecordManager = /** @class */ (function () {
    function RecordManager() {
        RecordManager.instance = this;
        console.log("new record");
    }
    Object.defineProperty(RecordManager, "Instance", {
        get: function () {
            if (RecordManager.instance) {
                return RecordManager.instance;
            }
            else {
                var curmanager = new RecordManager();
                curmanager.OnNew();
                return curmanager;
            }
        },
        enumerable: true,
        configurable: true
    });
    RecordManager.prototype.RecordStart = function () {
        if (!Laya.Browser.onMobile)
            return;
        console.log("RecordStart");
        this.record.start({
            duration: 60,
        });
    };
    RecordManager.prototype.RecordStop = function () {
        if (!Laya.Browser.onMobile)
            return;
        console.log("RecordStop");
        this.record.stop();
    };
    RecordManager.prototype.ShareVideo = function (_cb) {
        if (!Laya.Browser.onMobile)
            return;
        Laya.Browser.window.tt.shareAppMessage({
            channel: "video",
            query: "",
            templateId: "11cd2ak160f4k19a6g",
            title: "赢得了我，认你做大哥又如何",
            desc: "赢得了我，认你做大哥又如何",
            extra: {
                videoPath: this.completepath,
                videoTopics: ["赢得了我，认你做大哥又如何"]
            },
            success: function () {
                _cb && _cb(true);
                console.log("分享视频成功");
            },
            fail: function (e) {
                _cb && _cb(false);
                console.log("分享视频失败");
            }
        });
    };
    RecordManager.prototype.OnNew = function () {
        var _this = this;
        if (!Laya.Browser.onMobile)
            return;
        this.record = Laya.Browser.window.tt.getGameRecorderManager();
        this.record.onStart(function (res) {
            // 录屏开始
            console.log(res);
        });
        this.record.onStop(function (res) {
            _this.completepath = res.videoPath;
            console.log(res.videoPath);
        });
    };
    return RecordManager;
}());
exports.RecordManager = RecordManager;
},{}],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.tt.getUpdateManager();
        updateManager.onCheckForUpdate(function (res) {
            console.log("最新版本:" + res.hasUpdate);
        });
        updateManager.onUpdateReady(function () {
            Laya.Browser.window.tt.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,     //关卡ID 该字段必传
        //             stageName: stageName, //关卡名称  该字段必传
        //             userId: userId //用户ID 可选
        //         }
        //     );
        //     if(WxApi.newaccount)
        //     {
        //         Laya.Browser.window.wx.aldStage.onStart(
        //             {
        //                 stageId: "新用户:" + stageId,     //关卡ID 该字段必传
        //                 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,   //关卡ID 该字段必传
        //         stageName : stageName,  //关卡名称  该字段必传
        //         userId    : userId, //用户ID 可选
        //         event     : "revive",  //使用道具  关卡进行中，用户触发的操作    该字段必传
        //         params    : {
        //           itemName  : "使用复活",//使用道具名称 该字段必传
        //           itemCount : 1,   //使用道具数量  可选
        //           desc      : userevive //使用道具描述
        //         }
        //       });
        //       if(WxApi.newaccount)
        //       {
        //         Laya.Browser.window.wx.aldStage.onRunning({
        //             stageId   :"新用户:" +  stageId,   //关卡ID 该字段必传
        //             stageName : stageName,  //关卡名称  该字段必传
        //             userId    : userId, //用户ID 可选
        //             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,     //关卡ID 该字段必传
        //             stageName: stageName, //关卡名称  该字段必传
        //             userId: userId, //用户ID 可选
        //             event: "complete",   //关卡完成  关卡进行中，用户触发的操作    该字段必传
        //             params:
        //                 {
        //                     desc: "关卡完成"   //描述
        //                 }
        //         }
        //     );
        //     if(WxApi.newaccount)
        //     {
        //         Laya.Browser.window.wx.aldStage.onEnd(
        //             {
        //                 stageId:"新用户:" + stageId,     //关卡ID 该字段必传
        //                 stageName: stageName, //关卡名称  该字段必传
        //                 userId: userId, //用户ID 可选
        //                 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,     //关卡ID 该字段必传
        //             stageName: stageName, //关卡名称  该字段必传
        //             userId: userId, //用户ID 可选
        //             event: "fail",   //关卡完成  关卡进行中，用户触发的操作    该字段必传
        //             params:
        //                 {
        //                     desc: "失败",
        //                     score: score,//描述
        //                     car: carname//描述
        //                 }
        //         }
        //     );
        //     if(WxApi.newaccount)
        //     {
        //         Laya.Browser.window.wx.aldStage.onEnd(
        //             {
        //                 stageId:"新用户:" + stageId,     //关卡ID 该字段必传
        //                 stageName: stageName, //关卡名称  该字段必传
        //                 userId: userId, //用户ID 可选
        //                 event: "fail",   //关卡完成  关卡进行中，用户触发的操作    该字段必传
        //                 params:
        //                     {
        //                         desc: "失败",
        //                         score: score,//描述
        //                         car: carname//描述
        //                     }
        //             }
        //         );
        //     }
        // }
    };
    WxApi.OnShow = function (cb) {
        if (!Laya.Browser.window.tt)
            return;
        Laya.Browser.window.tt.onShow(cb);
    };
    WxApi.OffShow = function (cb) {
        if (!Laya.Browser.onWeiXin)
            return;
        Laya.Browser.window.tt.offShow(cb);
    };
    WxApi.shake = function () {
        Laya.Browser.window.tt.vibrateShort({});
    };
    WxApi.shakeLong = function () {
        Laya.Browser.window.tt.vibrateLong({});
    };
    WxApi.Shake = function (_short) {
        if (_short === void 0) { _short = true; }
        if (Laya.Browser.window.tt && 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.window.tt) {
            Laya.Browser.window.tt.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 DispatcherManager_1 = require("../utils/DispatcherManager");
var SocketNofify_1 = require("../WXSDK/SocketNofify");
var ServerSocket = /** @class */ (function () {
    /**
     * socket连接中
     */
    function ServerSocket() {
        /**
         * 1:自动断线，2：主动断线
         */
        this._offlinestate = 0;
        /**
         * 断线重连次数
         */
        this._connetNums = 0;
        this._socketconneting = false;
        ServerSocket.ins = this;
    }
    Object.defineProperty(ServerSocket, "Instance", {
        get: function () {
            if (ServerSocket.ins == null) {
                return new ServerSocket();
            }
            return ServerSocket.ins;
        },
        enumerable: true,
        configurable: true
    });
    //连接服务器
    ServerSocket.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);
            }
            this.sock.connectByUrl(gameHost);
        }
    };
    ServerSocket.prototype.isConnect = function () {
        if (this.sock && this.sock.connected) {
            return true;
        }
        return false;
    };
    ServerSocket.prototype.ioErro = function (e) {
        if (e === void 0) { e = null; }
        this._socketconneting = false;
        this._connetNums++;
        this.closewaitpanel();
        this.removeSocket();
        this._offlinestate = 1;
    };
    ServerSocket.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
     */
    ServerSocket.prototype.colseSocket = function (offlinestate) {
        if (offlinestate === void 0) { offlinestate = 1; }
        if (this.isConnect()) {
            this.closewaitpanel();
            this.removeSocket();
            if (offlinestate != -1) {
                this._offlinestate = offlinestate;
            }
            DispatcherManager_1.DispatcherManager.dispatchEvent(SocketNofify_1.SocketNofify.SOCKET_CLOSE);
        }
    };
    ServerSocket.prototype.onSocketClose = function (e) {
        if (e === void 0) { e = null; }
        this._socketconneting = false;
        this.closewaitpanel();
        this._offlinestate = 1;
        DispatcherManager_1.DispatcherManager.dispatchEvent(SocketNofify_1.SocketNofify.SOCKET_CLOSE);
    };
    ServerSocket.prototype.closewaitpanel = function () {
        fairygui.GRoot.inst.closeModalWait();
    };
    ServerSocket.prototype.openwaitpanel = function () {
        fairygui.GRoot.inst.showModalWait();
    };
    //连接成功返回
    ServerSocket.prototype.onSocketOpen = function (event) {
        if (event === void 0) { event = null; }
        this._connetNums = 0;
        this.closewaitpanel();
        this._offlinestate = 0;
        DispatcherManager_1.DispatcherManager.dispatchEvent(SocketNofify_1.SocketNofify.SOCKET_CONNECT_SUCCEED, null, false);
    };
    //向服务端发送消息
    ServerSocket.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));
        }
        else {
        }
    };
    //消息返回后，会广播出去
    //Global.addEventListener("你发送的cmd名称",监听方法,this)
    ServerSocket.prototype.onReceiveMessage = function (msg) {
        if (msg === void 0) { msg = null; }
        var socketdata = JSON.parse(msg);
    };
    return ServerSocket;
}());
exports.ServerSocket = ServerSocket;
},{"../WXSDK/SocketNofify":77,"../utils/DispatcherManager":83}],77:[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.SocketNofify = SocketNofify;
},{}],78:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WECHATEVENT = /** @class */ (function () {
    function WECHATEVENT() {
    }
    /**
    * 游戏进入后台事件
    */
    WECHATEVENT.WECHATEVENT_onhide = "WECHATEVENT_onhide";
    WECHATEVENT.WECHATEVENT_onAudioInterruptionEnd = "WECHATEVENT_onAudioInterruptionEnd";
    WECHATEVENT.WECHATEVENT_losefocus = "WECHATEVENT_losefocus";
    WECHATEVENT.WECHATEVENT_getfocus = "WECHATEVENT_getfocus";
    WECHATEVENT.WECHATEVENT_updateVideoNums = "WECHATEVENT_updateVideoNums";
    /**
     * 用户打点
     */
    WECHATEVENT.message_9891002 = "9891002";
    /**
     * 获取后台数据
     */
    WECHATEVENT.message_9891101 = "9891101";
    WECHATEVENT.WECHATEVENT_loginSucceed = "WECHATEVENT_loginSucceed";
    /**
     * 游戏从后台恢复显示事件
     */
    WECHATEVENT.WECHATEVENT_onshow = "WECHATEVENT_onshow";
    /**
     * 从收藏或者浮窗进入游戏
     */
    WECHATEVENT.WECHATEVENT_fromscorfk = "WECHATEVENT_fromscorfk";
    /**
     * 登录
     */
    WECHATEVENT.message_9891001 = "9891001";
    /**
     * 广告点击
     */
    WECHATEVENT.message_9891102 = "9891102";
    /**
     * 点击确定跳转到外部游戏
     */
    WECHATEVENT.message_9891103 = "9891103";
    return WECHATEVENT;
}());
exports.WECHATEVENT = WECHATEVENT;
},{}],79:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameUtils_1 = require("../utils/GameUtils");
var WECHATEVENT_1 = require("../WXSDK/WECHATEVENT");
var Global_1 = require("../Global");
var DateControl_1 = require("../Control/DateControl");
var LocalDataControl_1 = require("../Control/LocalDataControl");
var UserDataInfo_1 = require("../Data/UserDataInfo");
var GlobalTip_1 = require("../utils/GlobalTip");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var AudioControl_1 = require("../Control/AudioControl");
/*
* 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.ins = this;
    }
    Object.defineProperty(WXGamePlatform, "Instance", {
        get: function () {
            if (WXGamePlatform.ins == null) {
                return new WXGamePlatform();
            }
            return WXGamePlatform.ins;
        },
        enumerable: true,
        configurable: true
    });
    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 (DateControl_1.DateControl.Fresh) {
            WXGamePlatform.dayShareNum = 0;
            WXGamePlatform.dayVideoNum = 0;
            this.updateDayShareInfo();
            this.updateDayVideoInfo();
        }
        else {
            WXGamePlatform.dayShareNum = LocalDataControl_1.LocalDataControl.Instance.getnum(UserDataInfo_1.UserDataInfo.nowdayShare);
            WXGamePlatform.dayVideoNum = LocalDataControl_1.LocalDataControl.Instance.getnum(UserDataInfo_1.UserDataInfo.nowdayVideo);
        }
    };
    /**
     * 存储当天分享的信息
     */
    WXGamePlatform.prototype.updateDayShareInfo = function () {
        LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.nowdayShare, WXGamePlatform.dayShareNum.toString());
    };
    WXGamePlatform.prototype.updateDayVideoInfo = function () {
        LocalDataControl_1.LocalDataControl.Instance.addstr(UserDataInfo_1.UserDataInfo.nowdayVideo, WXGamePlatform.dayVideoNum.toString());
    };
    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.Instance.getLaunchOptionsSync();
            if (login_info) {
                var query = login_info.query;
                if (query && query.ChanID) {
                    WXGamePlatform.QuDaoID = query.ChanID;
                }
                var referrerInfo = login_info.referrerInfo;
                if (WXGamePlatform.QuDaoID == "" && referrerInfo && referrerInfo.appId) {
                    WXGamePlatform.QuDaoID = referrerInfo.appId;
                }
                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) {
                    // 请求完新版本信息的回调
                    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.Instance.exitGame();
                                    }
                                }
                            });
                        });
                        updateManager.onUpdateFailed(function () {
                            // 新版本下载失败
                            WXGamePlatform.Instance.exitGame();
                        });
                    }
                    else {
                        // if( WXGamePlatform.loginCallobj && WXGamePlatform.loginprogressCallback )
                        // {
                        //     WXGamePlatform.loginprogressCallback.call( WXGamePlatform.loginCallobj,10 );
                        // }
                        var wxplatform = WXGamePlatform.Instance;
                        wxplatform.login(callobj, succeedcallback, failcallback);
                    }
                });
            }
            else {
                // if( WXGamePlatform.loginCallobj && WXGamePlatform.loginprogressCallback )
                // {
                //     WXGamePlatform.loginprogressCallback.call( WXGamePlatform.loginCallobj,10 );
                // }
                var wxplatform = WXGamePlatform.Instance;
                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) {
            var posx = (res.windowWidth - 151) / 2;
            var posy = res.windowHeight - 172 - 40;
            WXGamePlatform.Instance.userinfobutton = wx.createUserInfoButton({
                type: 'image',
                image: 'wxlocal/login.png',
                style: {
                    left: posx,
                    top: posy,
                    width: 151,
                    height: 72
                }
            });
            WXGamePlatform.Instance.userinfobutton.onTap(WXGamePlatform.Instance.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.Instance;
        if (res) {
            var errMsg = res.errMsg;
            if (errMsg == "getUserInfo:ok") {
                WXGamePlatform.accreditstate = 1;
                wxplatform.closeuserinfobUtton();
                wxplatform.getUserInfo(false, wxplatform.userinfocallobj, wxplatform.userinfosuccallback, wxplatform.userinfofailcallback);
            }
            else {
                if (wxplatform.userinfocallobj && wxplatform.userinfofailcallback) {
                    wxplatform.userinfofailcallback.call(wxplatform.userinfocallobj);
                }
            }
        }
    };
    WXGamePlatform.prototype.closeuserinfobUtton = function () {
        var wxplatform = WXGamePlatform.Instance;
        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.Instance;
        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.Instance;
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.login({
                success: function (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;
                },
                fail: function (res) {
                    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 回调
                        var wxgamePlatform = WXGamePlatform.Instance;
                        if (wxgamePlatform._subcallback && wxgamePlatform._subcallobj) {
                            wxgamePlatform._subcallback.call(wxgamePlatform._subcallobj);
                        }
                    },
                    fail: function (res) {
                        // 分包加载失败通过 fail 回调
                        var wxgamePlatform = WXGamePlatform.Instance;
                        if (wxgamePlatform._subfailcallback && wxgamePlatform._subcallobj) {
                            wxgamePlatform._subfailcallback.call(wxgamePlatform._subcallobj);
                        }
                    }
                });
                if (loadTask.onProgressUpdate) {
                    loadTask.onProgressUpdate(function (res) {
                        var wxgamePlatform = WXGamePlatform.Instance;
                        if (wxgamePlatform._updatecallback && wxgamePlatform._subcallobj) {
                            wxgamePlatform._updatecallback.call(wxgamePlatform._subcallobj, res.progress);
                        }
                    });
                }
            }
            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) {
            Laya.Browser.window.wx.getShareInfo({
                shareTicket: obj.shareTicket,
                success: function (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) {
            wx.setUserCloudStorage({
                KVDataList: obj,
                success: function (res) {
                    if (succeedcallback) {
                        succeedcallback.call(callobj, res);
                    }
                },
                fail: function (res) {
                    if (failCallback) {
                        failCallback.call(callobj);
                    }
                }
            });
        }
    };
    /**
     * 显示消息提示框
     * @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) {
            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.Instance.playbgSound("bgm");
                AudioControl_1.AudioControl.Instance.ClearAllSOUND();
            });
        }
    };
    WXGamePlatform.prototype.onAudioInterruptionEnd = function () {
        if (Laya.Browser.window.wx) {
            Laya.Browser.window.wx.onAudioInterruptionEnd(function () {
                var wxgameplatform = WXGamePlatform.Instance;
                Laya.timer.clear(wxgameplatform, wxgameplatform.onAudioEndCallback);
                Laya.timer.once(500, wxgameplatform, wxgameplatform.onAudioEndCallback);
            });
        }
    };
    WXGamePlatform.prototype.onAudioEndCallback = function () {
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_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 () {
            });
        }
    };
    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]) {
            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) {
                GlobalTip_1.GlobalTip.Instance.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;
                if (res && res.scene) {
                    WXGamePlatform.fromscene = Number(res.scene);
                }
                Laya.timer.frameOnce(1, WXGamePlatform.Instance, WXGamePlatform.Instance.onShowSucceed);
            });
        }
    };
    WXGamePlatform.prototype.onShowSucceed = function () {
        var wxgameplatform = WXGamePlatform.Instance;
        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) {
                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.Instance;
                        if (res.confirm) {
                            WXGamePlatform.Instance.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) {
                    GlobalTip_1.GlobalTip.Instance.showWordTips("广告尚未准备好，请" + time + "秒后再试");
                    return;
                }
                DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_losefocus);
                WXGamePlatform.istongjiVideoNum = istongjiNum;
                this.nowvideokey = key;
                WXGamePlatform.videoplaying = true;
                this.videocallobj = callobj;
                this.videosucceedCallback = succeedcallback;
                this.videofailCallback = failCallback;
                this.videoAd = wx.createRewardedVideoAd({
                    adUnitId: 'adunit-0c687084c908ee89'
                });
                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.Instance.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.Instance;
        WXGamePlatform.videoplaying = false;
        wxgamePlatform.videoAd.offError(wxgamePlatform.onerro); //移除 不然被多次调用
        wxgamePlatform.videoAd.offClose(wxgamePlatform.closeAD); //移除 不然被多次调用
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_getfocus);
    };
    // 关闭广告
    WXGamePlatform.prototype.closeAD = function (status) {
        WXGamePlatform.lastVideoTime = Laya.Browser.now();
        var wxgamePlatform = WXGamePlatform.Instance;
        if (status && status.isEnded || status == undefined) {
            if (WXGamePlatform.istongjiVideoNum) {
                WXGamePlatform.dayVideoNum++;
                wxgamePlatform.updateDayVideoInfo();
                DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_updateVideoNums);
            }
            if (wxgamePlatform.videocallobj && wxgamePlatform.videosucceedCallback) {
                wxgamePlatform.videosucceedCallback.call(wxgamePlatform.videocallobj);
            }
        }
        else {
            GlobalTip_1.GlobalTip.Instance.showWordTips("未观看完整视频，无法获得奖励");
            if (wxgamePlatform.videocallobj && wxgamePlatform.videofailCallback) {
                wxgamePlatform.videofailCallback.call(wxgamePlatform.videocallobj);
            }
        }
        WXGamePlatform.videoplaying = false;
        wxgamePlatform.videoAd.offError(wxgamePlatform.onerro); //移除 不然被多次调用
        wxgamePlatform.videoAd.offClose(wxgamePlatform.closeAD); //移除 不然被多次调用
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_getfocus);
    };
    // 广告失败
    WXGamePlatform.prototype.failVideo = function () {
        WXGamePlatform.lastVideoTime = Laya.Browser.now();
        WXGamePlatform.videoplaying = false;
        GlobalTip_1.GlobalTip.Instance.showWordTips("广告加载失败,试试别的方式吧~");
        var wxgamePlatform = WXGamePlatform.Instance;
        wxgamePlatform.videoAd.offError(wxgamePlatform.onerro); //移除 不然被多次调用
        wxgamePlatform.videoAd.offClose(wxgamePlatform.closeAD); //移除 不然被多次调用
        if (wxgamePlatform.videocallobj && wxgamePlatform.videofailCallback) {
            wxgamePlatform.videofailCallback.call(wxgamePlatform.videocallobj);
        }
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_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) {
                    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-8c2d586135fa6d4f',
                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) {
        var self = WXGamePlatform.Instance;
        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) {
    };
    WXGamePlatform.prototype.showBanner = function (style) {
        if (this.bannerAd) {
            this.nowStype = style;
            var info = this.getSystemInfoSync();
            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 () {
    };
    /**
     * 排行榜下一页
     */
    WXGamePlatform.prototype.nextPageRank = function () {
    };
    /**
     * 关闭好友排行榜
     */
    WXGamePlatform.prototype.closeFriendRank = function (viewType) {
        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.Instance.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 = LocalDataControl_1.LocalDataControl.Instance;
        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 + "" });
        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.WXGamePlatform = WXGamePlatform;
},{"../Control/AudioControl":17,"../Control/DateControl":19,"../Control/LocalDataControl":22,"../Data/UserDataInfo":33,"../Global":39,"../WXSDK/WECHATEVENT":78,"../utils/DispatcherManager":83,"../utils/GameUtils":85,"../utils/GlobalTip":86}],80:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WXGamePlatform_1 = require("../WXSDK/WXGamePlatform");
var PlatfromType_1 = require("./PlatfromType");
var WECHATEVENT_1 = require("../WXSDK/WECHATEVENT");
var Global_1 = require("../Global");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var TimesTamper_1 = require("../Time/TimesTamper");
var DateControl_1 = require("../Control/DateControl");
var AudioControl_1 = require("../Control/AudioControl");
/*
* name;
*/
var pingtaiutils = /** @class */ (function () {
    function pingtaiutils() {
        this._isenable = false;
        pingtaiutils.ins = this;
    }
    Object.defineProperty(pingtaiutils, "Instance", {
        get: function () {
            if (pingtaiutils.ins == null) {
                return new pingtaiutils();
            }
            return pingtaiutils.ins;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 初始化平台
     */
    pingtaiutils.prototype.initPlatfrom = function () {
        if (Laya.Browser.window.tt) {
            Global_1.Global.nowplatfrom = PlatfromType_1.PlatfromType.tt;
        }
        else if (Laya.Browser.window.wx) //微信小游戏
         {
            Global_1.Global.nowplatfrom = PlatfromType_1.PlatfromType.wx;
        }
        else {
            Global_1.Global.nowplatfrom = PlatfromType_1.PlatfromType.pc;
        }
    };
    pingtaiutils.prototype.init = function () {
        this.initPlatfrom();
        // switch( Global.nowplatfrom )
        // {
        //     case PlatfromType.wx:
        //         WXGamePlatform.Instance.init();
        //     break;
        //     case PlatfromType.qq:
        //     break;
        //     default:
        //     break;
        // }
        // this.onShow( this,this.showcallback );
        // this.onHide(this,this.hidecallback);
    };
    pingtaiutils.prototype.initData = function () {
        DateControl_1.DateControl.Instance.SetSelf();
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.initData();
                break;
            default:
                break;
        }
    };
    /**
     * 合违规判断 true：合规，false:违规
     */
    pingtaiutils.checkEnable = function () {
        if (pingtaiutils.islegal == 1) {
            return true;
        }
        return false;
    };
    pingtaiutils.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.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.createUserAndLogin(this, this.loginSucceed, this.loginprogressCallback, this.loginfailcallback);
                break;
            default:
                this.loginSucceed(null);
                break;
        }
    };
    pingtaiutils.prototype.loginprogressCallback = function (value) {
    };
    pingtaiutils.prototype.loginSucceed = function (data) {
        fairygui.GRoot.inst.closeModalWait();
    };
    pingtaiutils.prototype.loginfailcallback = function () {
    };
    pingtaiutils.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.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.onShow(callobj, succeedcallback, failCallback);
                break;
            case PlatfromType_1.PlatfromType.qq:
                break;
        }
    };
    pingtaiutils.prototype.showcallback = function () {
        Laya.timer.clear(this, this.againplaybgSound);
        Laya.timer.once(500, this, this.againplaybgSound);
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_onshow);
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_getfocus);
        var fromscene = pingtaiutils.fromscene();
        if (fromscene == 1089 || fromscene == 1131) {
            DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_fromscorfk);
        }
    };
    pingtaiutils.prototype.againplaybgSound = function () {
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_onAudioInterruptionEnd);
    };
    pingtaiutils.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.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.onHide(callobj, succeedcallback);
                break;
            case PlatfromType_1.PlatfromType.qq:
                break;
        }
    };
    pingtaiutils.prototype.hidecallback = function () {
        TimesTamper_1.TimesTamper.Instance.sendonlineTongji();
        AudioControl_1.AudioControl.Instance.ClearAllSOUND();
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_onhide);
        DispatcherManager_1.DispatcherManager.dispatchEvent(WECHATEVENT_1.WECHATEVENT.WECHATEVENT_losefocus);
    };
    Object.defineProperty(pingtaiutils.prototype, "isshow", {
        /**
         * 当前游戏是否在显示中
         */
        get: function () {
            var bo = true;
            switch (Global_1.Global.nowplatfrom) {
                case PlatfromType_1.PlatfromType.wx:
                    if (WXGamePlatform_1.WXGamePlatform.isShowing) {
                        bo = true;
                    }
                    bo = false;
                    break;
            }
            return bo;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * 分包加载
     */
    pingtaiutils.prototype.loadSubpackage = function (typename, callobj, callback, callprogress, failcallback) {
        if (failcallback === void 0) { failcallback = null; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.loadSubpackage(typename, callobj, callback, callprogress, failcallback);
                break;
            default:
                if (callobj && callback) {
                    callback.call(callobj);
                }
                break;
        }
    };
    /**
     * 获取是否已经授权
     * @param callobj
     * @param callback
     */
    pingtaiutils.prototype.isaccredit = function (callobj, accreditCallback) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.getaccredit(callobj, accreditCallback);
                break;
            case PlatfromType_1.PlatfromType.qq:
                WXGamePlatform_1.WXGamePlatform.Instance.getaccredit(callobj, accreditCallback);
                break;
            default:
                if (accreditCallback && callobj) {
                    accreditCallback.call(callobj, true);
                }
                break;
        }
    };
    /**
     * 拿角色信息授权
     */
    pingtaiutils.prototype.createaccredit = function (callobj, callback, failcallback) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.createUserInfoButton(callobj, callback, failcallback);
                break;
        }
    };
    pingtaiutils.prototype.closeuserinfoButton = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.closeuserinfobUtton();
                break;
        }
    };
    /**
     * 退出游戏
     */
    pingtaiutils.prototype.exitGame = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.exitGame();
                break;
        }
    };
    /**
     * 打开客服对话框
     */
    pingtaiutils.prototype.openCustomerService = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.openCustomerService();
                break;
        }
    };
    /**
     * 短震动
     */
    pingtaiutils.prototype.vibrateShort = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.vibrateShort();
                break;
            default:
                break;
        }
    };
    pingtaiutils.isCanVideo = function () {
        var bo = false;
        if (pingtaiutils.checkEnable()) {
            bo = true;
        }
        else {
            switch (Global_1.Global.nowplatfrom) {
                case PlatfromType_1.PlatfromType.wx:
                    bo = WXGamePlatform_1.WXGamePlatform.Instance.isCanVideo();
                    break;
                default:
                    bo = true;
                    break;
            }
        }
        return bo;
    };
    pingtaiutils.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.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.startShareApp(key, callobj, succeedCallback, failCallback);
                break;
            default:
                if (callobj && succeedCallback) {
                    succeedCallback.call(callobj);
                }
                break;
        }
    };
    pingtaiutils.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.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.playVideo(key, callobj, succeedcallback, failCallback, istongjiNum);
                break;
            default:
                if (callobj && succeedcallback) {
                    succeedcallback.call(callobj);
                }
                break;
        }
    };
    pingtaiutils.prototype.createBanner = function (bannertype, style) {
        if (style === void 0) { style = { x: 0, y: 0, scale: 1 }; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.createBanner(bannertype, style);
                break;
            default:
                break;
        }
    };
    pingtaiutils.prototype.hideBanner = function (bannertype) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.hideBanner(bannertype);
                break;
            default:
                break;
        }
    };
    /**
     * 数据上传（用于排行榜数据显示）
     * @param param1 上报数据1
     * @param param2 上报数据2
     */
    pingtaiutils.prototype.storeToCloud = function (param1, param2) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.storeToCloud(param1, param2);
                break;
            default:
                break;
        }
    };
    /**
     * 打开好友排行榜
     */
    pingtaiutils.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.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.openFriendRank(type, viewType, rect, parent, data);
                break;
            default:
                break;
        }
    };
    /**
     * 排行榜打开状态时候，切换显示类型
     * @param type
     */
    pingtaiutils.prototype.changeFriendRank = function (type) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.changeFriendRank(type);
                break;
            default:
                break;
        }
    };
    /**
     * 排行榜上一页
     */
    pingtaiutils.prototype.prePageRank = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.prePageRank();
                break;
            default:
                break;
        }
    };
    /**
     * 排行榜下一页
     */
    pingtaiutils.prototype.nextPageRank = function () {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.nextPageRank();
                break;
            default:
                break;
        }
    };
    /**
     * 关闭好友排行榜
     */
    pingtaiutils.prototype.closeFriendRank = function (viewType) {
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.closeFriendRank(viewType);
                break;
            default:
                break;
        }
    };
    pingtaiutils.prototype.lockVideoLeftTime = function () {
        var time = 0;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                time = WXGamePlatform_1.WXGamePlatform.Instance.lockVideoLeftTime();
                break;
            default:
                break;
        }
        return time;
    };
    pingtaiutils.dayVideoNums = function () {
        var time = 0;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                time = WXGamePlatform_1.WXGamePlatform.dayVideoNum;
                break;
            default:
                break;
        }
        return time;
    };
    /**
     * 1089:添加到我的小程序，1131:添加到浮窗
     */
    pingtaiutils.fromscene = function () {
        var scene = 0;
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                scene = WXGamePlatform_1.WXGamePlatform.fromscene;
                break;
            default:
                break;
        }
        return scene;
    };
    pingtaiutils.createGameClubButton = function (style, icon) {
        if (icon === void 0) { icon = "green"; }
        switch (Global_1.Global.nowplatfrom) {
            case PlatfromType_1.PlatfromType.wx:
                WXGamePlatform_1.WXGamePlatform.Instance.createGameClubButton(style, icon);
                break;
            default:
                break;
        }
    };
    /**
     * 是否合规
     */
    pingtaiutils.islegal = 0;
    return pingtaiutils;
}());
exports.pingtaiutils = pingtaiutils;
},{"../Control/AudioControl":17,"../Control/DateControl":19,"../Global":39,"../Time/TimesTamper":58,"../WXSDK/WECHATEVENT":78,"../WXSDK/WXGamePlatform":79,"../utils/DispatcherManager":83,"./PlatfromType":72}],81:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlayerAccount_1 = require("./PlayerAccount");
// import { Account } from "../Account/Account";
var ttshare = /** @class */ (function () {
    function ttshare() {
    }
    ttshare.share = function () {
        Laya.Browser.window.tt.shareAppMessage({
            channel: "article",
            templateId: "ocgf9b46464b9anlff",
            title: "冲啊冲",
            imageUrl: "jiazai/123.png",
            query: "res.query",
            success: function () { },
            fail: function () { },
        });
    };
    return ttshare;
}());
exports.ttshare = ttshare;
var ttad = /** @class */ (function () {
    function ttad() {
        ttad.instance = this;
    }
    Object.defineProperty(ttad, "Instance", {
        get: function () {
            if (ttad.instance) {
                return ttad.instance;
            }
            else {
                return new ttad();
            }
        },
        enumerable: true,
        configurable: true
    });
    ttad.InitAD = function () {
        if (!PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.video || !Laya.Browser.onMobile)
            return;
        ttad.bannerAdUnitId = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.bannerAdUnitId ? PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.bannerAdUnitId : ttad.bannerAdUnitId;
        console.log("bannerAdUnitId", ttad.bannerAdUnitId);
        ttad.videlAdUnitId = PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.videlAdUnitId ? PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.videlAdUnitId : ttad.videlAdUnitId;
        console.log("videlAdUnitId", ttad.videlAdUnitId);
        ttad.videoAd = Laya.Browser.window.tt.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
        ttad.videoAd.onClose(function (res) {
            if (res.isEnded) {
                if (ttad.closecallback) {
                    ttad.closecallback(true);
                }
            }
            else {
                if (ttad.closecallback) {
                    ttad.closecallback(false);
                }
            }
        });
    };
    ttad.ShowVideo = function (_cb) {
        var _this = this;
        if (!PlayerAccount_1.PlayerAccount.CurrentAccount.CurAccountData.video || !Laya.Browser.onMobile)
            return;
        console.log("show video");
        ttad.closecallback = _cb;
        ttad.videoAd.show().then(function () {
            console.log("广告显示成功");
        }).catch(function (err) {
            ttad.ShowTxt("视频正在加载中");
            console.log("广告组件出现问题", err);
            // 可以手动加载一次
            Laya.timer.once(200, _this, function () {
                ttad.videoAd.load().then(function () {
                    console.log("手动加载成功");
                    // 加载成功后需要再显示广告
                    return ttad.videoAd.show();
                });
            });
        });
    };
    ttad.Showbanner = function () {
        if (!Laya.Browser.onMobile)
            return;
        console.log("show banner");
        ttad.canshow = true;
        var infor = Laya.Browser.window.tt.getSystemInfoSync();
        var targetBannerAdWidth = 200;
        if (ttad.bannerAd)
            ttad.bannerAd.destroy();
        Laya.timer.once(200, this, function () {
            ttad.bannerAd = Laya.Browser.window.tt.createBannerAd({
                adUnitId: ttad.bannerAdUnitId,
                style: {
                    width: targetBannerAdWidth,
                    top: infor.windowHeight - (targetBannerAdWidth / 16) * 9 // 根据系统约定尺寸计算出广告高度
                }
            });
            ttad.bannerAd.onLoad(function () {
                if (ttad.canshow) {
                    ttad.bannerAd.show().then(function () {
                        console.log("广告显示成功");
                    }).catch(function (err) {
                        console.log("广告组件出现问题", err);
                    });
                }
            });
            ttad.bannerAd.onResize(function (size) {
                console.log(size.width, size.height);
                ttad.bannerAd.style.top = infor.windowHeight - size.height;
                ttad.bannerAd.style.left = (infor.windowWidth - size.width) / 2;
            });
        });
    };
    ttad.Clear = function () {
        ttad.canshow = false;
        ttad.closecallback = null;
        if (ttad.bannerAd)
            ttad.bannerAd.hide();
    };
    /**抖音更多游戏方法*/
    ttad.CreateMoreGameBtn = function (fun) {
        if (fun === void 0) { fun = null; }
        if (!Laya.Browser.onMobile)
            return;
        if (Laya.Browser.onIOS) {
            ttad.ShowTxt("暂未开放");
            return;
        }
        Laya.Browser.window.tt.showMoreGamesModal({
            appLaunchOptions: [
                {
                    appId: "tt66d0106df9eaa083",
                    query: "foo=bar&baz=qux",
                    extraData: {}
                }
            ],
            success: function (res) {
                console.log("success", res.errMsg);
                if (fun) {
                    fun();
                }
            },
            fail: function (res) {
                console.log("fail", res.errMsg);
            }
        });
        // 监听弹窗关闭
        //   this.onMoreGamesModalClose();
    };
    /*监听弹窗关闭*/
    // static onMoreGamesModalClose()
    // {
    //     if(!Laya.Browser.onMobile)return;
    //     if( Laya.Browser.onIOS)
    //     {
    //         ttad.ShowTxt("暂未开放");
    //         return;
    //     }
    //     Laya.Browser.window.tt.onMoreGamesModalClose(function() {
    //         console.log("modal closed");
    //         if(Scene3DManager.getInstance().IsGamePasue)
    //         {
    //             EventUtils.dispatchEvent( GameEvent.continueGame );
    //         }
    //       });
    // }
    ttad.ShowTxt = function (text) {
        if (Laya.Browser.window.tt) {
            Laya.Browser.window.tt.showToast({ title: text });
        }
        else {
            console.log(text);
        }
    };
    ttad.videlAdUnitId = "15gfgp58pocp80hbkb";
    ttad.bannerAdUnitId = "dsk7cohbl2f4jpjtq5";
    ttad.canshow = true;
    return ttad;
}());
exports.ttad = ttad;
},{"./PlayerAccount":73}],82:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 全局侦听类及消息处理
 */
var DisPatcherOn = /** @class */ (function (_super) {
    __extends(DisPatcherOn, _super);
    function DisPatcherOn() {
        var _this = _super.call(this) || this;
        _this.isInit = false;
        DisPatcherOn.ins = _this;
        if (_this.isInit) {
        }
        if (_this._dispatcher == null) {
            _this._dispatcher = new Laya.EventDispatcher();
            _this.isInit = true;
        }
        return _this;
    }
    Object.defineProperty(DisPatcherOn, "Instance", {
        get: function () {
            if (DisPatcherOn.ins == null)
                return new DisPatcherOn();
            return DisPatcherOn.ins;
        },
        enumerable: true,
        configurable: true
    });
    DisPatcherOn.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);
    };
    DisPatcherOn.prototype.removeEventListener = function (type, listener, thisObject, useCapture) {
        if (useCapture === void 0) { useCapture = false; }
        this._dispatcher.off(type, thisObject, listener);
    };
    DisPatcherOn.prototype.hasEventListener = function (type) {
        return this._dispatcher.hasListener(type);
    };
    DisPatcherOn.prototype.dispatchEvent = function (type, data) {
        return this._dispatcher.event(type, data);
    };
    return DisPatcherOn;
}(Laya.EventDispatcher));
exports.DisPatcherOn = DisPatcherOn;
},{}],83:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LEvent_1 = require("./LEvent");
var DisPatcherOn_1 = require("./DisPatcherOn");
/*
* name;
*/
var DispatcherManager = /** @class */ (function () {
    function DispatcherManager() {
    }
    DispatcherManager.init = function () {
        DisPatcherOn_1.DisPatcherOn.Instance;
    };
    //新建事件
    DispatcherManager.Event = function (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.LEvent(type, obj, bubbles, cancelable);
    };
    //派发事件
    DispatcherManager.dispatchEvent = function (type, obj, bubbles, cancelable) {
        if (obj === void 0) { obj = null; }
        if (bubbles === void 0) { bubbles = false; }
        if (cancelable === void 0) { cancelable = false; }
        DisPatcherOn_1.DisPatcherOn.Instance.dispatchEvent(type, obj);
    };
    //监听事件
    DispatcherManager.addEventListener = function (type, thisObject, listener, useCapture, priority) {
        if (useCapture === void 0) { useCapture = false; }
        if (priority === void 0) { priority = 0; }
        DisPatcherOn_1.DisPatcherOn.Instance.addEventListener(type, listener, thisObject, useCapture, priority);
    };
    DispatcherManager.hasEventListener = function (type) {
        return DisPatcherOn_1.DisPatcherOn.Instance.hasEventListener(type);
    };
    DispatcherManager.removeEventListener = function (type, thisObject, listener, useCapture, priority) {
        if (useCapture === void 0) { useCapture = false; }
        if (priority === void 0) { priority = 0; }
        DisPatcherOn_1.DisPatcherOn.Instance.removeEventListener(type, listener, thisObject);
    };
    return DispatcherManager;
}());
exports.DispatcherManager = DispatcherManager;
},{"./DisPatcherOn":82,"./LEvent":87}],84:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Sprite = Laya.Sprite;
var GameState = /** @class */ (function () {
    function GameState() {
        /*********************************************************************** */
        this.btnArr = ["res/button.png", "res/button.png", "res/button.png"];
        this.nameArr = ["canvas截图", "sprite截图", "清理"];
    }
    GameState.prototype.drawSomething = function () {
        this.sp = new Sprite();
        Laya.stage.addChild(this.sp);
        //画线
        this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3);
        //画连续直线
        this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5);
        //画曲线
        this.sp.graphics.drawCurves(352, 58, [0, 0, 19, -100, 39, 0, 58, 100, 78, 0, 97, -100, 117, 0, 136, 100, 156, 0], "#ff0000", 5);
        //画矩形
        this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00");
        //画多边形
        this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00");
        //画三角形
        this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00");
        //画圆
        this.sp.graphics.drawCircle(98, 332, 50, "#00ffff");
        //画扇形
        this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff");
        //绘制圆角矩形，自定义路径
        this.sp.graphics.drawPath(400, 310, [["moveTo", 5, 0], ["lineTo", 105, 0], ["arcTo", 110, 0, 110, 5, 5], ["lineTo", 110, 55], ["arcTo", 110, 60, 105, 60, 5], ["lineTo", 5, 60], ["arcTo", 0, 60, 0, 55, 5], ["lineTo", 0, 5], ["arcTo", 0, 0, 5, 0, 5], ["closePath"]], { fillStyle: "#00ffff" });
    };
    GameState.prototype._onclick = function (e) {
        switch (e.target.name) {
            case this.nameArr[0]:
                var base64Url = this._canvas.toDataURL("image/png", 1);
                this.drawImage.skin = base64Url;
                break;
            case this.nameArr[1]:
                var text = Laya.stage.drawToTexture(Laya.Browser.clientWidth, Laya.Browser.clientHeight, 0, 0);
                this.drawSp.graphics.drawTexture(text, 0, 0, this.drawSp.width, this.drawSp.height);
                break;
            case this.nameArr[2]:
                this.drawImage.skin = null;
                this.drawSp.graphics.clear();
                this.drawSp.graphics.drawRect(0, 0, this.drawSp.width, this.drawSp.height, "#ff0000");
                break;
        }
    };
    GameState.removeselect = "GameState_removeselect";
    GameState.npcend = "GameState_npcendGame";
    /**
     * 通关成功
     */
    GameState.win = "GameState_winGame";
    /**
     * 通关失败
     */
    GameState.fail = "GameState_failGame";
    GameState.jump = "GameState_jumpgame";
    /**
     * 暂停游戏
     */
    GameState.stop = "GameState_stopGame";
    /**
     * 回到主界面
     */
    GameState.returnMainView = "returnMainView";
    GameState.updateSKinView = "GameState_updateSKinView";
    /*********************************************************************** */
    /**
     * 开始游戏
     */
    GameState.start = "GameState_startGame";
    /**
     * 结束游戏
     */
    GameState.end = "GameState_endGame";
    /**失败 */
    GameState.lose = "GameState_loseGame";
    /**
     * 复活
     */
    GameState.revive = "GameState_reviveGame";
    /**是否复活 */
    GameState.isdie = false;
    /**允许复活次数 */
    GameState.fuhuocishu = 1;
    /**是否已经发布过录屏 */
    GameState.recordscree = false;
    return GameState;
}());
exports.GameState = GameState;
},{}],85:[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 = {}));
},{}],86:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GlobalTipPanel_1 = require("../View/GlobalTipPanel");
var LayoutControl_1 = require("../Control/LayoutControl");
var LayOUT_1 = require("../utils/LayOUT");
var DispatcherManager_1 = require("../utils/DispatcherManager");
var GameState_1 = require("../utils/GameState");
/*
* name;
*/
var GlobalTip = /** @class */ (function () {
    function GlobalTip() {
        GlobalTip.ins = this;
    }
    Object.defineProperty(GlobalTip, "Instance", {
        get: function () {
            if (GlobalTip.ins == null) {
                return new GlobalTip();
            }
            return GlobalTip.ins;
        },
        enumerable: true,
        configurable: true
    });
    GlobalTip.prototype.initEvent = function () {
        GlobalTip.isEvent = true;
        DispatcherManager_1.DispatcherManager.addEventListener(GameState_1.GameState.removeselect, this, this.addwordList);
    };
    GlobalTip.prototype.showWordTips = function (word) {
        if (!GlobalTip.isEvent) {
            GlobalTip.Instance.initEvent();
        }
        if (GlobalTip.showWordList.length > 0) {
            var lastword = GlobalTip.showWordList[GlobalTip.showWordList.length - 1].nowword;
            // if( lastword == word )
            // {
            //     return;
            // }
        }
        if (GlobalTip.wordList.length > 0) {
            var item = GlobalTip.wordList.shift();
            LayoutControl_1.LayoutControl.Instance.AddLayerByName(item, LayOUT_1.LayOUT.TIP);
            GlobalTip.showWordList.push(item);
            item.showWord(word);
        }
        else {
            if (GlobalTip.showWordList.length < 10) {
                var item1 = new GlobalTipPanel_1.WordTipsPanel();
                LayoutControl_1.LayoutControl.Instance.AddLayerByName(item1, LayOUT_1.LayOUT.TIP);
                GlobalTip.showWordList.push(item1);
                item1.showWord(word);
            }
            else {
                var item1 = GlobalTip.showWordList.shift();
                item1.showWord(word);
                GlobalTip.showWordList.push(item1);
            }
        }
    };
    GlobalTip.prototype.addwordList = function (item) {
        if (item) {
            item.removeFromParent();
            var index = GlobalTip.showWordList.indexOf(item);
            if (index != -1) {
                GlobalTip.showWordList.splice(index, 1);
            }
            LayoutControl_1.LayoutControl.Instance.ClearLayerByName(LayOUT_1.LayOUT.TIP);
            GlobalTip.wordList.push(item);
        }
    };
    GlobalTip.wordList = [];
    GlobalTip.showWordList = [];
    GlobalTip.maxNum = 10;
    GlobalTip.isEvent = false;
    return GlobalTip;
}());
exports.GlobalTip = GlobalTip;
},{"../Control/LayoutControl":21,"../View/GlobalTipPanel":62,"../utils/DispatcherManager":83,"../utils/GameState":84,"../utils/LayOUT":88}],87:[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.LEvent = LEvent;
},{}],88:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LayOUT = /** @class */ (function () {
    function LayOUT() {
    }
    /**
     * 背景层
     */
    LayOUT.BG = "BG";
    /**
     * ui层
     */
    LayOUT.UI = "UI";
    /**
     * ui层上层
     */
    LayOUT.UITop = "UITop";
    /**
     * tips层
     */
    LayOUT.TIP = "TIP";
    /**
     * 新手引导层
     */
    LayOUT.GUIDE = "GUIDE";
    return LayOUT;
}());
exports.LayOUT = LayOUT;
},{}],89:[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.Instance = 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.Singleton = Singleton;
},{}],90:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AgencySkin_1 = require("../Agency/AgencySkin");
var PanelResDic_1 = require("../PrefabControl/PanelResDic");
var GlobalTip_1 = require("../utils/GlobalTip");
var AssetPath_1 = require("../Config/AssetPath");
var MovieClip = Laya.MovieClip;
var ttad_1 = require("../WXSDK/ttad");
var SkinItem = /** @class */ (function (_super) {
    __extends(SkinItem, _super);
    function SkinItem() {
        var _this = _super.call(this) || this;
        /********************************************************** */
        _this.bgColorChannels = { r: 99, g: 0, b: 0xFF };
        /********************************************** */
        _this.SWFPath = "res/swf/dragon.swf";
        _this.MCWidth = 318;
        _this.MCHeight = 406;
        return _this;
    }
    SkinItem.prototype.getHexColorString = function () {
        this.bgColorChannels.r = Math.floor(this.bgColorChannels.r);
        // 绿色通道使用0
        this.bgColorChannels.g = 0;
        //obj.g = Math.floor(obj.g);
        this.bgColorChannels.b = Math.floor(this.bgColorChannels.b);
        var r = this.bgColorChannels.r.toString(16);
        r = r.length == 2 ? r : "0" + r;
        var g = this.bgColorChannels.g.toString(16);
        g = g.length == 2 ? g : "0" + g;
        var b = this.bgColorChannels.b.toString(16);
        b = b.length == 2 ? b : "0" + b;
        return "#" + r + g + b;
    };
    /********************************************************** */
    SkinItem.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();
    };
    SkinItem.prototype.onInit = function () {
        this.initView();
        this.initEvent();
    };
    SkinItem.prototype.initView = function () {
        this.agencyskin = PanelResDic_1.PanelResDic.Instance.getSingleTon(AgencySkin_1.AgencySkin);
        this.c_state = this.getController("c_state");
    };
    SkinItem.prototype.initEvent = function () {
        this.on(Laya.Event.CLICK, this, this.btnclick);
    };
    SkinItem.prototype.btnclick = function () {
        if (this.pifuvo) {
            switch (this.c_state.selectedIndex) {
                case 0:
                    break;
                case 1: //拥有
                    this.agencyskin.GainPifu(this.pifuvo);
                    break;
                case 2: //活动获取
                    GlobalTip_1.GlobalTip.Instance.showWordTips("暂未开放");
                    break;
                case 3: //看视频获取
                    this.playvideocallback();
                    // pingtaiutils.Instance.playVideo( "",this,this.playvideocallback );
                    break;
                case 4: //金币购买
                    this.agencyskin.GainPifu(this.pifuvo);
                    break;
            }
        }
    };
    SkinItem.prototype.createMovieClip = function () {
        var mc = new MovieClip();
        mc.load(this.SWFPath);
        mc.x = (Laya.stage.width - this.MCWidth) / 2;
        mc.y = (Laya.stage.height - this.MCHeight) / 2;
        Laya.stage.addChild(mc);
    };
    /********************************************** */
    SkinItem.prototype.playvideocallback = function () {
        var _this = this;
        ttad_1.ttad.ShowVideo((function (isLoad) {
            if (isLoad) {
                _this.agencyskin.GainPifu(_this.pifuvo);
            }
        }));
    };
    SkinItem.prototype.showData = function (vo) {
        this.pifuvo = vo;
        if (this.pifuvo) {
            this.load_icon.icon = AssetPath_1.AssetPath.getroleicon(this.pifuvo.roleCFG.icon);
            if (this.agencyskin.RoleData.CharacterID == 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;
                }
            }
        }
    };
    /******************************************************** */
    SkinItem.prototype.preFixNumber = function (num, strLen) {
        return ("0000000000" + num).slice(-strLen);
    };
    SkinItem.prototype.evalBgColor = function () {
        var color = Math.random() * 0xFFFFFF;
        var channels = this.getColorChannals(color);
    };
    SkinItem.prototype.getColorChannals = function (color) {
        var result = [];
        result.push(color >> 16);
        result.push(color >> 8 & 0xFF);
        result.push(color & 0xFF);
        return result;
    };
    /******************************************************** */
    SkinItem.prototype.dispose = function () {
        this.off(Laya.Event.CLICK, this, this.btnclick);
        _super.prototype.dispose.call(this);
    };
    return SkinItem;
}(fairygui.GButton));
exports.SkinItem = SkinItem;
},{"../Agency/AgencySkin":6,"../Config/AssetPath":15,"../PrefabControl/PanelResDic":46,"../WXSDK/ttad":81,"../utils/GlobalTip":86}],91:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 继承baseView界面的打开关闭动效类型
 */
var ViewAction = /** @class */ (function () {
    function ViewAction() {
        /************************ */
        this._text = null;
    }
    /**
 * 动画状态开始时执行。
 */
    ViewAction.prototype.onStateEnter = function () {
        console.log("动画开始播放了");
        this._text.text = "动画状态：动画开始播放";
    };
    /**
     * 动画状态更新时执行。
     */
    ViewAction.prototype.onStateUpdate = function () {
        console.log("动画状态更新了");
        this._text.text = "动画状态：动画更新中";
    };
    /**
     * 动画状态退出时执行。
     */
    ViewAction.prototype.onStateExit = function () {
        console.log("动画退出了");
        this._text.text = "动画状态：动画开始退出";
    };
    ViewAction.prototype.addBox = function () {
        for (var i = 0; i < 8; i++) {
            this.addVerticalBox(-0.65, 0.165 + i * 0.33 * 2, 0);
            this.addVerticalBox(0, 0.165 + i * 0.33 * 2, 0);
            this.addVerticalBox(0.65, 0.165 + i * 0.33 * 2, 0);
        }
    };
    ViewAction.prototype.addVerticalBox = function (x, y, z) {
        var box = this.scene.addChild(new Laya.MeshSprite3D(this.mesh1));
        box.meshRenderer.material = this.mat1;
        box.meshRenderer.castShadow = true;
        box.meshRenderer.receiveShadow = true;
        box.transform.position = new Laya.Vector3(x, y, z);
        var rigidBody = box.addComponent(Laya.Rigidbody3D);
        rigidBody.mass = 10;
        rigidBody.friction = 0.4;
        rigidBody.restitution = 0.2;
        var boxShape = new Laya.BoxColliderShape(0.5, 0.33, 2);
        rigidBody.colliderShape = boxShape;
    };
    /**
     * 从小变大
     */
    ViewAction.ActionType_addscaleMinToMax = "ActionType_addscaleMinToMax";
    /**
     * 从大变小移出
     */
    ViewAction.ActionType_removescaleMaxToMin = "ActionType_removescaleMaxToMin";
    /**
     * 没有动效
     */
    ViewAction.ActionType_none = "ActionType_none";
    /********************************************** */
    /**
     * 从右边移动到中央
     */
    ViewAction.ActionType_addmoveToMiddle = "ActionType_addmoveToMiddle";
    /**
     * 从最右边移出
     */
    ViewAction.ActionType_removemoveToRight = "ActionType_removemoveToRight";
    /**
     * 从底部向上移动
     */
    ViewAction.ActionType_addmoveFromBottom = "ActionType_addmoveFromBottom";
    /**
     * 从上向底部移动
     */
    ViewAction.ActionType_addmoveFromup = "ActionType_addmoveFromup";
    return ViewAction;
}());
exports.ViewAction = ViewAction;
},{}]},{},[42])
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 1327220 characters]
