Rename some members to avoid confusion

This commit is contained in:
Sinai 2021-05-11 19:18:27 +10:00
parent ec215a0006
commit 7241247d05
24 changed files with 115 additions and 113 deletions

View File

@ -69,7 +69,7 @@ namespace UnityExplorer.UI.CacheObject
kvpCell.KeyInputField.UIRoot.SetActive(true); kvpCell.KeyInputField.UIRoot.SetActive(true);
kvpCell.KeyInputTypeLabel.gameObject.SetActive(true); kvpCell.KeyInputTypeLabel.gameObject.SetActive(true);
kvpCell.KeyLabel.gameObject.SetActive(false); kvpCell.KeyLabel.gameObject.SetActive(false);
kvpCell.KeyInspectButton.Button.gameObject.SetActive(false); kvpCell.KeyInspectButton.Component.gameObject.SetActive(false);
kvpCell.KeyInputField.Text = KeyInputText; kvpCell.KeyInputField.Text = KeyInputText;
kvpCell.KeyInputTypeLabel.text = KeyInputTypeText; kvpCell.KeyInputTypeLabel.text = KeyInputTypeText;
@ -79,7 +79,7 @@ namespace UnityExplorer.UI.CacheObject
kvpCell.KeyInputField.UIRoot.SetActive(false); kvpCell.KeyInputField.UIRoot.SetActive(false);
kvpCell.KeyInputTypeLabel.gameObject.SetActive(false); kvpCell.KeyInputTypeLabel.gameObject.SetActive(false);
kvpCell.KeyLabel.gameObject.SetActive(true); kvpCell.KeyLabel.gameObject.SetActive(true);
kvpCell.KeyInspectButton.Button.gameObject.SetActive(InspectWanted); kvpCell.KeyInspectButton.Component.gameObject.SetActive(InspectWanted);
kvpCell.KeyLabel.text = KeyLabelText; kvpCell.KeyLabel.text = KeyLabelText;
} }

View File

@ -101,7 +101,7 @@ namespace UnityExplorer.UI.CacheObject
if (!ShouldAutoEvaluate) if (!ShouldAutoEvaluate)
{ {
//cell.UpdateToggle.gameObject.SetActive(false); //cell.UpdateToggle.gameObject.SetActive(false);
cell.EvaluateButton.Button.gameObject.SetActive(true); cell.EvaluateButton.Component.gameObject.SetActive(true);
if (HasArguments) if (HasArguments)
{ {
if (!Evaluating) if (!Evaluating)
@ -110,14 +110,14 @@ namespace UnityExplorer.UI.CacheObject
{ {
cell.EvaluateButton.ButtonText.text = "Hide"; cell.EvaluateButton.ButtonText.text = "Hide";
Evaluator.UIRoot.transform.SetParent(cell.EvaluateHolder.transform, false); Evaluator.UIRoot.transform.SetParent(cell.EvaluateHolder.transform, false);
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Button, evalEnabledColor, evalEnabledColor * 1.3f); RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalEnabledColor, evalEnabledColor * 1.3f);
} }
} }
else else
cell.EvaluateButton.ButtonText.text = "Evaluate"; cell.EvaluateButton.ButtonText.text = "Evaluate";
if (!Evaluating) if (!Evaluating)
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Button, evalDisabledColor, evalDisabledColor * 1.3f); RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalDisabledColor, evalDisabledColor * 1.3f);
} }
//else //else
//{ //{

View File

@ -342,17 +342,17 @@ namespace UnityExplorer.UI.CacheObject
if (args.inputActive) if (args.inputActive)
{ {
cell.InputField.Text = ParseUtility.ToStringForInput(Value, LastValueType); cell.InputField.Text = ParseUtility.ToStringForInput(Value, LastValueType);
cell.InputField.InputField.readOnly = !CanWrite; cell.InputField.Component.readOnly = !CanWrite;
} }
// apply for bool and numbers // apply for bool and numbers
cell.ApplyButton.Button.gameObject.SetActive(args.applyActive); cell.ApplyButton.Component.gameObject.SetActive(args.applyActive);
// Inspect button only if last value not null. // Inspect button only if last value not null.
cell.InspectButton.Button.gameObject.SetActive(args.inspectActive && !LastValueWasNull); cell.InspectButton.Component.gameObject.SetActive(args.inspectActive && !LastValueWasNull);
// allow IValue for null strings though // allow IValue for null strings though
cell.SubContentButton.Button.gameObject.SetActive(args.subContentButtonActive && (!LastValueWasNull || State == ValueState.String)); cell.SubContentButton.Component.gameObject.SetActive(args.subContentButtonActive && (!LastValueWasNull || State == ValueState.String));
} }
// CacheObjectCell Apply // CacheObjectCell Apply

View File

@ -60,7 +60,7 @@ namespace UnityExplorer.UI.CacheObject.Views
// key Inspect // key Inspect
KeyInspectButton = UIFactory.CreateButton(keyGroup, "KeyInspectButton", "Inspect", new Color(0.15f, 0.15f, 0.15f)); KeyInspectButton = UIFactory.CreateButton(keyGroup, "KeyInspectButton", "Inspect", new Color(0.15f, 0.15f, 0.15f));
UIFactory.SetLayoutElement(KeyInspectButton.Button.gameObject, minWidth: 60, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0); UIFactory.SetLayoutElement(KeyInspectButton.Component.gameObject, minWidth: 60, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0);
KeyInspectButton.OnClick += KeyInspectClicked; KeyInspectButton.OnClick += KeyInspectClicked;
// label // label
@ -78,7 +78,7 @@ namespace UnityExplorer.UI.CacheObject.Views
KeyInputField = UIFactory.CreateInputField(keyGroup, "KeyInput", "empty"); KeyInputField = UIFactory.CreateInputField(keyGroup, "KeyInput", "empty");
UIFactory.SetLayoutElement(KeyInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 0, preferredWidth: 200); UIFactory.SetLayoutElement(KeyInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 0, preferredWidth: 200);
//KeyInputField.lineType = InputField.LineType.MultiLineNewline; //KeyInputField.lineType = InputField.LineType.MultiLineNewline;
KeyInputField.InputField.readOnly = true; KeyInputField.Component.readOnly = true;
return root; return root;
} }

View File

@ -33,7 +33,7 @@ namespace UnityExplorer.UI.CacheObject.Views
UIFactory.SetLayoutElement(EvaluateHolder, minHeight: 25, flexibleWidth: 9999, flexibleHeight: 775); UIFactory.SetLayoutElement(EvaluateHolder, minHeight: 25, flexibleWidth: 9999, flexibleHeight: 775);
EvaluateButton = UIFactory.CreateButton(EvaluateHolder, "EvaluateButton", "Evaluate", new Color(0.15f, 0.15f, 0.15f)); EvaluateButton = UIFactory.CreateButton(EvaluateHolder, "EvaluateButton", "Evaluate", new Color(0.15f, 0.15f, 0.15f));
UIFactory.SetLayoutElement(EvaluateButton.Button.gameObject, minWidth: 100, minHeight: 25); UIFactory.SetLayoutElement(EvaluateButton.Component.gameObject, minWidth: 100, minHeight: 25);
EvaluateButton.OnClick += EvaluateClicked; EvaluateButton.OnClick += EvaluateClicked;
} }

