|
@@ -660,9 +660,24 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
GUI.enabled = false;
|
|
|
}
|
|
|
|
|
|
+ bool previousGUIState = GUI.enabled;
|
|
|
+ GUI.enabled = !modItemsOnly;
|
|
|
+
|
|
|
+ modItemsToggle = GUI.Toggle(new Rect(GetPix(156),
|
|
|
+ GetPix(115),
|
|
|
+ GetPix(50),
|
|
|
+ GetPix(20)),
|
|
|
+ modItemsToggle,
|
|
|
+ "Mods",
|
|
|
+ style3
|
|
|
+ );
|
|
|
+
|
|
|
+ GUI.enabled = previousGUIState;
|
|
|
+
|
|
|
int iconSize = GetPix(45);
|
|
|
Rect position1;
|
|
|
Rect viewRect;
|
|
|
+ int bg2ItemCount = (!modItemsOnly && modItemsToggle) ? numberOfModItems : sortList.Count;
|
|
|
if (sceneLevel != 5)
|
|
|
{
|
|
|
position1 = new Rect(GetPix(7),
|
|
@@ -672,7 +687,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
viewRect = new Rect(0.0f,
|
|
|
0.0f,
|
|
|
position1.width * 0.845f,
|
|
|
- Mathf.Ceil(sortList.Count / 4f) * iconSize + GetPix(10));
|
|
|
+ Mathf.Ceil(bg2ItemCount / 4f) * iconSize + GetPix(10));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -683,16 +698,20 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
viewRect = new Rect(0.0f,
|
|
|
0.0f,
|
|
|
position1.width * 0.845f,
|
|
|
- Mathf.Ceil(sortList.Count / 4f) * iconSize + GetPix(10));
|
|
|
+ Mathf.Ceil(bg2ItemCount / 4f) * iconSize + GetPix(10));
|
|
|
}
|
|
|
|
|
|
bg2ScrollPos = GUI.BeginScrollView(position1, bg2ScrollPos, viewRect);
|
|
|
- for (int index = 0; index < sortList.Count; ++index)
|
|
|
+ int bg2Index = 0;
|
|
|
+ foreach (SortItem sortItem in sortList)
|
|
|
{
|
|
|
- SortItem sortItem = sortList[index];
|
|
|
+ if (modItemsToggle && !sortItem.isMod)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Rect position2 = new Rect(
|
|
|
- index % 4 * iconSize,
|
|
|
- index / 4 * iconSize,
|
|
|
+ bg2Index % 4 * iconSize,
|
|
|
+ bg2Index / 4 * iconSize,
|
|
|
iconSize,
|
|
|
iconSize
|
|
|
);
|
|
@@ -761,6 +780,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
}
|
|
|
|
|
|
GUI.DrawTexture(position2, sortItem.tex);
|
|
|
+ bg2Index++;
|
|
|
}
|
|
|
|
|
|
GUI.EndScrollView();
|
|
@@ -1093,6 +1113,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ numberOfModItems = 0;
|
|
|
slotIndex = num1;
|
|
|
sortList.Clear();
|
|
|
bg2ScrollPos = new Vector2(0.0f, 0.0f);
|
|
@@ -1100,7 +1121,15 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
if (itemDataList.Count == 0)
|
|
|
{
|
|
|
#region menu files
|
|
|
- foreach (string menuFile in GameUty.MenuFiles)
|
|
|
+ HashSet<string> modMenus = null;
|
|
|
+ if (!modItemsOnly)
|
|
|
+ {
|
|
|
+ modMenus = new HashSet<string>(GameUty.ModOnlysMenuFiles
|
|
|
+ .Select(file => Path.GetFileName(file).ToLowerInvariant()));
|
|
|
+ }
|
|
|
+
|
|
|
+ string[] menuFiles = modItemsOnly ? GameUty.ModOnlysMenuFiles : GameUty.MenuFiles;
|
|
|
+ foreach (string menuFile in menuFiles)
|
|
|
{
|
|
|
string fileName = Path.GetFileName(menuFile);
|
|
|
byte[] buf;
|
|
@@ -1113,7 +1142,11 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
buf = aFileBase.ReadAll();
|
|
|
}
|
|
|
|
|
|
- ItemData item = new ItemData() { menu = fileName };
|
|
|
+ ItemData item = new ItemData()
|
|
|
+ {
|
|
|
+ menu = fileName,
|
|
|
+ isMod = modItemsOnly ? true : modMenus.Contains(fileName)
|
|
|
+ };
|
|
|
BinaryReader binaryReader = new BinaryReader(new MemoryStream(buf), Encoding.UTF8);
|
|
|
if (binaryReader.ReadString() != "CM3D2_MENU")
|
|
|
{
|
|
@@ -1190,6 +1223,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
|
|
|
ItemData item = new ItemData()
|
|
|
{
|
|
|
+ isMod = true,
|
|
|
isOfficialMod = true,
|
|
|
menu = modFile,
|
|
|
priority = 1000
|
|
@@ -1267,6 +1301,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
icon = itemData.icon,
|
|
|
menu = itemData.menu,
|
|
|
tex = itemData.tex,
|
|
|
+ isMod = itemData.isMod,
|
|
|
isOfficialMod = itemData.isOfficialMod,
|
|
|
baseItem = itemData.baseItem
|
|
|
});
|
|
@@ -1286,6 +1321,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
{
|
|
|
if (item.menu != previousMenu)
|
|
|
{
|
|
|
+ if (!modItemsOnly && item.isMod) numberOfModItems++;
|
|
|
if (item.tex == null)
|
|
|
{
|
|
|
byte[] data = ImportCM.LoadTexture(GameUty.FileSystem, item.icon, false).data;
|