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AwB;YAC3B,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC1C,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;KAyCJ,CAAA;IA3DU,8BAAI,GAAG,2BAA2B,CAAC;IAFzB,yBAAyB;QAD7C,qCAAY,CAAC,uCAAoB,CAAC;OACd,yBAAyB,CA6D7C;IAAD,gCAAC;KAAA;kBA7DoB,yBAAyB","file":"","sourceRoot":"/","sourcesContent":["import { RegPresenter } from \"../PresenterCCViewFactory\";\r\nimport { ExchangeCodeViewType, ExchangeCodeView, ExchangeCodeViewProps } from \"../view/type/ExChangeCodeView\";\r\nimport { Presenter } from \"../../../common/classbase/PresenterBase\";\r\nimport { HttpRequests } from \"../../network/HttpRequests\";\r\nimport { GameModelManager } from \"../../model/GameModelManager\";\r\nimport { GameConstData } from \"../../../common/gameplay/gamedata/GameConstData\";\r\nimport { UIManager } from \"../../../common/gameplay/managers/UIManager\";\r\nimport { GameTextData } from \"../../../common/gameplay/gamedata/GameTextData\";\r\ninterface ExchangeCodeParam {\r\n titletxt: string;\r\n contenttxt: string;\r\n}\r\n@RegPresenter(ExchangeCodeViewType)\r\nexport default class ExchangeCodeViewPresenter extends Presenter<ExchangeCodeParam, ExchangeCodeView>\r\n{\r\n static uuid = \"ExchangeCodeViewPresenter\";\r\n\r\n private _viewProps: ExchangeCodeViewProps;\r\n\r\n constructor() {\r\n super();\r\n this._viewProps = {\r\n titletxt: \"\",\r\n contenttxt: \"\",\r\n onActionClick: this.onActionClickCallback\r\n };\r\n }\r\n\r\n onOpen(param: ExchangeCodeParam) {\r\n super.onOpen(param);\r\n this._viewProps.titletxt = param.titletxt;\r\n this._viewProps.contenttxt = param.contenttxt;\r\n this._view.setProps(this._viewProps);\r\n }\r\n\r\n onActionClickCallback = async (ret: boolean, cdkey: string) => {\r\n if (ret) {\r\n let ret = await HttpRequests.exchangeCDKEY(cdkey) as any;\r\n console.log(\"current ret is\" + JSON.stringify(ret));\r\n if (ret.code === \"0\") {\r\n\r\n let player = GameModelManager.getPlayerData();\r\n let outstr = \"\";\r\n for (let i = 0; i < ret.obj.props.length; i++) {\r\n let data = ret.obj.props[i];\r\n let id = Number.parseInt(data.prop_id);\r\n if (id === GameConstData.GAME_CONST_GOLD_ID_VALUE) {\r\n player.addGoldCoin(data.count);\r\n } else if (id === GameConstData.GAME_CONST_CLOTH_ID_VALUE) {\r\n player.addClothCoin(data.count);\r\n } else {\r\n player.addProps(id, data.count);\r\n }\r\n let item = GameModelManager.getItemConfig(id);\r\n outstr += item.name + \" x\" + data.count;\r\n\r\n if (i != ret.obj.props.length - 1) {\r\n outstr += \",\";\r\n }\r\n }\r\n UIManager.showToast(outstr);\r\n } else if (ret.code === \"104001\") {//错误的验证码\r\n let content = GameModelManager.getLanguageTxt(GameTextData.TEXT_CDKEYINVALID_VALUE);\r\n UIManager.showToast(content);\r\n } else if (ret.code === \"104002\")//已经领过了\r\n {\r\n let content = GameModelManager.getLanguageTxt(GameTextData.TEXT_CDKEYHADEXCHANGED_VALUE);\r\n UIManager.showToast(content);\r\n } else {//其他\r\n let content = GameModelManager.getLanguageTxt(GameTextData.TEXT_CDKEYINVALID_VALUE);\r\n UIManager.showToast(content);\r\n }\r\n }\r\n }\r\n}"]}