This commit is contained in:
puxuan 2025-10-22 15:05:56 +08:00
parent c1cdd00fe1
commit c21cece463
9 changed files with 201 additions and 66 deletions

View File

@ -40,7 +40,32 @@ function UISpineObject:getAnimationState(forceRefresh)
return self.animationState
end
---- loop必须为false
function UISpineObject:playAnimOnPercent(animName, loop, forceRefresh, forceGetSG, percent)
local trackEntry = self:playAnim(animName, loop, forceRefresh, forceGetSG)
local spineAnim = self:getAnimation(trackEntry)
local duration = spineAnim.Duration
trackEntry.AnimationStart = percent * duration
end
function UISpineObject:playAnimOnUpdate(animName, loop, forceRefresh, forceGetSG, percent)
self:killAniCompleteSeq()
self:getAnimationState(forceGetSG)
local trackEntry = self:playAnim(animName, loop, forceRefresh, forceGetSG)
local spineAnim = self:getAnimation(trackEntry)
local startTime = spineAnim.Duration * percent
if self.animationState then
local trackEntry = self.animationState:SetAnimation(startTime, animName, loop)
if forceRefresh then
self.skeletonGraphic:Update(startTime)
end
return trackEntry
end
end
function UISpineObject:playAnim(animName, loop, forceRefresh, forceGetSG)
self:killAniCompleteSeq()
self:getAnimationState(forceGetSG)
if self.animationState then
local trackEntry = self.animationState:SetAnimation(0, animName, loop)
@ -101,19 +126,41 @@ function UISpineObject:rePlayAnim(animName, loop, forceRefresh)
end
end
function UISpineObject:playAnimComplete(animName, loop, forceRefresh, complete, forceGetSG)
function UISpineObject:playAnimCompleteOnPer(animName, loop, forceRefresh, complete, forceGetSG, customTime, customCallback, percent)
local trackEntry = self:playAnim(animName, loop, forceRefresh, forceGetSG)
local spineAnim = self:getAnimation(trackEntry)
local duration = spineAnim.Duration
self:killAniCompleteSeq()
self.animCompleteSeq = self:createBindTweenSequence()
self.animCompleteSeq:AppendInterval(duration - (percent * duration))
self.animCompleteSeq:AppendCallback(complete)
if customTime and customCallback then
self.animCompleteSeq:InsertCallback(customTime, customCallback)
end
trackEntry.AnimationStart = percent * duration
end
function UISpineObject:playAnimComplete(animName, loop, forceRefresh, complete, forceGetSG, customTime, customCallback)
local spineAnim = self:getAnimation(self:playAnim(animName, loop, forceRefresh, forceGetSG))
local duration = spineAnim.Duration
if self.playAnimCompleteSeq then
self.playAnimCompleteSeq:Kill()
self.playAnimCompleteSeq = nil
self:killAniCompleteSeq()
self.animCompleteSeq = self:createBindTweenSequence()
self.animCompleteSeq:AppendInterval(duration)
self.animCompleteSeq:AppendCallback(complete)
if customTime and customCallback then
self.animCompleteSeq:InsertCallback(customTime, customCallback)
end
self.playAnimCompleteSeq = self:createBindTweenSequence()
self.playAnimCompleteSeq:AppendInterval(duration)
self.playAnimCompleteSeq:OnComplete(complete)
return duration
end
function UISpineObject:killAniCompleteSeq()
if self.animCompleteSeq then
self.animCompleteSeq:Kill()
self.animCompleteSeq = nil
end
end
function UISpineObject:findAnim(animName)
self:getAnimationState()
if self.animationState then
@ -129,13 +176,18 @@ function UISpineObject:getAnimation(trackEntry)
return trackEntry and trackEntry.Animation
end
function UISpineObject:setAttachment(slotName, attachmentName)
self:getSkeletonGraphic().Skeleton:SetAttachment(slotName, attachmentName)
end
function UISpineObject:getAnimSpeed()
if self.skeletonGraphic then
return self.skeletonGraphic.timeScale
end
end
function UISpineObject:setTimeScale(timeScale)
function UISpineObject:setAnimSpeed(timeScale)
if self.skeletonGraphic then
self.skeletonGraphic.timeScale = timeScale
end
@ -153,6 +205,18 @@ function UISpineObject:setIsUnScaledTime(value)
end
end
function UISpineObject:getAnimationDuration(animationName)
local spinAnimation = self:findAnim(animationName)
if spinAnimation == nil then
return 0
end
return spinAnimation.Duration
end
function UISpineObject:setDefaultMix(mixDuration)
self:getSkeletonGraphic().skeletonDataAsset:GetAnimationStateData().DefaultMix = mixDuration
end
function UISpineObject:clearTrack()
if self.animationState then
self.animationState:ClearTrack(0)

