Fix an issue causing duplicated clicks in some IL2CPP games, fix setting Component.enabled in IL2CPP

This commit is contained in:
sinaioutlander 2020-12-15 19:32:50 +11:00
parent 82e52de557
commit 97325a5f3a
4 changed files with 21 additions and 13 deletions

View File

@ -16,7 +16,7 @@ namespace UnityExplorer
public class ExplorerCore
{
public const string NAME = "UnityExplorer";
public const string VERSION = "3.1.0";
public const string VERSION = "3.1.1";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.unityexplorer";
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer";

View File

@ -111,8 +111,11 @@ namespace UnityExplorer.Inspectors.GameObjects
internal static void OnCompToggleClicked(int index, bool value)
{
var comp = s_compShortlist[index];
#if CPP
comp.TryCast<Behaviour>().enabled = value;
#else
(comp as Behaviour).enabled = value;
#endif
}
internal static void OnCompListObjectClicked(int index)

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
//using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
@ -51,8 +50,6 @@ namespace UnityExplorer.UI.Modules
private SceneFilter m_sceneFilter;
private ChildFilter m_childFilter;
internal bool m_isStaticClassSearching;
// ui elements
private Text m_resultCountText;
@ -257,8 +254,6 @@ namespace UnityExplorer.UI.Modules
internal void StaticClassSearch()
{
m_isStaticClassSearching = true;
var list = new List<Type>();
var nameFilter = "";
@ -295,8 +290,6 @@ namespace UnityExplorer.UI.Modules
private void SingletonSearch()
{
m_isStaticClassSearching = false;
var instances = new List<object>();
var nameFilter = "";
@ -356,8 +349,6 @@ namespace UnityExplorer.UI.Modules
internal void UnityObjectSearch()
{
m_isStaticClassSearching = false;
Type searchType = null;
switch (m_context)
{

View File

@ -46,6 +46,9 @@ namespace UnityExplorer.UI
SearchPage.Instance?.OnSceneChange();
}
#if CPP
internal static float s_timeOfLastClick;
#endif
public static void Update()
{
MainMenu.Instance?.Update();
@ -54,6 +57,7 @@ namespace UnityExplorer.UI
{
if (EventSystem.current != EventSys)
{
ExplorerCore.Log("Forcing EventSystem to UnityExplorer's");
ForceUnlockCursor.SetEventSystem();
}
@ -62,8 +66,18 @@ namespace UnityExplorer.UI
var evt = InputManager.InputPointerEvent;
if (evt != null)
{
if (!evt.eligibleForClick && evt.selectedObject)
evt.eligibleForClick = true;
if (Time.realtimeSinceStartup - s_timeOfLastClick > 0.1f)
{
s_timeOfLastClick = Time.realtimeSinceStartup;
if (!evt.eligibleForClick && evt.selectedObject)
evt.eligibleForClick = true;
}
else
{
if (evt.eligibleForClick)
evt.eligibleForClick = false;
}
}
#endif
}