local DyeLibrary_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') local CONST_DISPLAY_COUNT = 5 function DyeLibrary_Controller.OnStartup() EventSystem.Regist(EventID.FunctionUnlockUpdate, DyeLibrary_Controller.CheckRedPoint) private.params = { oldLevelCfg = nil, newLevelCfg = nil } end function DyeLibrary_Controller.OnShutdown() private.params = nil end function DyeLibrary_Controller.OpenMainPanel() local isUnlock, content = MDL.Unlock.IsClientUnlockWithText(MDL.Unlock.FunctionType.DyeLibrary, "IDS_Activity_Condition_01") if isUnlock then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIDyeIllustratedBase, nil, Const_UI_Lua.UIEnum.UIHeroIllustratedBase) end end function DyeLibrary_Controller.CheckUnlock() local isUnlock, content = MDL.Unlock.IsClientUnlockWithText(MDL.Unlock.FunctionType.DyeLibrary, "IDS_Activity_Condition_01") return isUnlock end function DyeLibrary_Controller.ShowLeveUpTipPanel(oldLevel, newLevel) if oldLevel and newLevel > oldLevel then private.params.newLevelCfg = DataSheetManager.PhantomPictorialScore:GetDataByLevelID(newLevel) local _, oldCfg = DataSheetManager.PhantomPictorialScore:TryGetDataByLevelID(oldLevel) if oldCfg then private.params.oldLevelCfg = oldCfg else private.params.oldLevelCfg = nil end private.params.type = LuaConst.PictorialType.Dye UIManager.OpenView(Const_UI_Lua.UIEnum.UIHeroIllustratedLevelUpTip, private.params) end end function DyeLibrary_Controller.CheckRedPoint() if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DyeLibrary) then CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.Library_Dye) return end if MDL.DyeLibrary.IsShowRP() then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.Library_Dye) return end CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.Library_Dye) end function DyeLibrary_Controller.GetEntryList() local entryList = {} for i, v in DataSheetManager.CollectionAP:GetEnumerator() do table.insert(entryList, v) end if #entryList < CONST_DISPLAY_COUNT then for i = #entryList + 1, CONST_DISPLAY_COUNT do --凑齐长度显示敬请期待 table.insert(entryList, 0) end end return entryList end --时装最顶级套装的 function DyeLibrary_Controller.GetCellDisplayPicture(appearanceID) local apCfg = DataSheetManager.CollectionAP:GetDataByID(appearanceID) local bestSuit for i, v in ipairs(apCfg.SuitList) do local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(v) if bestSuit == nil or bestSuit.Quality < suitCfg.Quality then bestSuit = suitCfg end end return bestSuit.SuitImage end function DyeLibrary_Controller.GetTotalNum(appearanceID) local count = 0 local apCfg = DataSheetManager.CollectionAP:GetDataByID(appearanceID) for i, v in ipairs(apCfg.SuitList) do local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(v) if suitCfg.Quality < CTL.DyeAppearance.SuitQuality_Middle then count = count + 1 end end return count end return DyeLibrary_Controller