This commit is contained in:
puxuan 2025-08-08 11:41:36 +08:00
parent 11a8648fbd
commit 6ab80119eb
7 changed files with 111 additions and 34 deletions

View File

@ -165,6 +165,7 @@ GConst.TYPEOF_UNITY_CLASS = {
BF_ELIMINATION_TOUCH_EVENT = typeof(CS.BF.EliminationTouchEvent),
BF_UI_SPINE_HELPER = typeof(CS.BF.UISpineHelper),
BF_CANVAS_SORTING_ORDER_HELPER = typeof(CS.BF.CanvasSortingOrderHelper),
BF_BATTLE_CONTROL_BG = typeof(CS.BF.BattleControlBg),
}
-- lua 组件

View File

@ -27,7 +27,7 @@ BattleConst.UNIT_FRONT_POS_X = 0 -- 战斗单位身前的坐标
BattleConst.UNIT_BODY_WIDTH = 240
BattleConst.UNIT_FRONT_DISTANCE = 50
BattleConst.MOVE_SPEED = 2000 -- 战斗单位攻击时的移动速度
BattleConst.MOVE_SPEED_ENTER = 500 -- 战斗单位入场时的移动速度
BattleConst.MOVE_SPEED_ENTER = 460 -- 战斗单位入场时的移动速度
BattleConst.HURT_STATE_CRIT = 1 -- 暴击
BattleConst.EFFECT_COLOR_RED = 1
BattleConst.EFFECT_COLOR_GREEN = 2

View File

@ -17,30 +17,30 @@ MainCityConst.BOTTOM_CLOSE_ICON = {
}
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_act_pvp_cell",
"app/ui/main_city/cell/side_bar_boss_rush_cell",
"app/ui/main_city/cell/side_bar_fourteen_day_cell",
"app/ui/main_city/cell/side_bar_hero_fund_cell",
"app/ui/main_city/cell/side_bar_seven_days_cell",
"app/ui/main_city/cell/side_bar_activity_cell",
"app/ui/main_city/cell/side_bar_full_moon_cell",
"app/ui/main_city/cell/side_bar_tourn_wave_cell",
"app/ui/main_city/cell/side_bar_tourn_arena_cell",
-- "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_act_pvp_cell",
-- "app/ui/main_city/cell/side_bar_boss_rush_cell",
-- "app/ui/main_city/cell/side_bar_fourteen_day_cell",
-- "app/ui/main_city/cell/side_bar_hero_fund_cell",
-- "app/ui/main_city/cell/side_bar_seven_days_cell",
-- "app/ui/main_city/cell/side_bar_activity_cell",
-- "app/ui/main_city/cell/side_bar_full_moon_cell",
-- "app/ui/main_city/cell/side_bar_tourn_wave_cell",
-- "app/ui/main_city/cell/side_bar_tourn_arena_cell",
-- gm放最后一个
"app/ui/main_city/cell/side_bar_gm_cell"
}
MainCityConst.RIGHT_SIDE_BARS = {
"app/ui/main_city/cell/side_bar_gold_pig_cell",
-- "app/ui/main_city/cell/side_bar_gold_pig_cell",
-- "app/ui/main_city/cell/side_bar_first_recharge_cell", 已作废
"app/ui/main_city/cell/side_bar_introduct_gift_cell",
"app/ui/main_city/cell/side_bar_beginner_gift_cell",
"app/ui/main_city/cell/side_bar_discount_cell",
-- "app/ui/main_city/cell/side_bar_introduct_gift_cell",
-- "app/ui/main_city/cell/side_bar_beginner_gift_cell",
-- "app/ui/main_city/cell/side_bar_discount_cell",
-- "app/ui/main_city/cell/side_bar_weapon_gift_cell",
-- "app/ui/main_city/cell/side_bar_armor_gift_cell",
"app/ui/main_city/cell/side_bar_grow_up_gift_cell",
-- "app/ui/main_city/cell/side_bar_grow_up_gift_cell",
}
return MainCityConst

View File

@ -9,6 +9,8 @@ local BOSS_SKILL_CELL = "app/ui/battle/cell/boss_skill_cell"
local BG_PATH = "assets/arts/textures/background/battle/%s.png"
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
local GRID_EDGE_CELL = "app/ui/battle/cell/grid_edge_cell"
local CHAPTER_BG_COMP = "app/ui/battle/battle_chapter_bg_comp"
local CHAPTER_BG_PATH = "assets/prefabs/ui/chapter/chapter_1_1.prefab"
local BOARD_SFX_ORDER = GConst.UI_EFFECT_ORDER.LEVEL4 + 1
local SIDE_ATK = GConst.BattleConst.SIDE_ATK
@ -287,6 +289,7 @@ function BattleBaseUI:_display()
self:initBossEnterAni()
self:initCounterAttack()
self:initTouchCancel()
self:initChapterBg()
self:hideMonsterSkillGridCells()
end
@ -1193,6 +1196,13 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side)
end
end
function BattleBaseUI:initChapterBg()
CellManager:loadCellAsync(CHAPTER_BG_PATH, CHAPTER_BG_COMP, self.mapNode, function(cell)
-- cell:getBaseObject():setAnchoredPositionY(738)
cell:pause()
self.chapterMapBg = cell
end)
end
-- shakeType: 奇数是水平震动 偶数是垂直震动
function BattleBaseUI:shakeScreen(shakeType, duration)

