* Fix `Hide on Startup` not working
* Fix for cases when we try to `scene.GetRootGameObjects()` but the scene has not yet fully loaded.
* MelonLoader releases will no longer spam "Preferences Saved!" constantly in the Console log
* Fix mistake with UI Event System setting/releasing
* Fix some UI elements not having correct Color transition values
This commit is contained in:
Sinai 2021-04-01 17:13:31 +11:00
parent 8f025622b4
commit d070ded036
11 changed files with 80 additions and 10 deletions

View File

@ -38,6 +38,34 @@ The standalone release is based on the BepInEx build, so it requires Harmony 2.0
1. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
2. Optionally subscribe to the `ExplorerStandalone.OnLog` event to handle logging if you wish.
## Issues and contributions
Both issue reports and PR contributions are welcome in this repository.
### Issue reporting
To report an issue with UnityExplorer, please use the following template (as well as any other information / images you can provide).
Please upload the required log files on [Pastebin](https://pastebin.com/) and include a link to your paste:
* All reports: Unity's `output_log.txt` or `Player.log`, should be found at `%userprofile%\AppData\LocalLow\[Company]\[Game]\` unless redirected.
* BepInEx: `BepInEx\LogOutput.log`
* MelonLoader: `MelonLoader\Latest.log`
Template:
```
* OS Platform:
* Display resolution:
* Game(s) tested on:
* UnityExplorer version(s) tested:
* Description of issue:
* Unity log pastebin link:
* Mod Loader log pastebin link:
```
## Features
<p align="center">

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;
using UnityExplorer.UI.Main;
@ -45,6 +46,8 @@ namespace UnityExplorer.Core.Config
PanelDragger.OnFinishDrag += PanelDragger_OnFinishDrag;
MainMenu.OnActiveTabChanged += MainMenu_OnActiveTabChanged;
DebugConsole.OnToggleShow += DebugConsole_OnToggleShow;
InitConsoleCallback();
}
internal static void RegisterConfigElement<T>(ConfigElement<T> configElement)
@ -134,6 +137,33 @@ namespace UnityExplorer.Core.Config
Last_SceneExplorer_State.Value = showing;
}
#region CONSOLE ONEXIT CALLBACK
internal static void InitConsoleCallback()
{
handler = new ConsoleEventDelegate(ConsoleEventCallback);
SetConsoleCtrlHandler(handler, true);
}
static bool ConsoleEventCallback(int eventType)
{
// 2 is Console Quit
if (eventType == 2)
Handler.SaveConfig();
return false;
}
static ConsoleEventDelegate handler;
private delegate bool ConsoleEventDelegate(int eventType);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool SetConsoleCtrlHandler(ConsoleEventDelegate callback, bool add);
#endregion
#region WINDOW ANCHORS / POSITION HELPERS
// Window Anchors helpers
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.10,0.78,0.95";
@ -210,5 +240,7 @@ namespace UnityExplorer.Core.Config
//ExplorerCore.LogWarning("Exception setting window position: " + ex);
}
}
#endregion
}
}

View File

@ -125,11 +125,17 @@ namespace UnityExplorer.Core.Input
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
if (UIManager.EventSys)
SetEventSystem();
}
else
{
Cursor.lockState = m_lastLockMode;
Cursor.visible = m_lastVisibleState;
if (UIManager.EventSys)
ReleaseEventSystem();
}
m_currentlySettingCursor = false;
}

View File

@ -89,10 +89,13 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp
internal delegate void d_GetRootGameObjects(int handle, IntPtr list);
public override GameObject[] GetRootGameObjects(Scene scene) => GetRootGameObjects(scene.handle);
public static GameObject[] GetRootGameObjects(int handle)
public override GameObject[] GetRootGameObjects(Scene scene)
{
if (!scene.isLoaded)
return new GameObject[0];
int handle = scene.handle;
if (handle == -1)
return new GameObject[0];

View File

@ -52,6 +52,9 @@ namespace UnityExplorer.Core.Runtime.Mono
public override GameObject[] GetRootGameObjects(Scene scene)
{
if (!scene.isLoaded)
return new GameObject[0];
return scene.GetRootGameObjects();
}

View File

@ -12,7 +12,7 @@ namespace UnityExplorer
public class ExplorerCore
{
public const string NAME = "UnityExplorer";
public const string VERSION = "3.3.2";
public const string VERSION = "3.3.3";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.unityexplorer";

View File

@ -69,7 +69,6 @@ namespace UnityExplorer.Loader.ML
public override void OnAnyConfigChanged()
{
MelonPreferences.Save();
}
public override void SaveConfig()

View File

@ -169,7 +169,7 @@ namespace UnityExplorer.UI.Main.Home.Inspectors.GameObjects
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
ColorBlock mainColors = new ColorBlock();
RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
var mainBtn = UIFactory.CreateButton(btnGroupObj,

View File

@ -176,7 +176,7 @@ namespace UnityExplorer.UI.Main.Home.Inspectors.GameObjects
// Main component button
ColorBlock mainColors = new ColorBlock();
RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
var mainBtn = UIFactory.CreateButton(groupObj,

View File

@ -180,7 +180,7 @@ namespace UnityExplorer.UI.Main
// Hide button
ColorBlock colorBlock = new ColorBlock();
RuntimeProvider.Instance.SetColorBlock(colorBlock, new Color(65f / 255f, 23f / 255f, 23f / 255f),
colorBlock = RuntimeProvider.Instance.SetColorBlock(colorBlock, new Color(65f / 255f, 23f / 255f, 23f / 255f),
new Color(35f / 255f, 10f / 255f, 10f / 255f), new Color(156f / 255f, 0f, 0f));
var hideButton = UIFactory.CreateButton(titleBar,

View File

@ -53,8 +53,7 @@ namespace UnityExplorer.UI
// Force refresh of anchors etc
Canvas.ForceUpdateCanvases();
if (!ConfigManager.Hide_On_Startup.Value)
ShowMenu = true;
ShowMenu = !ConfigManager.Hide_On_Startup.Value;
ExplorerCore.Log("UI initialized.");
}