|
@@ -1,4 +1,4 @@
|
|
-using System;
|
|
|
|
|
|
+using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.Text.RegularExpressions;
|
|
using System.Text.RegularExpressions;
|
|
@@ -156,6 +156,7 @@ namespace COM3D2.PropMyItem.Plugin
|
|
// Token: 0x0600002C RID: 44 RVA: 0x00003808 File Offset: 0x00001A08
|
|
// Token: 0x0600002C RID: 44 RVA: 0x00003808 File Offset: 0x00001A08
|
|
public void Awake()
|
|
public void Awake()
|
|
{
|
|
{
|
|
|
|
+ GameMain.Instance.StartCoroutine(CheckMenuDatabase());
|
|
try
|
|
try
|
|
{
|
|
{
|
|
SceneManager.sceneLoaded += this.OnSceneLoaded;
|
|
SceneManager.sceneLoaded += this.OnSceneLoaded;
|
|
@@ -165,6 +166,14 @@ namespace COM3D2.PropMyItem.Plugin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private System.Collections.IEnumerator CheckMenuDatabase()
|
|
|
|
+ {
|
|
|
|
+ if (_menuFilesReady) yield break;
|
|
|
|
+ while (!GameMain.Instance.MenuDataBase.JobFinished()) yield return null;
|
|
|
|
+ _menuFilesReady = true;
|
|
|
|
+ Console.WriteLine("PropMyItem: Menu files are ready");
|
|
|
|
+ }
|
|
|
|
+
|
|
// Token: 0x0600002D RID: 45 RVA: 0x0000383C File Offset: 0x00001A3C
|
|
// Token: 0x0600002D RID: 45 RVA: 0x0000383C File Offset: 0x00001A3C
|
|
private void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
|
|
private void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
|
|
{
|
|
{
|
|
@@ -197,8 +206,15 @@ namespace COM3D2.PropMyItem.Plugin
|
|
KeyCode keyCode = KeyCode.I;
|
|
KeyCode keyCode = KeyCode.I;
|
|
if (EnumUtil.TryParse<KeyCode>(UserConfig.Instance.GuiVisibleKey, true, out keyCode) && UserConfig.Instance.IsControlKey == Event.current.control && UserConfig.Instance.IsAltKey == Event.current.alt && UserConfig.Instance.IsShiftKey == Event.current.shift && Event.current.keyCode == keyCode && Event.current.type == EventType.KeyUp)
|
|
if (EnumUtil.TryParse<KeyCode>(UserConfig.Instance.GuiVisibleKey, true, out keyCode) && UserConfig.Instance.IsControlKey == Event.current.control && UserConfig.Instance.IsAltKey == Event.current.alt && UserConfig.Instance.IsShiftKey == Event.current.shift && Event.current.keyCode == keyCode && Event.current.type == EventType.KeyUp)
|
|
{
|
|
{
|
|
- this._isVisible = !this._isVisible;
|
|
|
|
- this._isMinimum = !this._isVisible;
|
|
|
|
|
|
+ if (_menuFilesReady)
|
|
|
|
+ {
|
|
|
|
+ this._isVisible = !this._isVisible;
|
|
|
|
+ this._isMinimum = !this._isVisible;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Console.WriteLine("PropMyItem: Menu files are not ready yet");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -1761,8 +1777,6 @@ namespace COM3D2.PropMyItem.Plugin
|
|
// Token: 0x06000044 RID: 68 RVA: 0x000071A0 File Offset: 0x000053A0
|
|
// Token: 0x06000044 RID: 68 RVA: 0x000071A0 File Offset: 0x000053A0
|
|
private void GetMainMenuFiles(ref List<MenuInfo> variationMenuList, Dictionary<string, MenuInfo> loadItems, Dictionary<string, string> favDic, Dictionary<string, string> colorLockDic, ref List<SMenuInfo> saveItems)
|
|
private void GetMainMenuFiles(ref List<MenuInfo> variationMenuList, Dictionary<string, MenuInfo> loadItems, Dictionary<string, string> favDic, Dictionary<string, string> colorLockDic, ref List<SMenuInfo> saveItems)
|
|
{
|
|
{
|
|
- ReadOnlyDictionary<string, bool> havePartsItems = GameMain.Instance.CharacterMgr.status.havePartsItems;
|
|
|
|
- string[] menuFiles = GameUty.MenuFiles;
|
|
|
|
this._menuList.Clear();
|
|
this._menuList.Clear();
|
|
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.menu", SearchOption.AllDirectories);
|
|
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.menu", SearchOption.AllDirectories);
|
|
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
|
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
|
@@ -1775,82 +1789,100 @@ namespace COM3D2.PropMyItem.Plugin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<string> list = new List<string>();
|
|
List<string> list = new List<string>();
|
|
- foreach (string text2 in menuFiles)
|
|
|
|
|
|
+
|
|
|
|
+ MenuDataBase database = GameMain.Instance.MenuDataBase;
|
|
|
|
+
|
|
|
|
+ // foreach (string text2 in menuFiles)
|
|
|
|
+ for (int i = 0; i < database.GetDataSize(); i++)
|
|
{
|
|
{
|
|
- try
|
|
|
|
|
|
+ database.SetIndex(i);
|
|
|
|
+ string menuFile = database.GetMenuFileName();
|
|
|
|
+ ParseMainMenuFile(menuFile, list, ref variationMenuList, loadItems, dictionary, favDic, colorLockDic, ref saveItems);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (string menuFile in GameUty.ModOnlysMenuFiles)
|
|
|
|
+ {
|
|
|
|
+ ParseMainMenuFile(menuFile, list, ref variationMenuList, loadItems, dictionary, favDic, colorLockDic, ref saveItems);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // lmao
|
|
|
|
+ private void ParseMainMenuFile(string menuFile, List<string> list, ref List<MenuInfo> variationMenuList, Dictionary<string, MenuInfo> loadItems, Dictionary<string, string> dictionary, Dictionary<string, string> favDic, Dictionary<string, string> colorLockDic, ref List<SMenuInfo> saveItems)
|
|
|
|
+ {
|
|
|
|
+ ReadOnlyDictionary<string, bool> havePartsItems = GameMain.Instance.CharacterMgr.status.havePartsItems;
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ if (menuFile.IndexOf("_i_man_") != 0 && menuFile.IndexOf("mbody") != 0 && menuFile.IndexOf("mhead") != 0 && !(Path.GetExtension(menuFile) != ".menu"))
|
|
{
|
|
{
|
|
- if (text2.IndexOf("_i_man_") != 0 && text2.IndexOf("mbody") != 0 && text2.IndexOf("mhead") != 0 && !(Path.GetExtension(text2) != ".menu"))
|
|
|
|
|
|
+ string fileName = Path.GetFileName(menuFile);
|
|
|
|
+ this._menuList.Add(fileName.ToLower());
|
|
|
|
+ if (fileName.Contains("cv_pattern"))
|
|
|
|
+ {
|
|
|
|
+ this._myPatternList.Add(fileName.ToLower());
|
|
|
|
+ }
|
|
|
|
+ if (!list.Contains(fileName))
|
|
{
|
|
{
|
|
- string fileName = Path.GetFileName(text2);
|
|
|
|
- this._menuList.Add(fileName.ToLower());
|
|
|
|
- if (fileName.Contains("cv_pattern"))
|
|
|
|
|
|
+ MenuInfo menuInfo = null;
|
|
|
|
+ if (!loadItems.TryGetValue(fileName, out menuInfo))
|
|
{
|
|
{
|
|
- this._myPatternList.Add(fileName.ToLower());
|
|
|
|
|
|
+ menuInfo = MenuModParser.ParseMenu(menuFile);
|
|
}
|
|
}
|
|
- if (!list.Contains(fileName))
|
|
|
|
|
|
+ if (menuInfo != null && menuInfo.MPN != MPN.null_mpn)
|
|
{
|
|
{
|
|
- MenuInfo menuInfo = null;
|
|
|
|
- if (!loadItems.TryGetValue(fileName, out menuInfo))
|
|
|
|
|
|
+ menuInfo.FileName = fileName;
|
|
|
|
+ if (havePartsItems.ContainsKey(fileName))
|
|
{
|
|
{
|
|
- menuInfo = MenuModParser.ParseMenu(text2);
|
|
|
|
|
|
+ menuInfo.IsShopTarget = true;
|
|
}
|
|
}
|
|
- if (menuInfo != null && menuInfo.MPN != MPN.null_mpn)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- menuInfo.FileName = fileName;
|
|
|
|
- if (havePartsItems.ContainsKey(fileName))
|
|
|
|
- {
|
|
|
|
- menuInfo.IsShopTarget = true;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- menuInfo.IsShopTarget = false;
|
|
|
|
- }
|
|
|
|
- string filePath = text2;
|
|
|
|
- if (dictionary.TryGetValue(fileName, out filePath))
|
|
|
|
|
|
+ menuInfo.IsShopTarget = false;
|
|
|
|
+ }
|
|
|
|
+ string filePath = menuFile;
|
|
|
|
+ if (dictionary.TryGetValue(fileName, out filePath))
|
|
|
|
+ {
|
|
|
|
+ menuInfo.IsMod = true;
|
|
|
|
+ menuInfo.FilePath = filePath;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ menuInfo.IsMod = false;
|
|
|
|
+ menuInfo.FilePath = fileName;
|
|
|
|
+ }
|
|
|
|
+ string empty = string.Empty;
|
|
|
|
+ if (this._menuMPNCategoryDic.TryGetValue(menuInfo.MPN, out empty))
|
|
|
|
+ {
|
|
|
|
+ menuInfo.CategoryName = empty;
|
|
|
|
+ }
|
|
|
|
+ list.Add(fileName);
|
|
|
|
+ if (!string.IsNullOrEmpty(menuInfo.IconName))
|
|
|
|
+ {
|
|
|
|
+ if (Regex.IsMatch(menuFile, "_z\\d{1,4}") || menuFile.Contains("_zurashi") || menuFile.Contains("_mekure") || menuFile.Contains("_porori") || menuFile.Contains("_back"))
|
|
{
|
|
{
|
|
- menuInfo.IsMod = true;
|
|
|
|
- menuInfo.FilePath = filePath;
|
|
|
|
|
|
+ variationMenuList.Add(menuInfo);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- menuInfo.IsMod = false;
|
|
|
|
- menuInfo.FilePath = fileName;
|
|
|
|
- }
|
|
|
|
- string empty = string.Empty;
|
|
|
|
- if (this._menuMPNCategoryDic.TryGetValue(menuInfo.MPN, out empty))
|
|
|
|
- {
|
|
|
|
- menuInfo.CategoryName = empty;
|
|
|
|
- }
|
|
|
|
- list.Add(fileName);
|
|
|
|
- if (!string.IsNullOrEmpty(menuInfo.IconName))
|
|
|
|
- {
|
|
|
|
- if (Regex.IsMatch(text2, "_z\\d{1,4}") || text2.Contains("_zurashi") || text2.Contains("_mekure") || text2.Contains("_porori") || text2.Contains("_back"))
|
|
|
|
|
|
+ if (favDic.ContainsKey(menuInfo.FileName))
|
|
{
|
|
{
|
|
- variationMenuList.Add(menuInfo);
|
|
|
|
|
|
+ menuInfo.IsFavorite = true;
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ if (colorLockDic.ContainsKey(menuInfo.FileName))
|
|
{
|
|
{
|
|
- if (favDic.ContainsKey(menuInfo.FileName))
|
|
|
|
- {
|
|
|
|
- menuInfo.IsFavorite = true;
|
|
|
|
- }
|
|
|
|
- if (colorLockDic.ContainsKey(menuInfo.FileName))
|
|
|
|
- {
|
|
|
|
- menuInfo.IsColorLock = true;
|
|
|
|
- }
|
|
|
|
- menuInfo.ColorNumber = 0;
|
|
|
|
- menuInfo.VariationMenuList.Add(menuInfo);
|
|
|
|
- this._mpnMenuListDictionary[menuInfo.MPN].Add(menuInfo);
|
|
|
|
|
|
+ menuInfo.IsColorLock = true;
|
|
}
|
|
}
|
|
|
|
+ menuInfo.ColorNumber = 0;
|
|
|
|
+ menuInfo.VariationMenuList.Add(menuInfo);
|
|
|
|
+ this._mpnMenuListDictionary[menuInfo.MPN].Add(menuInfo);
|
|
}
|
|
}
|
|
- saveItems.Add(new SMenuInfo(menuInfo));
|
|
|
|
}
|
|
}
|
|
|
|
+ saveItems.Add(new SMenuInfo(menuInfo));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch (Exception)
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ catch (Exception)
|
|
|
|
+ {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2012,6 +2044,8 @@ namespace COM3D2.PropMyItem.Plugin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private bool _menuFilesReady = false;
|
|
|
|
+
|
|
// Token: 0x04000028 RID: 40
|
|
// Token: 0x04000028 RID: 40
|
|
private int _sceneLevel;
|
|
private int _sceneLevel;
|
|
|
|
|