Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit fb6e413

Browse files
committed
Misc cleanups and adjustments
1 parent ca65aff commit fb6e413

File tree

16 files changed

+68
-55
lines changed

16 files changed

+68
-55
lines changed

src/Core/Reflection/Il2CppReflection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ internal bool DoLoadModule(string fullPath)
745745
//// var valueType = value.GetActualType();
746746
////
747747
//// Type typeOfKeys, typeOfValues;
748-
//// if (valueType.IsGenericType && valueType.GetGenericArguments() is var args && args.Length == 2)
748+
//// if (valueType.IsGenericType && valueType.GetGenericArguments() is ParameterInfo[] args && args.Length == 2)
749749
//// {
750750
//// typeOfKeys = args[0];
751751
//// typeOfValues = args[1];

src/Core/Tests/TestClass.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ private static object GetRandomObject()
194194

195195
#if CPP
196196

197+
public static Il2CppSystem.Collections.IList AAAAAAACppList;
198+
197199
public static string testStringOne = "Test";
198200
public static Il2CppSystem.Object testStringTwo = "string boxed as cpp object";
199201
public static Il2CppSystem.String testStringThree = "string boxed as cpp string";
@@ -237,6 +239,11 @@ static TestClass()
237239
BigList.Add(i.ToString());
238240

239241
#if CPP
242+
var list = new Il2CppSystem.Collections.Generic.List<Il2CppSystem.Object>(5);
243+
list.Add("one");
244+
list.Add("two");
245+
AAAAAAACppList = list.TryCast<Il2CppSystem.Collections.IList>();
246+
240247
CppBoxedDict = new Dictionary<Il2CppSystem.String, Il2CppSystem.Object>();
241248
CppBoxedDict.Add("1", new Il2CppSystem.Int32 { m_value = 1 }.BoxIl2CppObject());
242249
CppBoxedDict.Add("2", new Il2CppSystem.Int32 { m_value = 2 }.BoxIl2CppObject());

src/ExplorerCore.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private static IEnumerator SetupCoroutine()
8282
Log($"{NAME} {VERSION} initialized.");
8383

8484
//InspectorManager.Inspect(typeof(TestClass));
85+
InspectorManager.Inspect(Camera.main.gameObject);
8586
}
8687

8788
/// <summary>

src/UI/CSConsole/ConsoleController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ private static void UpdateCaret(out bool caretMoved)
321321
private static void SetCaretPosition(int caretPosition)
322322
{
323323
settingCaretCoroutine = true;
324+
Input.Component.readOnly = true;
324325
RuntimeProvider.Instance.StartCoroutine(SetAutocompleteCaretCoro(caretPosition));
325326
}
326327

@@ -343,6 +344,7 @@ private static IEnumerator SetAutocompleteCaretCoro(int caretPosition)
343344
color.a = defaultInputFieldAlpha;
344345
Input.Component.selectionColor = color;
345346

347+
Input.Component.readOnly = false;
346348
settingCaretCoroutine = false;
347349
}
348350

@@ -575,7 +577,7 @@ public static void Main()
575577

