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

Commit a1d0b64

Browse files
committed
Cleanup
1 parent 0b84405 commit a1d0b64

File tree

7 files changed

+37
-53
lines changed

7 files changed

+37
-53
lines changed

src/CacheObject/CacheMember.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,22 @@ public override void UnlinkFromView()
6161

6262
protected abstract void TrySetValue(object value);
6363

64-
public void EvaluateAndSetCell()
64+
/// <summary>
65+
/// Evaluate is called when first shown (if ShouldAutoEvaluate), or else when Evaluate button is clicked, or auto-updated.
66+
/// </summary>
67+
public void Evaluate()
6568
{
66-
Evaluate();
67-
if (CellView != null)
68-
SetDataToCell(CellView);
69+
SetValueFromSource(TryEvaluate());
6970
}
7071

7172
/// <summary>
72-
/// Evaluate when first shown (if ShouldAutoEvaluate), or else when Evaluate button is clicked, or auto-updated.
73+
/// Called when user presses the Evaluate button.
7374
/// </summary>
74-
public void Evaluate()
75+
public void EvaluateAndSetCell()
7576
{
76-
SetValueFromSource(TryEvaluate());
77+
Evaluate();
78+
if (CellView != null)
79+
SetDataToCell(CellView);
7780
}
7881

7982
public override void TrySetUserValue(object value)
@@ -85,9 +88,6 @@ public override void TrySetUserValue(object value)
8588
protected override void SetValueState(CacheObjectCell cell, ValueStateArgs args)
8689
{
8790
base.SetValueState(cell, args);
88-
89-
//var memCell = cell as CacheMemberCell;
90-
//memCell.UpdateToggle.gameObject.SetActive(ShouldAutoEvaluate);
9191
}
9292

9393
private static readonly Color evalEnabledColor = new Color(0.15f, 0.25f, 0.15f);
@@ -100,7 +100,6 @@ protected override bool SetCellEvaluateState(CacheObjectCell objectcell)
100100
cell.EvaluateHolder.SetActive(!ShouldAutoEvaluate);
101101
if (!ShouldAutoEvaluate)
102102
{
103-
//cell.UpdateToggle.gameObject.SetActive(false);
104103
cell.EvaluateButton.Component.gameObject.SetActive(true);
105104
if (HasArguments)
106105
{
@@ -119,11 +118,6 @@ protected override bool SetCellEvaluateState(CacheObjectCell objectcell)
119118
if (!Evaluating)
120119
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalDisabledColor, evalDisabledColor * 1.3f);
121120
}
122-
//else
123-
//{
124-
// cell.UpdateToggle.gameObject.SetActive(true);
125-
// cell.UpdateToggle.isOn = AutoUpdateWanted;
126-
//}
127121

128122
if (State == ValueState.NotEvaluated && !ShouldAutoEvaluate)
129123
{

src/CacheObject/IValues/InteractiveDictionary.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ public void SetCell(CacheKeyValuePairCell cell, int index)
169169
}
170170

171171
public int AdjustedWidth => (int)UIRect.rect.width - 80;
172-
//public int AdjustedKeyWidth => HalfWidth - 50;
173172

