|
@@ -68,8 +68,8 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
rectWin.x = Screen.width - rectWin.width;
|
|
|
rectWin.y = GetPix(65);
|
|
|
|
|
|
- saveManagerRect.width = Screen.width * 0.9f;
|
|
|
- saveManagerRect.height = Screen.height * 0.75f;
|
|
|
+ saveManagerRect.width = Screen.width * 0.45f;
|
|
|
+ saveManagerRect.height = Screen.height * 0.55f;
|
|
|
|
|
|
saveManagerRect.x = (float)(Screen.width * 0.5f - saveManagerRect.width * 0.5f);
|
|
|
saveManagerRect.y = (float)(Screen.height * 0.5f - saveManagerRect.height * 0.5f);
|
|
@@ -132,7 +132,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
}
|
|
|
else if (sceneFlg)
|
|
|
{
|
|
|
- if (manageSaveFlag)
|
|
|
+ if (manageSaveFlag || deleteDirectoryFlag)
|
|
|
{
|
|
|
saveModalRect = GUI.ModalWindow(9999, saveModalRect, SaveManagerModal, "", style);
|
|
|
}
|
|
@@ -266,179 +266,6 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void SaveSceneWindow(int winID)
|
|
|
- {
|
|
|
- GUIStyle style1 = new GUIStyle("label");
|
|
|
- style1.fontSize = GetPix(12);
|
|
|
- style1.alignment = TextAnchor.UpperLeft;
|
|
|
- GUIStyle style2 = new GUIStyle("button");
|
|
|
- style2.fontSize = GetPix(12);
|
|
|
- style2.alignment = TextAnchor.MiddleCenter;
|
|
|
- GUI.Label(new Rect(GetPix(50), GetPix(6), GetPix(100), GetPix(25)),
|
|
|
- "シーン管理",
|
|
|
- style1);
|
|
|
- if (GUI.Button(new Rect(GetPix(135), GetPix(3), GetPix(23), GetPix(23)),
|
|
|
- "→",
|
|
|
- style2))
|
|
|
- {
|
|
|
- faceFlg = false;
|
|
|
- poseFlg = false;
|
|
|
- sceneFlg = false;
|
|
|
- kankyoFlg = true;
|
|
|
- kankyo2Flg = false;
|
|
|
- bGui = true;
|
|
|
- copyIndex = 0;
|
|
|
- }
|
|
|
-
|
|
|
- int num1 = 50;
|
|
|
- if (GUI.Button(new Rect(GetPix(25), GetPix(31), GetPix(23), GetPix(23)),
|
|
|
- "<",
|
|
|
- style2))
|
|
|
- {
|
|
|
- --page;
|
|
|
- if (page < 0)
|
|
|
- {
|
|
|
- page = maxPage - 1;
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < 10; ++index)
|
|
|
- {
|
|
|
- date[index] = "未保存";
|
|
|
- ninzu[index] = "";
|
|
|
- IniKey iniKey = Preferences["scene"]["s" + (page * 10 + index + 1)];
|
|
|
- if (iniKey.Value != null && iniKey.Value.ToString() != "")
|
|
|
- {
|
|
|
- string[] strArray1 = iniKey.Value.Split('_');
|
|
|
- if (strArray1.Length >= 2)
|
|
|
- {
|
|
|
- string[] strArray2 = strArray1[0].Split(',');
|
|
|
- date[index] = strArray2[0];
|
|
|
- ninzu[index] = strArray2[1] + "人";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (GUI.Button(new Rect(GetPix(115), GetPix(31), GetPix(23), GetPix(23)),
|
|
|
- ">",
|
|
|
- style2))
|
|
|
- {
|
|
|
- ++page;
|
|
|
- if (page >= maxPage)
|
|
|
- {
|
|
|
- page = 0;
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < 10; ++index)
|
|
|
- {
|
|
|
- date[index] = "未保存";
|
|
|
- ninzu[index] = "";
|
|
|
- IniKey iniKey = Preferences["scene"]["s" + (page * 10 + index + 1)];
|
|
|
- if (iniKey.Value != null && iniKey.Value.ToString() != "")
|
|
|
- {
|
|
|
- string[] strArray1 = iniKey.Value.Split('_');
|
|
|
- if (strArray1.Length >= 2)
|
|
|
- {
|
|
|
- string[] strArray2 = strArray1[0].Split(',');
|
|
|
- date[index] = strArray2[0];
|
|
|
- ninzu[index] = strArray2[1] + "人";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- GUI.Label(new Rect(GetPix(60), GetPix(32), GetPix(100), GetPix(25)),
|
|
|
- (page * 10 + 1).ToString() + " ~ " + (page * 10 + 10),
|
|
|
- style1);
|
|
|
- if (saveScene2 > 0 && string.IsNullOrEmpty(thum_byte_to_base64_) && File.Exists(thum_file_path_))
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- Texture2D tex = new Texture2D(1, 1, TextureFormat.ARGB32, false);
|
|
|
- tex.LoadImage(File.ReadAllBytes(thum_file_path_));
|
|
|
- float num2 = tex.width / (float)tex.height;
|
|
|
- Vector2 vector2 = new Vector2(480f, 270f);
|
|
|
- int newWidth = tex.width;
|
|
|
- int newHeight = tex.height;
|
|
|
- if (vector2.x < (double)tex.width && vector2.y < (double)tex.height)
|
|
|
- {
|
|
|
- newWidth = (int)vector2.x;
|
|
|
- newHeight = Mathf.RoundToInt(newWidth / num2);
|
|
|
- if (vector2.y < (double)newHeight)
|
|
|
- {
|
|
|
- newHeight = (int)vector2.y;
|
|
|
- newWidth = Mathf.RoundToInt(newHeight * num2);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (vector2.x < (double)tex.width)
|
|
|
- {
|
|
|
- newWidth = (int)vector2.x;
|
|
|
- newHeight = Mathf.RoundToInt(newWidth / num2);
|
|
|
- }
|
|
|
- else if (vector2.y < (double)tex.height)
|
|
|
- {
|
|
|
- newHeight = (int)vector2.y;
|
|
|
- newWidth = Mathf.RoundToInt(newHeight * num2);
|
|
|
- }
|
|
|
-
|
|
|
- TextureScale.Bilinear(tex, newWidth, newHeight);
|
|
|
- thum_byte_to_base64_ = Convert.ToBase64String(tex.EncodeToPNG());
|
|
|
- DestroyImmediate(tex);
|
|
|
- Preferences["scene"]["ss" + saveScene2].Value = thum_byte_to_base64_;
|
|
|
- SaveConfig();
|
|
|
- thum_file_path_ = "";
|
|
|
- saveScene2 = 0;
|
|
|
- }
|
|
|
- catch { }
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < 10; ++index)
|
|
|
- {
|
|
|
- GUI.Label(new Rect(GetPix(5),
|
|
|
- GetPix(60 + num1 * index),
|
|
|
- GetPix(25),
|
|
|
- GetPix(25)),
|
|
|
- string.Concat(page * 10 + index + 1),
|
|
|
- style1);
|
|
|
- if (GUI.Button(new Rect(GetPix(20),
|
|
|
- GetPix(78 + num1 * index),
|
|
|
- GetPix(50),
|
|
|
- GetPix(20)),
|
|
|
- "保存",
|
|
|
- style2))
|
|
|
- {
|
|
|
- saveScene = page * 10 + index + 1;
|
|
|
- saveScene2 = saveScene;
|
|
|
-
|
|
|
- TakeScreenshot();
|
|
|
- }
|
|
|
-
|
|
|
- GUI.Label(new Rect(GetPix(25),
|
|
|
- GetPix(60 + num1 * index),
|
|
|
- GetPix(100),
|
|
|
- GetPix(25)),
|
|
|
- date[index],
|
|
|
- style1);
|
|
|
- GUI.Label(new Rect(GetPix(130),
|
|
|
- GetPix(60 + num1 * index),
|
|
|
- GetPix(100),
|
|
|
- GetPix(25)),
|
|
|
- ninzu[index],
|
|
|
- style1);
|
|
|
- if (date[index] != "未保存" && GUI.Button(new Rect(GetPix(100),
|
|
|
- GetPix(78 + num1 * index),
|
|
|
- GetPix(50),
|
|
|
- GetPix(20)),
|
|
|
- "読込",
|
|
|
- style2))
|
|
|
- {
|
|
|
- loadScene = page * 10 + index + 1;
|
|
|
- GameMain.Instance.SoundMgr.PlaySe("se002.ogg", false);
|
|
|
- }
|
|
|
- }
|
|
|
- GUI.DragWindow();
|
|
|
- }
|
|
|
-
|
|
|
private void BGSelectWindow2(int winID)
|
|
|
{
|
|
|
GUIStyle guiStyle1 = "label";
|
|
@@ -9149,7 +8976,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
GetPix(20)
|
|
|
), "□", resizeHandleStyle);
|
|
|
|
|
|
- if (createSaveFlag || loadSaveFlag || manageSaveFlag)
|
|
|
+ if (createSaveFlag || loadSaveFlag || manageSaveFlag || deleteDirectoryFlag || deleteFileFlag)
|
|
|
{
|
|
|
GUI.enabled = false;
|
|
|
}
|
|
@@ -9226,12 +9053,27 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
if (GUI.Button(new Rect(
|
|
|
windowPadding,
|
|
|
saveGridHeight + windowPadding,
|
|
|
- saveGridOffset,
|
|
|
+ GetPix(110),
|
|
|
buttonSize
|
|
|
), "New Folder", saveControlStyle))
|
|
|
{
|
|
|
createDirectory = true;
|
|
|
}
|
|
|
+
|
|
|
+ bool enabled = GUI.enabled;
|
|
|
+
|
|
|
+ GUI.enabled = selectedDirectory != 0;
|
|
|
+
|
|
|
+ if (GUI.Button(new Rect(
|
|
|
+ saveGridOffset - GetPix(80) + windowPadding,
|
|
|
+ saveGridHeight + windowPadding,
|
|
|
+ GetPix(80),
|
|
|
+ buttonSize
|
|
|
+ ), "Delete", saveControlStyle))
|
|
|
+ {
|
|
|
+ deleteDirectoryFlag = true;
|
|
|
+ }
|
|
|
+ GUI.enabled = enabled;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -9244,7 +9086,7 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
buttonSize
|
|
|
);
|
|
|
|
|
|
- bool cancel = GUI.Button(cancelRect, "X", saveControlStyle); // || Event.current.Equals(Event.KeyboardEvent("escape"));
|
|
|
+ bool cancel = GUI.Button(cancelRect, "X", saveControlStyle);
|
|
|
|
|
|
if (cancel)
|
|
|
{
|
|
@@ -9377,7 +9219,8 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
saveControlStyle.fontSize = GetPix(12);
|
|
|
saveControlStyle.alignment = TextAnchor.MiddleCenter;
|
|
|
|
|
|
- Texture2D previewImage = saveScenes[selectedSave].screenshot;
|
|
|
+ int index = deleteDirectoryFlag ? saveScenes.Count - 1 : selectedSave;
|
|
|
+ Texture2D previewImage = saveScenes.ElementAtOrDefault(index)?.screenshot;
|
|
|
|
|
|
int windowPadding = GetPix(10);
|
|
|
int windowPaddingY = GetPix(20);
|
|
@@ -9385,10 +9228,12 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
float previewWindowWidth = saveModalRect.width - windowPaddingY;
|
|
|
float previewWindowHeight = Mathf.Min(270 - windowPadding, saveModalRect.height - GetPix(70));
|
|
|
|
|
|
- float scale = Mathf.Min(previewWindowWidth / previewImage.width, previewWindowHeight / previewImage.height);
|
|
|
- float previewWidth = (previewImage.width * scale) - windowPaddingY;
|
|
|
- float previewHeight = (previewImage.height * scale) - windowPaddingY;
|
|
|
+ int texWidth = previewImage?.width ?? 480;
|
|
|
+ int texHeight = previewImage?.height ?? 270;
|
|
|
|
|
|
+ float scale = Mathf.Min(previewWindowWidth / texWidth, previewWindowHeight / texHeight);
|
|
|
+ float previewWidth = (texWidth * scale) - windowPaddingY;
|
|
|
+ float previewHeight = (texHeight * scale) - windowPaddingY;
|
|
|
|
|
|
float previewX = (saveModalRect.width / 2 - previewWidth / 2);
|
|
|
float previewY = windowPaddingY;
|
|
@@ -9401,14 +9246,21 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
, frame
|
|
|
);
|
|
|
|
|
|
- GUI.DrawTexture(new Rect(
|
|
|
- previewX,
|
|
|
- previewY,
|
|
|
- previewWidth,
|
|
|
- previewHeight
|
|
|
- ), previewImage);
|
|
|
+ if (previewImage != null)
|
|
|
+ {
|
|
|
+ GUI.DrawTexture(new Rect(
|
|
|
+ previewX,
|
|
|
+ previewY,
|
|
|
+ previewWidth,
|
|
|
+ previewHeight
|
|
|
+ ), previewImage);
|
|
|
+ }
|
|
|
|
|
|
- string title = saveScenes[selectedSave].info.Name;
|
|
|
+ string title = deleteDirectoryFlag
|
|
|
+ ? $"Are you sure you want to delete \"{directoryList[selectedDirectory]}\"?"
|
|
|
+ : deleteFileFlag
|
|
|
+ ? $"Are you sure you want to delete \"{saveScenes[index].info.Name}\"?"
|
|
|
+ : saveScenes[selectedSave].info.Name;
|
|
|
|
|
|
float labelY = previewY + previewHeight + windowPadding;
|
|
|
int labelHeight = GetPix(20);
|
|
@@ -9424,31 +9276,56 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
int buttonWidth = GetPix(80);
|
|
|
float buttonY = saveModalRect.height - windowPadding - buttonHeight;
|
|
|
|
|
|
-
|
|
|
if (GUI.Button(new Rect(
|
|
|
windowPadding,
|
|
|
buttonY,
|
|
|
buttonWidth,
|
|
|
buttonHeight
|
|
|
- ), "Overwrite", saveControlStyle))
|
|
|
+ ), deleteDirectoryFlag || deleteFileFlag ? "Yes" : "Overwrite", saveControlStyle))
|
|
|
{
|
|
|
- manageSaveFlag = false;
|
|
|
- createSaveFlag = true;
|
|
|
- overwriteFlag = true;
|
|
|
+ if (deleteDirectoryFlag)
|
|
|
+ {
|
|
|
+ DeleteDirectory();
|
|
|
+ }
|
|
|
+ else if (deleteFileFlag)
|
|
|
+ {
|
|
|
+ DeleteFile();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ overwriteFlag = true;
|
|
|
+ createSaveFlag = true;
|
|
|
|
|
|
- TakeScreenshot();
|
|
|
+ TakeScreenshot();
|
|
|
+ }
|
|
|
+ deleteFileFlag = false;
|
|
|
+ deleteDirectoryFlag = false;
|
|
|
+ manageSaveFlag = false;
|
|
|
}
|
|
|
|
|
|
- if (GUI.Button(new Rect(
|
|
|
- windowPaddingY + buttonWidth,
|
|
|
- buttonY,
|
|
|
- buttonWidth,
|
|
|
- buttonHeight
|
|
|
- ), "Load", saveControlStyle))
|
|
|
+ if (!(deleteDirectoryFlag || deleteFileFlag))
|
|
|
{
|
|
|
- manageSaveFlag = false;
|
|
|
- loadSaveFlag = true;
|
|
|
- loadScene = 1;
|
|
|
+ if (GUI.Button(new Rect(
|
|
|
+ windowPaddingY + buttonWidth,
|
|
|
+ buttonY,
|
|
|
+ buttonWidth,
|
|
|
+ buttonHeight
|
|
|
+ ), "Load", saveControlStyle))
|
|
|
+ {
|
|
|
+ manageSaveFlag = false;
|
|
|
+ loadSaveFlag = true;
|
|
|
+ loadScene = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (GUI.Button(new Rect(
|
|
|
+ windowPaddingY + 2 * buttonWidth + windowPadding,
|
|
|
+ buttonY,
|
|
|
+ buttonWidth,
|
|
|
+ buttonHeight
|
|
|
+ ), "Delete", saveControlStyle))
|
|
|
+ {
|
|
|
+ deleteFileFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (GUI.Button(new Rect(
|
|
@@ -9456,9 +9333,11 @@ namespace CM3D2.MultipleMaids.Plugin
|
|
|
buttonY,
|
|
|
buttonWidth,
|
|
|
buttonHeight
|
|
|
- ), "Cancel", saveControlStyle))
|
|
|
+ ), deleteFileFlag || deleteDirectoryFlag ? "No" : "Cancel", saveControlStyle))
|
|
|
{
|
|
|
manageSaveFlag = false;
|
|
|
+ deleteFileFlag = false;
|
|
|
+ deleteDirectoryFlag = false;
|
|
|
}
|
|
|
|
|
|
GUI.DragWindow();
|