local DyeAppearance_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') DyeAppearance_Controller.SuitQuality_Best = 1 --顶级套装品质 DyeAppearance_Controller.SuitQuality_Middle = 3 --普通套装品质 DyeAppearance_Controller.PartCount = 4 --套装部件上限值 private.recordPartColor = {} local LastDrawColorFlag = "DyeAppearance_LastDrawColorFlag" local CONST_DRAW_COST = 238 --抽奖代币常量 local CONST_DRAW_CURRENCY = 239 --兑换代币常量 function DyeAppearance_Controller.OnStartup() EventSystem.Regist(EventID.FunctionUnlockUpdate, private.OnFunctionUnlockUpdate) private.tempDyeColorList = {} --减少每次染色去重复创建table, private.initColorDict = {} --原皮色卡 private.colorQualityDict = {} for i, v in DataSheetManager.CollectionAPSuit:GetEnumerator() do for partId, color in ipairs(v.PartList) do if v.IsInit then if private.initColorDict[v.ApperanceID] == nil then private.initColorDict[v.ApperanceID] = {} end if private.initColorDict[v.ApperanceID][partId] == nil then private.initColorDict[v.ApperanceID][partId] = {} end private.initColorDict[v.ApperanceID][partId] = color end local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(color, partId, v.ApperanceID) private.colorQualityDict[colorCfg] = v.Quality end end private.firstGetColorCfgList = {} --存储获得的新色卡,做红点提示用,进入对应色卡界面将对应数据清除 end function DyeAppearance_Controller.IsDyeItem(id) return id == CONST_DRAW_COST or id == CONST_DRAW_CURRENCY end function DyeAppearance_Controller.GetJumpFunc(id) if id == CONST_DRAW_COST then return private.JumpToDrawCard elseif id == CONST_DRAW_CURRENCY then return private.JumpToPayMall end end function private.JumpToDrawCard() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DyeAppearance) == false then CTL.Tips.AddTipsMsg(Const_IDS.IDS_CollectionLottery_Jump) return end local appearanceId for i, v in DataSheetManager.CollectionAP:GetEnumerator() do if MDL.DyeAppearance.GetIsAppearanceActive(v.ID) then appearanceId = v.ID for part = 1, DyeAppearance_Controller.PartCount do local _, isComplete = CTL.DyeAppearance.GetPartActiveCount(v.ID, part) if isComplete == false then appearanceId = v.ID break end end end end if appearanceId then DyeAppearance_Controller.TryGetDye(appearanceId) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_CollectionLottery_Jump) end end function private.JumpToPayMall() UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIPayMallBasePanel, { tabId = CTL.PayMall.ShopTabType.Shop, childTabId = CTL.PayMall.PayMallMainTabId.DyeAppearance }) end function DyeAppearance_Controller.GetColorQuality(colorCfg) return private.colorQualityDict[colorCfg] or DyeAppearance_Controller.SuitQuality_Middle end function DyeAppearance_Controller.OpenMain(heroId, appearanceId) if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DyeAppearance) == false then return end UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIDyeAppearanceBase, { heroId = heroId, appearanceId = appearanceId }) end function DyeAppearance_Controller.OnFunctionUnlockUpdate(fucId, isUnlock) if fucId == MDL.Unlock.FunctionType.DyeAppearance then if not isUnlock then private.ForceRemoveAll() end end end function private.ForceRemoveAll() EventSystem.Dispatch(EventID.UI_CloseAndRecoverView, Const_UI_Lua.UIEnum.UIDyeAppearanceBase) UIManager.CloseView(Const_UI_Lua.UIEnum.UIDyeAppearancePrizeWheel) end --跳转抽奖界面 function DyeAppearance_Controller.TryGetDye(appearanceId) if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DyeAppearance) == false then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_168_WarnCode_Funtion_Not_Unlock) return end if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIDyeAppearancePrizeWheel) then return end UIManager.OpenView(Const_UI_Lua.UIEnum.UIDyeAppearancePrizeWheel, { appearanceId = appearanceId }) end --mode:0=PVP模 1=战斗模 2=展示模 function DyeAppearance_Controller.SetModelDye(renderEntity, appearanceId, partList, mode) local _, cfg = DataSheetManager.CollectionAP:TryGetDataByID(appearanceId) if cfg then local modelPath = UTL.UIRender.GetModelPath(nil, mode == 2, appearanceId) if CTL.HotFix.CanAssetLoad(modelPath) == false then return end local dyeDataPath if mode == 0 then dyeDataPath = cfg.PVPConfig elseif mode == 1 then dyeDataPath = cfg.BattleConfig elseif mode == 2 then dyeDataPath = cfg.ShowConfig end table.clearArray(private.tempDyeColorList) for partIndex, color in ipairs(partList) do local partCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(color, partIndex, appearanceId) private.tempDyeColorList[partIndex] = partCfg.ColorConfig end if #private.tempDyeColorList > 0 then renderEntity:SetDye(dyeDataPath, private.tempDyeColorList) end end end function private.SortColorRule(a, b) return a.RankID < b.RankID end function private.SortSuitDescRule(a, b) local isSuitActive_a = a.isSuitActive local isSuitActive_b = b.isSuitActive if isSuitActive_a ~= isSuitActive_b then return isSuitActive_b end return a.suitId > b.suitId end function DyeAppearance_Controller.CollectPartColorList(colorList, appearanceId, partIndex, isFilter) table.clearArray(colorList) for i, v in DataSheetManager.CollectionAPPart:GetEnumerator() do if v.PartID == partIndex and v.ApperanceID == appearanceId then if isFilter and private.initColorDict[v.ApperanceID][v.PartID] == v.ColorID then else table.insert(colorList, v) end end end table.sort(colorList, private.SortColorRule) end function DyeAppearance_Controller.CollectInitColorList(colorList, appearanceId) table.clearArray(colorList) for i, v in DataSheetManager.CollectionAPPart:GetEnumerator() do if v.ApperanceID == appearanceId and private.initColorDict[v.ApperanceID][v.PartID] == v.ColorID then colorList[v.PartID] = v.ColorID end end end function DyeAppearance_Controller.IsSuitActive(suitId) local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(suitId) local isSuitActive = true for partIndex, colorId in ipairs(suitCfg.PartList) do if MDL.DyeAppearance.IsColorActive(suitCfg.ApperanceID, partIndex, colorId) == false then isSuitActive = false break end end return isSuitActive end function DyeAppearance_Controller.GetTotalAttr(appearanceId) local totalAttr = {} --套装属性 for i, v in DataSheetManager.CollectionAPSuit:GetEnumerator() do if v.ApperanceID == appearanceId then if DyeAppearance_Controller.IsSuitActive(v.ID) then for _, attr in ipairs(v.Attr_Table) do totalAttr[attr.AttrType] = totalAttr[attr.AttrType] and totalAttr[attr.AttrType] + attr.AttrNum or attr.AttrNum end end end end --色卡属性 for i, v in DataSheetManager.CollectionAPPart:GetEnumerator() do if v.ApperanceID == appearanceId then if MDL.DyeAppearance.IsColorActive(appearanceId, v.PartID, v.ColorID) then for _, attr in ipairs(v.Attr_Table) do totalAttr[attr.AttrType] = totalAttr[attr.AttrType] and totalAttr[attr.AttrType] + attr.AttrNum or attr.AttrNum end end end end return totalAttr end --部位上色卡激活的数量 function DyeAppearance_Controller.GetPartActiveCount(appearanceId, partIndex) local totalNum = 0 for i, v in DataSheetManager.CollectionAPPart:GetEnumerator() do if v.PartID == partIndex and v.ApperanceID == appearanceId then totalNum = totalNum + 1 end end local activeList = MDL.DyeAppearance.GetPartActiveColorList(appearanceId, partIndex) if activeList then return #activeList, #activeList >= totalNum end return 0, false end --套装中色卡激活的数量 function DyeAppearance_Controller.GetSuitActiveCount(suitId) local curCount = 0 local isComplete = true local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(suitId) for i, v in ipairs(suitCfg.PartList) do if MDL.DyeAppearance.IsColorActive(suitCfg.ApperanceID, i, v) then curCount = curCount + 1 else isComplete = false end end if curCount == 0 then isComplete = false end return curCount, isComplete end --套装中已经激活的color是否都染上了 function DyeAppearance_Controller.GetIfSuitAllPartDye(suitId) local isAllDye local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(suitId) for i, v in ipairs(suitCfg.PartList) do if MDL.DyeAppearance.IsColorActive(suitCfg.ApperanceID, i, v) then if MDL.DyeAppearance.IsColorDye(suitCfg.ApperanceID, i, v) then isAllDye = true else isAllDye = false break end end end if isAllDye == nil then isAllDye = false end return isAllDye end function DyeAppearance_Controller.TrySaveSuit(suitId) local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(suitId) local count, isComplete = DyeAppearance_Controller.GetSuitActiveCount(suitId) if count == 0 then UTL.MessageBox.ShowOKCancelBox(nil, Const_IDS.IDS_CollectionAP_Tip7, function() CTL.DyeAppearance.TryGetDye(suitCfg.ApperanceID) end, nil) else if isComplete then local apCfg = DataSheetManager.CollectionAP:GetDataByID(suitCfg.ApperanceID) MDL.DyeAppearance.SetCurColorReq(suitCfg.ApperanceID, suitCfg.PartList, true) --套装的神兵和光效也穿上 if suitCfg.MagicWeaponID > 0 then local info = MDL.Appearance.GetAppearanceDataByHeroID_AppearanceID(apCfg.HeroID, suitCfg.MagicWeaponID, MDL.Appearance.AppearanceType.Weapon) if info and info.isActive then MDL.Appearance.WearAppearanceRequest(suitCfg.MagicWeaponID, apCfg.HeroID, MDL.Appearance.AppearanceType.Weapon) end end if suitCfg.LightEffectID1 > 0 then if MDL.LightEffect.IsActivateByHeroID_LightEffectID(apCfg.HeroID,suitCfg.LightEffectID1) and MDL.LightEffect.IsWearByHeroID_LightEffectID(apCfg.HeroID,suitCfg.LightEffectID1) == false then MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.PutOn, apCfg.HeroID, suitCfg.LightEffectID1) end end if suitCfg.LightEffectID2 > 0 then if MDL.LightEffect.IsActivateByHeroID_LightEffectID(apCfg.HeroID,suitCfg.LightEffectID2) and MDL.LightEffect.IsWearByHeroID_LightEffectID(apCfg.HeroID,suitCfg.LightEffectID2) == false then MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.PutOn, apCfg.HeroID, suitCfg.LightEffectID2) end end if suitCfg.LightEffectID3 > 0 then if MDL.LightEffect.IsActivateByHeroID_LightEffectID(apCfg.HeroID,suitCfg.LightEffectID3) and MDL.LightEffect.IsWearByHeroID_LightEffectID(apCfg.HeroID,suitCfg.LightEffectID3) == false then MDL.LightEffect.LightEffectOptRequest(MDL.LightEffect.OptType.PutOn, apCfg.HeroID, suitCfg.LightEffectID3) end end EventSystem.Dispatch(EventID.UI_DyeAppearance_SwitchTabIndex, 0) else local partList = MDL.DyeAppearance.GetDyeAppearancePartList(suitCfg.ApperanceID) for i, v in ipairs(suitCfg.PartList) do if MDL.DyeAppearance.IsColorActive(suitCfg.ApperanceID, i, v) then partList[i] = v end end UTL.MessageBox.ShowOKCancelBox(nil, Const_IDS.IDS_CollectionAP_Tip5, function() MDL.DyeAppearance.SetCurColorReq(suitCfg.ApperanceID, partList) EventSystem.Dispatch(EventID.UI_DyeAppearance_SwitchTabIndex, 0) end, nil) end end end function private.FormatSuitActiveDesc(suitName, isActive, id1, id2, id3, id4) local content = "" if id1 > 0 then content = content .. private.FormatItemDesc(id1, 1, isActive) end if id2 > 0 then content = content .. private.FormatItemDesc(id2, 2, isActive) end if id3 > 0 then content = content .. private.FormatItemDesc(id3, 3, isActive) end if id4 > 0 then content = content .. private.FormatItemDesc(id4, 4, isActive) end if isActive then return UTL.Color.FormatTextByColor("573504", string.FormatByIdsId(Const_IDS.IDS_CollectionAP_Tip11, UIUtils.GetLocalizedTxt(Const_IDS[suitName]), content)) else return UTL.Color.FormatTextByColor("4D4D4D", string.FormatByIdsId(Const_IDS.IDS_CollectionAP_Tip11, UIUtils.GetLocalizedTxt(Const_IDS[suitName]), content)) end end --mode:1环绕 2脚底 3法相 4神兵 function private.FormatItemDesc(id, mode, isActive) local itemId if mode == 1 then itemId = DataSheetManager.LightEffect:GetDataByID(id).Activation elseif mode == 2 then itemId = DataSheetManager.LightEffect:GetDataByID(id).Activation elseif mode == 3 then itemId = DataSheetManager.LightEffect:GetDataByID(id).Activation elseif mode == 4 then itemId = DataSheetManager.WeaponAppearance:GetDataByID(id).Activation end local itemData = DataSheetManager.ItemData:GetDataByID(itemId) local itemName if isActive then itemName = string.format("【%s】", CTL.ChannelChat.HyperlinkTag.Item .. "|" .. itemId, UIUtils.GetLocalizedTxt(Const_IDS[itemData.Name])) else itemName = string.format("【%s】", CTL.ChannelChat.HyperlinkTag.Item .. "|" .. itemId, UIUtils.GetLocalizedTxt(Const_IDS[itemData.Name])) end return itemName end function DyeAppearance_Controller.GetSuitDescList() local list = {} for i, v in DataSheetManager.CollectionAPSuit:GetEnumerator() do if v.LightEffectID1 > 0 or v.LightEffectID2 > 0 or v.LightEffectID3 > 0 or v.MagicWeaponID > 0 then local isSuitActive = DyeAppearance_Controller.IsSuitActive(v.ID) local item = { suitId = v.ID, isSuitActive = isSuitActive, desc = private.FormatSuitActiveDesc(v.Name, isSuitActive, v.LightEffectID1, v.LightEffectID2, v.LightEffectID3, v.MagicWeaponID) } table.insert(list, item) end end table.sort(list, private.SortSuitDescRule) return list end function DyeAppearance_Controller.GetNoteParams(noteId, suitId) if noteId == LuaConst.NoteID.DyeAppearanceColor then local param1 local param2 for i = DyeAppearance_Controller.SuitQuality_Best, DyeAppearance_Controller.SuitQuality_Middle do for _, v in DataSheetManager.CollectionAPSuit:GetEnumerator() do if v.Quality == i then if param1 == nil then param1 = "" else param1 = param1 .. "\n" end if i ~= DyeAppearance_Controller.SuitQuality_Middle then if param2 == nil then param2 = "" else param2 = param2 .. "\n" end end if i == DyeAppearance_Controller.SuitQuality_Best then param1 = param1 .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_CollectionAP_Tip14) .. ":" param2 = param2 .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_CollectionAP_Tip17) .. ":" elseif i == DyeAppearance_Controller.SuitQuality_Middle then param1 = param1 .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_CollectionAP_Tip16) .. ":" else param1 = param1 .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_CollectionAP_Tip15) .. ":" param2 = param2 .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_CollectionAP_Tip18) .. ":" end local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(v.PartList[1], 1, v.ApperanceID) for _, attr in ipairs(colorCfg.Attr_Table) do param1 = param1 .. " " .. UTL.Attr.GetAttrText(attr.AttrType, attr.AttrNum) end if i ~= DyeAppearance_Controller.SuitQuality_Middle then for _, attr in ipairs(v.Attr_Table) do param2 = param2 .. " " .. UTL.Attr.GetAttrText(attr.AttrType, attr.AttrNum) end end break end end end return { param1, param2 } elseif noteId == LuaConst.NoteID.DyeAppearanceSuit then local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(suitId) local param1 = UIUtils.GetLocalizedTxt(Const_IDS[suitCfg.Name]) local param2 = "" for _, attr in ipairs(suitCfg.Attr_Table) do param2 = param2 .. " " .. UTL.Attr.GetAttrText(attr.AttrType, attr.AttrNum) end return { param1, param2 } end end function DyeAppearance_Controller.CheckRed(heroId) if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DyeAppearance) == false then return false end for i, v in DataSheetManager.CollectionAP:GetEnumerator() do if v.HeroID == heroId then if DyeAppearance_Controller.CheckDyeAppearanceRed(v.ID) then return true end end end return false end function DyeAppearance_Controller.CheckDyeAppearanceRed(appearanceId) if MDL.DyeAppearance.GetIsAppearanceActive(appearanceId) == false then return false end --有新获得的色卡给提示红点 if DyeAppearance_Controller.CheckNoticeRed(appearanceId) then return true end --可抽奖红点 if DyeAppearance_Controller.CheckDrawCardRed(appearanceId) then return true end return false end function DyeAppearance_Controller.CheckNoticeRed(appearanceId) local apCfg = DataSheetManager.CollectionAP:GetDataByID(appearanceId) for _, v in ipairs(apCfg.SuitList) do local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(v) for part, color in ipairs(suitCfg.PartList) do if DyeAppearance_Controller.GetIsColorNoticeRed(color, part, appearanceId) then return true end end end return false end function DyeAppearance_Controller.CheckPartNoticeRed(appearanceId, partId) local apCfg = DataSheetManager.CollectionAP:GetDataByID(appearanceId) for _, v in ipairs(apCfg.SuitList) do local suitCfg = DataSheetManager.CollectionAPSuit:GetDataByID(v) local color = suitCfg.PartList[partId] if DyeAppearance_Controller.GetIsColorNoticeRed(color, partId, appearanceId) then return true end end return false end function DyeAppearance_Controller.GetIsColorNoticeRed(color, part, appearanceId) local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(color, part, appearanceId) return table.containValue(private.firstGetColorCfgList, colorCfg) end function DyeAppearance_Controller.AddNoticeColor(color, part, appearanceId) local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(color, part, appearanceId) table.insert(private.firstGetColorCfgList, colorCfg) end function DyeAppearance_Controller.ShowColorRewardItem(color, part, appearanceId) local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(color, part, appearanceId) UIManager.OpenView(Const_UI_Lua.UIEnum.UIDyeAppearanceGain, { colorCfg = colorCfg }) end function DyeAppearance_Controller.RemoveNoticeColor(appearanceId, part, colorId) local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(colorId, part, appearanceId) table.removebyvalue(private.firstGetColorCfgList, colorCfg) EventSystem.Dispatch(EventID.UI_DyeAppearance_UpdateDrawCardRed) end function DyeAppearance_Controller.CheckDrawCardRed(appearanceId) for i = 1, DyeAppearance_Controller.PartCount do if DyeAppearance_Controller.CheckPartDrawCardRed(appearanceId, i) then return true end end return false end function DyeAppearance_Controller.RemoveDrawCardRed() MDL.RedPoint.OneTimeRedPointRequest(MDL.RedPoint.RedPointType.DyeDrawCard, 1, true) EventSystem.Dispatch(EventID.UI_DyeAppearance_UpdateDrawCardRed) end function DyeAppearance_Controller.CheckPartDrawCardRed(appearanceId, partIndex) --一天提示一次 local time = MDL.RedPoint.GetRedPointTimeByType(MDL.RedPoint.RedPointType.DyeDrawCard) if time == nil or (time > 0 and UTL.Time.IsTimestampCrossDay(time)) then local appearanceCfg = DataSheetManager.CollectionAP:GetDataByID(appearanceId) local activeCount, isComplete = CTL.DyeAppearance.GetPartActiveCount(appearanceId, partIndex) if isComplete then --该套装所有色卡都抽完 return false end local costCfg = DataSheetManager.CollectionAPJackpot:GetDataByCostID_Count(appearanceCfg.CostID, activeCount) local needCount = costCfg.ItemNum local curCount = MDL.Bag.GetItemCount(costCfg.ItemID) or 0 return curCount >= needCount end return false end function DyeAppearance_Controller.HasActiveCount(target) return MDL.DyeAppearance.GetDyeAppearanceCount() >= target end function DyeAppearance_Controller.SetColorItemTemplate(item, colorCfg, isShowEquipped, isShowGet, isShowLock, isShowDraw, isShowSelect) UIUtils.SetImageByAssetBundle(item.icon, colorCfg.Icon) local quality = DyeAppearance_Controller.GetColorQuality(colorCfg) if quality == DyeAppearance_Controller.SuitQuality_Best then item.state:SetState(2) elseif quality == DyeAppearance_Controller.SuitQuality_Middle then item.state:SetState(0) else item.state:SetState(1) end if isShowEquipped == true then UIUtils.SetActive(item.equipped, true) else UIUtils.SetActive(item.equipped, false) end if isShowGet == true then UIUtils.SetActive(item.get, true) else UIUtils.SetActive(item.get, false) end if isShowLock == true then UIUtils.SetActive(item.lock, true) else UIUtils.SetActive(item.lock, false) end if isShowDraw == true then UIUtils.SetActive(item.obj_draw, true) else UIUtils.SetActive(item.obj_draw, false) end if isShowSelect == true then UIUtils.SetActive(item.select, true) else UIUtils.SetActive(item.select, false) end end function DyeAppearance_Controller.GetLastDrawColorId(appearanceId, partIndex) local lastDrawData = PersistentData.PlayerData:Get(LastDrawColorFlag, nil) if lastDrawData == nil or lastDrawData[appearanceId] == nil or lastDrawData[appearanceId][partIndex] == nil then local bestCfg for i, v in DataSheetManager.CollectionAPPart:GetEnumerator() do if v.PartID == partIndex and v.ApperanceID == appearanceId then if v.ColorID ~= private.initColorDict[v.ApperanceID][v.PartID] and MDL.DyeAppearance.IsColorActive(appearanceId, v.PartID, v.ColorID) then return v.ColorID end if bestCfg == nil or DyeAppearance_Controller.GetColorQuality(bestCfg) > DyeAppearance_Controller.GetColorQuality(v) then bestCfg = v end end end --一个没抽返回最高品质的色卡 return bestCfg.ColorID else return lastDrawData[appearanceId][partIndex] end end function DyeAppearance_Controller.RecordLastDrawColorId(appearanceId, partIndex, colorId) local lastDrawData = PersistentData.PlayerData:Get(LastDrawColorFlag, nil) if lastDrawData == nil then lastDrawData = { [appearanceId] = { [partIndex] = colorId } } else if lastDrawData[appearanceId] == nil then lastDrawData[appearanceId] = { [partIndex] = colorId } else lastDrawData[appearanceId][partIndex] = colorId end end PersistentData.PlayerData:Set(LastDrawColorFlag, lastDrawData, true) end function DyeAppearance_Controller.GetSuitExtraAttr(appearanceId, forceInit) if DataSheetManager.CollectionAP:TryGetDataByID(appearanceId) == false then return nil end if MDL.DyeAppearance.GetIsAppearanceActive(appearanceId) and (forceInit == nil or forceInit == false) then --已经激活,返回该时装的所有属性 return DyeAppearance_Controller.GetTotalAttr(appearanceId) else --未激活,返回初始套装的属性值+初始色卡的属性值 local attrTab = {} for i, v in DataSheetManager.CollectionAPSuit:GetEnumerator() do if v.ApperanceID == appearanceId and v.IsInit then for _, attr in ipairs(v.Attr_Table) do attrTab[attr.AttrType] = attr.AttrNum end for partId, colorId in ipairs(v.PartList) do local colorCfg = DataSheetManager.CollectionAPPart:GetDataByColorID_PartID_ApperanceID(colorId, partId, appearanceId) for _, attr in ipairs(colorCfg.Attr_Table) do attrTab[attr.AttrType] = attrTab[attr.AttrType] and attrTab[attr.AttrType] + attr.AttrNum or attr.AttrNum end end break end end return attrTab end end function DyeAppearance_Controller.GetDyeSpecialEffectDetail(appearanceId) local _, apCfg = DataSheetManager.CollectionAP:TryGetDataByID(appearanceId) if apCfg then for _, v in DataSheetManager.CollectionAPSuit:GetEnumerator() do if v.ApperanceID == appearanceId and v.SkillID > 0 then return v.SkillID, v.SkillIcon, v.SkillName, DyeAppearance_Controller.IsSuitActive(v.ID) end end end return 0 end function DyeAppearance_Controller.CheckIfUnSave(appearanceId) for i = 1, DyeAppearance_Controller.PartCount do local color = private.recordPartColor[i] if color and MDL.DyeAppearance.IsColorActive(appearanceId, i, color) then if MDL.DyeAppearance.IsColorDye(appearanceId, i, color) == false then return true end end end return false end function DyeAppearance_Controller.RecoverDyeRecord(appearanceId) local part1, part2, part3, part4 = MDL.DyeAppearance.GetCurDyePartColorId(appearanceId) private.recordPartColor[1] = part1 private.recordPartColor[2] = part2 private.recordPartColor[3] = part3 private.recordPartColor[4] = part4 end function DyeAppearance_Controller.GetRecordColorList() return private.recordPartColor end function DyeAppearance_Controller.GetPartRecordColor(partIndex) return private.recordPartColor[partIndex] end function DyeAppearance_Controller.SetPartRecordColor(partIndex, color) private.recordPartColor[partIndex] = color end return DyeAppearance_Controller