Merge branch 'dev' into arena
# Conflicts: # lua/app/config/localization/localization_global_const.lua # lua/app/config/strings/cn/global.lua # lua/app/module/battle/controller/battle_controller.lua # lua/app/ui/main_city/main_city_ui.lua
This commit is contained in:
commit
ce97be9b65
@ -215,6 +215,11 @@ BIReport.DIALY_CHALLENGE_OPT_TYPE = {
|
||||
TASK_STATE = "TaskState",
|
||||
}
|
||||
|
||||
BIReport.MISCELLANEOUS_OPT_TYPE = {
|
||||
EVALUATE_OPEN = "EvaluateOpen",
|
||||
EVALUATE_CLOSE = "EvaluateClose",
|
||||
}
|
||||
|
||||
-- b6
|
||||
local EVENT_NAME_EXIT = "client_exit"
|
||||
local EVENT_NAME_FIGHT = "client_fight"
|
||||
@ -241,6 +246,7 @@ local EVENT_NAME_BOUNTY_OPT = "client_bounty_opt" -- 通用战令事件(包括
|
||||
local EVENT_NAME_NETWORK_OPT = "client_network_opt" -- 网络操作
|
||||
local EVENT_NAME_APPLOVIN_AD_REVENUE = "client_applovin_ad_revenue" -- applovin广告收入
|
||||
local EVENT_NAME_DAILY_CHALLENGE_OPT = "client_daily_challenge_opt"
|
||||
local EVENT_NAME_MISCELLANEOUS_OPT = "event_name_miscellaneous_opt" -- 一些杂项
|
||||
|
||||
function BIReport:setIsNewPlayer(isNewPlayer)
|
||||
self.isNewPlayer = isNewPlayer
|
||||
@ -1060,4 +1066,19 @@ function BIReport:postPbDecodefailed(pbName, reqData)
|
||||
self:report(EVENT_NAME_NETWORK_OPT, args)
|
||||
end
|
||||
|
||||
function BIReport:postRateClose(rateStar)
|
||||
local args = {
|
||||
event_type = BIReport.MISCELLANEOUS_OPT_TYPE.EVALUATE_CLOSE,
|
||||
rate_star = rateStar,
|
||||
}
|
||||
self:report(EVENT_NAME_MISCELLANEOUS_OPT, args)
|
||||
end
|
||||
|
||||
function BIReport:postRateOpen()
|
||||
local args = {
|
||||
event_type = BIReport.MISCELLANEOUS_OPT_TYPE.EVALUATE_OPEN,
|
||||
}
|
||||
self:report(EVENT_NAME_MISCELLANEOUS_OPT, args)
|
||||
end
|
||||
|
||||
return BIReport
|
||||
@ -29,6 +29,7 @@ function DataManager:init()
|
||||
self:initManager("SevenDayData", "app/userdata/activity/seven_day/seven_day_data")
|
||||
self:initManager("ShopData", "app/userdata/shop/shop_data")
|
||||
self:initManager("SummonData", "app/userdata/summon/summon_data")
|
||||
self:initManager("AIHelperData", "app/userdata/game_setting/ai_helper_data")
|
||||
end
|
||||
|
||||
function DataManager:initManager(name, path)
|
||||
@ -107,6 +108,7 @@ function DataManager:clear()
|
||||
self.SummonData:clear()
|
||||
-- 任务数据最后清理
|
||||
self.TaskData:clear()
|
||||
self.AIHelperData:clear()
|
||||
ModuleManager.TaskManager:clear()
|
||||
self:clearTryOpenFunc()
|
||||
end
|
||||
@ -151,6 +153,7 @@ function DataManager:initWithServerData(data)
|
||||
-- 商店礼包都初始化完了后检查一下每日红点
|
||||
self.ShopData:checkShopDiscountRedPoint()
|
||||
self.SummonData:init(data.summon, true)
|
||||
self.AIHelperData:init(nil, true)
|
||||
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据
|
||||
if data.fund then
|
||||
self.GrowthFundData:init(data.fund.funds)
|
||||
|
||||
@ -66,6 +66,7 @@ function SDKPayGoogleManager:queryProducts(callback)
|
||||
if #subsList > 0 then
|
||||
self:queryProductInfo(PAY_TYPE_SUBS, json.encode(subsList), function(code, msg)
|
||||
if code == 0 then
|
||||
self.queryProductsOver = true
|
||||
if msg and msg ~= "" then -- 更新products
|
||||
local jData = json.decode(msg)
|
||||
if jData and #jData > 0 then
|
||||
@ -80,6 +81,7 @@ function SDKPayGoogleManager:queryProducts(callback)
|
||||
end
|
||||
end)
|
||||
else
|
||||
self.queryProductsOver = true
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
@ -262,51 +264,55 @@ end
|
||||
-- 检查是否可以支付
|
||||
function SDKPayGoogleManager:checkPay(productId, callback)
|
||||
if self:_getIsGoogleStoreConnected() then -- google商店是否初始化
|
||||
self:doUncompleteOrder(function(code) -- 先处理未完成的订单
|
||||
if code == 0 then
|
||||
callback(0)
|
||||
elseif code == 1 then -- 指定的productId存在支付状态中的订单
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
else -- 存在未完成的订单消耗失败的情况,但是因为不是当前productId,所以允许继续支付
|
||||
callback(0)
|
||||
end
|
||||
end, productId)
|
||||
self:queryProducts(function()
|
||||
self:doUncompleteOrder(function(code) -- 先处理未完成的订单
|
||||
if code == 0 then
|
||||
callback(0)
|
||||
elseif code == 1 then -- 指定的productId存在支付状态中的订单
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
else -- 存在未完成的订单消耗失败的情况,但是因为不是当前productId,所以允许继续支付
|
||||
callback(0)
|
||||
end
|
||||
end, productId)
|
||||
end)
|
||||
else
|
||||
self:connectGoogleStore(function(code)
|
||||
if code == 0 then
|
||||
self:doUncompleteOrder(function(consumeSucc)
|
||||
if code == 0 then
|
||||
callback(0)
|
||||
elseif code == 1 then -- 指定的productId存在支付状态中的订单
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
else -- 存在未完成的订单消耗失败的情况,但是因为不是当前productId,所以允许继续支付
|
||||
callback(0)
|
||||
end
|
||||
end, productId)
|
||||
self:queryProducts(function()
|
||||
self:doUncompleteOrder(function(consumeSucc)
|
||||
if code == 0 then
|
||||
callback(0)
|
||||
elseif code == 1 then -- 指定的productId存在支付状态中的订单
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
else -- 存在未完成的订单消耗失败的情况,但是因为不是当前productId,所以允许继续支付
|
||||
callback(0)
|
||||
end
|
||||
end, productId)
|
||||
end)
|
||||
else
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_22),
|
||||
|
||||
@ -127,6 +127,8 @@ function ChapterManager:endFightFinish(result)
|
||||
DataManager.HeroData:checkIfCanShowHeroUnlock(maxChapter)
|
||||
-- 章节通关 检查是否要弹出功能解锁界面
|
||||
DataManager.PlayerData:checkIfCanShowModuleUnlock(maxChapter)
|
||||
-- 评价弹窗
|
||||
self:tryShowEvaluationPopup(maxChapter)
|
||||
end
|
||||
-- 第二章战斗结算,触发成长礼包
|
||||
if result.reqData.chapter_id == GConst.ShopConst.INTRODUCTORY_GIFT_TRIGGER_CHAPTER_ID then
|
||||
@ -137,4 +139,11 @@ function ChapterManager:endFightFinish(result)
|
||||
end
|
||||
end
|
||||
|
||||
function ChapterManager:tryShowEvaluationPopup(chapter)
|
||||
if chapter ~= 2 then
|
||||
return
|
||||
end
|
||||
UIManager:showUI("app/ui/game_setting/rate_ui")
|
||||
end
|
||||
|
||||
return ChapterManager
|
||||
@ -82,4 +82,14 @@ function GameSettingManager:showSupport(objectId)
|
||||
GFunc.openUrl(CS.System.Uri(url .. language .. userId .. tempStr .. customData).AbsoluteUri)
|
||||
end
|
||||
|
||||
function GameSettingManager:reqAiHelper()
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.AIHelpUnreadReq, {}, {}, self.rspAiHelper)
|
||||
end
|
||||
|
||||
function GameSettingManager:rspAiHelper(result)
|
||||
if result.error_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.AIHelperData:init(result)
|
||||
end
|
||||
end
|
||||
|
||||
return GameSettingManager
|
||||
@ -101,6 +101,8 @@ local ProtoMsgType = {
|
||||
[2731283225] = "MailExtractRsp",
|
||||
[2849800229] = "MailReadReq",
|
||||
[2849802062] = "MailReadRsp",
|
||||
[2909093054] = "AIHelpUnreadReq",
|
||||
[2909094887] = "AIHelpUnreadRsp",
|
||||
[3003864530] = "ActTriggerGiftNtf",
|
||||
[3013273736] = "PVPRankHeroesReq",
|
||||
[3013275569] = "PVPRankHeroesRsp",
|
||||
@ -266,6 +268,8 @@ local ProtoMsgType = {
|
||||
MailExtractRsp = 2731283225,
|
||||
MailReadReq = 2849800229,
|
||||
MailReadRsp = 2849802062,
|
||||
AIHelpUnreadReq = 2909093054,
|
||||
AIHelpUnreadRsp = 2909094887,
|
||||
ActTriggerGiftNtf = 3003864530,
|
||||
PVPRankHeroesReq = 3013273736,
|
||||
PVPRankHeroesRsp = 3013275569,
|
||||
@ -431,6 +435,8 @@ local ProtoMsgType = {
|
||||
MailExtractRsp = "MailExtractRsp",
|
||||
MailReadReq = "MailReadReq",
|
||||
MailReadRsp = "MailReadRsp",
|
||||
AIHelpUnreadReq = "AIHelpUnreadReq",
|
||||
AIHelpUnreadRsp = "AIHelpUnreadRsp",
|
||||
ActTriggerGiftNtf = "ActTriggerGiftNtf",
|
||||
PVPRankHeroesReq = "PVPRankHeroesReq",
|
||||
PVPRankHeroesRsp = "PVPRankHeroesRsp",
|
||||
|
||||
@ -18,6 +18,7 @@ function GameSettingUI:onLoadRootComplete()
|
||||
self.uiMap = self.root:genAllChildren()
|
||||
self:_display()
|
||||
self:_addListeners()
|
||||
self:_bind()
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.BIND_ACCOUNT_SUCCESS, function()
|
||||
self:refreshAccountInfo()
|
||||
end)
|
||||
@ -162,6 +163,7 @@ function GameSettingUI:initSupportBtn()
|
||||
self.uiMap["game_setting_ui.bg.support_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUPPORT_DESC_2))
|
||||
self.uiMap["game_setting_ui.bg.support_btn"]:addClickListener(function()
|
||||
ModuleManager.GameSettingManager:showSupport()
|
||||
DataManager.AIHelperData:clearRp()
|
||||
end)
|
||||
end
|
||||
|
||||
@ -216,6 +218,17 @@ function GameSettingUI:_addListeners()
|
||||
end)
|
||||
end
|
||||
|
||||
function GameSettingUI:_bind()
|
||||
self:bind(DataManager.AIHelperData, "isDirty", function()
|
||||
local supportBtn = self.uiMap["game_setting_ui.bg.support_btn"]
|
||||
if DataManager.AIHelperData:getRp() then
|
||||
supportBtn:addRedPoint(88, 24, 0.8)
|
||||
else
|
||||
supportBtn:removeRedPoint()
|
||||
end
|
||||
end, true)
|
||||
end
|
||||
|
||||
function GameSettingUI:refreshMusic()
|
||||
local offIcon = self.uiMap["game_setting_ui.bg.music_bg.off"]
|
||||
local onIcon = self.uiMap["game_setting_ui.bg.music_bg.on"]
|
||||
|
||||
144
lua/app/ui/game_setting/rate_ui.lua
Normal file
144
lua/app/ui/game_setting/rate_ui.lua
Normal file
@ -0,0 +1,144 @@
|
||||
local RateUI = class("RateUI", BaseUI)
|
||||
|
||||
local COLOR = BF.Color(1, 1, 1, 1)
|
||||
|
||||
local BTN_ICON = {
|
||||
"common_btn_green_2",
|
||||
"common_btn_grey_2"
|
||||
}
|
||||
|
||||
function RateUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function RateUI:showCommonBG()
|
||||
return false
|
||||
end
|
||||
|
||||
function RateUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/setting/rate_ui.prefab"
|
||||
end
|
||||
|
||||
function RateUI:ctor()
|
||||
self.curStar = 0
|
||||
end
|
||||
|
||||
function RateUI:onClose()
|
||||
if self.starSeq then
|
||||
self.starSeq:Kill()
|
||||
self.starSeq = nil
|
||||
end
|
||||
end
|
||||
|
||||
function RateUI:onLoadRootComplete()
|
||||
self:_display()
|
||||
self:_addListeners()
|
||||
end
|
||||
|
||||
function RateUI:_display()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
|
||||
uiMap["rate_ui.bg.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.RATE_DESC_1))
|
||||
uiMap["rate_ui.later_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.RATE_DESC_2))
|
||||
|
||||
if not self.stars then
|
||||
self.stars = {}
|
||||
for i = 1, 5 do
|
||||
self.stars[i] = {
|
||||
touchNode = uiMap["rate_ui.bg.bg_" .. i],
|
||||
star = uiMap["rate_ui.bg.bg_" .. i .. ".star"]
|
||||
}
|
||||
self.stars[i].star:setVisible(true)
|
||||
end
|
||||
end
|
||||
|
||||
self:onClickStar(0)
|
||||
end
|
||||
|
||||
function RateUI:_addListeners()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
|
||||
uiMap["rate_ui.bg.bg_1"]:addClickListener(function()
|
||||
self:onClickStar(1)
|
||||
end)
|
||||
|
||||
uiMap["rate_ui.bg.bg_2"]:addClickListener(function()
|
||||
self:onClickStar(2)
|
||||
end)
|
||||
|
||||
uiMap["rate_ui.bg.bg_3"]:addClickListener(function()
|
||||
self:onClickStar(3)
|
||||
end)
|
||||
|
||||
uiMap["rate_ui.bg.bg_4"]:addClickListener(function()
|
||||
self:onClickStar(4)
|
||||
end)
|
||||
|
||||
uiMap["rate_ui.bg.bg_5"]:addClickListener(function()
|
||||
self:onClickStar(5)
|
||||
end)
|
||||
|
||||
uiMap["rate_ui.bg.btn"]:addClickListener(function()
|
||||
if self.curStar <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
BIReport:postRateClose(self.curStar)
|
||||
self:closeUI()
|
||||
|
||||
if self.curStar > 3 then
|
||||
local url = "https://play.google.com/store/apps/details?id=com.combo.heroes.puzzle.rpg"
|
||||
if Platform:isIosPlatform() then
|
||||
url = "https://itunes.apple.com/app/6450101181"
|
||||
end
|
||||
GFunc.openUrl(url)
|
||||
end
|
||||
end)
|
||||
|
||||
uiMap["rate_ui.later_tx"]:addClickListener(function()
|
||||
self:closeUI()
|
||||
end)
|
||||
BIReport:postRateOpen()
|
||||
end
|
||||
|
||||
function RateUI:onClickStar(star)
|
||||
self.curStar = star
|
||||
for index, starInfo in ipairs(self.stars) do
|
||||
starInfo.star:setVisible(index <= star)
|
||||
end
|
||||
|
||||
local uiMap = self.root:genAllChildren()
|
||||
local icon = BTN_ICON[1]
|
||||
|
||||
local btnTx = uiMap["rate_ui.bg.btn.ok_tx"]
|
||||
local btnTxGray = uiMap["rate_ui.bg.btn.ok_tx_gray"]
|
||||
if self.curStar <= 0 then
|
||||
icon = BTN_ICON[2]
|
||||
btnTx:setText(GConst.EMPTY_STRING)
|
||||
btnTxGray:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK))
|
||||
else
|
||||
btnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK))
|
||||
btnTxGray:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
local btn = uiMap["rate_ui.bg.btn"]
|
||||
btn:setSprite(GConst.ATLAS_PATH.COMMON, icon)
|
||||
btn:setTouchEnable(self.curStar > 0)
|
||||
|
||||
if self.starSeq then
|
||||
self.starSeq:Kill()
|
||||
self.starSeq = nil
|
||||
end
|
||||
|
||||
self.stars[1].star:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE).color = COLOR
|
||||
if self.curStar > 0 then
|
||||
return
|
||||
else
|
||||
self.starSeq = self.root:createBindTweenSequence()
|
||||
self.stars[1].star:setVisible(true)
|
||||
self.starSeq:Append(self.stars[1].star:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):DOFade(0, 1))
|
||||
self.starSeq:Append(self.stars[1].star:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):DOFade(1, 1))
|
||||
self.starSeq:SetLoops(-1)
|
||||
end
|
||||
end
|
||||
|
||||
return RateUI
|
||||
10
lua/app/ui/game_setting/rate_ui.lua.meta
Normal file
10
lua/app/ui/game_setting/rate_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5559edab930e7aa479e17c2ed272a89c
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -51,8 +51,14 @@ function SelectOtherBtnUI:onLoadRootComplete()
|
||||
self.uiMap["select_other_btn_ui.bg.mail_btn"]:setVisible(false)
|
||||
end
|
||||
cellCount = cellCount + 1
|
||||
self.uiMap["select_other_btn_ui.bg.setting_btn"]:setAnchoredPositionY(y)
|
||||
self.uiMap["select_other_btn_ui.bg.setting_btn"]:addClickListener(function()
|
||||
local settingBtn = self.uiMap["select_other_btn_ui.bg.setting_btn"]
|
||||
if DataManager.AIHelperData:getRp() then
|
||||
settingBtn:addRedPoint(124, 35, 0.8, nil, nil, true)
|
||||
else
|
||||
settingBtn:removeRedPoint()
|
||||
end
|
||||
settingBtn:setAnchoredPositionY(y)
|
||||
settingBtn:addClickListener(function()
|
||||
self:closeUI()
|
||||
ModuleManager.GameSettingManager:showSettingUI()
|
||||
end)
|
||||
|
||||
@ -266,6 +266,7 @@ function MainCityUI:_bind()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
self:bind(DataManager.ArenaData, "isDirty", function()
|
||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
||||
if self.subComps[self.selectedIndex] then
|
||||
@ -273,6 +274,10 @@ function MainCityUI:_bind()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
self:bind(DataManager.AIHelperData, "isDirty", function()
|
||||
self:refreshSettingBtn()
|
||||
end)
|
||||
end
|
||||
|
||||
function MainCityUI:initBottomUI()
|
||||
@ -784,6 +789,10 @@ function MainCityUI:updateTime()
|
||||
self:refreshRightBtns()
|
||||
self.waitRefreshSideBar = false
|
||||
end
|
||||
|
||||
if DataManager.AIHelperData:getNeedReqTime() then
|
||||
ModuleManager.GameSettingManager:reqAiHelper()
|
||||
end
|
||||
end
|
||||
|
||||
function MainCityUI:updateSideBarStatus()
|
||||
@ -913,7 +922,7 @@ function MainCityUI:refreshBottomRp()
|
||||
end
|
||||
|
||||
function MainCityUI:refreshSettingBtn()
|
||||
if DataManager.MailData:getIsOpen() and DataManager.MailData:getRedPoint() then
|
||||
if (DataManager.MailData:getIsOpen() and DataManager.MailData:getRedPoint()) or DataManager.AIHelperData:getRp() then
|
||||
self.settingbtn:addRedPoint(40, 40, 0.7)
|
||||
else
|
||||
self.settingbtn:removeRedPoint()
|
||||
|
||||
52
lua/app/userdata/game_setting/ai_helper_data.lua
Normal file
52
lua/app/userdata/game_setting/ai_helper_data.lua
Normal file
@ -0,0 +1,52 @@
|
||||
local AIHelperData = class("AIHelperData", BaseData)
|
||||
|
||||
local INIT_DELAY_TIME = 10
|
||||
local REQ_INTERVAL = 1800
|
||||
|
||||
function AIHelperData:ctor()
|
||||
self.data.isDirty = false
|
||||
self.aiHelperRpCount = 0
|
||||
end
|
||||
|
||||
function AIHelperData:init(data, isInit)
|
||||
self.nextReqTime = Time:getServerTime() + REQ_INTERVAL
|
||||
if isInit then -- 初始化没有数据,自己构建一份,并且延迟发送请求
|
||||
data = {
|
||||
count = 0
|
||||
}
|
||||
self.nextReqTime = Time:getServerTime() + INIT_DELAY_TIME
|
||||
end
|
||||
if not data then
|
||||
return
|
||||
end
|
||||
self.aiHelperRpCount = data.count
|
||||
self:setIsDirty()
|
||||
end
|
||||
|
||||
function AIHelperData:setIsDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function AIHelperData:getNextReqTime()
|
||||
return self.nextReqTime
|
||||
end
|
||||
|
||||
function AIHelperData:getNeedReqTime()
|
||||
if self:getNextReqTime() <= Time:getServerTime() then
|
||||
self.nextReqTime = Time:getServerTime() + REQ_INTERVAL
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function AIHelperData:getRp()
|
||||
return self.aiHelperRpCount > 0
|
||||
end
|
||||
|
||||
function AIHelperData:clearRp()
|
||||
self.aiHelperRpCount = 0
|
||||
self:setIsDirty()
|
||||
end
|
||||
|
||||
return AIHelperData
|
||||
10
lua/app/userdata/game_setting/ai_helper_data.lua.meta
Normal file
10
lua/app/userdata/game_setting/ai_helper_data.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c61b7067b2b095246bcc2b80c0f7f55f
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -166,8 +166,10 @@ function HeroData:getRp()
|
||||
end
|
||||
|
||||
for id, entity in pairs(self.heroes) do
|
||||
if entity:canLvUp() and not heroMap[id] then
|
||||
return true
|
||||
if entity:canLvUp() then
|
||||
if heroMap[id] or not entity:isActived() then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user