View File

@ -86,12 +86,12 @@ namespace UnityExplorer.UI.CacheObject.Views
if (!this.SubContentHolder.activeSelf) if (!this.SubContentHolder.activeSelf)
{ {
this.SubContentButton.ButtonText.text = "▲"; this.SubContentButton.ButtonText.text = "▲";
RuntimeProvider.Instance.SetColorBlock(SubContentButton.Button, subInactiveColor, subInactiveColor * 1.3f); RuntimeProvider.Instance.SetColorBlock(SubContentButton.Component, subInactiveColor, subInactiveColor * 1.3f);
} }
else else
{ {
this.SubContentButton.ButtonText.text = "▼"; this.SubContentButton.ButtonText.text = "▼";
RuntimeProvider.Instance.SetColorBlock(SubContentButton.Button, subActiveColor, subActiveColor * 1.3f); RuntimeProvider.Instance.SetColorBlock(SubContentButton.Component, subActiveColor, subActiveColor * 1.3f);
} }
} }
@ -136,7 +136,7 @@ namespace UnityExplorer.UI.CacheObject.Views
UIFactory.SetLayoutElement(rightHoriGroup, minHeight: 25, minWidth: 200, flexibleWidth: 9999, flexibleHeight: 800); UIFactory.SetLayoutElement(rightHoriGroup, minHeight: 25, minWidth: 200, flexibleWidth: 9999, flexibleHeight: 800);
SubContentButton = UIFactory.CreateButton(rightHoriGroup, "SubContentButton", "▲", subInactiveColor); SubContentButton = UIFactory.CreateButton(rightHoriGroup, "SubContentButton", "▲", subInactiveColor);
UIFactory.SetLayoutElement(SubContentButton.Button.gameObject, minWidth: 25, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0); UIFactory.SetLayoutElement(SubContentButton.Component.gameObject, minWidth: 25, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0);
SubContentButton.OnClick += SubContentClicked; SubContentButton.OnClick += SubContentClicked;
// Type label // Type label
@ -158,13 +158,13 @@ namespace UnityExplorer.UI.CacheObject.Views
// Apply // Apply
ApplyButton = UIFactory.CreateButton(rightHoriGroup, "ApplyButton", "Apply", new Color(0.15f, 0.19f, 0.15f)); ApplyButton = UIFactory.CreateButton(rightHoriGroup, "ApplyButton", "Apply", new Color(0.15f, 0.19f, 0.15f));
UIFactory.SetLayoutElement(ApplyButton.Button.gameObject, minWidth: 70, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0); UIFactory.SetLayoutElement(ApplyButton.Component.gameObject, minWidth: 70, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0);
ApplyButton.OnClick += ApplyClicked; ApplyButton.OnClick += ApplyClicked;
// Inspect // Inspect
InspectButton = UIFactory.CreateButton(rightHoriGroup, "InspectButton", "Inspect", new Color(0.15f, 0.15f, 0.15f)); InspectButton = UIFactory.CreateButton(rightHoriGroup, "InspectButton", "Inspect", new Color(0.15f, 0.15f, 0.15f));
UIFactory.SetLayoutElement(InspectButton.Button.gameObject, minWidth: 70, flexibleWidth: 0, minHeight: 25); UIFactory.SetLayoutElement(InspectButton.Component.gameObject, minWidth: 70, flexibleWidth: 0, minHeight: 25);
InspectButton.OnClick += InspectClicked; InspectButton.OnClick += InspectClicked;
// Main value label // Main value label

View File

@ -230,7 +230,7 @@ namespace UnityExplorer.UI.CacheObject.Views
var inputField = UIFactory.CreateInputField(horiGroup, "InputField", "..."); var inputField = UIFactory.CreateInputField(horiGroup, "InputField", "...");
UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25, flexibleHeight: 50, minWidth: 100, flexibleWidth: 1000); UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25, flexibleHeight: 50, minWidth: 100, flexibleWidth: 1000);
inputField.InputField.lineType = InputField.LineType.MultiLineNewline; inputField.Component.lineType = InputField.LineType.MultiLineNewline;
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize; inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
inputField.OnValueChanged += (string val) => { inputArray[index] = val; }; inputField.OnValueChanged += (string val) => { inputArray[index] = val; };
inputFields.Add(inputField); inputFields.Add(inputField);
@ -266,7 +266,7 @@ namespace UnityExplorer.UI.CacheObject.Views
// evaluate button // evaluate button
var evalButton = UIFactory.CreateButton(UIRoot, "EvaluateButton", "Evaluate", new Color(0.2f, 0.2f, 0.2f)); var evalButton = UIFactory.CreateButton(UIRoot, "EvaluateButton", "Evaluate", new Color(0.2f, 0.2f, 0.2f));
UIFactory.SetLayoutElement(evalButton.Button.gameObject, minHeight: 25, minWidth: 150, flexibleWidth: 0); UIFactory.SetLayoutElement(evalButton.Component.gameObject, minHeight: 25, minWidth: 150, flexibleWidth: 0);
evalButton.OnClick += () => evalButton.OnClick += () =>
{ {
Owner.EvaluateAndSetCell(); Owner.EvaluateAndSetCell();

View File

@ -26,12 +26,12 @@ namespace UnityExplorer.UI.IValues
{ {
base.OnBorrowed(owner); base.OnBorrowed(owner);
m_applyButton.Button.gameObject.SetActive(owner.CanWrite); m_applyButton.Component.gameObject.SetActive(owner.CanWrite);
foreach (var slider in m_sliders) foreach (var slider in m_sliders)
slider.interactable = owner.CanWrite; slider.interactable = owner.CanWrite;
foreach (var input in m_inputs) foreach (var input in m_inputs)
input.InputField.readOnly = !owner.CanWrite; input.Component.readOnly = !owner.CanWrite;
} }
// owner setting value to this // owner setting value to this
@ -158,7 +158,7 @@ namespace UnityExplorer.UI.IValues
// apply button // apply button
m_applyButton = UIFactory.CreateButton(horiGroup, "ApplyButton", "Apply", new Color(0.2f, 0.26f, 0.2f)); m_applyButton = UIFactory.CreateButton(horiGroup, "ApplyButton", "Apply", new Color(0.2f, 0.26f, 0.2f));
UIFactory.SetLayoutElement(m_applyButton.Button.gameObject, minHeight: 25, minWidth: 90); UIFactory.SetLayoutElement(m_applyButton.Component.gameObject, minHeight: 25, minWidth: 90);
m_applyButton.OnClick += SetValueToOwner; m_applyButton.OnClick += SetValueToOwner;
// sliders / inputs // sliders / inputs

View File

@ -191,7 +191,7 @@ namespace UnityExplorer.UI.IValues
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hori, false, false, true, true, 2); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hori, false, false, true, true, 2);
var applyButton = UIFactory.CreateButton(hori, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f)); var applyButton = UIFactory.CreateButton(hori, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
UIFactory.SetLayoutElement(applyButton.Button.gameObject, minHeight: 25, minWidth: 100); UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 100);
applyButton.OnClick += OnApplyClicked; applyButton.OnClick += OnApplyClicked;
var dropdownObj = UIFactory.CreateDropdown(hori, out enumDropdown, "not set", 14, null); var dropdownObj = UIFactory.CreateDropdown(hori, out enumDropdown, "not set", 14, null);