576578
internal const string HELP_COROUTINES = @"// To start a Coroutine directly, use ""Start(SomeCoroutine());"" in REPL mode.
577579
578-
// To define a coroutine, you will need to compile it seperately. For example:
580+
// To declare a coroutine, you will need to compile it separately. For example:
579581
public class MyCoro
580582
{
581583
public static IEnumerator Main()

src/UI/CacheObject/Views/CacheListEntryCell.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public class CacheListEntryCell : CacheObjectCell
1313
public Image Image { get; private set; }
1414
public InteractiveList ListOwner => Occupant.Owner as InteractiveList;
1515

16-
public static Color EvenColor = new Color(0.07f, 0.07f, 0.07f);
17-
public static Color OddColor = new Color(0.063f, 0.063f, 0.063f);
16+
public static Color EvenColor = new Color(0.12f, 0.12f, 0.12f);
17+
public static Color OddColor = new Color(0.1f, 0.1f, 0.1f);
1818

1919
public override GameObject CreateContent(GameObject parent)
2020
{

src/UI/IValues/InteractiveValueStruct.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ private void AddEditorRow()
180180

181181
fieldRows.Add(row);
182182

183-
var label = UIFactory.CreateLabel(row, "Label", "notset", TextAnchor.MiddleRight);
184-
UIFactory.SetLayoutElement(label.gameObject, minHeight: 25, minWidth: 175, flexibleWidth: 0);
183+
var label = UIFactory.CreateLabel(row, "Label", "notset", TextAnchor.MiddleLeft);
184+
UIFactory.SetLayoutElement(label.gameObject, minHeight: 25, minWidth: 50, flexibleWidth: 0);
185185
label.horizontalOverflow = HorizontalWrapMode.Wrap;
186186
labels.Add(label);
187187

src/UI/Models/InputFieldRef.cs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,24 @@
88

99
namespace UnityExplorer.UI
1010
{
11-
public class InputFieldRef : UIBehaviourModel
11+
public class InputFieldRef : UIModel
1212
{
13+
public static readonly HashSet<InputFieldRef> inputsPendingUpdate = new HashSet<InputFieldRef>();
14+
15+
public static void UpdateInstances()
16+
{
17+
if (inputsPendingUpdate.Any())
18+
{
19+
foreach (var entry in inputsPendingUpdate)
20+
{
21+
LayoutRebuilder.MarkLayoutForRebuild(entry.Rect);
22+
entry.OnValueChanged?.Invoke(entry.Component.text);
23+
}
24+
25+
inputsPendingUpdate.Clear();
26+
}
27+
}
28+
1329
public InputFieldRef(InputField component)
1430
{
1531
this.Component = component;
@@ -33,22 +49,11 @@ public string Text
3349
public TextGenerator TextGenerator => Component.cachedInputTextGenerator;
3450
public bool ReachedMaxVerts => TextGenerator.vertexCount >= UIManager.MAX_TEXT_VERTS;
3551

36-
private bool updatedWanted;
3752

3853
private void OnInputChanged(string value)
3954
{
40-
updatedWanted = true;
41-
}
42-
43-
public override void Update()
44-
{
45-
if (updatedWanted)
46-
{
47-
LayoutRebuilder.MarkLayoutForRebuild(Rect);
48-
49-
OnValueChanged?.Invoke(Component.text);
50-
updatedWanted = false;
51-
}
55+
if (!inputsPendingUpdate.Contains(this))
56+
inputsPendingUpdate.Add(this);
5257
}
5358

5459
public override GameObject UIRoot => Component.gameObject;

src/UI/ObjectExplorer/ObjectSearch.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public ObjectSearch(ObjectExplorerPanel parent)
3030
private string lastCheckedTypeInput;
3131
private bool lastTypeCanHaveGO;
3232

33-
public ButtonListSource<object> dataHandler;
33+
public ButtonListHandler<object, ButtonCell> dataHandler;
3434

3535
private ScrollPool<ButtonCell> resultsScrollPool;
3636
private List<object> currentResults = new List<object>();
@@ -74,7 +74,7 @@ public void DoSearch()
7474

7575
public void Update()
7676
{
77-
if (lastCheckedTypeInput != desiredTypeInput)
77+
if (m_context == SearchContext.UnityObject && lastCheckedTypeInput != desiredTypeInput)
7878
{
7979
lastCheckedTypeInput = desiredTypeInput;
8080

@@ -101,10 +101,9 @@ private void OnContextDropdownChanged(int value)
101101
{
102102
m_context = (SearchContext)value;
103103

104-
bool shouldShowGoFilters = m_context == SearchContext.UnityObject;
105-
106-
sceneFilterRow.SetActive(shouldShowGoFilters);
107-
childFilterRow.SetActive(shouldShowGoFilters);
104+
lastCheckedTypeInput = null;
105+
sceneFilterRow.SetActive(false);
106+
childFilterRow.SetActive(false);
108107

109108
unityObjectClassRow.SetActive(m_context == SearchContext.UnityObject);
110109
}
@@ -244,11 +243,9 @@ public override void ConstructUI(GameObject parent)
244243

245244
// RESULTS SCROLL POOL
246245

247-
dataHandler = new ButtonListSource<object>(resultsScrollPool, GetEntries, SetCell, ShouldDisplayCell, OnCellClicked);
248-
resultsScrollPool = UIFactory.CreateScrollPool<ButtonCell>(uiRoot, "ResultsList", out GameObject scrollObj, out GameObject scrollContent);
249-
250-
//if (!Pool<ButtonCell>.PrototypeObject)
251-
// Pool<ButtonCell>.PrototypeObject = ButtonCell.CreatePrototypeCell(Pool<ButtonCell>.InactiveHolder).gameObject;
246+
dataHandler = new ButtonListHandler<object, ButtonCell>(resultsScrollPool, GetEntries, SetCell, ShouldDisplayCell, OnCellClicked);
247+
resultsScrollPool = UIFactory.CreateScrollPool<ButtonCell>(uiRoot, "ResultsList", out GameObject scrollObj,
248+
out GameObject scrollContent);
252249

253250
resultsScrollPool.Initialize(dataHandler);
254251
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);

src/UI/ObjectExplorer/SceneExplorer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ private void PopulateSceneDropdown()
120120

121121
private void OnFilterInput(string input)
122122
{
123+
if ((!string.IsNullOrEmpty(input) && !Tree.Filtering) || (string.IsNullOrEmpty(input) && Tree.Filtering))
124+
{
125+
Tree.displayedObjects.Clear();
126+
}
127+
123128
Tree.CurrentFilter = input;
124129
Tree.RefreshData(true, true);
125130
}
@@ -208,7 +213,7 @@ public override void ConstructUI(GameObject content)
208213
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
209214
UIFactory.SetLayoutElement(scrollContent, flexibleHeight: 9999);
210215

211-
Tree = new TransformTree(scrollPool) { GetRootEntriesMethod = GetRootEntries };
216+
Tree = new TransformTree(scrollPool, GetRootEntries);
212217
Tree.Init();
213218
Tree.RefreshData(true, true);
214219
//scrollPool.Viewport.GetComponent<Mask>().enabled = false;

src/UI/Panels/CSConsolePanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CSConsolePanel : UIPanel
1515
{
1616
public override string Name => "C# Console";
1717
public override UIManager.Panels PanelType => UIManager.Panels.CSConsole;
18-
public override int MinWidth => 740;
18+
public override int MinWidth => 750;
1919
public override int MinHeight => 300;
2020

2121
public InputFieldScroller InputScroll { get; private set; }

0 commit comments

Comments
 (0)