This commit is contained in:
xiekaidong 2023-05-31 18:06:18 +08:00
commit ededa19132
16 changed files with 150 additions and 170 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b8f4a8cf53417314abb0cba97d791459
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ed5cd4e2a31830e439ea9f1e38f55731
guid: fbc7bda584c3578478d7e7fe2bb9e7a1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -101,6 +101,7 @@ function LoginManager:goToLoginScene()
ModuleManager.BattleManager:clearOnExitScene()
NetManager:closeAndClear()
UIManager:backToLoginWithoutLogout()
UIManager:clearUIPrefabCache()
DataManager:clear()
end

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2dba9e1bf395ae54584347a571d14188
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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()