From 2959b8db73534b963b795d615b4f88c84f93b7f9 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 22 May 2023 10:24:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_manager.lua | 4 +++ .../battle/controller/battle_controller.lua | 4 +-- .../skill/battle_grid_effect_handle.lua | 2 +- lua/app/ui/battle/battle_box_open_ui.lua | 35 +++++++++++++++++++ lua/app/ui/battle/battle_box_open_ui.lua.meta | 10 ++++++ 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 lua/app/ui/battle/battle_box_open_ui.lua create mode 100644 lua/app/ui/battle/battle_box_open_ui.lua.meta diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index f87d74d3..099e0450 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -18,6 +18,10 @@ function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx) UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport, mysteryBoxIdx = mysteryBoxIdx}) end +function BattleManager:showBoxOpenUI(rewards, callback) + UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback}) +end + function BattleManager:playBattle(battleType, params, returnFunc) params = params or {} if self.battleController then -- 同一时间只能有一场战斗 diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 22a7785a..da935111 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -1011,7 +1011,7 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ end end if entity:getEffectType() then - local list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self, onlyCheck) + local succ, list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self, onlyCheck) if list then aniUnit.aniPosList = {} aniUnit.overCallback = aniUnit.callback @@ -1156,7 +1156,7 @@ function BattleController:onFillBoardOver(isRoundBeginCheck) local index = table.remove(self.showMysteryBoxIndexs, 1) local boardList, _, mysteryBoxIndexMap = self:getInitBoard() local rewards = mysteryBoxIndexMap[index] - ModuleManager.TipsManager:showRewardsTips(rewards, nil, nil, function() + ModuleManager.BattleManager:showBoxOpenUI(rewards, function() self:onFillBoardOver() end) return diff --git a/lua/app/module/battle/skill/battle_grid_effect_handle.lua b/lua/app/module/battle/skill/battle_grid_effect_handle.lua index 513b984c..7495b3e0 100644 --- a/lua/app/module/battle/skill/battle_grid_effect_handle.lua +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua @@ -12,7 +12,7 @@ local function _directionElinination(entity, gridEntities, battleController, onl end local direction = effectParams[1] local list = ModuleManager.BattleManager:getPosIdsByDirection(entity:getPosId(), direction) - return list + return true, list end local function _crossSpread(entity, gridEntities, battleController, onlyCheck) diff --git a/lua/app/ui/battle/battle_box_open_ui.lua b/lua/app/ui/battle/battle_box_open_ui.lua new file mode 100644 index 00000000..92804a65 --- /dev/null +++ b/lua/app/ui/battle/battle_box_open_ui.lua @@ -0,0 +1,35 @@ +local BattleBoxOpenUI = class("BattleBoxOpenUI", BaseUI) + +function BattleBoxOpenUI:isFullScreen() + return false +end + +function BattleBoxOpenUI:getPrefabPath() + return "assets/prefabs/ui/battle/battle_box_open_ui.prefab" +end + +function BattleBoxOpenUI:ctor(params) + self.rewards = params.rewards + self.callback = params.callback +end + +function BattleBoxOpenUI:onLoadRootComplete() + local uiMap = self.root:genAllChildren() + if not self.rewardCell then + self.rewardCell = CellManager:addCellComp(uiMap["battle_box_open_ui.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL) + end + + local reward = self.rewards[1] + if reward then + self.rewardCell:refreshByConfig(reward) + end + + uiMap["battle_box_open_ui.mask"]:addClickListener(function() + self:closeUI() + if self.callback then + self.callback() + end + end) +end + +return BattleBoxOpenUI \ No newline at end of file diff --git a/lua/app/ui/battle/battle_box_open_ui.lua.meta b/lua/app/ui/battle/battle_box_open_ui.lua.meta new file mode 100644 index 00000000..dbb44a5d --- /dev/null +++ b/lua/app/ui/battle/battle_box_open_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 4a9fb63578c42f747a246e6e0c5662e7 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} From 8d131457f66464765931d055ac8b2f35bb045965 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 22 May 2023 10:57:38 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E7=BE=8E=E6=9C=AF=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_skill_select_comp.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/app/ui/battle/battle_skill_select_comp.lua b/lua/app/ui/battle/battle_skill_select_comp.lua index 6d143a9a..98220432 100644 --- a/lua/app/ui/battle/battle_skill_select_comp.lua +++ b/lua/app/ui/battle/battle_skill_select_comp.lua @@ -20,6 +20,8 @@ end function BattleSkillSelectComp:_display() local uiMap = self:getUIMap() uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) + local bg2 = uiMap["battle_select_skill_comp.bg_2"] + bg2:setVisible(self.onlyCommonSkill) local bg = uiMap["battle_select_skill_comp.bg_1"] if ModuleManager.BattleManager.battleController then bg:setVisible(false) From a47b2bdf2cc1707f5ba4c4c83981fb927c01b71d Mon Sep 17 00:00:00 2001 From: chenxi Date: Mon, 22 May 2023 11:21:55 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=85=88=E5=B1=8F=E8=94=BD=E9=87=91?= =?UTF-8?q?=E7=8C=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/chapter/chapter_manager.lua | 2 +- lua/app/ui/main_city/cell/side_bar_god_pig_cell.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index 0ec4c93c..f296139e 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -91,7 +91,7 @@ function ChapterManager:endFightFinish(result) ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx) DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx) -- 处理金猪 - DataManager.GodPigData:addGoldPigCount() + -- DataManager.GodPigData:addGoldPigCount() local newMaxChapter = DataManager.ChapterData:getNewChapterId() if maxChapter ~= newMaxChapter then diff --git a/lua/app/ui/main_city/cell/side_bar_god_pig_cell.lua b/lua/app/ui/main_city/cell/side_bar_god_pig_cell.lua index 6c5c7b42..7c4c7db0 100644 --- a/lua/app/ui/main_city/cell/side_bar_god_pig_cell.lua +++ b/lua/app/ui/main_city/cell/side_bar_god_pig_cell.lua @@ -2,7 +2,7 @@ local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell" local SideBarGodPigCell = class("SideBarGodPigCell", SideBarBaseCellComp) function SideBarGodPigCell:getIsOpen() - return DataManager.GodPigData:getIsOpen() + return false end function SideBarGodPigCell:getIconRes() From f18e16103c2f7574b631130d64c6423af866e08c Mon Sep 17 00:00:00 2001 From: chenxi Date: Mon, 22 May 2023 11:36:26 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E9=82=AE=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 34 +++++++++++++++++++ .../localization_global_const.lua | 1 + lua/app/config/strings/cn/global.lua | 1 + .../ui/game_setting/select_other_btn_ui.lua | 12 +++++++ lua/app/ui/mail/mail_detail_ui.lua | 11 ++++-- lua/app/ui/main_city/main_city_ui.lua | 13 +++++++ lua/app/userdata/bag/item_data.lua | 2 ++ lua/app/userdata/player/player_data.lua | 33 ++++++++++++++++-- 8 files changed, 102 insertions(+), 5 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 984c4a77..8fc369cf 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -69,6 +69,7 @@ BIReport.ITEM_GET_TYPE = { BOUNTY = "Bounty", IDLE_DROP = "IdleDrop", IDLE_QUICK_DROP = "IdleQuickDrop", + MAIL = "Mail" } BIReport.ADS_CLICK_TYPE = { @@ -112,6 +113,11 @@ BIReport.COIN_TYPE = { [2] = "Gem", } +BIReport.MAIL_OPT_TYPE = { + OPEN = "Open", + CLAIM = "Claim", +} + -- b6 local EVENT_NAME_EXIT = "client_exit" local EVENT_NAME_FIGHT = "client_fight" @@ -130,6 +136,7 @@ local EVENT_NAME_CHAPTER_OPT = "client_chapter_opt" -- 章节 local EVENT_NAME_VIT_USE = "client_vit_use" local EVENT_NAME_VIT_GET = "client_vit_get" local EVENT_NAME_TASK = "client_task" +local EVENT_NAME_MAIL_OPT = "client_mail_opt" function BIReport:setIsNewPlayer(isNewPlayer) self.isNewPlayer = isNewPlayer @@ -714,4 +721,31 @@ function BIReport:postDailyTaskFinish(taskType, cfgId, taskId, refresh) self:report(EVENT_NAME_TASK, args) end +-- 邮箱 +function BIReport:postMailOpen(mailId) + -- IsNew 是否是新用户 + -- MaxLevel 最大关卡 + -- Email_ID 邮件编号 + + local args = { + mail_id = 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) + -- IsNew 是否是新用户 + -- MaxLevel 最大关卡 + -- Email_ID 邮件编号 + + local args = { + mail_id = mailId, + event_type = BIReport.MAIL_OPT_TYPE.CLAIM, + } + self:report(EVENT_NAME_MAIL_OPT, args) + BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args) +end + return BIReport \ No newline at end of file diff --git a/lua/app/config/localization/localization_global_const.lua b/lua/app/config/localization/localization_global_const.lua index e0c6cac9..f2dd4327 100644 --- a/lua/app/config/localization/localization_global_const.lua +++ b/lua/app/config/localization/localization_global_const.lua @@ -116,6 +116,7 @@ local LocalizationGlobalConst = BTN_DELETE_ALL_READ_MAIL = "BTN_DELETE_ALL_READ_MAIL", BTN_CLAIM_ALL = "BTN_CLAIM_ALL", BTN_READ = "BTN_READ", + MAIL_COUNTDOWN = "MAIL_COUNTDOWN", } return LocalizationGlobalConst \ No newline at end of file diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 47180099..c5f4a640 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -116,6 +116,7 @@ local localization_global = ["BTN_DELETE_ALL_READ_MAIL"] = "删除已读邮件", ["BTN_CLAIM_ALL"] = "领取所有", ["BTN_READ"] = "读取", + ["MAIL_COUNTDOWN"] = "{0}小时到期", } return localization_global \ No newline at end of file diff --git a/lua/app/ui/game_setting/select_other_btn_ui.lua b/lua/app/ui/game_setting/select_other_btn_ui.lua index 29e08790..fa6c23a6 100644 --- a/lua/app/ui/game_setting/select_other_btn_ui.lua +++ b/lua/app/ui/game_setting/select_other_btn_ui.lua @@ -20,6 +20,18 @@ function SelectOtherBtnUI:onLoadRootComplete() self:closeUI() ModuleManager.MailManager:showMailUI() end) + + local redPoint, isAdRedPoint = DataManager.MailData:getRedPoint() + if redPoint then + if isAdRedPoint then + self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8, "common_ad_3", nil, true) + else + self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8) + end + else + self.uiMap["select_other_btn_ui.bg.mail_btn"]:removeRedPoint() + end + self.uiMap["select_other_btn_ui.bg.mail_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIL_NAME)) self.uiMap["select_other_btn_ui.bg.setting_btn"]:addClickListener(function() diff --git a/lua/app/ui/mail/mail_detail_ui.lua b/lua/app/ui/mail/mail_detail_ui.lua index 5903a4aa..7b0b40ad 100644 --- a/lua/app/ui/mail/mail_detail_ui.lua +++ b/lua/app/ui/mail/mail_detail_ui.lua @@ -27,7 +27,7 @@ function MailDetailUI:_display() local uiMap = self.root:genAllChildren() uiMap["mail_detail_ui.bg.btn_claimed.btn_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM)) uiMap["mail_detail_ui.bg.tx_1"]:setText(self.entity:getMailName()) - uiMap["mail_detail_ui.bg.tx_4"]:setText(I18N:getGlobalText(I18N.GlobalConst.IDLE_TITLE2)) + uiMap["mail_detail_ui.bg.tx_4"]:setText(I18N:getGlobalText(I18N.GlobalConst.EXTRA_REWARDS)) uiMap["mail_detail_ui.bg.btn_claimed"]:setActive(not self.entity:isReceived()) local content = uiMap["mail_detail_ui.bg.tx_3"] @@ -35,7 +35,6 @@ function MailDetailUI:_display() content:setSizeDeltaY(content:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight) content:setAnchoredPositionY(0) - local haveReward = self.entity:haveReward() uiMap["mail_detail_ui.bg.img_bg"]:setVisible(haveReward) local contentScroll = uiMap["mail_detail_ui.bg.scrollrect"] @@ -55,7 +54,13 @@ function MailDetailUI:_addListeners() end) uiMap["mail_detail_ui.bg.btn_close"]:addClickListener(function() - self:closeUI() + local haveReward = self.entity:haveReward() + if haveReward then + ModuleManager.MailManager:claimMail({self.entity:getId()}) + self:closeUI() + else + self:closeUI() + end 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 069a78c4..61759779 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -81,6 +81,7 @@ function MainCityUI:onRefresh() self:refreshLeftBtns() self:refreshRightBtns() self:updateSideBarStatus() + self:refreshSettingBtn() end function MainCityUI:onReshow() @@ -162,6 +163,10 @@ function MainCityUI:_bind() self:bind(DataManager.BountyData, "dirty", function() self:refreshBounty() end) + + self:bind(DataManager.MailData, "redPoint", function() + self:refreshSettingBtn() + end) end function MainCityUI:initBottomUI() @@ -665,6 +670,14 @@ function MainCityUI:refreshBottomRp() end end +function MainCityUI:refreshSettingBtn() + if DataManager.MailData:getRedPoint() then + self.settingbtn:addRedPoint(40, 40, 0.7) + else + self.settingbtn:removeRedPoint() + end +end + function MainCityUI:checkMainPop() -- 引导 if self:checkTutorial() then diff --git a/lua/app/userdata/bag/item_data.lua b/lua/app/userdata/bag/item_data.lua index 436ce13d..77af1c82 100644 --- a/lua/app/userdata/bag/item_data.lua +++ b/lua/app/userdata/bag/item_data.lua @@ -206,6 +206,8 @@ function ItemData:_addItemNumById(id, num) end elseif id == ItemConst.ITEM_ID_BOUNTY_EXP then DataManager.BountyData:addExp(num) + elseif id == ItemConst.ITEM_ID_EXP then + DataManager.PlayerData:addExp(num) end self:setDirty() end diff --git a/lua/app/userdata/player/player_data.lua b/lua/app/userdata/player/player_data.lua index 0e63a8d2..878fa1b3 100644 --- a/lua/app/userdata/player/player_data.lua +++ b/lua/app/userdata/player/player_data.lua @@ -1,10 +1,14 @@ local PlayerData = class("PlayerData", BaseData) +function PlayerData:ctor() + self.data.dirty = false +end + function PlayerData:init(data) local basicInfo = data.basic_info or GConst.EMPTY_TABLE self.data.level = basicInfo.level or 1 self.data.exp = basicInfo.exp or 0 - self.data.dirty = false + self.lvUpNeedExp = self:getNextExp(self.data.level) self.data.payAmount = basicInfo.pay_amount or 0 local energyLimit = data.energy_limit or GConst.EMPTY_TABLE @@ -14,6 +18,10 @@ function PlayerData:init(data) self.lastLoginTime = basicInfo.lastLoginTime or Time:getBeginningOfServerToday() end +function PlayerData:markDirty() + self.data.dirty = not self.data.dirty +end + function PlayerData:setVit(vit) self.vit = vit end @@ -29,12 +37,33 @@ function PlayerData:getMaxVit() return self.maxVit end +function PlayerData:getMaxLv() + return ConfigManager:getConfigNum("player_exp") +end + +function PlayerData:addExp(exp) + self.data.exp = self.data.exp + exp + if self.data.level >= self:getMaxLv() then + return + end + self:markDirty() +end + function PlayerData:getLv() return self.data.level end +function PlayerData:getNextExp(lv) + lv = lv or self.data.level + local cfg = ConfigManager:getConfig("player_exp") + if not cfg[lv] then + return 1 + end + return cfg[lv].need_exp +end + function PlayerData:getExpPercent() - return 0 + return self.data.exp / self.lvUpNeedExp end function PlayerData:getAccountInfo() From 4acb1271f22c2f83f83ed0a43fc7d17d2348806c Mon Sep 17 00:00:00 2001 From: chenxi Date: Mon, 22 May 2023 12:00:39 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=A9=BA=E9=82=AE=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/game_setting/select_other_btn_ui.lua | 2 +- lua/app/ui/mail/mail_ui.lua | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/app/ui/game_setting/select_other_btn_ui.lua b/lua/app/ui/game_setting/select_other_btn_ui.lua index fa6c23a6..553c45e7 100644 --- a/lua/app/ui/game_setting/select_other_btn_ui.lua +++ b/lua/app/ui/game_setting/select_other_btn_ui.lua @@ -24,7 +24,7 @@ function SelectOtherBtnUI:onLoadRootComplete() local redPoint, isAdRedPoint = DataManager.MailData:getRedPoint() if redPoint then if isAdRedPoint then - self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8, "common_ad_3", nil, true) + self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 1, "common_ad_3", nil, true) else self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8) end diff --git a/lua/app/ui/mail/mail_ui.lua b/lua/app/ui/mail/mail_ui.lua index c60916bc..cdb79f76 100644 --- a/lua/app/ui/mail/mail_ui.lua +++ b/lua/app/ui/mail/mail_ui.lua @@ -68,6 +68,8 @@ function MailUI:_display() uiMap["mail_ui.bg.title_bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIL_TITLE)) uiMap["mail_ui.bg.btn_delect.btn_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_DELETE_ALL_READ_MAIL)) uiMap["mail_ui.bg.btn_claimed.btn_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM_ALL)) + + self.emptyBg = uiMap["mail_ui.bg.empty"] end function MailUI:_addListeners() @@ -90,6 +92,11 @@ function MailUI:refreshScrollRect() if self.needRefills then self.scrollRect:clearCells() self.scrollRect:refillCells(#self.mailList) + if #self.mailList > 0 then + self.emptyBg:setVisible(false) + else + self.emptyBg:setVisible(true) + end else self.scrollRect:updateAllCell() end @@ -108,6 +115,12 @@ function MailUI:refreshScrollRect() end) self.scrollRect:clearCells() self.scrollRect:refillCells(#self.mailList) + + if #self.mailList > 0 then + self.emptyBg:setVisible(false) + else + self.emptyBg:setVisible(true) + end self.needRefills = false end From 528ac6a89b17b85d8c60d922ace04d1059cf089c Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 22 May 2023 15:59:17 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=8A=80=E8=83=BDtips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../localization_global_const.lua | 2 + lua/app/config/strings/cn/global.lua | 3 + lua/app/global/global_const.lua | 1 + lua/app/module/hero/hero_manager.lua | 4 + lua/app/module/tips/tips_manager.lua | 14 +++ lua/app/ui/battle/battle_ui.lua | 3 + lua/app/ui/battle/cell/skill_node_cell.lua | 6 + lua/app/ui/tips/battle_board_skill_tips.lua | 115 ++++++++++++++++++ .../ui/tips/battle_board_skill_tips.lua.meta | 10 ++ lua/app/userdata/battle/battle_data.lua | 2 - lua/app/userdata/hero/hero_entity.lua | 2 +- 11 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 lua/app/ui/tips/battle_board_skill_tips.lua create mode 100644 lua/app/ui/tips/battle_board_skill_tips.lua.meta diff --git a/lua/app/config/localization/localization_global_const.lua b/lua/app/config/localization/localization_global_const.lua index e0c6cac9..d9daef9e 100644 --- a/lua/app/config/localization/localization_global_const.lua +++ b/lua/app/config/localization/localization_global_const.lua @@ -1,5 +1,7 @@ local LocalizationGlobalConst = { + BATTLE_DESC_9 = "BATTLE_DESC_9", + BATTLE_DESC_10 = "BATTLE_DESC_10", MAIN_BTN_1 = "MAIN_BTN_1", QLT_DESC_1 = "QLT_DESC_1", QLT_DESC_2 = "QLT_DESC_2", diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 47180099..c6622ebb 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -116,6 +116,9 @@ local localization_global = ["BTN_DELETE_ALL_READ_MAIL"] = "删除已读邮件", ["BTN_CLAIM_ALL"] = "领取所有", ["BTN_READ"] = "读取", + + ["BATTLE_DESC_9"] = "{0}攻击力:{1}", + ["BATTLE_DESC_10"] = "已激活效果", } return localization_global \ No newline at end of file diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 43eb0d24..16d3beab 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -135,6 +135,7 @@ GConst.TYPEOF_UNITY_CLASS = { BF_TUTORIAL_CLICKAREA = typeof(CS.BF.TutorialClickArea), BF_CAMERA_HELPER = typeof(CS.BF.CameraHelper), BF_HORIZONTAL_OR_VERTICAL_LAYOUT = typeof(CS.BF.BFHorizontalOrVerticalLayout), + BF_GRID_LAYOUT = typeof(CS.BF.BFGridLayout), BF_SCROLL_RECT_CENTER = typeof(CS.BF.ScrollRectCenterController), BF_SCROLL_RECT_CENTER_CORE = typeof(CS.BF.ScrollRectCenter), BF_GRAPHIC_FLIP = typeof(CS.BF.BFGraphicFlip), diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index 768f6bb4..9ffcfcad 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -26,6 +26,10 @@ end ------------------------------------------ 英雄相关的工具方法 ------------------------------ +function HeroManager:getHeroName(id) + return I18N:getConfig("hero")[id].name +end + function HeroManager:getHeroIcon(heroId) local cfg = ConfigManager:getConfig("hero")[heroId] return cfg and tostring(cfg.icon) diff --git a/lua/app/module/tips/tips_manager.lua b/lua/app/module/tips/tips_manager.lua index 312fb2de..df326294 100644 --- a/lua/app/module/tips/tips_manager.lua +++ b/lua/app/module/tips/tips_manager.lua @@ -111,6 +111,20 @@ function TipsManager:getRewardDesc(rewardId, rewardType) return GConst.EMPTY_STRING end +function TipsManager:showBattleBoardSkillTips(elementType, tarPrefabObj, alignType) + local params = { + elementType = elementType, + aniType = UIManager.ANI_TYPE.NONE, + } + if tarPrefabObj then + alignType = alignType or TipsManager.ALIGN_TYPE.TOP_CENTER + local tarCornerScreenPos, location = self:getCornerScreenPosition(tarPrefabObj, alignType) + params.tarCornerScreenPos = tarCornerScreenPos + params.location = location + end + UIManager:showUI("app/ui/tips/battle_board_skill_tips", params) +end + function TipsManager:getCornerScreenPosition(tarPrefabObj, alignType) local uiCamera = UIManager:getUICameraComponent() local rectTransform = tarPrefabObj:getComponent(GConst.TYPEOF_UNITY_CLASS.RECTTRANSFORM) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index d0712443..f2580feb 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -134,6 +134,9 @@ function BattleUI:initSkill() self.skillNodeCells[elementType]:refresh(skillEntity) end self.skillNodeCells[elementType]:getBaseObject():setActive(skillEntity ~= nil) + self.skillNodeCells[elementType]:addClickListener(function() + ModuleManager.TipsManager:showBattleBoardSkillTips(elementType) + end) end end diff --git a/lua/app/ui/battle/cell/skill_node_cell.lua b/lua/app/ui/battle/cell/skill_node_cell.lua index 72a484c5..0a6c75eb 100644 --- a/lua/app/ui/battle/cell/skill_node_cell.lua +++ b/lua/app/ui/battle/cell/skill_node_cell.lua @@ -57,4 +57,10 @@ function SkillNodeCell:refresh(skillEntity, elementMap, showSfx) self.lastValue = value end +function SkillNodeCell:addClickListener(func) + local uiMap = self:getUIMap() + local iconNode = uiMap["skill_node_cell.icon_node"] + iconNode:addClickListener(func) +end + return SkillNodeCell \ No newline at end of file diff --git a/lua/app/ui/tips/battle_board_skill_tips.lua b/lua/app/ui/tips/battle_board_skill_tips.lua new file mode 100644 index 00000000..427500df --- /dev/null +++ b/lua/app/ui/tips/battle_board_skill_tips.lua @@ -0,0 +1,115 @@ +local BaseTips = require "app/ui/tips/base_tips" +local BattleBoardSkillTips = class("BattleBoardSkillTips", BaseTips) + +local SELECT_SKILL_CELL = "app/ui/battle/cell/select_skill_cell" +local MIN_HEIGHT = 248 +local MAX_HEIGHT = 348 +local NO_SKILL_HRIGHT = 136 + +function BattleBoardSkillTips:ctor(params) + local elementType = params.elementType + self.params = params + self.boardSkillEntity = DataManager.BattleData:getSkillEntityByElement(elementType) + self.battleUnitEntity = DataManager.BattleData:getAtkTeam():getAllMembers()[elementType] + self.tarCornerScreenPos = params.tarCornerScreenPos + self.location = params.location +end + +function BattleBoardSkillTips:getPrefabPath() + return "assets/prefabs/ui/tips/battle_skill_tips.prefab" +end + +function BattleBoardSkillTips:onLoadRootComplete() + local uiMap = self.root:genAllChildren() + self.bg = uiMap["battle_skill_tips.bg_1"] + self.mask = uiMap["battle_skill_tips.mask"] + self.atkDesc = uiMap["battle_skill_tips.bg_1.atk_desc"] + self.skillDesc = uiMap["battle_skill_tips.bg_1.skill_desc"] + self.validEffectDesc = uiMap["battle_skill_tips.bg_1.valid_effect_desc"] + self.gridLayout = uiMap["battle_skill_tips.bg_1.grid_layout"] + if not self.selectSkillCells then + self.selectSkillCells = {} + for i = 1, 7 do + self.selectSkillCells[i] = CellManager:addCellComp(uiMap["battle_skill_tips.bg_1.grid_layout.skill_select_cell_" .. i], SELECT_SKILL_CELL) + end + end + + local tipsBgTransform = self.bg:getTransform() + self.originSizeDelta = tipsBgTransform.sizeDelta + self.originPivot = tipsBgTransform.pivot + self.originAnchoredPosition = tipsBgTransform.anchoredPosition + self.originLocalPosition = tipsBgTransform.localPosition +end + +function BattleBoardSkillTips:onRefresh() + self.mask:addClickListener(function () + self:closeUI() + end) + + local heroId = self.battleUnitEntity:getId() + local heroEntity = DataManager.HeroData:getHeroById(heroId) + if not heroEntity then + return + end + local heroNmae = ModuleManager.HeroManager:getHeroName(heroId) + local atk = self.battleUnitEntity:getAtk() + self.atkDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_9, heroNmae, atk)) + self.skillDesc:setText(ModuleManager.HeroManager:getSkillDesc(heroEntity:getBaseSkill())) + self.validEffectDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_10)) + + local addY = self.skillDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight - self.skillDesc:fastGetSizeDeltaY() + if addY < 0 then + addY = 0 + end + + local count = 0 + local rougeSkillList = heroEntity:getRogueSkillList() + for index, cell in ipairs(self.selectSkillCells) do + local rogueSkillId = rougeSkillList[index] + cell:getBaseObject():setActive(rogueSkillId ~= nil) + if rogueSkillId then + local selectedCount = DataManager.BattleData:getSkillCount(rogueSkillId) + if selectedCount > 0 then + count = count + 1 + local skillId = rogueSkillId + local count = selectedCount + local value = DataManager.BattleData:getSelectSkillMap()[skillId].value or 0 + cell:refresh(skillId, count) + cell:addClickListener(function() + ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId, value), cell:getBaseObject()) + end) + else + cell:getBaseObject():setActive(false) + end + end + end + + self.gridLayout:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRID_LAYOUT):RefreshLayout() + + if count > 5 then + addY = addY + MAX_HEIGHT + elseif count >= 1 then + addY = addY + MIN_HEIGHT + else + addY = addY + NO_SKILL_HRIGHT + self.validEffectDesc:setText(GConst.EMPTY_STRING) + end + + self.bg:setSizeDeltaY(addY) + + if self.tarCornerScreenPos then + self:locate(self.location, self.originSizeDelta, self.bg, self.tarCornerScreenPos) + end +end + +function BattleBoardSkillTips:onClose() + if self.originSizeDelta then + local tipsBgTransform = self.bg:getTransform() + tipsBgTransform.sizeDelta = self.originSizeDelta + tipsBgTransform.pivot = self.originPivot + tipsBgTransform.anchoredPosition = self.originAnchoredPosition + tipsBgTransform.localPosition = self.originLocalPosition + end +end + +return BattleBoardSkillTips \ No newline at end of file diff --git a/lua/app/ui/tips/battle_board_skill_tips.lua.meta b/lua/app/ui/tips/battle_board_skill_tips.lua.meta new file mode 100644 index 00000000..3671db90 --- /dev/null +++ b/lua/app/ui/tips/battle_board_skill_tips.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7c2687668f1925246a6f78bf3b8defd1 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/battle/battle_data.lua b/lua/app/userdata/battle/battle_data.lua index 37f274c0..c5ce9c2c 100644 --- a/lua/app/userdata/battle/battle_data.lua +++ b/lua/app/userdata/battle/battle_data.lua @@ -521,11 +521,9 @@ end function BattleData:addCommonSelectSkillCount(count) self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1) - Logger.logHighlight("self.commonSelectSkillCount " .. self.commonSelectSkillCount) end function BattleData:useCommonSelectSkillCount() - Logger.logHighlight("useCommonSelectSkillCount " .. self.commonSelectSkillCount) if self.commonSelectSkillCount <= 0 then self.commonSelectSkillCount = 0 return false diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index 9ca5cf43..dd477907 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -222,7 +222,7 @@ function HeroEntity:getHurtNum() end function HeroEntity:getName() - return I18N:getConfig("hero")[self:getCfgId()].name + return ModuleManager.HeroManager:getHeroName(self:getCfgId()) end function HeroEntity:getActiveRogueCount()