local UIQRCodeLogin = UIViewClass() local EventSystem = require('Event/EventSystem') function UIQRCodeLogin:OnOpened() self:RegistSystemEvent(EventID.PCPackage_OpenQrCodeError, self.OnOpenQrCodeError) self:PlayUIAnimation(ConstAssetPathConfig.Path33, self.rotate.transform, false) UTL.Item.SetLocalizationImage(nil, self.img_Logo, "img_Logo.png") self:OnValueChanged(self.toggle_Auto) self:StartRepeatFunc(self.UpdateQRCodeLoginCallback, 3, -1) self:InitQrCodePanel() end function UIQRCodeLogin:InitQrCodePanel() UIUtils.SetActive(self.qrcode_cn, GameAppInfo.IsChinesePackage()) UIUtils.SetActive(self.qrCode_hmt, not GameAppInfo.IsChinesePackage()) if GameAppInfo.IsChinesePackage() then self.qrcode_cn:OpenWebpage("http://usdk.yingxiong.com/hu/v2/scanqr/qr?from=pc&pcode=17078&clb=js") self.qrcode_cn:RegisterQRCodeLoginCallback() elseif GameAppInfo.IsOverseaPackage() then if GameAppInfo.IsOfficalPackage() then self.qrCode_hmt:OpenWebpage("https://qrlogin.newtypegames.com?size=280") else self.qrCode_hmt:OpenWebpage("https://qrlogin-qa.newtypegames.com?size=280") end self.qrCode_hmt:RegisterQRCodeLoginCallback() end end function UIQRCodeLogin:OnOpenQrCodeError(errorCode) logging.error(LTAG.ERROR, "OnOpenQrCodeError", errorCode) if errorCode == 1 then CTL.Login.OpenErrorWarnPanel(UIUtils.GetLocalizedTxt(Const_IDS["IDS_ERROR_NETWORK_AUTH_10005"]), function() self:InitQrCodePanel() end) end end function UIQRCodeLogin:UpdateQRCodeLoginCallback(deltaTime, timeSinceUpdate) if GameAppInfo.IsChinesePackage() then self.qrcode_cn:RegisterQRCodeLoginCallback() elseif GameAppInfo.IsOverseaPackage() then self.qrCode_hmt:RegisterQRCodeLoginCallback() end end function UIQRCodeLogin:OnValueChanged(comp, index) if comp == self.toggle_Auto then CTL.WinLogin.SetIsAutoLogin(self.toggle_Auto.isOn) end end return UIQRCodeLogin