View File

@ -168,21 +168,96 @@ function ModuleManager:getIsOpen(key, hideToast)
if cfg == nil then
return true
end
-- 优先判断等级
-- 且
if cfg.sever_time then
local serverDay = DataManager.PlayerData:getServerOpenDay()
local isOpen = serverDay >= cfg.sever_time
if not hideToast and not isOpen then
if cfg.level then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_LEVEL_SEVER, cfg.level, serverDay, cfg.sever_time))
elseif cfg.stage then
local str = DataManager.ChapterData:getChapterNameXYMode(cfg.stage)
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_STAGE_SEVER, str, serverDay, cfg.sever_time))
else
-- 策划说必定有level或stage
end
end
if not isOpen then
return false
end
end
if cfg.time then
local createDay = DataManager.PlayerData:getCreateDay()
local isOpen = createDay >= cfg.time
if not hideToast and not isOpen then
if cfg.level then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_LEVEL_SEVER, cfg.level, createDay, cfg.time))
elseif cfg.stage then
local str = DataManager.ChapterData:getChapterNameXYMode(cfg.stage)
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_STAGE_SEVER, str, createDay, cfg.time))
else
-- 策划说必定有level或stage
end
end
if not isOpen then
return false
end
end
if cfg.level then
local isOpen = DataManager.PlayerData:getLv() >= cfg.level
if not hideToast and not isOpen then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_LEVEL, cfg.level))
end
return isOpen
elseif cfg.stage then -- 没有填等级字段就判断关卡
local isOpen = DataManager.ChapterData:getMaxChapterId() >= cfg.stage
if not hideToast and not isOpen then
local page = DataManager.ChapterData:getChapterPage(cfg.stage)
local stage = DataManager.ChapterData:getChapterStage(cfg.stage)
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_STAGE, page .. "-" .. stage))
if not isOpen then
return false
end
return isOpen
end
if cfg.stage then
local isOpen = DataManager.ChapterData:getChapterPassed(cfg.stage)
if not hideToast and not isOpen then
local str = DataManager.ChapterData:getChapterNameXYMode(cfg.stage)
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_STAGE, str))
end
if not isOpen then
return false
end
end
-- 或
local stage2, time2
if cfg.stage_2 then
local isOpen = DataManager.ChapterData:getChapterPassed(cfg.stage_2)
if isOpen then
return true
else
stage2 = cfg.stage_2
end
end
if cfg.time_2 then
local createDay = DataManager.PlayerData:getCreateDay()
local isOpen = createDay >= cfg.time_2
if isOpen then
return true
else
time2 = cfg.time_2
end
end
if stage2 and time2 then
if not hideToast then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_STAGE_OR_SEVER, stage2, time2))
end
return false
elseif stage2 and not cfg.time_2 then
if not hideToast then
local str = DataManager.ChapterData:getChapterNameXYMode(stage2)
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_STAGE, str))
end
return false
elseif time2 and not cfg.stage_2 then
if not hideToast then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.FUNC_OPEN_SEVER, time2))
end
return false
end
return true
end

View File

@ -932,6 +932,9 @@ local LocalizationGlobalConst =
DUNGEON_TITLE_7 = "DUNGEON_TITLE_7",
DUNGEON_TITLE_8 = "DUNGEON_TITLE_8",
DUNGEON_TITLE_9 = "DUNGEON_TITLE_9",
FUNC_OPEN_STAGE_SEVER = "FUNC_OPEN_STAGE_SEVER",
FUNC_OPEN_LEVEL_SEVER = "FUNC_OPEN_LEVEL_SEVER",
FUNC_OPEN_STAGE_OR_SEVER = "FUNC_OPEN_STAGE_OR_SEVER",
}
return LocalizationGlobalConst

View File

@ -932,6 +932,9 @@ local localization_global =
["DUNGEON_TITLE_7"] = "材料探索",
["DUNGEON_TITLE_8"] = "金币",
["DUNGEON_TITLE_9"] = "材料",
["FUNC_OPEN_STAGE_SEVER"] = "通关章节{0}且{1}/{2}天后解锁",
["FUNC_OPEN_LEVEL_SEVER"] = "等级达到{0}且{1}/{2}天后解锁",
["FUNC_OPEN_STAGE_OR_SEVER"] = "通关章节{0}或{1}/{2}天后解锁",
}
return localization_global

View File

