Skip to content

Commit

Permalink
[KKS] Fixed window not hiding on load screens, config and dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Oct 23, 2021
1 parent c6625df commit d06b1cd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/KKS_BrowserFolders_Hooks/ClassroomFolders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void Init(PreviewCharaList list, int sex)

public void OnGui()
{
if (_customCharaFile != null && _customCharaFile.isVisible && _targetScene == Scene.AddSceneName)
if (_customCharaFile != null && _customCharaFile.isVisible && _targetScene == Scene.AddSceneName && !Scene.IsOverlap && !Scene.IsNowLoadingFade)
{
var screenRect = GetFullscreenBrowserRect();
IMGUIUtils.DrawSolidBox(screenRect);
Expand Down
2 changes: 1 addition & 1 deletion src/KKS_BrowserFolders_Hooks/FreeHFolders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void OnGui()
{
if (_freeHFile != null
//&& !_isLive
&& _targetScene == Scene.AddSceneName)
&& _targetScene == Scene.AddSceneName && !Scene.IsOverlap && !Scene.IsNowLoadingFade)
{
var screenRect = GetFullscreenBrowserRect();
IMGUIUtils.DrawSolidBox(screenRect);
Expand Down
3 changes: 2 additions & 1 deletion src/KKS_BrowserFolders_Hooks/HOutfitFolders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using ChaCustom;
using HarmonyLib;
using KKAPI.Utilities;
using Manager;
using UnityEngine;

namespace BrowserFolders.Hooks.KKS
Expand Down Expand Up @@ -41,7 +42,7 @@ public static void InitHook(clothesFileControl __instance)

public void OnGui()
{
if (_uiObject && _uiObject.activeSelf && _sceneName == Manager.Scene.AddSceneName)
if (_uiObject && _uiObject.activeSelf && _sceneName == Scene.AddSceneName && !Scene.IsOverlap && !Scene.IsNowLoadingFade)
{
var screenRect = new Rect((int)(Screen.width * 0.004), (int)(Screen.height * 0.57f), (int)(Screen.width * 0.125), (int)(Screen.height * 0.35));
IMGUIUtils.DrawSolidBox(screenRect);
Expand Down
12 changes: 8 additions & 4 deletions src/KKS_BrowserFolders_Hooks/MakerFolders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class MakerFolders : IFolderBrowser
private static Toggle _loadCharaToggle;
private static Toggle _saveCharaToggle;
private static GameObject _saveFront;
private static GameObject _ccwGo;

public static string CurrentRelativeFolder => _folderTreeView?.CurrentRelativeFolder;

Expand Down Expand Up @@ -45,7 +46,8 @@ private static string DirectoryPathModifier(string currentDirectoryPath)

[HarmonyPostfix]
[HarmonyPatch(typeof(CustomCharaFile), nameof(CustomCharaFile.Initialize))]
public static void InitializePatch(CustomCharaFile __instance) {
public static void InitializePatch(CustomCharaFile __instance)
{
if (_customCharaFile == null)
{
_customCharaFile = __instance;
Expand All @@ -60,8 +62,7 @@ public static void InitializePatch(CustomCharaFile __instance) {
[HarmonyPrefix]
[HarmonyPatch(typeof(CustomCharaFile), "Start")]
public static void InitHook(CustomCharaFile __instance)
{

{
var gt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/06_SystemTop");
_loadCharaToggle = gt.transform.Find("tglLoadChara").GetComponent<Toggle>();
_saveCharaToggle = gt.transform.Find("tglSaveChara").GetComponent<Toggle>();
Expand All @@ -72,6 +73,9 @@ public static void InitHook(CustomCharaFile __instance)
_saveFront = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CvsCaptureFront");

_targetScene = Scene.AddSceneName;

// Exit maker / save character dialog boxes
_ccwGo = GameObject.FindObjectOfType<CustomCheckWindow>()?.gameObject;
}

public void OnGui()
Expand All @@ -84,7 +88,7 @@ public void OnGui()
if (_loadCharaToggle != null && _loadCharaToggle.isOn || _saveCharaToggle != null && _saveCharaToggle.isOn)
{
// Check if the character picture take screen is displayed
if (_saveFront == null || !_saveFront.activeSelf)
if ((_saveFront == null || !_saveFront.activeSelf) && !Scene.IsOverlap && !Scene.IsNowLoadingFade && (_ccwGo == null || !_ccwGo.activeSelf))
{
if (_refreshList)
{
Expand Down
2 changes: 1 addition & 1 deletion src/KKS_BrowserFolders_Hooks/MakerOutfitFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void OnGui()
if (_loadOutfitToggle != null && _loadOutfitToggle.isOn || _saveOutfitToggle != null && _saveOutfitToggle.isOn)
{
// Check if the character picture take screen is displayed
if (_saveFront == null || !_saveFront.activeSelf)
if ((_saveFront == null || !_saveFront.activeSelf) && !Scene.IsOverlap && !Scene.IsNowLoadingFade)
{
if (_refreshList)
{
Expand Down
2 changes: 1 addition & 1 deletion src/KKS_BrowserFolders_Hooks/NewGameFolders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void Init(EntryPlayer list, int sex)

public void OnGui()
{
if (_newGame != null && _targetScene == Scene.AddSceneName)
if (_newGame != null && _targetScene == Scene.AddSceneName && !Scene.IsOverlap && !Scene.IsNowLoadingFade)
{
var screenRect = GetFullscreenBrowserRect();
IMGUIUtils.DrawSolidBox(screenRect);
Expand Down

0 comments on commit d06b1cd

Please sign in to comment.