103 lines
2.5 KiB
C#
103 lines
2.5 KiB
C#
|
|
using Framework;
|
|||
|
|
using PhxhSDK;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
public class TeamMarkManager : Singlenton<TeamMarkManager>, IInitable
|
|||
|
|
{
|
|||
|
|
public class TeamMark
|
|||
|
|
{
|
|||
|
|
public int ID;
|
|||
|
|
public int ItemID;
|
|||
|
|
public string nameKey;
|
|||
|
|
public string iconKey;
|
|||
|
|
public string imgPathKey;
|
|||
|
|
public string sourcePathKey;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private List<TeamMark> allMarks = new List<TeamMark>();
|
|||
|
|
private List<TeamMark> ShowMarks = new();
|
|||
|
|
private int unlockMarksCnt = 0;
|
|||
|
|
private int selectedMarkIndex = -1;
|
|||
|
|
|
|||
|
|
private bool initialized = false;
|
|||
|
|
|
|||
|
|
void initList()
|
|||
|
|
{
|
|||
|
|
if(initialized)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var TeamMarkCfg = TableManager.Instance.Tables.TeamMark;
|
|||
|
|
allMarks.Clear();
|
|||
|
|
foreach (var item in TeamMarkCfg.DataList)
|
|||
|
|
{
|
|||
|
|
TeamMark mark = new TeamMark();
|
|||
|
|
mark.ID = item.ID;
|
|||
|
|
mark.ItemID = item.ItemID;
|
|||
|
|
mark.nameKey = item.NameLocal;
|
|||
|
|
mark.iconKey = item.PreviewIconPath;
|
|||
|
|
mark.imgPathKey = item.BGIconPath;
|
|||
|
|
mark.sourcePathKey = item.AchieveRequirement;
|
|||
|
|
allMarks.Add(mark);
|
|||
|
|
}
|
|||
|
|
SetUnlockMarks();
|
|||
|
|
initialized = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ShowMarks<6B><73>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>ǰ<EFBFBD><C7B0>
|
|||
|
|
/// </summary>
|
|||
|
|
void SetUnlockMarks()
|
|||
|
|
{
|
|||
|
|
ShowMarks.Clear();
|
|||
|
|
unlockMarksCnt = 0;
|
|||
|
|
for (int i = 0; i < allMarks.Count; i++)
|
|||
|
|
{
|
|||
|
|
if (CategoryManager.Instance.GetItemCount(allMarks[i].ItemID) > 0)//<2F>ѽ<EFBFBD><D1BD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
ShowMarks.Insert(unlockMarksCnt++, allMarks[i]);//<2F>ѽ<EFBFBD><D1BD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>ǰ<EFBFBD><C7B0>
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ShowMarks.Add(allMarks[i]);//δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7>ں<EFBFBD><DABA><EFBFBD>
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Init()
|
|||
|
|
{
|
|||
|
|
EventManager.Instance.Register(EventManager.EventName.ItemChange, SetUnlockMarks);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Release()
|
|||
|
|
{
|
|||
|
|
EventManager.Instance.Unregister(EventManager.EventName.ItemChange, SetUnlockMarks);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>TeamMarkChoose<73><65><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public List<TeamMark> ShownList
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if (!initialized)
|
|||
|
|
{
|
|||
|
|
initList();
|
|||
|
|
}
|
|||
|
|
return ShowMarks;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int UnlockMarksCnt
|
|||
|
|
{
|
|||
|
|
get { return unlockMarksCnt; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int SelectedMarkIndex
|
|||
|
|
{
|
|||
|
|
get { return selectedMarkIndex; }
|
|||
|
|
set { selectedMarkIndex = value; }
|
|||
|
|
}
|
|||
|
|
}
|