diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 86831afe..c4cfdf42 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -35,6 +35,7 @@ BIReport.ACCOUNT_OPT_TYPE = { LOGIN_FAILED = "LoginFailed", BIND_CLICK = "BindClick", BIND_FINISH = "BindFinish", + DELETE = "Delete" } BIReport.CHAPTER_OPT_TYPE = { @@ -765,7 +766,6 @@ function BIReport:postMailOpen(mailId) event_type = BIReport.MAIL_OPT_TYPE.OPEN, } self:report(EVENT_NAME_MAIL_OPT, args) - BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args) end function BIReport:postMailClaim(mailId) @@ -778,7 +778,14 @@ function BIReport:postMailClaim(mailId) event_type = BIReport.MAIL_OPT_TYPE.CLAIM, } self:report(EVENT_NAME_MAIL_OPT, args) - BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args) +end + +function BIReport:postAccountDelete(loginType) + local args = { + login_type = loginType, + event_type = BIReport.ACCOUNT_OPT_TYPE.DELETE, + } + self:report(EVENT_NAME_ACCOUNT_OPT, args) end return BIReport \ No newline at end of file diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua index 1743db0b..1329067a 100644 --- a/lua/app/common/module_manager.lua +++ b/lua/app/common/module_manager.lua @@ -49,6 +49,8 @@ local MODULE_PATHS = { MailManager = "app/module/mail/mail_manager", -- 玩家 PlayerManager = "app/module/player/player_manager", + -- 账号 + AccountManager= "app/module/account/account_manager", } -- 这里的key对应func_open里的id diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 7eef40c2..49a61766 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -35,7 +35,7 @@ local CONST_METATABLE = { } setmetatable(GConst, CONST_METATABLE) -GConst.ANDROID_STORE_URL = "https://play.google.com/store/apps/details?id=com.cobby.lonelysurvivor" +GConst.ANDROID_STORE_URL = "https://play.google.com/store/apps/details?id=com.knight.connect.rpg" GConst.IOS_STORE_URL = "https://itunes.apple.com/app/1637393009" GConst.SKIP_VERSION = CS.BF.GameConst.SKIP_VERSION GConst.DESIGN_RESOLUTION_WIDTH = CS.BF.GameConst.DESIGN_RESOLUTION_WIDTH diff --git a/lua/app/global/global_func.lua b/lua/app/global/global_func.lua index a79988ad..094b119a 100644 --- a/lua/app/global/global_func.lua +++ b/lua/app/global/global_func.lua @@ -336,16 +336,6 @@ function GFunc.showMessageBox(params) MessageBox:showMessageBox(params) end -function GFunc.showCheatingBox(params) - local CheatMessageBox = require "app/ui/common/cheat_message_box" - CheatMessageBox:showCheatMessageBox(params) -end - -function GFunc.hideCheatingBox() - local CheatMessageBox = require "app/ui/common/cheat_message_box" - CheatMessageBox:hideCheatMessageBox() -end - function GFunc.showToast(params) ModuleManager.ToastManager:showToast(params) end diff --git a/lua/app/module/account.meta b/lua/app/module/account.meta new file mode 100644 index 00000000..b929040c --- /dev/null +++ b/lua/app/module/account.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b8f4a8cf53417314abb0cba97d791459 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/module/account/account_manager.lua b/lua/app/module/account/account_manager.lua new file mode 100644 index 00000000..eba93751 --- /dev/null +++ b/lua/app/module/account/account_manager.lua @@ -0,0 +1,28 @@ +local AccountManager = class("AccountManager", BaseModule) + +function AccountManager:showBindUI() + if DataManager.PlayerData:isBinded() then + return + end + UIManager:showUI("app/ui/game_setting/setting_binding_ui") +end + +function AccountManager:showDeleteUI() + return UIManager:showUI("app/ui/game_setting/account_delete_ui") +end + +function AccountManager:deleteAccount() + self:sendMessage(ProtoMsgType.FromMsgEnum.DeleteReq, {}, {}, self.onDeleteAccount, BIReport.ITEM_GET_TYPE.NONE) +end + +function AccountManager:onDeleteAccount(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then -- 删除账号成功 + local info = LocalData:getLastLoginInfo() + BIReport:postAccountDelete(info.type) + ModuleManager.LoginManager:goToLoginScene() + else + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DELETE_ACCOUNT_FAILED)) + end +end + +return AccountManager \ No newline at end of file diff --git a/lua/app/ui/common/cheat_message_box.lua.meta b/lua/app/module/account/account_manager.lua.meta similarity index 86% rename from lua/app/ui/common/cheat_message_box.lua.meta rename to lua/app/module/account/account_manager.lua.meta index fa77c80e..7f82a3f7 100644 --- a/lua/app/ui/common/cheat_message_box.lua.meta +++ b/lua/app/module/account/account_manager.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ed5cd4e2a31830e439ea9f1e38f55731 +guid: fbc7bda584c3578478d7e7fe2bb9e7a1 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/module/login/login_manager.lua b/lua/app/module/login/login_manager.lua index 7016bf8d..63524c2e 100644 --- a/lua/app/module/login/login_manager.lua +++ b/lua/app/module/login/login_manager.lua @@ -101,6 +101,7 @@ function LoginManager:goToLoginScene() ModuleManager.BattleManager:clearOnExitScene() NetManager:closeAndClear() UIManager:backToLoginWithoutLogout() + UIManager:clearUIPrefabCache() DataManager:clear() end diff --git a/lua/app/net/net_manager.lua b/lua/app/net/net_manager.lua index caf2042b..611805b2 100644 --- a/lua/app/net/net_manager.lua +++ b/lua/app/net/net_manager.lua @@ -215,12 +215,17 @@ function NetManager:connect(domain, port, callback, socketName) pbData.status = not pbData.err_code and 0 or ProtoMsgDispatch:getErrCodeEnum(pbData.err_code) if pbData.status ~= 0 then self:closeAndClear() - local lastLoginType = LocalData:getLastLoginType() - if lastLoginType == NetManager.LOGIN_TYPE.GOOGLE or lastLoginType == NetManager.LOGIN_TYPE.APPLE then - local loginType = SDKManager.BF_LOGIN_TYPE.GOOGLE - if lastLoginType == NetManager.LOGIN_TYPE.APPLE then - loginType = SDKManager.BF_LOGIN_TYPE.APPLE - end + local accountInfo = LocalData:getAccountInfo() + local loginType + local lastLoginType + if accountInfo.google_id and accountInfo.google_id ~= "" then + loginType = SDKManager.BF_LOGIN_TYPE.GOOGLE + lastLoginType = NetManager.LOGIN_TYPE.GOOGLE + elseif accountInfo.apple_id and accountInfo.apple_id ~= "" then + loginType = SDKManager.BF_LOGIN_TYPE.APPLE + lastLoginType = NetManager.LOGIN_TYPE.APPLE + end + if loginType then SDKManager:login(function(params) if not params.token then return diff --git a/lua/app/ui/common/cheat_message_box.lua b/lua/app/ui/common/cheat_message_box.lua deleted file mode 100644 index 1844ca0a..00000000 --- a/lua/app/ui/common/cheat_message_box.lua +++ /dev/null @@ -1,80 +0,0 @@ -local CheatMessageBox = {} - -function CheatMessageBox:showCheatMessageBox(params) - if params and params.noDeleteBtn then - CheatMessageBox.noDeleteBtn = true - end - UIManager:getCheatMessageBox(function(prefabObject) - local uiMap = prefabObject:genAllChildren() - uiMap["message_box.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MESSAGE_BOX_TITLE)) - uiMap["cheating_ui.title_bg_img.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHEATING_DESC_1)) - uiMap["message_box.title_bg_img.ok_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESSC)) - uiMap["cheating_box.title_bg_img.delete_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DELETE_ACCOUNT_DESC)) - uiMap["cheating_ui.title_bg_img.bg1.player_id_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.COPY_ID)) - uiMap["cheating_ui.title_bg_img.bg2.player_id_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.COPY_MAIL)) - - local objectId = "" - uiMap["cheating_ui.title_bg_img.bg1.player_id"]:setText("PlayerID:" .. objectId) - uiMap["cheating_ui.title_bg_img.bg2.player_id"]:setText("LonelySurvivorTech@cobbygame.com") - - uiMap["cheating_ui.title_bg_img.bg1.player_id_btn"]:addClickListener(function() - -- local objectId = :getServerPlayerId() or "" - -- GFunc.copyStr(objectId) - end) - - uiMap["cheating_ui.title_bg_img.bg2.player_id_btn"]:addClickListener(function() - GFunc.copyStr("LonelySurvivorTech@cobbygame.com") - end) - - local okBtn = uiMap["message_box.title_bg_img.ok_btn"] - okBtn:addClickListener(function() - local subject = "Lonely Survivor(" .. Platform:getClientVersion() .. ")'s Feedback" - - local platform = "Android" - if Platform:isIosPlatform() then - platform = "IOS" - end - - local objectId = "" - - local body = "\nPlease don't delete the information below\n===========\nGameName: Lonely Survivor\n" - body = body .. "GameVersion: " .. Platform:getClientVersion() .. "\n" - body = body .. "Device Model: " .. DeviceHelper:getDeviceModel() .. "\n" - body = body .. "Platform: " .. platform .. "\n" - body = body .. "OSversion: " .. DeviceHelper:getOSVersion() .. "\n" - body = body .. "User ID: " .. objectId .. "\n" - body = body .. "===========\nPlease don't delete the information above" - - local uri = CS.System.Uri("mailto:LonelySurvivorTech@cobbygame.com?subject=" .. subject .. "&body=" .. body) - GFunc.openUrl(uri.AbsoluteUri) - end) - - local deleteBtn = uiMap["cheating_box.title_bg_img.delete_btn"] - - deleteBtn:addClickListener(function() - local sortingOrder = prefabObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).sortingOrder + 1 - local obj = ModuleManager.AccountManager:showDeleteUI() - obj:setUIOrder(0, sortingOrder) - end) - - local showDeleteBtn = true - if CheatMessageBox.noDeleteBtn then - showDeleteBtn = false - end - - deleteBtn:setActive(showDeleteBtn) - if showDeleteBtn then - okBtn:setAnchoredPositionX(132) - else - okBtn:setAnchoredPositionX(0) - end - end) -end - -function CheatMessageBox:hideCheatMessageBox() - if not CheatMessageBox.noDeleteBtn then - UIManager:hideCheatMessageBox() - end -end - -return CheatMessageBox \ No newline at end of file diff --git a/lua/app/ui/game_setting/account_delete_ui.lua b/lua/app/ui/game_setting/account_delete_ui.lua new file mode 100644 index 00000000..7ba88c5f --- /dev/null +++ b/lua/app/ui/game_setting/account_delete_ui.lua @@ -0,0 +1,63 @@ +local AccountDeleteUI = class("AccountDeleteUI", BaseUI) + +function AccountDeleteUI:isFullScreen() + return false +end + +function AccountDeleteUI:showCommonBG() + return false +end + +function AccountDeleteUI:getPrefabPath() + return "assets/prefabs/ui/setting/account_delete_ui.prefab" +end + +function AccountDeleteUI:onClose() + if self.inputFieldObj then + self.inputFieldObj:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text = GConst.EMPTY_STRING + end +end + +function AccountDeleteUI:ctor() + self.besureTxStr = I18N:getGlobalText(I18N.GlobalConst.BESURE_DELETE_ACCOUNT_DESC) +end + +function AccountDeleteUI:onLoadRootComplete() + local uiMap = self.root:genAllChildren() + self.okBtn = uiMap["account_delete_ui.title_bg_img.change_btn"] + self.btnTx = uiMap["account_delete_ui.title_bg_img.change_btn.text"] + self.okBtnGray = uiMap["account_delete_ui.title_bg_img.change_btn.gray"] + self.inputFieldObj = uiMap["account_delete_ui.title_bg_img.input_field"] + + self.okBtn:addClickListener(function() + local content = self.inputFieldObj:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).text + if content == self.besureTxStr then + ModuleManager.AccountManager:deleteAccount() + end + end) + + uiMap["account_delete_ui.title_bg_img.close_btn"]:addClickListener(function() + self:closeUI() + end) + + self:_display() +end + +function AccountDeleteUI:_display() + local uiMap = self.root:genAllChildren() + uiMap["account_delete_ui.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MESSAGE_BOX_TITLE)) + uiMap["account_delete_ui.title_bg_img.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BESURE_DELETE_TIPS_DESC, self.besureTxStr)) + + self:refreshBtn(true) + self.inputFieldObj:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TMP_INPUT_FIELD).onValueChanged:AddListener(function(content) + self:refreshBtn(content ~= self.besureTxStr) + end) +end + +function AccountDeleteUI:refreshBtn(gray) + self.okBtnGray:setVisible(gray) + self.okBtn:setTouchEnable(not gray) + self.btnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK)) +end + +return AccountDeleteUI \ No newline at end of file diff --git a/lua/app/ui/game_setting/account_delete_ui.lua.meta b/lua/app/ui/game_setting/account_delete_ui.lua.meta new file mode 100644 index 00000000..8817dc6d --- /dev/null +++ b/lua/app/ui/game_setting/account_delete_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 2dba9e1bf395ae54584347a571d14188 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/game_setting/game_setting_ui.lua b/lua/app/ui/game_setting/game_setting_ui.lua index 8dd0dbc4..65acbbda 100644 --- a/lua/app/ui/game_setting/game_setting_ui.lua +++ b/lua/app/ui/game_setting/game_setting_ui.lua @@ -62,6 +62,7 @@ function GameSettingUI:initLoginBtn() local deleteTx = self.uiMap["game_setting_ui.bg.delete_tx"] deleteTx:setText(I18N:getGlobalText(I18N.GlobalConst.DELETE_ACCOUNT_DESC)) deleteTx:addClickListener(function() + ModuleManager.AccountManager:showDeleteUI() end) end diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 9947eacd..6b764822 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -139,8 +139,10 @@ function MainCityUI:_addListeners() end return end - self.bottomBtnSpines[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:playAnimComplete("born", false, false, function() - self.bottomBtnSpines[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:playAnim("idle", false, false) + self.bottomBtnSpines[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:playAnimComplete("born1", false, false, function() + self.bottomBtnSpines[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:playAnimComplete("born2", false, false, function() + self.bottomBtnSpines[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:playAnim("idle", false, false) + end) end) self:refreshBottom(GConst.MainCityConst.BOTTOM_PAGE.SHOP, true) if self.subComps and self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then @@ -261,8 +263,10 @@ function MainCityUI:initBottomUI() BIReport:postHomeBtnCilck(BIReport.CLICK_BTN_TYPE[MainCityUI.CLICK_BTN_TYPE[i]]) end - self.bottomBtnSpines[i]:playAnimComplete("born", false, false, function() - self.bottomBtnSpines[i]:playAnim("idle", false, false) + self.bottomBtnSpines[i]:playAnimComplete("born1", false, false, function() + self.bottomBtnSpines[i]:playAnimComplete("born2", false, false, function() + self.bottomBtnSpines[i]:playAnim("idle", false, false) + end) end) self:refreshBottom(i, true) end) diff --git a/lua/app/ui/ui_manager.lua b/lua/app/ui/ui_manager.lua index 221fef8d..6e82968f 100644 --- a/lua/app/ui/ui_manager.lua +++ b/lua/app/ui/ui_manager.lua @@ -1,7 +1,6 @@ local UIManager = {} local MESSAGE_BOX_PATH = "assets/prefabs/ui/common/message_box.prefab" -local CHEATING_BOX_PATH = "assets/prefabs/ui/common/cheating_box.prefab" local TUTORIAL_PATH = "assets/prefabs/ui/tutorial/tutorial_ui.prefab" UIManager.UI_TYPE = { @@ -405,7 +404,6 @@ end -- 显示引导节点 function UIManager:showTutorial() self.tutorialCanvas:setActive(true) - self:hideChatBtn() end -- 隐藏引导节点 @@ -577,9 +575,6 @@ function UIManager:addLoadUICompleteListener(uiIndex, callback) end function UIManager:getMessageBox(top, callback) - if self.cheatMsgBox and self.cheatMsgBox:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).enabled then - return - end if top then if self.topMsgBox == nil then UIPrefabManager:loadUIWidgetAsync(MESSAGE_BOX_PATH, self.messageBoxNode, function (prefabObject) @@ -621,36 +616,6 @@ function UIManager:getMessageBox(top, callback) end end -function UIManager:getCheatMessageBox(callback) - if self.topMsgBox then - self.topMsgBox:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).enabled = false - end - if self.messageBox then - self.messageBox:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).enabled = false - end - if self.cheatMsgBox == nil then - UIPrefabManager:loadUIWidgetAsync(CHEATING_BOX_PATH, self.messageBoxNode, function (prefabObject) - if self.cheatMsgBox then - prefabObject:destroy() - callback(self.cheatMsgBox) - return - end - prefabObject:initPrefabHelper() - prefabObject:getTransform():SetAsLastSibling() - - local messageBoxCanvas = prefabObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS) - local messageBoxCanvasOrder = UI_MAX_ORDER + UI_INTERVAL_ORDER*OTHER_CANVAS_INTERVAL_ORDER.MESSAGE_BOX_TOP + 1 - messageBoxCanvas.overrideSorting = true - messageBoxCanvas.sortingOrder = messageBoxCanvasOrder - self.cheatMsgBox = prefabObject - callback(self.cheatMsgBox) - end) - else - self.cheatMsgBox:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).enabled = true - callback(self.cheatMsgBox) - end -end - function UIManager:getMessageBoxGameObject(top) if top then return self.topMsgBox @@ -669,12 +634,6 @@ function UIManager:hideMessageBox() end end -function UIManager:hideCheatMessageBox() - if self.cheatMsgBox then - self.cheatMsgBox:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).enabled = false - end -end - function UIManager:hideMessageBoxByTag(tag) if self.messageBox then if self.messageBox:getTag() == tag then @@ -972,23 +931,14 @@ function UIManager:showNotchScreen() end end -function UIManager:backToLogin(clearLoginType) +function UIManager:backToLogin() self:stopCurrentBGM() - - SDKManager:gameLogout(clearLoginType or false, function () - -- 移除 - -- SchedulerManager:removeCrossDaySId() - - -- 清除引导 - ModuleManager.TutorialManager:stopTutorial() - -- 触发断线回到Login界面事件 - -- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.LOGOUT_BACK_TO_LOGIN) - - self:closeAllUI() - ModuleManager.BattleManager:clearOnExitScene() - self:hideChatBtn() - Game:showLoginUI() - end) + SDKManager:logout() + -- 清除引导 + ModuleManager.TutorialManager:stopTutorial() + self:closeAllUI() + ModuleManager.BattleManager:clearOnExitScene() + Game:showLoginUI() end function UIManager:backToLoginWithoutLogout() @@ -997,7 +947,6 @@ function UIManager:backToLoginWithoutLogout() self:closeAllUI() ModuleManager.BattleManager:clearOnExitScene() - self:hideChatBtn() Game:showLoginUI() end diff --git a/lua/app/userdata/daily_challenge/daily_challenge_data.lua b/lua/app/userdata/daily_challenge/daily_challenge_data.lua index 121e56a4..25f97784 100644 --- a/lua/app/userdata/daily_challenge/daily_challenge_data.lua +++ b/lua/app/userdata/daily_challenge/daily_challenge_data.lua @@ -33,14 +33,6 @@ function DailyChallengeData:onGetedTaskReward(idx) end function DailyChallengeData:clear() - self.maxWave = nil - self.fixedChapterId = nil - self.chapterDailyId = nil - self.tasks = nil - self.buffIds = nil - self.totalFightCount = nil - self.todayFightCount = nil - self.initDay = nil end function DailyChallengeData:isOpen()