View File

@ -0,0 +1,36 @@
local BattleChapterBgComp = class("BattleChapterBgComp", LuaComponent)
function BattleChapterBgComp:init()
local uiMap = self.baseObject:genAllChildren()
local buildNode = uiMap["chapter_1_1.build_node"]
self.allObj = {}
for i = 1, 3 do
local bg = uiMap["chapter_1_1.bg_" .. i]
local bg1 = uiMap["chapter_1_1.prospect_" .. i]
local bg2 = uiMap["chapter_1_1.middle_" .. i]
if bg then
table.insert(self.allObj, bg)
end
if bg1 then
table.insert(self.allObj, bg1)
end
if bg2 then
table.insert(self.allObj, bg2)
end
end
table.insert(self.allObj, buildNode)
end
function BattleChapterBgComp:pause()
for i,v in ipairs(self.allObj) do
v:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_BATTLE_CONTROL_BG).canMove = false
end
end
function BattleChapterBgComp:doMove()
for i,v in ipairs(self.allObj) do
v:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_BATTLE_CONTROL_BG):SetPositionByTime(0.02)
end
end
return BattleChapterBgComp

View File

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

View File

@ -7,8 +7,8 @@ local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
local BATTLE_TASK_CELL = "app/ui/battle/cell/battle_task_cell"
local DEFAULT_X = 10000
local BOARD_POS_UP = BF.Vector2(0, 47)
local BOARD_POS_DOWN = BF.Vector2(0, -740)
local BOARD_POS_UP = BF.Vector2(0, -58)
local BOARD_POS_DOWN = BF.Vector2(0, -440)
local CacheVector2 = CS.UnityEngine.Vector2(0, 0)
---------------------------------必须重写的方法----------------------------------
function BattleUI:initBaseInfo()
@ -31,6 +31,7 @@ function BattleUI:initBaseInfo()
self.gridEdgeNode = uiMap["battle_ui.bg_2.board_node.board_center_node.grid_edge_node"]
self.gridEdgeCacheCell = uiMap["battle_ui.cache_node.grid_edge_cell"]
self.topNode = uiMap["battle_ui.top_node"]
self.mapNode = uiMap["battle_ui.battle_root.map_node"]
-- taskNode
self.taskNode = uiMap["battle_ui.top_node.task_node"]
@ -60,9 +61,9 @@ end
function BattleUI:initBg()
self.bg = self.uiMap["battle_ui.battle_root.bg"]
self.bg:setLocalScale(0, 0, 0)
local width = self.bg:fastGetSizeDelta()
self.bg:setAnchoredPositionX(width/4)
-- self.bg:setLocalScale(0, 0, 0)
-- local width = self.bg:fastGetSizeDelta()
-- self.bg:setAnchoredPositionX(width/4)
end
function BattleUI:initSkill()
local uiMap = self.root:genAllChildren()
@ -335,6 +336,7 @@ function BattleUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_ui.top_node.close_btn"]:addClickListener(function()
ModuleManager.BattleManager:showPauseUI(self.battleController.battleType, self.battleController)
-- self:moveBattlefield(1)
end)
self:addEventListener(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, function(posIdList)
@ -355,19 +357,37 @@ function BattleUI:_bind()
end
function BattleUI:moveBattlefield(time)
local width = self.bg:fastGetSizeDelta()
self.bg:setAnchoredPositionX(width/4)
if self.bgMoveTween == nil then
self.bgMoveTween = self.bg:getTransform():DOAnchorPosX(-width/4, time)
self.bgMoveTween:SetIntId(GConst.DOTWEEN_IDS.BATTLE)
self.bgMoveTween:SetAutoKill(false)
else
local x, y = self.bg:fastGetAnchoredPosition()
CacheVector2.x = -width/4
CacheVector2.y = y
self.bgMoveTween:ChangeEndValue(CacheVector2, time, true)
self.bgMoveTween:Restart()
-- local width = self.bg:fastGetSizeDelta()
-- self.bg:setAnchoredPositionX(width/4)
-- if self.bgMoveTween == nil then
-- self.bgMoveTween = self.bg:getTransform():DOAnchorPosX(-width/4, time)
-- self.bgMoveTween:SetIntId(GConst.DOTWEEN_IDS.BATTLE)
-- self.bgMoveTween:SetAutoKill(false)
-- else
-- local x, y = self.bg:fastGetAnchoredPosition()
-- CacheVector2.x = -width/4
-- CacheVector2.y = y
-- self.bgMoveTween:ChangeEndValue(CacheVector2, time, true)
-- self.bgMoveTween:Restart()
-- end
if not self.chapterMapBg then
return
end
if self.mapSid then
self:unscheduleGlobal(self.mapSid)
self.mapSid = nil
end
local maxCount = math.floor(time / 0.02 + 0.000001)
local count = 0
self.mapSid = self:scheduleGlobal(function()
if count >= maxCount then
self:unscheduleGlobal(self.mapSid)
self.mapSid = nil
return
end
self.chapterMapBg:doMove()
count = count + 1
end)
end
function BattleUI:showLeftBuffTips(buffList, autoClose)