diff --git a/lua/app/bf/unity/uiprefab_object.lua b/lua/app/bf/unity/uiprefab_object.lua index 83589047..996e5530 100644 --- a/lua/app/bf/unity/uiprefab_object.lua +++ b/lua/app/bf/unity/uiprefab_object.lua @@ -634,6 +634,13 @@ function UIPrefabObject:setClickAnimation(enable) end end +function UIPrefabObject:stopClickAnimation() + local eventListener = self:getComponent(BF_UI_TOUCH_EVENT) + if eventListener then + eventListener:StopTouchAnimation() + end +end + function UIPrefabObject:setTouchEnable(enable) local maskableGraphic = self:getComponent(UI_MASKABLE_GRAPHIC) if maskableGraphic then diff --git a/lua/app/game.lua b/lua/app/game.lua index 1a5838ad..4a659c01 100644 --- a/lua/app/game.lua +++ b/lua/app/game.lua @@ -399,6 +399,37 @@ if NOT_PUBLISH then Logger.printTable(map) end end + + if (Input.GetKeyDown(KeyCode.RightArrow) or Input.GetKeyDown(KeyCode.LeftArrow)) and Input.GetKey(KeyCode.LeftControl) then + local configName = ModuleManager.DevToolManager.set_board_info.config + local idx = ModuleManager.DevToolManager.set_board_info.idx or 0 + if not configName then + return + end + local config = ConfigManager:getConfig(configName) + if Input.GetKeyDown(KeyCode.LeftArrow) then + idx = idx - 1 + else + idx = idx + 1 + end + if not config[idx] then + Logger.logHighlight(configName .. " 没有id idx = " .. idx) + return + end + Logger.logHighlight(configName .. " 当前 idx = " .. idx) + ModuleManager.DevToolManager.set_board_info.idx = idx + + local board = config[idx].board + if not board then + board = config[idx].board_daily_challenge + end + + if ModuleManager.BattleManager:isInBattle() then + local battleController = ModuleManager.BattleManager.battleController + battleController.battleData:refreshBoard(board, battleController:getBlockIcon()) + battleController.battleUI:initGridCell() + end + end end Game._releaseOnApplicationFocus = Game.onApplicationFocus diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 9240e0b8..007c90f6 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1411,7 +1411,9 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx) break end end - BattleHelper:playSkillSound(soundHit[soundIndex], 0) + if soundHit[soundIndex] and soundHit[soundIndex] > 0 then + BattleHelper:playSkillSound(soundHit[soundIndex], 0) + end end end end diff --git a/lua/app/module/gm/gm_const.lua b/lua/app/module/gm/gm_const.lua index 9817246d..24aa0bb4 100644 --- a/lua/app/module/gm/gm_const.lua +++ b/lua/app/module/gm/gm_const.lua @@ -111,5 +111,12 @@ args:技能id Example: add_monster_skill 10027]], type = "add_monster_skill" }, + { + title = "设置棋盘遍历信息", + desc = [[设置棋盘遍历信息type:set_board_info +args:棋盘配置表名 起始boardId +Example: set_board_info 10027]], + type = "set_board_info" + }, } return GMConst \ No newline at end of file diff --git a/lua/app/module/maincity/maincity_const.lua b/lua/app/module/maincity/maincity_const.lua index 4e6fc491..6bf73be7 100644 --- a/lua/app/module/maincity/maincity_const.lua +++ b/lua/app/module/maincity/maincity_const.lua @@ -1,5 +1,7 @@ local MainCityConst = {} +MainCityConst.SIDE_BAR_MIN_COUNT = 3 + MainCityConst.BOTTOM_PAGE = { MAIN = 1, HERO = 2, @@ -20,6 +22,7 @@ MainCityConst.MAIN_MODULE = { MainCityConst.LEFT_SIDE_BARS = { "app/ui/main_city/cell/side_bar_idle_cell", + "app/ui/main_city/cell/side_bar_growth_fund_cell", "app/ui/main_city/cell/side_bar_seven_days_cell", -- gm放最后一个 "app/ui/main_city/cell/side_bar_gm_cell" @@ -27,7 +30,6 @@ MainCityConst.LEFT_SIDE_BARS = { MainCityConst.RIGHT_SIDE_BARS = { "app/ui/main_city/cell/side_bar_gold_pig_cell", - "app/ui/main_city/cell/side_bar_growth_fund_cell", "app/ui/main_city/cell/side_bar_first_recharge_cell", "app/ui/main_city/cell/side_bar_beginner_gift_cell", "app/ui/main_city/cell/side_bar_grow_up_gift_1_cell", diff --git a/lua/app/ui/gm/gm_tool_ui.lua b/lua/app/ui/gm/gm_tool_ui.lua index d0e72d68..8859b58a 100644 --- a/lua/app/ui/gm/gm_tool_ui.lua +++ b/lua/app/ui/gm/gm_tool_ui.lua @@ -107,6 +107,12 @@ function GMToolUI:sendMsg(gmCommand) return end self:addMonsterSkill(args.args) + elseif args.args[1] == "set_board_info" then -- 特殊处理 + ModuleManager.DevToolManager.set_board_info = { + config = args.args[2], + idx = tonumber(args.args[3]) or 0 + } + self:closeUI() elseif args.args[1] == "time" then -- 特殊处理 local args1 = {} args1.args = {} diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 641f1f3e..b520f19c 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -440,20 +440,26 @@ function MainCityUI:refreshLeftBtns() table.insert(self.leftBarList, cell) end end - if #self.leftBarList <= 0 then + local sideBarShowCount = #self.leftBarList + if sideBarShowCount <= 0 then self.leftNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) return end self.leftNode:setAnchoredPositionX(0) local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2 - if isClose then -- 只显示一个 - local first = self.leftBarList[1] - first:setAnchoredPositionY(y) - first:refresh() - first:setActive(true) - first:setVisible(true) - y = y - self.sideBarHeight - SIDE_BAR_INTERVAL - for i = 2, #self.leftBarList do + if isClose then -- 只显示3个 + local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT + for i = 1, minCount do + local sideBarBtn = self.leftBarList[i] + if i <= sideBarShowCount then + sideBarBtn:setAnchoredPositionY(y) + sideBarBtn:refresh() + sideBarBtn:setActive(true) + sideBarBtn:setVisible(true) + y = y - self.sideBarHeight - SIDE_BAR_INTERVAL + end + end + for i = minCount + 1, sideBarShowCount do self.leftBarList[i]:refresh() self.leftBarList[i]:setActive(true) self.leftBarList[i]:setVisible(false) @@ -467,11 +473,18 @@ function MainCityUI:refreshLeftBtns() y = y - self.sideBarHeight - SIDE_BAR_INTERVAL end end - local arrowHeight = self.leftArrowBtn:getRectHeight() - y = y + self.sideBarHeight/2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight - self.leftSideBar:setSizeDeltaY(-y) - self.leftArrowImg:setLocalScale(1, isClose and -1 or 1, 1) - self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET) + if sideBarShowCount <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then -- 小于3个不显示箭头 + y = y + self.sideBarHeight / 2 + self.leftSideBar:setSizeDeltaY(-y) + self.leftArrowBtn:stopClickAnimation() + self.leftArrowBtn:setVisible(false) + else + local arrowHeight = self.leftArrowBtn:getRectHeight() + y = y + self.sideBarHeight/2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight + self.leftSideBar:setSizeDeltaY(-y) + self.leftArrowImg:setLocalScale(1, isClose and -1 or 1, 1) + self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET) + end end function MainCityUI:openOrCloseRightSideBar() @@ -506,6 +519,7 @@ function MainCityUI:refreshRightBtns() table.insert(self.rightBarList, cell) end end + local sideBarShowCount = #self.rightBarList if #self.rightBarList <= 0 then self.rightNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS) return @@ -513,13 +527,18 @@ function MainCityUI:refreshRightBtns() self.rightNode:setAnchoredPositionX(0) local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2 if isClose then -- 只显示一个 - local first = self.rightBarList[1] - first:setAnchoredPositionY(y) - first:refresh() - first:setActive(true) - first:setVisible(true) - y = y - self.sideBarHeight - SIDE_BAR_INTERVAL - for i = 2, #self.rightBarList do + local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT + for i = 1, minCount do + local sideBarBtn = self.rightBarList[i] + if i <= sideBarShowCount then + sideBarBtn:setAnchoredPositionY(y) + sideBarBtn:refresh() + sideBarBtn:setActive(true) + sideBarBtn:setVisible(true) + y = y - self.sideBarHeight - SIDE_BAR_INTERVAL + end + end + for i = minCount + 1, sideBarShowCount do self.rightBarList[i]:refresh() self.rightBarList[i]:setActive(true) self.rightBarList[i]:setVisible(false) @@ -533,11 +552,18 @@ function MainCityUI:refreshRightBtns() y = y - self.sideBarHeight - SIDE_BAR_INTERVAL end end - local arrowHeight = self.rightArrowBtn:getRectHeight() - y = y + self.sideBarHeight / 2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight - self.rightSideBar:setSizeDeltaY(-y) - self.rightArrowImg:setLocalScale(1, isClose and -1 or 1, 1) - self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET) + if sideBarShowCount <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then + y = y + self.sideBarHeight / 2 + self.rightSideBar:setSizeDeltaY(-y) + self.rightArrowBtn:stopClickAnimation() + self.rightArrowBtn:setVisible(false) + else + local arrowHeight = self.rightArrowBtn:getRectHeight() + y = y + self.sideBarHeight / 2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight + self.rightSideBar:setSizeDeltaY(-y) + self.rightArrowImg:setLocalScale(1, isClose and -1 or 1, 1) + self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + y + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET) + end end function MainCityUI:clearSideBarList(sideBarList) @@ -712,15 +738,21 @@ end function MainCityUI:updateSideBarStatus() if self.leftBarList then - local first = self.leftBarList[1] - if first then - if first:getIsShowRedPoint() then - first:showRedPoint() - else - first:hideRedPoint() + local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT + for i = 1, minCount do + local sideBarBtn = self.leftBarList[i] + if sideBarBtn then + if sideBarBtn:getIsShowRedPoint() then + sideBarBtn:showRedPoint() + else + sideBarBtn:hideRedPoint() + end end + end + local sideBarCount = #self.leftBarList + if sideBarCount > minCount then local count = 0 - for i = 2, #self.leftBarList do + for i = minCount + 1, sideBarCount do if self.leftBarList[i]:getIsShowRedPoint() then self.leftBarList[i]:showRedPoint() count = count + 1 @@ -738,15 +770,21 @@ function MainCityUI:updateSideBarStatus() end end if self.rightBarList then - local first = self.rightBarList[1] - if first then - if first:getIsShowRedPoint() then - first:showRedPoint() - else - first:hideRedPoint() + local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT + for i = 1, minCount do + local sideBarBtn = self.rightBarList[i] + if sideBarBtn then + if sideBarBtn:getIsShowRedPoint() then + sideBarBtn:showRedPoint() + else + sideBarBtn:hideRedPoint() + end end + end + local sideBarCount = #self.rightBarList + if sideBarCount > minCount then local count = 0 - for i = 2, #self.rightBarList do + for i = minCount + 1, sideBarCount do if self.rightBarList[i]:getIsShowRedPoint() then self.rightBarList[i]:showRedPoint() count = count + 1