2using System.Collections.Generic;
4using System.Text.RegularExpressions;
18 private List<UIItemPCCPart>
_items =
new List<UIItemPCCPart>();
20 private List<Outline>
_outlines =
new List<Outline>();
24 private static readonly Regex
_idRegex =
new Regex(
"(\\d+)|(\\D+)", RegexOptions.Compiled);
26 public void Activate(UIPCC uiPcc, UIItemPCC uiItemPcc)
35 SpriteProvider provider =
_uiPcc.actor.provider;
36 int frame = (provider.currentFrame + 2) % 4;
39 item.SetSpriteIndex(provider.currentDir, frame);
45 List<PCC.Part> list =
_uiItemPcc.parts.ToList();
47 foreach (PCC.Part part in list)
52 SetOutline(
item.outline);
56 item.button.onClick.AddListener(delegate
58 _uiItemPcc.slider.value = 0f;
59 SetOutline(
item.outline);
61 item.button.tooltip.lang =
"empty";
68 UnityEngine.Object.Destroy(
item.gameObject);
72 item.button.onClick.AddListener(delegate
74 _uiItemPcc.slider.value =
_uiItemPcc.parts.IndexOf(part);
75 SetOutline(
item.outline);
79 item.button.icon.color =
_uiPcc.pccm.ApplyColorMod(color);
83 void SetOutline(
Outline outline)
88 outline.enabled =
false;
90 outline.enabled =
true;
105 if (
_cached.TryGetValue(part, out var value))
109 string dir = part.dir;
112 title =
"unknownAuthor".lang()
131 int num = GetPartSortOrder(lhs);
132 int num2 = GetPartSortOrder(rhs);
144 bool flag =
int.TryParse(
id, out result);
146 bool flag2 =
int.TryParse(id2, out result2);
149 return result.CompareTo(result2);
159 MatchCollection matchCollection =
_idRegex.Matches(
id);
160 MatchCollection matchCollection2 =
_idRegex.Matches(id2);
161 int num3 = Math.Min(matchCollection.Count, matchCollection2.Count);
162 for (
int i = 0; i < num3; i++)
164 string value = matchCollection[i].Value;
165 string value2 = matchCollection2[i].Value;
167 bool num4 =
int.TryParse(value, out result3);
169 bool flag3 =
int.TryParse(value2, out result4);
170 int num5 = ((!(num4 && flag3)) ?
string.Compare(value, value2, StringComparison.OrdinalIgnoreCase) : result3.CompareTo(result4));
176 return matchCollection.Count - matchCollection2.Count;
177 static int GetPartSortOrder(PCC.Part part)
List< BaseModPackage > packages
static BaseModManager Instance
void Activate(UIPCC uiPcc, UIItemPCC uiItemPcc)
static readonly Dictionary< PCC.Part, BaseModPackage > _cached
List< Outline > _outlines
static string GetPartProviderString(PCC.Part part)
static BaseModPackage GetPartProvider(PCC.Part part)
static int PartSorter(PCC.Part lhs, PCC.Part rhs)
List< UIItemPCCPart > _items
static readonly Regex _idRegex