corrected a mistake

This commit is contained in:
playinful 2024-03-28 13:35:42 -04:00
parent 689c997f6a
commit a0d02116c5
2 changed files with 6 additions and 66 deletions

View file

@ -11,7 +11,6 @@ using DG.Tweening;
using HeavenStudio.Util;
using HeavenStudio.Editor.Track;
using System.Text;
using System.Configuration;
namespace HeavenStudio.Editor
{
@ -278,26 +277,16 @@ namespace HeavenStudio.Editor
void SortAlphabet(List<RectTransform> mgs)
{
var alph = mgs.OrderBy(AlphabetSortKey).ToList();
for (int i = 0; i < alph.Count; i++) {
alph[i].SetSiblingIndex(i + fxActive.Count + 1);
for (int i = 0; i < mgsActive.Count; i++) {
mgs[i].SetSiblingIndex(i + fxActive.Count + 1);
}
}
string AlphabetSortKey(RectTransform minigame)
{
var mg = EventCaller.instance.GetMinigame(minigame.name);
if (mg.displayName.StartsWith("the ", System.StringComparison.InvariantCultureIgnoreCase))
return mg.displayName[4..];
else
return mg.displayName;
}
// if there are no favorites, the games will sort alphabetically
void SortFavorites(List<RectTransform> allMgs)
{
var favs = allMgs.FindAll(mg => mg.GetComponent<GridGameSelectorGame>().StarActive).OrderBy(AlphabetSortKey).ToList();
var mgs = allMgs.FindAll(mg => !mg.GetComponent<GridGameSelectorGame>().StarActive).OrderBy(AlphabetSortKey).ToList();
var favs = allMgs.FindAll(mg => mg.GetComponent<GridGameSelectorGame>().StarActive);
var mgs = allMgs.FindAll(mg => !mg.GetComponent<GridGameSelectorGame>().StarActive);
if (Input.GetKey(KeyCode.LeftShift)) {
foreach (var fav in favs)
@ -315,13 +304,7 @@ namespace HeavenStudio.Editor
void SortChronologic(List<RectTransform> mgs)
{
var chrono = mgs.OrderBy(MainSeriesSortKey).ThenBy(ChronologicSortKey).ThenBy(AlphabetSortKey).ToList();
for (int i = 0; i < chrono.Count; i++) {
chrono[i].SetSiblingIndex(i + fxActive.Count + 1);
}
/*var systems = new List<RectTransform>[] {
var systems = new List<RectTransform>[] {
new List<RectTransform>(),
new List<RectTransform>(),
new List<RectTransform>(),
@ -357,46 +340,7 @@ namespace HeavenStudio.Editor
system[i].SetSiblingIndex(j);
j++;
}
}*/
}
int MainSeriesSortKey(RectTransform minigame)
{
var mg = EventCaller.instance.GetMinigame(minigame.name);
if (mg.tags.Count > 0)
{
return mg.tags[0] switch
{
"agb" or "ntr" or "rvl" or "ctr" => 0,
_ => 1,
};
}
return 1;
}
uint ChronologicSortKey(RectTransform minigame)
{
var mg = EventCaller.instance.GetMinigame(minigame.name);
if (mg.chronologicalSortKey is uint i)
return i;
if (mg.tags.Count > 0)
{
switch (mg.tags[0])
{
case "agb":
return 0608039999;
case "ntr":
return 0807319999;
case "rvl":
return 1107219999;
case "ctr":
return 1506119999;
default:
return 2401159999;
}
}
return uint.MaxValue;
}
public void Search()

View file

@ -368,8 +368,6 @@ namespace HeavenStudio
public bool fxOnly;
public List<GameAction> actions = new List<GameAction>();
public uint? chronologicalSortKey;
public List<string> tags;
public string defaultLocale = "en";
public string wantAssetBundle = null;
@ -403,7 +401,7 @@ namespace HeavenStudio
set => soundSequences = value;
}
public Minigame(string name, string displayName, string color, bool hidden, bool fxOnly, List<GameAction> actions, List<string> tags = null, string wantAssetBundle = null, string defaultLocale = "en", List<string> supportedLocales = null, bool inferred = false, uint? chronologicalSortKey = null)
public Minigame(string name, string displayName, string color, bool hidden, bool fxOnly, List<GameAction> actions, List<string> tags = null, string wantAssetBundle = null, string defaultLocale = "en", List<string> supportedLocales = null, bool inferred = false)
{
this.name = name;
this.displayName = displayName;
@ -420,8 +418,6 @@ namespace HeavenStudio
this.splitColorL = null;
this.splitColorR = null;
this.chronologicalSortKey = chronologicalSortKey;
}
public Minigame(string name, string displayName, string color, string splitColorL, string splitColorR, bool hidden, bool fxOnly, List<GameAction> actions, List<string> tags = null, string wantAssetBundle = null, string defaultLocale = "en", List<string> supportedLocales = null, bool inferred = false)