@ -4,13 +4,8 @@ function MaincityManager:showMainCityUI(isFirstEnter, targetIndex)
UIManager:showUI(UIManager.UI_PATH.MAINCITY_UI, {isFirstEnter = isFirstEnter, targetIndex = targetIndex})
end
function MaincityManager:showModuleUnlockUI()
local chapterId = DataManager.PlayerData:getModuleUnlockChapter()
if chapterId <= 0 then
return
end
DataManager.PlayerData:markShowModuleUnlock()
UIManager:showUI("app/ui/main_city/module_unlock_ui", {chapterId = chapterId})
function MaincityManager:showModuleUnlockUI(params)
UIManager:showUI("app/ui/main_city/module_unlock_ui", params)
end
function MaincityManager:showChapterBoxUI(chapterId)
@ -46,10 +41,10 @@ function MaincityManager:getFuncOpenShowList()
if ModuleManager:showPop(moduleKey) and not LocalData:getFuncOpenShowList()[moduleKey] then
if ModuleManager:getIsOpen(moduleKey, true) then
table.insert(showList, moduleKey)
elseif moduleKey == ModuleManager.MODULE_KEY.EQUIP_SKIN and DataManager.WeaponData:isOpen() then
table.insert(showList, moduleKey)
elseif moduleKey == ModuleManager.MODULE_KEY.SKIN and DataManager.SkinData:isOpen() then
table.insert(showList, moduleKey)
-- elseif moduleKey == ModuleManager.MODULE_KEY.EQUIP_SKIN and DataManager.WeaponData:isOpen() then
-- table.insert(showList, moduleKey)
-- elseif moduleKey == ModuleManager.MODULE_KEY.SKIN and DataManager.SkinData:isOpen() then
-- table.insert(showList, moduleKey)
end
end
end

View File

@ -39,15 +39,12 @@ function SideBarActSprintCell:_refreshTime()
local remainTime = DataManager.ActSprintData:getRemainTime()
if remainTime then
self.timeBg:setActive(true)
self.timeBg:setAnchoredPositionY(-70)
self.txName:setAnchoredPositionY(5)
if remainTime < 0 then
remainTime = 0
end
self.txTime:setText(Time:formatNumTimeStr(remainTime))
else
self.timeBg:setActive(false)
self.txName:setAnchoredPositionY(5)
end
end

View File

@ -295,11 +295,13 @@ function MainComp:getDailyChallengeBtnPosition()
end
function MainComp:getIdleBtnPosition()
return self.leftBtn:getPosition()
local pos = self.leftBtn:getPosition()
return {x = pos.x + 0.5, y = pos.y + 0.5, z = 0}
end
function MainComp:getSummonBtnPosition()
return self.rightBtn:getPosition()
local pos = self.rightBtn:getPosition()
return {x = pos.x - 0.5, y = pos.y + 0.5, z = 0}
end
function MainComp:refreshHero()

View File

@ -650,14 +650,14 @@ function MainCityUI:checkMainPop()
return
end
-- 检查功能弹窗
if DataManager.PlayerData:getIfCanShowModuleUnlock() and not GFunc.isShenhe() then
ModuleManager.MaincityManager:showModuleUnlockUI()
return
end
-- if DataManager.PlayerData:getIfCanShowModuleUnlock() and not GFunc.isShenhe() then
-- ModuleManager.MaincityManager:showModuleUnlockUI()
-- return
-- end
-- 功能解锁
local showFuncList = ModuleManager.MaincityManager:getFuncOpenShowList()
if showFuncList and #showFuncList > 0 and not GFunc.isShenhe() then
ModuleManager.MaincityManager:showModuleUnlockUI()
ModuleManager.MaincityManager:showModuleUnlockUI(showFuncList)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.REFRESH_MAIN_CITY_BOTTOM)
return
end

View File

@ -17,18 +17,14 @@ function ModuleUnlockUI:onClose()
self.animVanish:Kill()
self.animVanish = nil
end
if self.spineStar then
self.spineStar:killAniCompleteSeq()
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
end
function ModuleUnlockUI:ctor(params)
self.chapterId = params and params.chapterId
self.unlockList = {}
local cfg = ConfigManager:getConfig("func_open")
for k, v in pairs(cfg) do
if v.stage == self.chapterId and v.pop_ups == nil then
table.insert(self.unlockList, k)
end
end
self.unlockList = params or {}
end
function ModuleUnlockUI:onLoadRootComplete()
@ -65,7 +61,7 @@ function ModuleUnlockUI:checkShowNext()
return
end
self.moduleKey = table.remove(self.unlockList, 1)
ModuleManager.MaincityManager:markFuncOpen(self.moduleType)
ModuleManager.MaincityManager:markFuncOpen(self.moduleKey)
local info = ConfigManager:getConfig("func_open")[self.moduleKey]
local i18nInfo = I18N:getConfig("func_open")[self.moduleKey]