174173
public override void SetLayout()
175174
{

src/Inspectors/InspectUnderMouse.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,24 @@ public static void OnDropdownSelect(int index)
4646
public override bool ShouldSaveActiveState => false;
4747
public override bool ShowByDefault => false;
4848

49-
internal static Text objNameLabel;
50-
internal static Text objPathLabel;
51-
internal static Text mousePosLabel;
49+
private static Text objNameLabel;
50+
private static Text objPathLabel;
51+
private static Text mousePosLabel;
5252

5353
// Mouse Inspector
5454
public static bool Inspecting { get; set; }
5555
public static MouseInspectMode Mode { get; set; }
5656

57+
private static Camera MainCamera;
58+
private static GraphicRaycaster[] graphicRaycasters;
59+
5760
private static GameObject lastHitObject;
5861
private static Vector3 lastMousePos;
5962

6063
private static readonly List<Graphic> wasDisabledGraphics = new List<Graphic>();
6164
private static readonly List<CanvasGroup> wasDisabledCanvasGroups = new List<CanvasGroup>();
6265
private static readonly List<GameObject> objectsAddedCastersTo = new List<GameObject>();
6366

64-
internal static Camera MainCamera;
65-
internal static GraphicRaycaster[] graphicRaycasters;
66-
6767
public void StartInspect(MouseInspectMode mode)
6868
{
6969
MainCamera = Camera.main;

src/Inspectors/InspectorManager.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@ public static class InspectorManager
2121

2222
public static float PanelWidth;
2323

24-
internal static void CloseAllTabs()
25-
{
26-
if (Inspectors.Any())
27-
{
28-
for (int i = Inspectors.Count - 1; i >= 0; i--)
29-
Inspectors[i].CloseInspector();
30-
31-
Inspectors.Clear();
32-
}
33-
34-
UIManager.SetPanelActive(UIManager.Panels.Inspector, false);
35-
}
36-
3724
public static void Inspect(object obj, CacheObjectBase sourceCache = null)
3825
{
3926
if (obj.IsNullOrDestroyed())
@@ -50,6 +37,11 @@ public static void Inspect(object obj, CacheObjectBase sourceCache = null)
5037
CreateInspector<ReflectionInspector>(obj, false, sourceCache);
5138
}
5239

40+
public static void Inspect(Type type)
41+
{
42+
CreateInspector<ReflectionInspector>(type, true);
43+
}
44+
5345
private static bool TryFocusActiveInspector(object target)
5446
{
5547
foreach (var inspector in Inspectors)
@@ -64,11 +56,6 @@ private static bool TryFocusActiveInspector(object target)
6456
return false;
6557
}
6658

67-
public static void Inspect(Type type)
68-
{
69-
CreateInspector<ReflectionInspector>(type, true);
70-
}
71-
7259
public static void SetInspectorActive(InspectorBase inspector)
7360
{
7461
UnsetActiveInspector();
@@ -87,6 +74,19 @@ public static void UnsetActiveInspector()
8774
}
8875
}
8976

77+
internal static void CloseAllTabs()
78+
{
79+
if (Inspectors.Any())
80+
{
81+
for (int i = Inspectors.Count - 1; i >= 0; i--)
82+
Inspectors[i].CloseInspector();
83+
84+
Inspectors.Clear();
85+
}
86+
87+
UIManager.SetPanelActive(UIManager.Panels.Inspector, false);
88+
}
89+
9090
private static void CreateInspector<T>(object target, bool staticReflection = false,
9191
CacheObjectBase sourceCache = null) where T : InspectorBase
9292
{

src/Loader/MelonLoader/ExplorerMelonMod.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
using System;
33
using System.IO;
44
using MelonLoader;
5-
using UnityEngine;
6-
using UnityEngine.EventSystems;
75
using UnityExplorer;
8-
using UnityExplorer.Core;
96
using UnityExplorer.Core.Config;
10-
using UnityExplorer.Core.Input;
117
using UnityExplorer.Loader.ML;
12-
using HarmonyLib;
13-
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.UNIVERSAL)]
148

9+
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.UNIVERSAL)]
1510
[assembly: MelonInfo(typeof(ExplorerMelonMod), ExplorerCore.NAME, ExplorerCore.VERSION, ExplorerCore.AUTHOR)]
1611
[assembly: MelonGame(null, null)]
1712
[assembly: MelonColor(ConsoleColor.DarkCyan)]

src/UI/Panels/OptionsPanel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace UnityExplorer.UI.Panels
1313
{
14-
// TODO move the logic out of this class into ConfigManager
15-
1614
public class OptionsPanel : UIPanel, ICacheObjectController, ICellPoolDataSource<ConfigEntryCell>
1715
{
1816
public override string Name => "Options";

src/UI/Panels/UIPanel.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,8 @@ public override void SetActive(bool active)
116116

117117
if (NavButtonWanted)
118118
{
119-
if (active)
120-
RuntimeProvider.Instance.SetColorBlock(NavButton.Component, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f);
121-
else
122-
RuntimeProvider.Instance.SetColorBlock(NavButton.Component, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
119+
var color = active ? UIManager.enabledButtonColor : UIManager.disabledButtonColor;
120+
RuntimeProvider.Instance.SetColorBlock(NavButton.Component, color, color * 1.2f);
123121
}
124122

125123
if (!active)

0 commit comments

Comments
 (0)