天赋
This commit is contained in:
parent
afbe226434
commit
a1a3238192
@ -133,6 +133,7 @@ function DataManager:clear()
|
||||
self.ActBossRushData:clear()
|
||||
self.FourteenDayData:clear()
|
||||
self.ActPvpData:clear()
|
||||
self.TalentData:clear()
|
||||
ModuleManager.TaskManager:clear()
|
||||
self:clearTryOpenFunc()
|
||||
self.activityBountyLevelMap = nil
|
||||
@ -196,6 +197,7 @@ function DataManager:initWithServerData(data)
|
||||
end
|
||||
self.HeroFundData:init(data.hero_fund)
|
||||
self.FourteenDayData:init(data.fourteen_bounty)
|
||||
self.TalentData:init(data.talent)
|
||||
|
||||
-- 任务数据最后初始化,依赖其他模块的数据
|
||||
self.TaskData:init()
|
||||
|
||||
@ -6,8 +6,8 @@ MainCityConst.BOTTOM_PAGE = {
|
||||
SHOP = 1,
|
||||
HERO = 2,
|
||||
MAIN = 3,
|
||||
DUNGEON = 4,
|
||||
COMPANY = 5,
|
||||
DUNGEON = 5,
|
||||
COMPANY = 4,
|
||||
}
|
||||
|
||||
MainCityConst.BOTTOM_ICON = {
|
||||
|
||||
@ -4,65 +4,15 @@ function TalentManager:showMainUI()
|
||||
UIManager:showUI("app/ui/talent/talent_main_ui")
|
||||
end
|
||||
|
||||
-- function TalentManager:claimReward(index, isPro)
|
||||
-- local args = {
|
||||
-- level = index,
|
||||
-- is_pro = isPro,
|
||||
-- }
|
||||
-- self:sendMessage(ProtoMsgType.FromMsgEnum.BountyRewardReq, args, {}, self.onClaimReward, BIReport.ITEM_GET_TYPE.BOUNTY_REWARD)
|
||||
-- end
|
||||
function TalentManager:talentUpgrade()
|
||||
local args = {}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.TalentUpgradeReq, args, {}, self.onTalentUpgradeRsp, BIReport.ITEM_GET_TYPE.BOUNTY_REWARD)
|
||||
end
|
||||
|
||||
-- function TalentManager:onClaimReward(result)
|
||||
-- if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
-- if result.rewards then
|
||||
-- -- 读表获取该层奖励 如果是箱子走单独奖励展示接口
|
||||
-- local isOneKeyGet = false
|
||||
-- local isSpecialBox = false
|
||||
-- local index = result.reqData.level
|
||||
-- local rewardId
|
||||
-- if index == 0 then -- 一键领取
|
||||
-- isOneKeyGet = true
|
||||
-- else
|
||||
-- local isPro = result.reqData.is_pro
|
||||
-- local info = DataManager.BountyData:getSeasonInfoByLevel(index)
|
||||
-- local rewardType
|
||||
-- if info then
|
||||
-- local reward = isPro and info.reward_pro or info.reward
|
||||
-- rewardType = reward and reward.type
|
||||
-- rewardId = reward and reward.id
|
||||
-- if rewardType == GConst.REWARD_TYPE.ITEM then
|
||||
-- local itemCfgInfo = ConfigManager:getConfig("item")[rewardId]
|
||||
-- if itemCfgInfo and itemCfgInfo.type == GConst.ItemConst.ITEM_TYPE.BOX then
|
||||
-- isSpecialBox = true
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- if isSpecialBox and not isOneKeyGet then
|
||||
-- ModuleManager.ShopManager:showBoxOpenUI({type = GConst.ShopConst.BOX_REWARD_TYPE.BOUNTY, params = rewardId, rewards = result.rewards})
|
||||
-- local openType = BIReport.BOX_OPEN_OPEN_TYPE.BOUNTY
|
||||
-- BIReport:postBoxOpen(rewardId, BIReport.BOX_OPEN_BOX_TYPE.ACTIVITY, openType, 0, result.rewards)
|
||||
-- else
|
||||
-- GFunc.showRewardBox(result.rewards)
|
||||
-- end
|
||||
-- end
|
||||
-- if result.reqData.is_pro ~= nil then
|
||||
-- local BountyData = DataManager.BountyData
|
||||
-- local index = result.reqData.level
|
||||
-- if index ~= 0 then
|
||||
-- if result.reqData.is_pro then
|
||||
-- BountyData:onClaimProReward(result.reqData.level)
|
||||
-- else
|
||||
-- BountyData:onClaimReward(result.reqData.level)
|
||||
-- end
|
||||
-- else
|
||||
-- BountyData:onOneKeyClaimReward()
|
||||
-- end
|
||||
|
||||
-- BIReport:postBountyReward(BountyData:getBountyReportType(), BountyData:getLevel(), BountyData:getExp(), BountyData:getSeason(), result.reqData.level, result.reqData.is_pro)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
function TalentManager:onTalentUpgradeRsp(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.TalentData:onUpgrade(result)
|
||||
end
|
||||
end
|
||||
|
||||
return TalentManager
|
||||
@ -23,7 +23,6 @@ function ResourceCell:show(itemId, hideAddImg)
|
||||
end
|
||||
self.baseObject:setActive(true)
|
||||
|
||||
Logger.logHighlight("显示货币 %s", itemId)
|
||||
local obj = DataManager.BagData.ItemData:getItemById(itemId)
|
||||
self.resImg:setSprite(obj:getIconRes())
|
||||
|
||||
|
||||
@ -12,8 +12,9 @@ end
|
||||
|
||||
function TalentCell:refresh(idx, cfg)
|
||||
self.bg:setSprite(GConst.ATLAS_PATH.UI_TALENT, "talent_" .. idx)
|
||||
self.descTx1:setText("攻击提升")
|
||||
self.descTx2:setText("Lv." .. idx)
|
||||
self.descTx1:setText("攻击提升" .. idx)
|
||||
local lv = DataManager.TalentData:getLevels(idx)
|
||||
self.descTx2:setText("Lv." .. lv)
|
||||
end
|
||||
|
||||
function TalentCell:setActive(active)
|
||||
|
||||
@ -31,9 +31,12 @@ function TalentMainUI:onLoadRootComplete()
|
||||
end)
|
||||
|
||||
self.getBtn = uiMap["talent_ui.get_btn"]
|
||||
local text = uiMap["talent_ui.get_btn.text"]
|
||||
local costTx = uiMap["talent_ui.get_btn.cost.cost_tx"]
|
||||
|
||||
self.costIcon = uiMap["talent_ui.get_btn.cost.icon"]
|
||||
self.costTx = uiMap["talent_ui.get_btn.cost.cost_tx"]
|
||||
self.descTx = uiMap["talent_ui.desc_tx"]
|
||||
self.upNode = uiMap["talent_ui.up_node"]
|
||||
self.upTalentCell = uiMap["talent_ui.up_node.talent_cell"]:addLuaComponent(TALENT_CELL)
|
||||
self.upNode:setActive(false)
|
||||
|
||||
-- uiMap["talent_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TALENT))
|
||||
uiMap["talent_ui.title_tx"]:setText("研发中心")
|
||||
@ -46,11 +49,57 @@ function TalentMainUI:onLoadRootComplete()
|
||||
cell:refresh(index, self.list[index])
|
||||
end)
|
||||
self.scrollRect:clearCells()
|
||||
|
||||
self.getBtn:addClickListener(function()
|
||||
if not GFunc.checkCost(self.cfg.cost.id, self.cfg.cost.num, true) then
|
||||
return
|
||||
end
|
||||
local can, stage = DataManager.TalentData:checkStage()
|
||||
if not can then
|
||||
GFunc.showToast("等级达到" .. stage .. "可研发")
|
||||
return
|
||||
end
|
||||
ModuleManager.TalentManager:talentUpgrade()
|
||||
end)
|
||||
|
||||
self.upNode:addClickListener(function()
|
||||
self.upNode:setActive(false)
|
||||
end)
|
||||
|
||||
self:bind(DataManager.TalentData, "isDirty", function()
|
||||
self:onUpgrade()
|
||||
self:onRefresh()
|
||||
end)
|
||||
end
|
||||
|
||||
function TalentMainUI:onRefresh()
|
||||
self.list = DataManager.TalentData:getCfgList()
|
||||
self.scrollRect:setTotalCount(#self.list)
|
||||
self.scrollRect:refillCells(#self.list)
|
||||
|
||||
local stage = DataManager.TalentData:getStage()
|
||||
self.cfg = DataManager.TalentData:getPlayerExpCfgList(stage)
|
||||
self.costIcon:setSprite(GFunc.getIconRes(self.cfg.cost.id))
|
||||
if not GFunc.checkCost(self.cfg.cost.id, self.cfg.cost.num) then
|
||||
self.costTx:setText("<color=#FA3939>" .. self.cfg.cost.num .. "</color>")
|
||||
else
|
||||
self.costTx:setText(self.cfg.cost.num)
|
||||
end
|
||||
|
||||
if not DataManager.TalentData:checkStage() then
|
||||
self.descTx:setActive(true)
|
||||
self.descTx:setText("等级达到" .. stage .. "可研发")
|
||||
else
|
||||
self.descTx:setActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
function TalentMainUI:onUpgrade()
|
||||
local upData = DataManager.TalentData:getUpData()
|
||||
if not upData then
|
||||
return
|
||||
end
|
||||
self.upNode:setActive(true)
|
||||
self.upTalentCell:refresh(upData.id, self.list[upData.id])
|
||||
end
|
||||
|
||||
return TalentMainUI
|
||||
@ -1,11 +1,20 @@
|
||||
local TalentData = class("TalentData", BaseData)
|
||||
|
||||
local TalentCfg = ConfigManager:getConfig("talent")
|
||||
local PlayerExpCfg = ConfigManager:getConfig("player_exp")
|
||||
|
||||
function TalentData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function TalentData:ctor()
|
||||
self.data.isDirty = false
|
||||
end
|
||||
|
||||
function TalentData:init(data)
|
||||
data = data or GConst.EMPTY_TABLE
|
||||
self.stage = data.stage
|
||||
self.levels = data.levels or {}
|
||||
end
|
||||
|
||||
function TalentData:clear()
|
||||
@ -15,4 +24,40 @@ function TalentData:getCfgList()
|
||||
return TalentCfg
|
||||
end
|
||||
|
||||
function TalentData:getPlayerExpCfgList(stage)
|
||||
if stage then
|
||||
return PlayerExpCfg[stage]
|
||||
end
|
||||
return PlayerExpCfg
|
||||
end
|
||||
|
||||
function TalentData:getStage()
|
||||
return self.stage
|
||||
end
|
||||
|
||||
function TalentData:checkStage()
|
||||
local lv = DataManager.PlayerData:getLv()
|
||||
return lv >= self.stage, self.stage
|
||||
end
|
||||
|
||||
function TalentData:getLevels(id)
|
||||
if id then
|
||||
return self.levels[id] or 0
|
||||
end
|
||||
return self.levels
|
||||
end
|
||||
|
||||
function TalentData:onUpgrade(data)
|
||||
self.upData = data
|
||||
self.stage = data.stage
|
||||
self.levels[data.id] = data.level
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function TalentData:getUpData()
|
||||
local data = self.upData
|
||||
self.upData = nil
|
||||
return data
|
||||
end
|
||||
|
||||
return TalentData
|
||||
Loading…
x
Reference in New Issue
Block a user