{
  "code": "import { NetInfoManager } from \"./NetInfoManager\";\r\nimport UserModel, { UserAttr } from \"../Net/UserModel\";\r\nimport NetManager, { PROTOCOLS } from \"../Net/NetManager\";\r\nvar TiledMap = Laya.TiledMap;\r\nvar Rectangle = Laya.Rectangle;\r\nvar Browser = Laya.Browser;\r\nvar Handler = Laya.Handler;\r\nexport class PlayerManager {\r\n    constructor() {\r\n        this.stage = 1;\r\n        this.equipId = 1;\r\n        this.mLastMouseX = 0;\r\n        this.mLastMouseY = 0;\r\n        this.mX = 0;\r\n        this.mY = 0;\r\n    }\r\n    static get Instance() {\r\n        return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());\r\n    }\r\n    static GlobalMessage() {\r\n        PlayerManager.tower_reward = Number(NetInfoManager.Instance.GetGlobal(\"tower_reward\"));\r\n        PlayerManager.block_reward = Number(NetInfoManager.Instance.GetGlobal(\"block_reward\"));\r\n        PlayerManager.enemy_reward = Number(NetInfoManager.Instance.GetGlobal(\"enemy_reward\"));\r\n    }\r\n    InitPlayer() {\r\n        var usermodel = UserModel.Instance.CurModel;\r\n        PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);\r\n        PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)[\"1\"]);\r\n        this.SetInfo();\r\n    }\r\n    SpeedUp(level, chanel, count, callback) {\r\n        let param = [{ \"t\": UserModel.Instance.CurModel.ServerTime }, { \"attr\": \"rate\" }, { \"level\": level }, { \"channel\": chanel }, { \"amount\": count }];\r\n        NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {\r\n            if (callback)\r\n                callback(true);\r\n        }, (data) => {\r\n            if (callback)\r\n                callback(false);\r\n        });\r\n    }\r\n    SetInfo() {\r\n        let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)[\"power\"];\r\n        if (power)\r\n            this.powerLevel = Number(power);\r\n        else\r\n            this.powerLevel = 1;\r\n        let al = NetInfoManager.Instance._atk.length;\r\n        let t = this.powerLevel > al ? al : this.powerLevel;\r\n        PlayerManager.bulletAttack = NetInfoManager.Instance.GetAtk(t)[\"atk\"];\r\n        let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)[\"rate\"];\r\n        if (rate)\r\n            this.rateLevel = Number(rate);\r\n        else\r\n            this.rateLevel = 1;\r\n        let al1 = NetInfoManager.Instance._rate.length;\r\n        let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;\r\n        PlayerManager.bulletTime = NetInfoManager.Instance.GetRate(t1)[\"rate\"];\r\n    }\r\n    createMap() {\r\n        this.tiledMap = new TiledMap();\r\n        this.mX = this.mY = 0;\r\n        this.tiledMap.createMap(\"res/tiledMap/desert.json\", new Rectangle(0, 0, Browser.width, Browser.height), new Handler(this, this.completeHandler));\r\n    }\r\n    completeHandler() {\r\n        console.log(\"地图创建完成\");\r\n        console.log(\"ClientW:\" + Browser.clientWidth + \" ClientH:\" + Browser.clientHeight);\r\n        Laya.stage.on(Laya.Event.RESIZE, this, this.resize);\r\n        this.resize();\r\n    }\r\n    mouseDown() {\r\n        this.mLastMouseX = Laya.stage.mouseX;\r\n        this.mLastMouseY = Laya.stage.mouseY;\r\n        Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove);\r\n    }\r\n    mouseMove() {\r\n        this.tiledMap.moveViewPort(this.mX - (Laya.stage.mouseX - this.mLastMouseX), this.mY - (Laya.stage.mouseY - this.mLastMouseY));\r\n    }\r\n    mouseUp() {\r\n        this.mX = this.mX - (Laya.stage.mouseX - this.mLastMouseX);\r\n        this.mY = this.mY - (Laya.stage.mouseY - this.mLastMouseY);\r\n        Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.mouseMove);\r\n    }\r\n    resize() {\r\n        this.tiledMap.changeViewPort(this.mX, this.mY, Browser.width, Browser.height);\r\n    }\r\n    PowerUp(level, chanel, count, callback) {\r\n        let param = [{ \"t\": UserModel.Instance.CurModel.ServerTime }, { \"attr\": \"power\" }, { \"level\": level }, { \"channel\": chanel }, { \"amount\": count }];\r\n        NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {\r\n            if (callback)\r\n                callback(true);\r\n        }, (data) => {\r\n            if (callback)\r\n                callback(false);\r\n        });\r\n    }\r\n}\r\nPlayerManager.bulletAttack = 1;\r\nPlayerManager.bulletTime = 0.3;\r\n//# sourceMappingURL=PlayerManager.js.map",
  "references": [
    "E:/LayaProject/gungang/src/Game/DispatcherManager.ts",
    "E:/LayaProject/gungang/src/Game/NetInfoManager.ts",
    "E:/LayaProject/gungang/src/Net/UserModel.ts",
    "E:/LayaProject/gungang/src/Util/GameTool.ts",
    "E:/LayaProject/gungang/src/Net/NetManager.ts"
  ],
  "map": "{\"version\":3,\"file\":\"PlayerManager.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Game/PlayerManager.ts\"],\"names\":[],\"mappings\":\"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG1D,IAAO,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAChC,IAAO,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAClC,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC9B,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAI9B,MAAM,OAAO,aAAa;IAA1B;QAMW,UAAK,GAAW,CAAC,CAAC;QAClB,YAAO,GAAW,CAAC,CAAC;QAwDnB,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;QACxB,OAAE,GAAW,CAAC,CAAC;QACf,OAAE,GAAW,CAAC,CAAC;IA0D3B,CAAC;IA1HU,MAAM,KAAK,QAAQ;QACtB,OAAO,aAAa,CAAC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