View File

@ -26,8 +26,8 @@ namespace UnityExplorer.UI.IValues
{ {
base.OnBorrowed(owner); base.OnBorrowed(owner);
inputField.InputField.readOnly = !owner.CanWrite; inputField.Component.readOnly = !owner.CanWrite;
ApplyButton.Button.gameObject.SetActive(owner.CanWrite); ApplyButton.Component.gameObject.SetActive(owner.CanWrite);
SaveFilePath.Text = Path.Combine(ConfigManager.Default_Output_Path.Value, "untitled.txt"); SaveFilePath.Text = Path.Combine(ConfigManager.Default_Output_Path.Value, "untitled.txt");
} }
@ -65,11 +65,7 @@ namespace UnityExplorer.UI.IValues
private void OnInputChanged(string input) private void OnInputChanged(string input)
{ {
EditedValue = input; EditedValue = input;
SaveFileRow.SetActive(IsStringTooLong(EditedValue));
if (IsStringTooLong(EditedValue))
{
ExplorerCore.LogWarning("InputField length has reached maximum character count!");
}
} }
private void OnSaveFileClicked() private void OnSaveFileClicked()
@ -109,7 +105,7 @@ namespace UnityExplorer.UI.IValues
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horizRow, false, false, true, true, 4); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horizRow, false, false, true, true, 4);
var saveButton = UIFactory.CreateButton(horizRow, "SaveButton", "Save file"); var saveButton = UIFactory.CreateButton(horizRow, "SaveButton", "Save file");
UIFactory.SetLayoutElement(saveButton.Button.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0); UIFactory.SetLayoutElement(saveButton.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
saveButton.OnClick += OnSaveFileClicked; saveButton.OnClick += OnSaveFileClicked;
SaveFilePath = UIFactory.CreateInputField(horizRow, "SaveInput", "..."); SaveFilePath = UIFactory.CreateInputField(horizRow, "SaveInput", "...");
@ -118,13 +114,13 @@ namespace UnityExplorer.UI.IValues
// Main Input / apply // Main Input / apply
ApplyButton = UIFactory.CreateButton(UIRoot, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f)); ApplyButton = UIFactory.CreateButton(UIRoot, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
UIFactory.SetLayoutElement(ApplyButton.Button.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0); UIFactory.SetLayoutElement(ApplyButton.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
ApplyButton.OnClick += OnApplyClicked; ApplyButton.OnClick += OnApplyClicked;
inputField = UIFactory.CreateInputField(UIRoot, "InputField", "empty"); inputField = UIFactory.CreateInputField(UIRoot, "InputField", "empty");
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize; inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25, flexibleHeight: 500, flexibleWidth: 9999); UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25, flexibleHeight: 500, flexibleWidth: 9999);
inputField.InputField.lineType = InputField.LineType.MultiLineNewline; inputField.Component.lineType = InputField.LineType.MultiLineNewline;
inputField.OnValueChanged += OnInputChanged; inputField.OnValueChanged += OnInputChanged;
return UIRoot; return UIRoot;

View File

@ -104,7 +104,7 @@ namespace UnityExplorer.UI.IValues
{ {
base.OnBorrowed(owner); base.OnBorrowed(owner);
applyButton.Button.gameObject.SetActive(owner.CanWrite); applyButton.Component.gameObject.SetActive(owner.CanWrite);
} }
// Setting value from owner to this // Setting value from owner to this
@ -190,7 +190,7 @@ namespace UnityExplorer.UI.IValues
var fitter = input.UIRoot.AddComponent<ContentSizeFitter>(); var fitter = input.UIRoot.AddComponent<ContentSizeFitter>();
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
input.InputField.lineType = InputField.LineType.MultiLineNewline; input.Component.lineType = InputField.LineType.MultiLineNewline;
inputFields.Add(input); inputFields.Add(input);
} }
@ -203,7 +203,7 @@ namespace UnityExplorer.UI.IValues
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleWidth: 9999); UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleWidth: 9999);
applyButton = UIFactory.CreateButton(UIRoot, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f)); applyButton = UIFactory.CreateButton(UIRoot, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
UIFactory.SetLayoutElement(applyButton.Button.gameObject, minHeight: 25, minWidth: 175); UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 175);
applyButton.OnClick += OnApplyClicked; applyButton.OnClick += OnApplyClicked;
return UIRoot; return UIRoot;

View File

@ -26,9 +26,9 @@ namespace UnityExplorer.UI.Inspectors
public void SetTabColor(bool active) public void SetTabColor(bool active)
{ {
if (active) if (active)
RuntimeProvider.Instance.SetColorBlock(TabButton.Button, _enabledTabColor, _enabledTabColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(TabButton.Component, _enabledTabColor, _enabledTabColor * 1.2f);
else else
RuntimeProvider.Instance.SetColorBlock(TabButton.Button, _disabledTabColor, _disabledTabColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(TabButton.Component, _disabledTabColor, _disabledTabColor * 1.2f);
} }
public GameObject CreateContent(GameObject parent) public GameObject CreateContent(GameObject parent)
@ -40,15 +40,15 @@ namespace UnityExplorer.UI.Inspectors
TabButton = UIFactory.CreateButton(UIRoot, "TabButton", ""); TabButton = UIFactory.CreateButton(UIRoot, "TabButton", "");
UIFactory.SetLayoutElement(TabButton.Button.gameObject, minWidth: 165, flexibleWidth: 0); UIFactory.SetLayoutElement(TabButton.Component.gameObject, minWidth: 165, flexibleWidth: 0);
TabText = TabButton.Button.GetComponentInChildren<Text>(); TabText = TabButton.Component.GetComponentInChildren<Text>();
TabText.horizontalOverflow = HorizontalWrapMode.Overflow; TabText.horizontalOverflow = HorizontalWrapMode.Overflow;
TabText.alignment = TextAnchor.MiddleLeft; TabText.alignment = TextAnchor.MiddleLeft;
CloseButton = UIFactory.CreateButton(UIRoot, "CloseButton", "X", new Color(0.2f, 0.2f, 0.2f, 1)); CloseButton = UIFactory.CreateButton(UIRoot, "CloseButton", "X", new Color(0.2f, 0.2f, 0.2f, 1));
UIFactory.SetLayoutElement(CloseButton.Button.gameObject, minWidth: 20, flexibleWidth: 0); UIFactory.SetLayoutElement(CloseButton.Component.gameObject, minWidth: 20, flexibleWidth: 0);
var closeBtnText = CloseButton.Button.GetComponentInChildren<Text>(); var closeBtnText = CloseButton.Component.GetComponentInChildren<Text>();
closeBtnText.color = Color.red; closeBtnText.color = Color.red;
return UIRoot; return UIRoot;

View File

@ -125,10 +125,16 @@ namespace UnityExplorer.UI.Inspectors
NameText.text = SignatureHighlighter.Parse(TargetType, true); NameText.text = SignatureHighlighter.Parse(TargetType, true);
string asmText; string asmText;
if (TargetType.Assembly != null && !string.IsNullOrEmpty(TargetType.Assembly.Location))
try
{
asmText = Path.GetFileName(TargetType.Assembly.Location); asmText = Path.GetFileName(TargetType.Assembly.Location);
else }
catch
{
asmText = $"{TargetType.Assembly.GetName().Name} <color=grey><i>(in memory)</i></color>"; asmText = $"{TargetType.Assembly.GetName().Name} <color=grey><i>(in memory)</i></color>";
}
AssemblyText.text = $"<color=grey>Assembly:</color> {asmText}"; AssemblyText.text = $"<color=grey>Assembly:</color> {asmText}";
// unity helpers // unity helpers
@ -139,8 +145,8 @@ namespace UnityExplorer.UI.Inspectors
this.filterInputField.Text = ""; this.filterInputField.Text = "";
SetFilter("", StaticOnly ? BindingFlags.Static : BindingFlags.Instance); SetFilter("", StaticOnly ? BindingFlags.Static : BindingFlags.Instance);
scopeFilterButtons[BindingFlags.Default].Button.gameObject.SetActive(!StaticOnly); scopeFilterButtons[BindingFlags.Default].Component.gameObject.SetActive(!StaticOnly);
scopeFilterButtons[BindingFlags.Instance].Button.gameObject.SetActive(!StaticOnly); scopeFilterButtons[BindingFlags.Instance].Component.gameObject.SetActive(!StaticOnly);
foreach (var toggle in memberTypeToggles) foreach (var toggle in memberTypeToggles)
toggle.isOn = true; toggle.isOn = true;
@ -199,11 +205,11 @@ namespace UnityExplorer.UI.Inspectors
if (flagsFilter != FlagsFilter) if (flagsFilter != FlagsFilter)
{ {
var btn = scopeFilterButtons[FlagsFilter].Button; var btn = scopeFilterButtons[FlagsFilter].Component;
RuntimeProvider.Instance.SetColorBlock(btn, disabledButtonColor, disabledButtonColor * 1.3f); RuntimeProvider.Instance.SetColorBlock(btn, disabledButtonColor, disabledButtonColor * 1.3f);
this.FlagsFilter = flagsFilter; this.FlagsFilter = flagsFilter;
btn = scopeFilterButtons[FlagsFilter].Button; btn = scopeFilterButtons[FlagsFilter].Component;
RuntimeProvider.Instance.SetColorBlock(btn, enabledButtonColor, enabledButtonColor * 1.3f); RuntimeProvider.Instance.SetColorBlock(btn, enabledButtonColor, enabledButtonColor * 1.3f);
} }
} }
@ -371,7 +377,7 @@ namespace UnityExplorer.UI.Inspectors
// Update button and toggle // Update button and toggle
var updateButton = UIFactory.CreateButton(rowObj, "UpdateButton", "Update displayed values", new Color(0.22f, 0.28f, 0.22f)); var updateButton = UIFactory.CreateButton(rowObj, "UpdateButton", "Update displayed values", new Color(0.22f, 0.28f, 0.22f));
UIFactory.SetLayoutElement(updateButton.Button.gameObject, minHeight: 25, minWidth: 175, flexibleWidth: 0); UIFactory.SetLayoutElement(updateButton.Component.gameObject, minHeight: 25, minWidth: 175, flexibleWidth: 0);
updateButton.OnClick += UpdateDisplayedMembers; updateButton.OnClick += UpdateDisplayedMembers;
var toggleObj = UIFactory.CreateToggle(rowObj, "AutoUpdateToggle", out autoUpdateToggle, out Text toggleText); var toggleObj = UIFactory.CreateToggle(rowObj, "AutoUpdateToggle", out autoUpdateToggle, out Text toggleText);
@ -416,7 +422,7 @@ namespace UnityExplorer.UI.Inspectors
var color = setAsActive ? enabledButtonColor : disabledButtonColor; var color = setAsActive ? enabledButtonColor : disabledButtonColor;
var button = UIFactory.CreateButton(parent, "Filter_" + flags, lbl, color); var button = UIFactory.CreateButton(parent, "Filter_" + flags, lbl, color);
UIFactory.SetLayoutElement(button.Button.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 70, flexibleWidth: 0); UIFactory.SetLayoutElement(button.Component.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 70, flexibleWidth: 0);
scopeFilterButtons.Add(flags, button); scopeFilterButtons.Add(flags, button);
button.OnClick += () => { SetFilter(flags); }; button.OnClick += () => { SetFilter(flags); };
@ -478,18 +484,18 @@ namespace UnityExplorer.UI.Inspectors
if (typeof(Component).IsAssignableFrom(TargetType)) if (typeof(Component).IsAssignableFrom(TargetType))
{ {
ComponentRef = (Component)Target.TryCast(typeof(Component)); ComponentRef = (Component)Target.TryCast(typeof(Component));
gameObjectButton.Button.gameObject.SetActive(true); gameObjectButton.Component.gameObject.SetActive(true);
} }
else else
gameObjectButton.Button.gameObject.SetActive(false); gameObjectButton.Component.gameObject.SetActive(false);
if (typeof(Texture2D).IsAssignableFrom(TargetType)) if (typeof(Texture2D).IsAssignableFrom(TargetType))
{ {
TextureRef = (Texture2D)Target.TryCast(typeof(Texture2D)); TextureRef = (Texture2D)Target.TryCast(typeof(Texture2D));
textureButton.Button.gameObject.SetActive(true); textureButton.Component.gameObject.SetActive(true);
} }
else else
textureButton.Button.gameObject.SetActive(false); textureButton.Component.gameObject.SetActive(false);
} }
private void OnGameObjectButtonClicked() private void OnGameObjectButtonClicked()
@ -538,11 +544,11 @@ namespace UnityExplorer.UI.Inspectors
UIFactory.SetLayoutElement(unityObjectRow, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999); UIFactory.SetLayoutElement(unityObjectRow, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
textureButton = UIFactory.CreateButton(unityObjectRow, "TextureButton", "View Texture", new Color(0.2f, 0.2f, 0.2f)); textureButton = UIFactory.CreateButton(unityObjectRow, "TextureButton", "View Texture", new Color(0.2f, 0.2f, 0.2f));
UIFactory.SetLayoutElement(textureButton.Button.gameObject, minHeight: 25, minWidth: 150); UIFactory.SetLayoutElement(textureButton.Component.gameObject, minHeight: 25, minWidth: 150);
textureButton.OnClick += ToggleTextureViewer; textureButton.OnClick += ToggleTextureViewer;
gameObjectButton = UIFactory.CreateButton(unityObjectRow, "GameObjectButton", "Inspect GameObject", new Color(0.2f, 0.2f, 0.2f)); gameObjectButton = UIFactory.CreateButton(unityObjectRow, "GameObjectButton", "Inspect GameObject", new Color(0.2f, 0.2f, 0.2f));
UIFactory.SetLayoutElement(gameObjectButton.Button.gameObject, minHeight: 25, minWidth: 170); UIFactory.SetLayoutElement(gameObjectButton.Component.gameObject, minHeight: 25, minWidth: 170);
gameObjectButton.OnClick += OnGameObjectButtonClicked; gameObjectButton.OnClick += OnGameObjectButtonClicked;
var nameLabel = UIFactory.CreateLabel(unityObjectRow, "NameLabel", "Name:", TextAnchor.MiddleLeft, Color.grey); var nameLabel = UIFactory.CreateLabel(unityObjectRow, "NameLabel", "Name:", TextAnchor.MiddleLeft, Color.grey);
@ -550,14 +556,14 @@ namespace UnityExplorer.UI.Inspectors
nameInput = UIFactory.CreateInputField(unityObjectRow, "NameInput", "untitled"); nameInput = UIFactory.CreateInputField(unityObjectRow, "NameInput", "untitled");
UIFactory.SetLayoutElement(nameInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 1000); UIFactory.SetLayoutElement(nameInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 1000);
nameInput.InputField.readOnly = true; nameInput.Component.readOnly = true;
var instanceLabel = UIFactory.CreateLabel(unityObjectRow, "InstanceLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey); var instanceLabel = UIFactory.CreateLabel(unityObjectRow, "InstanceLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
UIFactory.SetLayoutElement(instanceLabel.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0); UIFactory.SetLayoutElement(instanceLabel.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
instanceIdInput = UIFactory.CreateInputField(unityObjectRow, "InstanceIDInput", "ERROR"); instanceIdInput = UIFactory.CreateInputField(unityObjectRow, "InstanceIDInput", "ERROR");
UIFactory.SetLayoutElement(instanceIdInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 0); UIFactory.SetLayoutElement(instanceIdInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 0);
instanceIdInput.InputField.readOnly = true; instanceIdInput.Component.readOnly = true;
unityObjectRow.SetActive(false); unityObjectRow.SetActive(false);
@ -591,7 +597,7 @@ namespace UnityExplorer.UI.Inspectors
new Color(0.1f, 0.1f, 0.1f)); new Color(0.1f, 0.1f, 0.1f));
var saveBtn = UIFactory.CreateButton(saveRowObj, "SaveButton", "Save .PNG", new Color(0.2f, 0.25f, 0.2f)); var saveBtn = UIFactory.CreateButton(saveRowObj, "SaveButton", "Save .PNG", new Color(0.2f, 0.25f, 0.2f));
UIFactory.SetLayoutElement(saveBtn.Button.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0); UIFactory.SetLayoutElement(saveBtn.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
saveBtn.OnClick += OnSaveTextureClicked; saveBtn.OnClick += OnSaveTextureClicked;
textureSavePathInput = UIFactory.CreateInputField(saveRowObj, "SaveInput", "..."); textureSavePathInput = UIFactory.CreateInputField(saveRowObj, "SaveInput", "...");

View File

@ -13,12 +13,12 @@ namespace UnityExplorer.UI
{ {
public Action OnClick; public Action OnClick;
public Button Button { get; } public Button Component { get; }
public Text ButtonText { get; } public Text ButtonText { get; }
public ButtonRef(Button button) public ButtonRef(Button button)
{ {
this.Button = button; this.Component = button;
this.ButtonText = button.GetComponentInChildren<Text>(); this.ButtonText = button.GetComponentInChildren<Text>();
button.onClick.AddListener(() => { OnClick?.Invoke(); }); button.onClick.AddListener(() => { OnClick?.Invoke(); });

View File

@ -12,7 +12,7 @@ namespace UnityExplorer.UI
{ {
public InputFieldRef(InputField InputField) public InputFieldRef(InputField InputField)
{ {
this.InputField = InputField; this.Component = InputField;
Rect = InputField.GetComponent<RectTransform>(); Rect = InputField.GetComponent<RectTransform>();
PlaceholderText = InputField.placeholder.TryCast<Text>(); PlaceholderText = InputField.placeholder.TryCast<Text>();
InputField.onValueChanged.AddListener(OnInputChanged); InputField.onValueChanged.AddListener(OnInputChanged);
@ -20,17 +20,17 @@ namespace UnityExplorer.UI
public event Action<string> OnValueChanged; public event Action<string> OnValueChanged;
public InputField InputField; public InputField Component;
public Text PlaceholderText; public Text PlaceholderText;
public RectTransform Rect; public RectTransform Rect;
public string Text public string Text
{ {
get => InputField.text; get => Component.text;
set => InputField.text = value; set => Component.text = value;
} }
public TextGenerator TextGenerator => InputField.cachedInputTextGenerator; public TextGenerator TextGenerator => Component.cachedInputTextGenerator;
public bool ReachedMaxVerts => TextGenerator.vertexCount >= UIManager.MAX_TEXT_VERTS; public bool ReachedMaxVerts => TextGenerator.vertexCount >= UIManager.MAX_TEXT_VERTS;
private bool updatedWanted; private bool updatedWanted;
@ -46,12 +46,12 @@ namespace UnityExplorer.UI
{ {
LayoutRebuilder.MarkLayoutForRebuild(Rect); LayoutRebuilder.MarkLayoutForRebuild(Rect);
OnValueChanged?.Invoke(InputField.text); OnValueChanged?.Invoke(Component.text);
updatedWanted = false; updatedWanted = false;
} }
} }
public override GameObject UIRoot => InputField.gameObject; public override GameObject UIRoot => Component.gameObject;
public override void ConstructUI(GameObject parent) public override void ConstructUI(GameObject parent)
{ {

View File

@ -232,7 +232,7 @@ namespace UnityExplorer.UI.ObjectExplorer
// Search button // Search button
var searchButton = UIFactory.CreateButton(uiRoot, "SearchButton", "Search"); var searchButton = UIFactory.CreateButton(uiRoot, "SearchButton", "Search");
UIFactory.SetLayoutElement(searchButton.Button.gameObject, minHeight: 25, flexibleHeight: 0); UIFactory.SetLayoutElement(searchButton.Component.gameObject, minHeight: 25, flexibleHeight: 0);
searchButton.OnClick += DoSearch; searchButton.OnClick += DoSearch;
// Results count label // Results count label

View File

@ -175,8 +175,8 @@ namespace UnityExplorer.UI.ObjectExplorer
//Filter input field //Filter input field
var inputField = UIFactory.CreateInputField(filterRow, "FilterInput", "Search..."); var inputField = UIFactory.CreateInputField(filterRow, "FilterInput", "Search...");
inputField.InputField.targetGraphic.color = new Color(0.2f, 0.2f, 0.2f); inputField.Component.targetGraphic.color = new Color(0.2f, 0.2f, 0.2f);
RuntimeProvider.Instance.SetColorBlock(inputField.InputField, new Color(0.4f, 0.4f, 0.4f), new Color(0.2f, 0.2f, 0.2f), RuntimeProvider.Instance.SetColorBlock(inputField.Component, new Color(0.4f, 0.4f, 0.4f), new Color(0.2f, 0.2f, 0.2f),
new Color(0.08f, 0.08f, 0.08f)); new Color(0.08f, 0.08f, 0.08f));
UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25); UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25);
inputField.OnValueChanged += OnFilterInput; inputField.OnValueChanged += OnFilterInput;
@ -187,7 +187,7 @@ namespace UnityExplorer.UI.ObjectExplorer
UIFactory.SetLayoutElement(refreshRow, minHeight: 30, flexibleHeight: 0); UIFactory.SetLayoutElement(refreshRow, minHeight: 30, flexibleHeight: 0);
var refreshButton = UIFactory.CreateButton(refreshRow, "RefreshButton", "Update"); var refreshButton = UIFactory.CreateButton(refreshRow, "RefreshButton", "Update");
UIFactory.SetLayoutElement(refreshButton.Button.gameObject, minWidth: 65, flexibleWidth: 0); UIFactory.SetLayoutElement(refreshButton.Component.gameObject, minWidth: 65, flexibleWidth: 0);
refreshButton.OnClick += UpdateTree; refreshButton.OnClick += UpdateTree;
var refreshToggle = UIFactory.CreateToggle(refreshRow, "RefreshToggle", out Toggle toggle, out Text text); var refreshToggle = UIFactory.CreateToggle(refreshRow, "RefreshToggle", out Toggle toggle, out Text text);
@ -249,38 +249,38 @@ namespace UnityExplorer.UI.ObjectExplorer
var buttonRow = UIFactory.CreateHorizontalGroup(sceneLoaderObj, "LoadButtons", true, true, true, true, 4); var buttonRow = UIFactory.CreateHorizontalGroup(sceneLoaderObj, "LoadButtons", true, true, true, true, 4);
var loadButton = UIFactory.CreateButton(buttonRow, "LoadSceneButton", "Load (Single)", new Color(0.1f, 0.3f, 0.3f)); var loadButton = UIFactory.CreateButton(buttonRow, "LoadSceneButton", "Load (Single)", new Color(0.1f, 0.3f, 0.3f));
UIFactory.SetLayoutElement(loadButton.Button.gameObject, minHeight: 25, minWidth: 150); UIFactory.SetLayoutElement(loadButton.Component.gameObject, minHeight: 25, minWidth: 150);
loadButton.OnClick += () => loadButton.OnClick += () =>
{ {
TryLoadScene(LoadSceneMode.Single, allSceneDrop); TryLoadScene(LoadSceneMode.Single, allSceneDrop);
}; };
var loadAdditiveButton = UIFactory.CreateButton(buttonRow, "LoadSceneButton", "Load (Additive)", new Color(0.1f, 0.3f, 0.3f)); var loadAdditiveButton = UIFactory.CreateButton(buttonRow, "LoadSceneButton", "Load (Additive)", new Color(0.1f, 0.3f, 0.3f));
UIFactory.SetLayoutElement(loadAdditiveButton.Button.gameObject, minHeight: 25, minWidth: 150); UIFactory.SetLayoutElement(loadAdditiveButton.Component.gameObject, minHeight: 25, minWidth: 150);
loadAdditiveButton.OnClick += () => loadAdditiveButton.OnClick += () =>
{ {
TryLoadScene(LoadSceneMode.Additive, allSceneDrop); TryLoadScene(LoadSceneMode.Additive, allSceneDrop);
}; };
var disabledColor = new Color(0.24f, 0.24f, 0.24f); var disabledColor = new Color(0.24f, 0.24f, 0.24f);
RuntimeProvider.Instance.SetColorBlock(loadButton.Button, disabled: disabledColor); RuntimeProvider.Instance.SetColorBlock(loadButton.Component, disabled: disabledColor);
RuntimeProvider.Instance.SetColorBlock(loadAdditiveButton.Button, disabled: disabledColor); RuntimeProvider.Instance.SetColorBlock(loadAdditiveButton.Component, disabled: disabledColor);
loadButton.Button.interactable = false; loadButton.Component.interactable = false;
loadAdditiveButton.Button.interactable = false; loadAdditiveButton.Component.interactable = false;
allSceneDrop.onValueChanged.AddListener((int val) => allSceneDrop.onValueChanged.AddListener((int val) =>
{ {
var text = allSceneDrop.options[val].text; var text = allSceneDrop.options[val].text;
if (text == DEFAULT_LOAD_TEXT) if (text == DEFAULT_LOAD_TEXT)
{ {
loadButton.Button.interactable = false; loadButton.Component.interactable = false;
loadAdditiveButton.Button.interactable = false; loadAdditiveButton.Component.interactable = false;
} }
else else
{ {
loadButton.Button.interactable = true; loadButton.Component.interactable = true;
loadAdditiveButton.Button.interactable = true; loadAdditiveButton.Component.interactable = true;
} }
}); });
} }

View File

@ -43,7 +43,7 @@ namespace UnityExplorer.UI.Panels
content.SetActive(true); content.SetActive(true);
var button = tabButtons[tabIndex]; var button = tabButtons[tabIndex];
RuntimeProvider.Instance.SetColorBlock(button.Button, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(button.Component, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f);
SelectedTab = tabIndex; SelectedTab = tabIndex;
SaveToConfigManager(); SaveToConfigManager();
@ -52,7 +52,7 @@ namespace UnityExplorer.UI.Panels
private void DisableTab(int tabIndex) private void DisableTab(int tabIndex)
{ {
tabPages[tabIndex].SetActive(false); tabPages[tabIndex].SetActive(false);
RuntimeProvider.Instance.SetColorBlock(tabButtons[tabIndex].Button, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(tabButtons[tabIndex].Component, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
} }
public override void Update() public override void Update()

View File

@ -29,11 +29,11 @@ namespace UnityExplorer.UI.Panels
Instances.Sort((a, b) => b.Panel.GetSiblingIndex().CompareTo(a.Panel.GetSiblingIndex())); Instances.Sort((a, b) => b.Panel.GetSiblingIndex().CompareTo(a.Panel.GetSiblingIndex()));
// move AutoCompleter to bottom // move AutoCompleter to bottom
if (AutoCompleter.Instance != null) if (AutoCompleteModal.Instance != null)
{ {
var idx = Instances.IndexOf(AutoCompleter.Instance.Dragger); var idx = Instances.IndexOf(AutoCompleteModal.Instance.Dragger);
Instances.RemoveAt(idx); Instances.RemoveAt(idx);
Instances.Insert(0, AutoCompleter.Instance.Dragger); Instances.Insert(0, AutoCompleteModal.Instance.Dragger);
} }
} }

View File

@ -116,9 +116,9 @@ namespace UnityExplorer.UI.Panels
if (NavButtonWanted) if (NavButtonWanted)
{ {
if (active) if (active)
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(NavButton.Component, UIManager.enabledButtonColor, UIManager.enabledButtonColor * 1.2f);
else else
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(NavButton.Component, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
} }
} }
@ -149,8 +149,8 @@ namespace UnityExplorer.UI.Panels
// create navbar button // create navbar button
NavButton = UIFactory.CreateButton(UIManager.NavbarButtonHolder, $"Button_{PanelType}", Name); NavButton = UIFactory.CreateButton(UIManager.NavbarButtonHolder, $"Button_{PanelType}", Name);
UIFactory.SetLayoutElement(NavButton.Button.gameObject, minWidth: 118, flexibleWidth: 0); UIFactory.SetLayoutElement(NavButton.Component.gameObject, minWidth: 118, flexibleWidth: 0);
RuntimeProvider.Instance.SetColorBlock(NavButton.Button, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f); RuntimeProvider.Instance.SetColorBlock(NavButton.Component, UIManager.disabledButtonColor, UIManager.disabledButtonColor * 1.2f);
NavButton.OnClick += () => NavButton.OnClick += () =>
{ {
UIManager.TogglePanel(PanelType); UIManager.TogglePanel(PanelType);
@ -187,8 +187,8 @@ namespace UnityExplorer.UI.Panels
UIFactory.SetLayoutElement(closeHolder, minHeight: 25, flexibleHeight: 0, minWidth: 30, flexibleWidth: 9999); UIFactory.SetLayoutElement(closeHolder, minHeight: 25, flexibleHeight: 0, minWidth: 30, flexibleWidth: 9999);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(closeHolder, false, false, true, true, 0, childAlignment: TextAnchor.MiddleRight); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(closeHolder, false, false, true, true, 0, childAlignment: TextAnchor.MiddleRight);
var closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—"); var closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—");
UIFactory.SetLayoutElement(closeBtn.Button.gameObject, minHeight: 25, minWidth: 25, flexibleWidth: 0); UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 25, flexibleWidth: 0);
RuntimeProvider.Instance.SetColorBlock(closeBtn.Button, new Color(0.33f, 0.32f, 0.31f)); RuntimeProvider.Instance.SetColorBlock(closeBtn.Component, new Color(0.33f, 0.32f, 0.31f));
closeBtn.OnClick += () => closeBtn.OnClick += () =>
{ {

View File

@ -262,7 +262,7 @@ namespace UnityExplorer.UI
var btn = CreateButton(parent, name, text, colors); var btn = CreateButton(parent, name, text, colors);
RuntimeProvider.Instance.SetColorBlock(btn.Button, normalColor, normalColor * 1.2f, normalColor * 0.7f); RuntimeProvider.Instance.SetColorBlock(btn.Component, normalColor, normalColor * 1.2f, normalColor * 0.7f);
return btn; return btn;
} }
@ -893,12 +893,12 @@ namespace UnityExplorer.UI
var inputField = CreateInputField(viewportObj, "InputField", placeHolderText); var inputField = CreateInputField(viewportObj, "InputField", placeHolderText);
var content = inputField.UIRoot; var content = inputField.UIRoot;
var textComp = inputField.InputField.textComponent; var textComp = inputField.Component.textComponent;
textComp.alignment = TextAnchor.UpperLeft; textComp.alignment = TextAnchor.UpperLeft;
textComp.fontSize = fontSize; textComp.fontSize = fontSize;
textComp.horizontalOverflow = HorizontalWrapMode.Wrap; textComp.horizontalOverflow = HorizontalWrapMode.Wrap;
inputField.InputField.lineType = InputField.LineType.MultiLineNewline; inputField.Component.lineType = InputField.LineType.MultiLineNewline;
inputField.InputField.targetGraphic.color = color; inputField.Component.targetGraphic.color = color;
inputField.PlaceholderText.alignment = TextAnchor.UpperLeft; inputField.PlaceholderText.alignment = TextAnchor.UpperLeft;
inputField.PlaceholderText.fontSize = fontSize; inputField.PlaceholderText.fontSize = fontSize;
inputField.PlaceholderText.horizontalOverflow = HorizontalWrapMode.Wrap; inputField.PlaceholderText.horizontalOverflow = HorizontalWrapMode.Wrap;
@ -911,8 +911,8 @@ namespace UnityExplorer.UI
contentRect.anchorMax = new Vector2(1, 1); contentRect.anchorMax = new Vector2(1, 1);
contentRect.offsetMin = new Vector2(2, 0); contentRect.offsetMin = new Vector2(2, 0);
contentRect.offsetMax = new Vector2(2, 0); contentRect.offsetMax = new Vector2(2, 0);
inputField.InputField.lineType = InputField.LineType.MultiLineNewline; inputField.Component.lineType = InputField.LineType.MultiLineNewline;
inputField.InputField.targetGraphic.color = color; inputField.Component.targetGraphic.color = color;
// Slider // Slider

View File

@ -44,7 +44,7 @@ namespace UnityExplorer.UI
public static InspectorPanel Inspector { get; private set; } public static InspectorPanel Inspector { get; private set; }
public static CSConsolePanel CSharpConsole { get; private set; } public static CSConsolePanel CSharpConsole { get; private set; }
public static AutoCompleter AutoCompleter { get; private set; } public static AutoCompleteModal AutoCompleter { get; private set; }
// assets // assets
internal static Font ConsoleFont { get; private set; } internal static Font ConsoleFont { get; private set; }
@ -167,7 +167,7 @@ namespace UnityExplorer.UI
//InspectUnderMouse.ConstructUI(); //InspectUnderMouse.ConstructUI();
AutoCompleter = new AutoCompleter(); AutoCompleter = new AutoCompleteModal();
AutoCompleter.ConstructUI(); AutoCompleter.ConstructUI();
Explorer = new ObjectExplorerPanel(); Explorer = new ObjectExplorerPanel();
@ -278,8 +278,8 @@ namespace UnityExplorer.UI
// Hide menu button // Hide menu button
var closeBtn = UIFactory.CreateButton(navbarPanel, "CloseButton", ConfigManager.Main_Menu_Toggle.Value.ToString()); var closeBtn = UIFactory.CreateButton(navbarPanel, "CloseButton", ConfigManager.Main_Menu_Toggle.Value.ToString());
UIFactory.SetLayoutElement(closeBtn.Button.gameObject, minHeight: 25, minWidth: 80, flexibleWidth: 0); UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 80, flexibleWidth: 0);
RuntimeProvider.Instance.SetColorBlock(closeBtn.Button, new Color(0.63f, 0.32f, 0.31f), RuntimeProvider.Instance.SetColorBlock(closeBtn.Component, new Color(0.63f, 0.32f, 0.31f),
new Color(0.81f, 0.25f, 0.2f), new Color(0.6f, 0.18f, 0.16f)); new Color(0.81f, 0.25f, 0.2f), new Color(0.6f, 0.18f, 0.16f));
ConfigManager.Main_Menu_Toggle.OnValueChanged += (KeyCode val) => { closeBtn.ButtonText.text = val.ToString(); }; ConfigManager.Main_Menu_Toggle.OnValueChanged += (KeyCode val) => { closeBtn.ButtonText.text = val.ToString(); };

View File

@ -53,8 +53,8 @@ namespace UnityExplorer.UI.Widgets
UIRoot.SetActive(false); UIRoot.SetActive(false);
this.Button = UIFactory.CreateButton(UIRoot, "NameButton", "Name"); this.Button = UIFactory.CreateButton(UIRoot, "NameButton", "Name");
UIFactory.SetLayoutElement(Button.Button.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0); UIFactory.SetLayoutElement(Button.Component.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
var buttonText = Button.Button.GetComponentInChildren<Text>(); var buttonText = Button.Component.GetComponentInChildren<Text>();
buttonText.horizontalOverflow = HorizontalWrapMode.Overflow; buttonText.horizontalOverflow = HorizontalWrapMode.Overflow;
buttonText.alignment = TextAnchor.MiddleLeft; buttonText.alignment = TextAnchor.MiddleLeft;
@ -62,7 +62,7 @@ namespace UnityExplorer.UI.Widgets
Color highlight = new Color(0.25f, 0.25f, 0.25f); Color highlight = new Color(0.25f, 0.25f, 0.25f);
Color pressed = new Color(0.05f, 0.05f, 0.05f); Color pressed = new Color(0.05f, 0.05f, 0.05f);
Color disabled = new Color(1, 1, 1, 0); Color disabled = new Color(1, 1, 1, 0);
RuntimeProvider.Instance.SetColorBlock(Button.Button, normal, highlight, pressed, disabled); RuntimeProvider.Instance.SetColorBlock(Button.Component, normal, highlight, pressed, disabled);
Button.OnClick += () => { OnClick?.Invoke(CurrentDataIndex); }; Button.OnClick += () => { OnClick?.Invoke(CurrentDataIndex); };

View File

@ -55,13 +55,13 @@ namespace UnityExplorer.UI.Widgets
{ {
NameButton.ButtonText.text = $"<color=grey>[{childCount}]</color> {NameButton.ButtonText.text}"; NameButton.ButtonText.text = $"<color=grey>[{childCount}]</color> {NameButton.ButtonText.text}";
ExpandButton.Button.interactable = true; ExpandButton.Component.interactable = true;
ExpandButton.ButtonText.text = cached.Expanded ? "▼" : "►"; ExpandButton.ButtonText.text = cached.Expanded ? "▼" : "►";
ExpandButton.ButtonText.color = cached.Expanded ? new Color(0.5f, 0.5f, 0.5f) : new Color(0.3f, 0.3f, 0.3f); ExpandButton.ButtonText.color = cached.Expanded ? new Color(0.5f, 0.5f, 0.5f) : new Color(0.3f, 0.3f, 0.3f);
} }
else else
{ {
ExpandButton.Button.interactable = false; ExpandButton.Component.interactable = false;
ExpandButton.ButtonText.text = "▪"; ExpandButton.ButtonText.text = "▪";
ExpandButton.ButtonText.color = new Color(0.3f, 0.3f, 0.3f); ExpandButton.ButtonText.color = new Color(0.3f, 0.3f, 0.3f);
} }
@ -114,11 +114,11 @@ namespace UnityExplorer.UI.Widgets
this.spacer = spacerObj.GetComponent<LayoutElement>(); this.spacer = spacerObj.GetComponent<LayoutElement>();
ExpandButton = UIFactory.CreateButton(this.UIRoot, "ExpandButton", "►"); ExpandButton = UIFactory.CreateButton(this.UIRoot, "ExpandButton", "►");
UIFactory.SetLayoutElement(ExpandButton.Button.gameObject, minWidth: 15, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0); UIFactory.SetLayoutElement(ExpandButton.Component.gameObject, minWidth: 15, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0);
NameButton = UIFactory.CreateButton(this.UIRoot, "NameButton", "Name", null); NameButton = UIFactory.CreateButton(this.UIRoot, "NameButton", "Name", null);
UIFactory.SetLayoutElement(NameButton.Button.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0); UIFactory.SetLayoutElement(NameButton.Component.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
var nameLabel = NameButton.Button.GetComponentInChildren<Text>(); var nameLabel = NameButton.Component.GetComponentInChildren<Text>();
nameLabel.horizontalOverflow = HorizontalWrapMode.Overflow; nameLabel.horizontalOverflow = HorizontalWrapMode.Overflow;
nameLabel.alignment = TextAnchor.MiddleLeft; nameLabel.alignment = TextAnchor.MiddleLeft;
@ -126,8 +126,8 @@ namespace UnityExplorer.UI.Widgets
Color highlight = new Color(0.25f, 0.25f, 0.25f); Color highlight = new Color(0.25f, 0.25f, 0.25f);
Color pressed = new Color(0.05f, 0.05f, 0.05f); Color pressed = new Color(0.05f, 0.05f, 0.05f);
Color disabled = new Color(1, 1, 1, 0); Color disabled = new Color(1, 1, 1, 0);
RuntimeProvider.Instance.SetColorBlock(ExpandButton.Button, normal, highlight, pressed, disabled); RuntimeProvider.Instance.SetColorBlock(ExpandButton.Component, normal, highlight, pressed, disabled);
RuntimeProvider.Instance.SetColorBlock(NameButton.Button, normal, highlight, pressed, disabled); RuntimeProvider.Instance.SetColorBlock(NameButton.Component, normal, highlight, pressed, disabled);
NameButton.OnClick += OnMainButtonClicked; NameButton.OnClick += OnMainButtonClicked;
ExpandButton.OnClick += OnExpandClicked; ExpandButton.OnClick += OnExpandClicked;