mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-15 07:56:41 +08:00
Automatic code cleanup (no real changes)
- Use explicit type of var - Use 'new()' - Remove unnecessary usings - Sort usings - Apply formatting
This commit is contained in:
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityExplorer.Config;
|
||||
using UniverseLib;
|
||||
@ -45,7 +41,7 @@ namespace UnityExplorer.UI
|
||||
ConfigManager.Target_Display.Value = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ActiveDisplayIndex = display;
|
||||
ActiveDisplay.Activate();
|
||||
@ -72,7 +68,7 @@ namespace UnityExplorer.UI
|
||||
yield return null;
|
||||
yield return null;
|
||||
|
||||
foreach (var panel in UIManager.UIPanels.Values)
|
||||
foreach (Panels.UIPanel panel in UIManager.UIPanels.Values)
|
||||
{
|
||||
panel.EnsureValidSize();
|
||||
panel.EnsureValidPosition();
|
||||
|
@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI;
|
||||
|
||||
namespace UnityExplorer.UI
|
||||
@ -48,7 +43,7 @@ namespace UnityExplorer.UI
|
||||
popupLabel = UIFactory.CreateLabel(UIManager.UIRoot, "ClipboardNotification", "", TextAnchor.MiddleCenter);
|
||||
popupLabel.rectTransform.sizeDelta = new(500, 100);
|
||||
popupLabel.gameObject.AddComponent<Outline>();
|
||||
var popupGroup = popupLabel.gameObject.AddComponent<CanvasGroup>();
|
||||
CanvasGroup popupGroup = popupLabel.gameObject.AddComponent<CanvasGroup>();
|
||||
popupGroup.blocksRaycasts = false;
|
||||
}
|
||||
}
|
||||
|
@ -2,19 +2,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using UniverseLib.Input;
|
||||
using UnityExplorer.Runtime;
|
||||
using UnityExplorer.UI;
|
||||
using UnityExplorer.UI.Panels;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UniverseLib;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI.Widgets.ButtonList;
|
||||
using UniverseLib.UI.Widgets.ScrollView;
|
||||
using UniverseLib.Utility;
|
||||
using UniverseLib.UI.Models;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
{
|
||||
@ -184,7 +180,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
|
||||
private void OnCellClicked(int dataIndex)
|
||||
{
|
||||
var suggestion = Suggestions[dataIndex];
|
||||
Suggestion suggestion = Suggestions[dataIndex];
|
||||
CurrentHandler.OnSuggestionClicked(suggestion);
|
||||
}
|
||||
|
||||
@ -198,7 +194,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
return;
|
||||
}
|
||||
|
||||
var suggestion = Suggestions[index];
|
||||
Suggestion suggestion = Suggestions[index];
|
||||
cell.Button.ButtonText.text = suggestion.DisplayText;
|
||||
|
||||
if (CurrentHandler.AllowNavigation && index == SelectedIndex && setFirstCell)
|
||||
@ -230,7 +226,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
|
||||
if (CurrentHandler.AnchorToCaretPosition)
|
||||
{
|
||||
var textGen = input.Component.cachedInputTextGenerator;
|
||||
TextGenerator textGen = input.Component.cachedInputTextGenerator;
|
||||
int caretIdx = Math.Max(0, Math.Min(textGen.characterCount - 1, input.Component.caretPosition));
|
||||
|
||||
// normalize the caret horizontal position
|
||||
|
@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UnityExplorer.CSConsole;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
@ -75,32 +69,32 @@ namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
// Tools Row
|
||||
|
||||
var toolsRow = UIFactory.CreateHorizontalGroup(this.uiContent, "ToggleRow", false, false, true, true, 5, new Vector4(8, 8, 10, 5),
|
||||
GameObject toolsRow = UIFactory.CreateHorizontalGroup(this.uiContent, "ToggleRow", false, false, true, true, 5, new Vector4(8, 8, 10, 5),
|
||||
default, TextAnchor.MiddleLeft);
|
||||
UIFactory.SetLayoutElement(toolsRow, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||
|
||||
// Buttons
|
||||
|
||||
var compileButton = UIFactory.CreateButton(toolsRow, "CompileButton", "Compile", new Color(0.33f, 0.5f, 0.33f));
|
||||
ButtonRef compileButton = UIFactory.CreateButton(toolsRow, "CompileButton", "Compile", new Color(0.33f, 0.5f, 0.33f));
|
||||
UIFactory.SetLayoutElement(compileButton.Component.gameObject, minHeight: 28, minWidth: 130, flexibleHeight: 0);
|
||||
compileButton.ButtonText.fontSize = 15;
|
||||
compileButton.OnClick += () => { OnCompileClicked?.Invoke(); };
|
||||
|
||||
var resetButton = UIFactory.CreateButton(toolsRow, "ResetButton", "Reset", new Color(0.33f, 0.33f, 0.33f));
|
||||
ButtonRef resetButton = UIFactory.CreateButton(toolsRow, "ResetButton", "Reset", new Color(0.33f, 0.33f, 0.33f));
|
||||
UIFactory.SetLayoutElement(resetButton.Component.gameObject, minHeight: 28, minWidth: 80, flexibleHeight: 0);
|
||||
resetButton.ButtonText.fontSize = 15;
|
||||
resetButton.OnClick += () => { OnResetClicked?.Invoke(); };
|
||||
|
||||
// Help dropdown
|
||||
|
||||
var helpDrop = UIFactory.CreateDropdown(toolsRow, "HelpDropdown", out var dropdown, "Help", 14, null);
|
||||
GameObject helpDrop = UIFactory.CreateDropdown(toolsRow, "HelpDropdown", out Dropdown dropdown, "Help", 14, null);
|
||||
UIFactory.SetLayoutElement(helpDrop, minHeight: 25, minWidth: 100);
|
||||
HelpDropdown = dropdown;
|
||||
HelpDropdown.onValueChanged.AddListener((int val) => { this.OnHelpDropdownChanged?.Invoke(val); });
|
||||
|
||||
// Enable Ctrl+R toggle
|
||||
|
||||
var ctrlRToggleObj = UIFactory.CreateToggle(toolsRow, "CtrlRToggle", out var CtrlRToggle, out Text ctrlRToggleText);
|
||||
GameObject ctrlRToggleObj = UIFactory.CreateToggle(toolsRow, "CtrlRToggle", out Toggle CtrlRToggle, out Text ctrlRToggleText);
|
||||
UIFactory.SetLayoutElement(ctrlRToggleObj, minWidth: 150, flexibleWidth: 0, minHeight: 25);
|
||||
ctrlRToggleText.alignment = TextAnchor.UpperLeft;
|
||||
ctrlRToggleText.text = "Compile on Ctrl+R";
|
||||
@ -108,7 +102,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Enable Suggestions toggle
|
||||
|
||||
var suggestToggleObj = UIFactory.CreateToggle(toolsRow, "SuggestionToggle", out var SuggestionsToggle, out Text suggestToggleText);
|
||||
GameObject suggestToggleObj = UIFactory.CreateToggle(toolsRow, "SuggestionToggle", out Toggle SuggestionsToggle, out Text suggestToggleText);
|
||||
UIFactory.SetLayoutElement(suggestToggleObj, minWidth: 120, flexibleWidth: 0, minHeight: 25);
|
||||
suggestToggleText.alignment = TextAnchor.UpperLeft;
|
||||
suggestToggleText.text = "Suggestions";
|
||||
@ -116,7 +110,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Enable Auto-indent toggle
|
||||
|
||||
var autoIndentToggleObj = UIFactory.CreateToggle(toolsRow, "IndentToggle", out var AutoIndentToggle, out Text autoIndentToggleText);
|
||||
GameObject autoIndentToggleObj = UIFactory.CreateToggle(toolsRow, "IndentToggle", out Toggle AutoIndentToggle, out Text autoIndentToggleText);
|
||||
UIFactory.SetLayoutElement(autoIndentToggleObj, minWidth: 120, flexibleWidth: 0, minHeight: 25);
|
||||
autoIndentToggleText.alignment = TextAnchor.UpperLeft;
|
||||
autoIndentToggleText.text = "Auto-indent";
|
||||
@ -124,7 +118,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Console Input
|
||||
|
||||
var inputArea = UIFactory.CreateUIObject("InputGroup", uiContent);
|
||||
GameObject inputArea = UIFactory.CreateUIObject("InputGroup", uiContent);
|
||||
UIFactory.SetLayoutElement(inputArea, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(inputArea, false, true, true, true);
|
||||
inputArea.AddComponent<Image>().color = Color.white;
|
||||
@ -132,8 +126,8 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// line numbers
|
||||
|
||||
var linesHolder = UIFactory.CreateUIObject("LinesHolder", inputArea);
|
||||
var linesRect = linesHolder.GetComponent<RectTransform>();
|
||||
GameObject linesHolder = UIFactory.CreateUIObject("LinesHolder", inputArea);
|
||||
RectTransform linesRect = linesHolder.GetComponent<RectTransform>();
|
||||
linesRect.pivot = new Vector2(0, 1);
|
||||
linesRect.anchorMin = new Vector2(0, 0);
|
||||
linesRect.anchorMax = new Vector2(0, 1);
|
||||
@ -149,8 +143,8 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
int fontSize = 16;
|
||||
|
||||
var inputObj = UIFactory.CreateScrollInputField(inputArea, "ConsoleInput", ConsoleController.STARTUP_TEXT,
|
||||
out var inputScroller, fontSize);
|
||||
GameObject inputObj = UIFactory.CreateScrollInputField(inputArea, "ConsoleInput", ConsoleController.STARTUP_TEXT,
|
||||
out InputFieldScroller inputScroller, fontSize);
|
||||
InputScroller = inputScroller;
|
||||
ConsoleController.defaultInputFieldAlpha = Input.Component.selectionColor.a;
|
||||
Input.OnValueChanged += InvokeOnValueChanged;
|
||||
@ -173,8 +167,8 @@ namespace UnityExplorer.UI.Panels
|
||||
Input.PlaceholderText.fontSize = fontSize;
|
||||
|
||||
// Lexer highlight text overlay
|
||||
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", InputText.gameObject);
|
||||
var highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||
GameObject highlightTextObj = UIFactory.CreateUIObject("HighlightText", InputText.gameObject);
|
||||
RectTransform highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||
highlightTextRect.pivot = new Vector2(0, 1);
|
||||
highlightTextRect.anchorMin = Vector2.zero;
|
||||
highlightTextRect.anchorMax = Vector2.one;
|
||||
|
@ -1,17 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.CacheObject;
|
||||
using UnityExplorer.CacheObject.Views;
|
||||
using UnityExplorer.Config;
|
||||
using UniverseLib;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
namespace UnityExplorer.UI.Panels
|
||||
@ -41,14 +32,14 @@ namespace UnityExplorer.UI.Panels
|
||||
public static bool TryPaste(Type targetType, out object paste)
|
||||
{
|
||||
paste = Current;
|
||||
var pasteType = Current?.GetActualType();
|
||||
Type pasteType = Current?.GetActualType();
|
||||
|
||||
if (Current != null && !targetType.IsAssignableFrom(pasteType))
|
||||
{
|
||||
Notification.ShowMessage($"Cannot assign '{pasteType.Name}' to '{targetType.Name}'!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Notification.ShowMessage("Pasted!");
|
||||
return true;
|
||||
}
|
||||
@ -74,7 +65,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
InspectorManager.Inspect(Current);
|
||||
}
|
||||
|
||||
|
||||
protected internal override void DoSetDefaultPosAndAnchors()
|
||||
{
|
||||
this.Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, MinWidth);
|
||||
@ -89,20 +80,20 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Actual panel content
|
||||
|
||||
var firstRow = UIFactory.CreateHorizontalGroup(uiContent, "FirstRow", false, false, true, true, 5, new(2,2,2,2), new(1,1,1,0));
|
||||
GameObject firstRow = UIFactory.CreateHorizontalGroup(uiContent, "FirstRow", false, false, true, true, 5, new(2, 2, 2, 2), new(1, 1, 1, 0));
|
||||
UIFactory.SetLayoutElement(firstRow, minHeight: 25, flexibleWidth: 999);
|
||||
|
||||
// Title for "Current Paste:"
|
||||
var currentPasteTitle = UIFactory.CreateLabel(firstRow, "CurrentPasteTitle", "Current paste:", TextAnchor.MiddleLeft, color: Color.grey);
|
||||
Text currentPasteTitle = UIFactory.CreateLabel(firstRow, "CurrentPasteTitle", "Current paste:", TextAnchor.MiddleLeft, color: Color.grey);
|
||||
UIFactory.SetLayoutElement(currentPasteTitle.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
||||
|
||||
// Clear clipboard button
|
||||
var clearButton = UIFactory.CreateButton(firstRow, "ClearPasteButton", "Clear Clipboard");
|
||||
UniverseLib.UI.Models.ButtonRef clearButton = UIFactory.CreateButton(firstRow, "ClearPasteButton", "Clear Clipboard");
|
||||
UIFactory.SetLayoutElement(clearButton.Component.gameObject, minWidth: 120, minHeight: 25, flexibleWidth: 0);
|
||||
clearButton.OnClick += () => Copy(null);
|
||||
|
||||
// Current Paste info row
|
||||
var currentPasteHolder = UIFactory.CreateHorizontalGroup(uiContent, "SecondRow", false, false, true, true, 0,
|
||||
GameObject currentPasteHolder = UIFactory.CreateHorizontalGroup(uiContent, "SecondRow", false, false, true, true, 0,
|
||||
new(2, 2, 2, 2), childAlignment: TextAnchor.UpperCenter);
|
||||
|
||||
// Actual current paste info label
|
||||
@ -111,7 +102,7 @@ namespace UnityExplorer.UI.Panels
|
||||
UpdateCurrentPasteInfo();
|
||||
|
||||
// Inspect button
|
||||
var inspectButton = UIFactory.CreateButton(currentPasteHolder, "InspectButton", "Inspect");
|
||||
UniverseLib.UI.Models.ButtonRef inspectButton = UIFactory.CreateButton(currentPasteHolder, "InspectButton", "Inspect");
|
||||
UIFactory.SetLayoutElement(inspectButton.Component.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 80, flexibleWidth: 0);
|
||||
inspectButton.OnClick += InspectClipboard;
|
||||
}
|
||||
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UnityExplorer.Hooks;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
@ -87,7 +81,7 @@ namespace UnityExplorer.UI.Panels
|
||||
UIFactory.SetLayoutElement(currentHooksPanel, flexibleHeight: 9999, flexibleWidth: 9999);
|
||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(currentHooksPanel, true, true, true, true);
|
||||
|
||||
var addRow = UIFactory.CreateHorizontalGroup(currentHooksPanel, "AddRow", false, true, true, true, 4,
|
||||
GameObject addRow = UIFactory.CreateHorizontalGroup(currentHooksPanel, "AddRow", false, true, true, true, 4,
|
||||
new Vector4(2, 2, 2, 2), new Color(0.2f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(addRow, minHeight: 30, flexibleWidth: 9999);
|
||||
|
||||
@ -95,14 +89,14 @@ namespace UnityExplorer.UI.Panels
|
||||
UIFactory.SetLayoutElement(classSelectorInputField.Component.gameObject, flexibleWidth: 9999);
|
||||
new TypeCompleter(typeof(object), classSelectorInputField, true, false);
|
||||
|
||||
var addButton = UIFactory.CreateButton(addRow, "AddButton", "Add Hooks");
|
||||
ButtonRef addButton = UIFactory.CreateButton(addRow, "AddButton", "Add Hooks");
|
||||
UIFactory.SetLayoutElement(addButton.Component.gameObject, minWidth: 100, minHeight: 25);
|
||||
addButton.OnClick += OnClassInputAddClicked;
|
||||
|
||||
var hooksLabel = UIFactory.CreateLabel(currentHooksPanel, "HooksLabel", "Current Hooks", TextAnchor.MiddleCenter);
|
||||
Text hooksLabel = UIFactory.CreateLabel(currentHooksPanel, "HooksLabel", "Current Hooks", TextAnchor.MiddleCenter);
|
||||
UIFactory.SetLayoutElement(hooksLabel.gameObject, minHeight: 30, flexibleWidth: 9999);
|
||||
|
||||
HooksScrollPool = UIFactory.CreateScrollPool<HookCell>(currentHooksPanel, "HooksScrollPool",
|
||||
HooksScrollPool = UIFactory.CreateScrollPool<HookCell>(currentHooksPanel, "HooksScrollPool",
|
||||
out GameObject hooksScroll, out GameObject hooksContent);
|
||||
UIFactory.SetLayoutElement(hooksScroll, flexibleHeight: 9999);
|
||||
HooksScrollPool.Initialize(HookManager.Instance);
|
||||
@ -116,10 +110,10 @@ namespace UnityExplorer.UI.Panels
|
||||
addHooksLabel = UIFactory.CreateLabel(addHooksPanel, "AddLabel", "NOT SET", TextAnchor.MiddleCenter);
|
||||
UIFactory.SetLayoutElement(addHooksLabel.gameObject, minHeight: 30, minWidth: 100, flexibleWidth: 9999);
|
||||
|
||||
var buttonRow = UIFactory.CreateHorizontalGroup(addHooksPanel, "ButtonRow", false, false, true, true, 5);
|
||||
GameObject buttonRow = UIFactory.CreateHorizontalGroup(addHooksPanel, "ButtonRow", false, false, true, true, 5);
|
||||
UIFactory.SetLayoutElement(buttonRow, minHeight: 25, flexibleWidth: 9999);
|
||||
|
||||
var doneButton = UIFactory.CreateButton(buttonRow, "DoneButton", "Done", new Color(0.2f, 0.3f, 0.2f));
|
||||
ButtonRef doneButton = UIFactory.CreateButton(buttonRow, "DoneButton", "Done", new Color(0.2f, 0.3f, 0.2f));
|
||||
UIFactory.SetLayoutElement(doneButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||
doneButton.OnClick += HookManager.Instance.DoneAddingHooks;
|
||||
|
||||
@ -140,26 +134,26 @@ namespace UnityExplorer.UI.Panels
|
||||
UIFactory.SetLayoutElement(editorPanel, flexibleHeight: 9999, flexibleWidth: 9999);
|
||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(editorPanel, true, true, true, true);
|
||||
|
||||
var editorLabel = UIFactory.CreateLabel(editorPanel,
|
||||
"EditorLabel",
|
||||
Text editorLabel = UIFactory.CreateLabel(editorPanel,
|
||||
"EditorLabel",
|
||||
"Edit Harmony patch source as desired. Accepted method names are Prefix, Postfix, Finalizer and Transpiler (can define multiple).\n\n" +
|
||||
"Hooks are temporary! Please copy the source into your IDE to avoid losing work if you wish to keep it!",
|
||||
"Hooks are temporary! Please copy the source into your IDE to avoid losing work if you wish to keep it!",
|
||||
TextAnchor.MiddleLeft);
|
||||
UIFactory.SetLayoutElement(editorLabel.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||
|
||||
var editorButtonRow = UIFactory.CreateHorizontalGroup(editorPanel, "ButtonRow", false, false, true, true, 5);
|
||||
GameObject editorButtonRow = UIFactory.CreateHorizontalGroup(editorPanel, "ButtonRow", false, false, true, true, 5);
|
||||
UIFactory.SetLayoutElement(editorButtonRow, minHeight: 25, flexibleWidth: 9999);
|
||||
|
||||
var editorSaveButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Save and Return", new Color(0.2f, 0.3f, 0.2f));
|
||||
ButtonRef editorSaveButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Save and Return", new Color(0.2f, 0.3f, 0.2f));
|
||||
UIFactory.SetLayoutElement(editorSaveButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||
editorSaveButton.OnClick += HookManager.Instance.EditorInputSave;
|
||||
|
||||
var editorDoneButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Cancel and Return", new Color(0.2f, 0.2f, 0.2f));
|
||||
ButtonRef editorDoneButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Cancel and Return", new Color(0.2f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(editorDoneButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||
editorDoneButton.OnClick += HookManager.Instance.EditorInputCancel;
|
||||
|
||||
int fontSize = 16;
|
||||
var inputObj = UIFactory.CreateScrollInputField(editorPanel, "EditorInput", "", out var inputScroller, fontSize);
|
||||
GameObject inputObj = UIFactory.CreateScrollInputField(editorPanel, "EditorInput", "", out InputFieldScroller inputScroller, fontSize);
|
||||
EditorInputScroller = inputScroller;
|
||||
EditorInput.OnValueChanged += HookManager.Instance.OnEditorInputChanged;
|
||||
|
||||
@ -171,8 +165,8 @@ namespace UnityExplorer.UI.Panels
|
||||
EditorInput.PlaceholderText.fontSize = fontSize;
|
||||
|
||||
// Lexer highlight text overlay
|
||||
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", EditorInputText.gameObject);
|
||||
var highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||
GameObject highlightTextObj = UIFactory.CreateUIObject("HighlightText", EditorInputText.gameObject);
|
||||
RectTransform highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||
highlightTextRect.pivot = new Vector2(0, 1);
|
||||
highlightTextRect.anchorMin = Vector2.zero;
|
||||
highlightTextRect.anchorMax = Vector2.one;
|
||||
|
@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UnityExplorer.Inspectors;
|
||||
using UniverseLib.UI;
|
||||
|
||||
@ -54,11 +48,11 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public override void ConstructPanelContent()
|
||||
{
|
||||
var closeHolder = this.TitleBar.transform.Find("CloseHolder").gameObject;
|
||||
GameObject closeHolder = this.TitleBar.transform.Find("CloseHolder").gameObject;
|
||||
|
||||
// Inspect under mouse dropdown on title bar
|
||||
|
||||
var mouseDropdown = UIFactory.CreateDropdown(closeHolder, "MouseInspectDropdown", out MouseInspectDropdown, "Mouse Inspect", 14,
|
||||
GameObject mouseDropdown = UIFactory.CreateDropdown(closeHolder, "MouseInspectDropdown", out MouseInspectDropdown, "Mouse Inspect", 14,
|
||||
MouseInspector.OnDropdownSelect);
|
||||
UIFactory.SetLayoutElement(mouseDropdown, minHeight: 25, minWidth: 140);
|
||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("Mouse Inspect"));
|
||||
@ -68,7 +62,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// add close all button to titlebar
|
||||
|
||||
var closeAllBtn = UIFactory.CreateButton(closeHolder.gameObject, "CloseAllBtn", "Close All",
|
||||
UniverseLib.UI.Models.ButtonRef closeAllBtn = UIFactory.CreateButton(closeHolder.gameObject, "CloseAllBtn", "Close All",
|
||||
new Color(0.3f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(closeAllBtn.Component.gameObject, minHeight: 25, minWidth: 80);
|
||||
closeAllBtn.Component.transform.SetSiblingIndex(closeAllBtn.Component.transform.GetSiblingIndex() - 1);
|
||||
|
@ -3,15 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UniverseLib.UI.Widgets.ScrollView;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
@ -29,7 +26,7 @@ namespace UnityExplorer.UI.Panels
|
||||
public LogInfo(string message, LogType type) { this.message = message; this.type = type; }
|
||||
}
|
||||
|
||||
private static readonly List<LogInfo> Logs = new List<LogInfo>();
|
||||
private static readonly List<LogInfo> Logs = new();
|
||||
private static string CurrentStreamPath;
|
||||
|
||||
public override string Name => "Log";
|
||||
@ -67,16 +64,16 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
private void SetupIO()
|
||||
{
|
||||
var fileName = $"UnityExplorer {DateTime.Now:u}.txt";
|
||||
string fileName = $"UnityExplorer {DateTime.Now:u}.txt";
|
||||
fileName = IOUtility.EnsureValidFilename(fileName);
|
||||
var path = Path.Combine(ExplorerCore.ExplorerFolder, "Logs");
|
||||
string path = Path.Combine(ExplorerCore.ExplorerFolder, "Logs");
|
||||
CurrentStreamPath = IOUtility.EnsureValidFilePath(Path.Combine(path, fileName));
|
||||
|
||||
// clean old log(s)
|
||||
var files = Directory.GetFiles(path);
|
||||
string[] files = Directory.GetFiles(path);
|
||||
if (files.Length >= 10)
|
||||
{
|
||||
var sorted = files.ToList();
|
||||
List<string> sorted = files.ToList();
|
||||
// sort by 'datetime.ToString("u")' will put the oldest ones first
|
||||
sorted.Sort();
|
||||
for (int i = 0; i < files.Length - 9; i++)
|
||||
@ -113,7 +110,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Cell pool
|
||||
|
||||
private static readonly Dictionary<LogType, Color> logColors = new Dictionary<LogType, Color>
|
||||
private static readonly Dictionary<LogType, Color> logColors = new()
|
||||
{
|
||||
{ LogType.Log, Color.white },
|
||||
{ LogType.Warning, Color.yellow },
|
||||
@ -122,8 +119,8 @@ namespace UnityExplorer.UI.Panels
|
||||
{ LogType.Exception, Color.red },
|
||||
};
|
||||
|
||||
private readonly Color logEvenColor = new Color(0.34f, 0.34f, 0.34f);
|
||||
private readonly Color logOddColor = new Color(0.28f, 0.28f, 0.28f);
|
||||
private readonly Color logEvenColor = new(0.34f, 0.34f, 0.34f);
|
||||
private readonly Color logOddColor = new(0.28f, 0.28f, 0.28f);
|
||||
|
||||
public void OnCellBorrowed(ConsoleLogCell cell) { }
|
||||
|
||||
@ -138,12 +135,12 @@ namespace UnityExplorer.UI.Panels
|
||||
// Logs are displayed in reverse order (newest at top)
|
||||
index = Logs.Count - index - 1;
|
||||
|
||||
var log = Logs[index];
|
||||
LogInfo log = Logs[index];
|
||||
cell.IndexLabel.text = $"{index}:";
|
||||
cell.Input.Text = log.message;
|
||||
cell.Input.Component.textComponent.color = logColors[log.type];
|
||||
|
||||
var color = index % 2 == 0 ? logEvenColor : logOddColor;
|
||||
Color color = index % 2 == 0 ? logEvenColor : logOddColor;
|
||||
RuntimeHelper.SetColorBlock(cell.Input.Component, color);
|
||||
}
|
||||
|
||||
@ -167,21 +164,21 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Buttons and toggles
|
||||
|
||||
var optionsRow = UIFactory.CreateUIObject("OptionsRow", this.uiContent);
|
||||
GameObject optionsRow = UIFactory.CreateUIObject("OptionsRow", this.uiContent);
|
||||
UIFactory.SetLayoutElement(optionsRow, minHeight: 25, flexibleWidth: 9999);
|
||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(optionsRow, false, false, true, true, 5, 2, 2, 2, 2);
|
||||
|
||||
var clearButton = UIFactory.CreateButton(optionsRow, "ClearButton", "Clear", new Color(0.2f, 0.2f, 0.2f));
|
||||
ButtonRef clearButton = UIFactory.CreateButton(optionsRow, "ClearButton", "Clear", new Color(0.2f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(clearButton.Component.gameObject, minHeight: 23, flexibleHeight: 0, minWidth: 60);
|
||||
clearButton.OnClick += ClearLogs;
|
||||
clearButton.Component.transform.SetSiblingIndex(1);
|
||||
|
||||
var fileButton = UIFactory.CreateButton(optionsRow, "FileButton", "Open Log File", new Color(0.2f, 0.2f, 0.2f));
|
||||
ButtonRef fileButton = UIFactory.CreateButton(optionsRow, "FileButton", "Open Log File", new Color(0.2f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(fileButton.Component.gameObject, minHeight: 23, flexibleHeight: 0, minWidth: 100);
|
||||
fileButton.OnClick += OpenLogFile;
|
||||
fileButton.Component.transform.SetSiblingIndex(2);
|
||||
|
||||
var unityToggle = UIFactory.CreateToggle(optionsRow, "UnityLogToggle", out var toggle, out var toggleText);
|
||||
GameObject unityToggle = UIFactory.CreateToggle(optionsRow, "UnityLogToggle", out Toggle toggle, out Text toggleText);
|
||||
UIFactory.SetLayoutElement(unityToggle, minHeight: 25, minWidth: 150);
|
||||
toggleText.text = "Log Unity Debug?";
|
||||
toggle.isOn = ConfigManager.Log_Unity_Debug.Value;
|
||||
|
@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityExplorer.Inspectors.MouseInspectors;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UniverseLib.UI.Widgets.ButtonList;
|
||||
using UniverseLib.UI.Widgets.ScrollView;
|
||||
using UniverseLib.Utility;
|
||||
@ -53,7 +47,7 @@ namespace UnityExplorer.UI.Panels
|
||||
if (index >= UiInspector.LastHitObjects.Count)
|
||||
return;
|
||||
|
||||
var obj = UiInspector.LastHitObjects[index];
|
||||
GameObject obj = UiInspector.LastHitObjects[index];
|
||||
cell.Button.ButtonText.text = $"<color=cyan>{obj.name}</color> ({obj.transform.GetTransformPath(true)})";
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UniverseLib.UI.Models;
|
||||
using UnityExplorer.ObjectExplorer;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
|
||||
namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
@ -31,18 +23,18 @@ namespace UnityExplorer.UI.Panels
|
||||
public override bool ShouldSaveActiveState => true;
|
||||
|
||||
public int SelectedTab = 0;
|
||||
private readonly List<UIModel> tabPages = new List<UIModel>();
|
||||
private readonly List<ButtonRef> tabButtons = new List<ButtonRef>();
|
||||
private readonly List<UIModel> tabPages = new();
|
||||
private readonly List<ButtonRef> tabButtons = new();
|
||||
|
||||
public void SetTab(int tabIndex)
|
||||
{
|
||||
if (SelectedTab != -1)
|
||||
DisableTab(SelectedTab);
|
||||
|
||||
var content = tabPages[tabIndex];
|
||||
UIModel content = tabPages[tabIndex];
|
||||
content.SetActive(true);
|
||||
|
||||
var button = tabButtons[tabIndex];
|
||||
ButtonRef button = tabButtons[tabIndex];
|
||||
RuntimeHelper.SetColorBlock(button.Component, UniversalUI.EnabledButtonColor, UniversalUI.EnabledButtonColor * 1.2f);
|
||||
|
||||
SelectedTab = tabIndex;
|
||||
@ -99,7 +91,7 @@ namespace UnityExplorer.UI.Panels
|
||||
public override void ConstructPanelContent()
|
||||
{
|
||||
// Tab bar
|
||||
var tabGroup = UIFactory.CreateHorizontalGroup(uiContent, "TabBar", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||
GameObject tabGroup = UIFactory.CreateHorizontalGroup(uiContent, "TabBar", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||
UIFactory.SetLayoutElement(tabGroup, minHeight: 25, flexibleHeight: 0);
|
||||
|
||||
// Scene Explorer
|
||||
@ -122,7 +114,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
private void AddTabButton(GameObject tabGroup, string label)
|
||||
{
|
||||
var button = UIFactory.CreateButton(tabGroup, $"Button_{label}", label);
|
||||
ButtonRef button = UIFactory.CreateButton(tabGroup, $"Button_{label}", label);
|
||||
|
||||
int idx = tabButtons.Count;
|
||||
//button.onClick.AddListener(() => { SetTab(idx); });
|
||||
|
@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UnityExplorer.CacheObject;
|
||||
using UnityExplorer.CacheObject.Views;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UnityExplorer.Config;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Widgets.ScrollView;
|
||||
|
||||
@ -26,7 +21,7 @@ namespace UnityExplorer.UI.Panels
|
||||
public override bool ShowByDefault => false;
|
||||
|
||||
// Entry holders
|
||||
private readonly List<CacheConfigEntry> configEntries = new List<CacheConfigEntry>();
|
||||
private readonly List<CacheConfigEntry> configEntries = new();
|
||||
|
||||
// ICacheObjectController
|
||||
public CacheObjectBase ParentCacheObject => null;
|
||||
@ -39,10 +34,12 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public OptionsPanel()
|
||||
{
|
||||
foreach (var entry in ConfigManager.ConfigElements)
|
||||
foreach (KeyValuePair<string, IConfigElement> entry in ConfigManager.ConfigElements)
|
||||
{
|
||||
var cache = new CacheConfigEntry(entry.Value);
|
||||
cache.Owner = this;
|
||||
CacheConfigEntry cache = new(entry.Value)
|
||||
{
|
||||
Owner = this
|
||||
};
|
||||
configEntries.Add(cache);
|
||||
}
|
||||
}
|
||||
@ -71,18 +68,18 @@ namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
// Save button
|
||||
|
||||
var saveBtn = UIFactory.CreateButton(this.uiContent, "Save", "Save Options", new Color(0.2f, 0.3f, 0.2f));
|
||||
UniverseLib.UI.Models.ButtonRef saveBtn = UIFactory.CreateButton(this.uiContent, "Save", "Save Options", new Color(0.2f, 0.3f, 0.2f));
|
||||
UIFactory.SetLayoutElement(saveBtn.Component.gameObject, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 0);
|
||||
saveBtn.OnClick += ConfigManager.Handler.SaveConfig;
|
||||
|
||||
// Config entries
|
||||
|
||||
var scrollPool = UIFactory.CreateScrollPool<ConfigEntryCell>(this.uiContent, "ConfigEntries", out GameObject scrollObj,
|
||||
ScrollPool<ConfigEntryCell> scrollPool = UIFactory.CreateScrollPool<ConfigEntryCell>(this.uiContent, "ConfigEntries", out GameObject scrollObj,
|
||||
out GameObject scrollContent);
|
||||
|
||||
scrollPool.Initialize(this);
|
||||
|
||||
foreach (var config in configEntries)
|
||||
foreach (CacheConfigEntry config in configEntries)
|
||||
config.UpdateValueFromSource();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI.Models;
|
||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
namespace UnityExplorer.UI.Panels
|
||||
@ -46,7 +41,7 @@ namespace UnityExplorer.UI.Panels
|
||||
wasAnyDragging = false;
|
||||
Resizing = false;
|
||||
|
||||
foreach (var instance in Instances)
|
||||
foreach (PanelDragger instance in Instances)
|
||||
{
|
||||
instance.WasDragging = false;
|
||||
instance.WasResizing = false;
|
||||
@ -60,7 +55,7 @@ namespace UnityExplorer.UI.Panels
|
||||
// move AutoCompleter to bottom
|
||||
if (AutoCompleteModal.Instance != null)
|
||||
{
|
||||
var idx = Instances.IndexOf(AutoCompleteModal.Instance.Dragger);
|
||||
int idx = Instances.IndexOf(AutoCompleteModal.Instance.Dragger);
|
||||
Instances.RemoveAt(idx);
|
||||
Instances.Insert(0, AutoCompleteModal.Instance.Dragger);
|
||||
}
|
||||
@ -82,10 +77,10 @@ namespace UnityExplorer.UI.Panels
|
||||
else
|
||||
state = MouseState.NotPressed;
|
||||
|
||||
var mousePos = DisplayManager.MousePosition;
|
||||
Vector3 mousePos = DisplayManager.MousePosition;
|
||||
|
||||
handledInstanceThisFrame = false;
|
||||
foreach (var instance in Instances)
|
||||
foreach (PanelDragger instance in Instances)
|
||||
{
|
||||
if (!instance.Panel.gameObject.activeSelf)
|
||||
continue;
|
||||
@ -97,7 +92,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
if (wasAnyDragging && state == MouseState.NotPressed)
|
||||
{
|
||||
foreach (var instance in Instances)
|
||||
foreach (PanelDragger instance in Instances)
|
||||
instance.WasDragging = false;
|
||||
wasAnyDragging = false;
|
||||
}
|
||||
@ -243,7 +238,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public void OnDrag()
|
||||
{
|
||||
var mousePos = DisplayManager.MousePosition;
|
||||
Vector3 mousePos = DisplayManager.MousePosition;
|
||||
|
||||
Vector2 diff = (Vector2)mousePos - lastDragPosition;
|
||||
lastDragPosition = mousePos;
|
||||
@ -266,10 +261,10 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
private readonly Dictionary<ResizeTypes, Rect> m_resizeMask = new()
|
||||
{
|
||||
{ ResizeTypes.Top, default },
|
||||
{ ResizeTypes.Left, default },
|
||||
{ ResizeTypes.Right, default },
|
||||
{ ResizeTypes.Bottom, default },
|
||||
{ ResizeTypes.Top, default },
|
||||
{ ResizeTypes.Left, default },
|
||||
{ ResizeTypes.Right, default },
|
||||
{ ResizeTypes.Bottom, default },
|
||||
};
|
||||
|
||||
[Flags]
|
||||
@ -438,8 +433,8 @@ namespace UnityExplorer.UI.Panels
|
||||
else if (currentResizeType.HasFlag(ResizeTypes.Bottom))
|
||||
anchorMin.y -= diffY;
|
||||
|
||||
var prevMin = Panel.anchorMin;
|
||||
var prevMax = Panel.anchorMax;
|
||||
Vector2 prevMin = Panel.anchorMin;
|
||||
Vector2 prevMax = Panel.anchorMax;
|
||||
|
||||
Panel.anchorMin = new Vector2(anchorMin.x, anchorMin.y);
|
||||
Panel.anchorMax = new Vector2(anchorMax.x, anchorMax.y);
|
||||
@ -469,9 +464,9 @@ namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
try
|
||||
{
|
||||
var text = UIFactory.CreateLabel(UIManager.UIRoot, "ResizeCursor", "↔", TextAnchor.MiddleCenter, Color.white, true, 35);
|
||||
Text text = UIFactory.CreateLabel(UIManager.UIRoot, "ResizeCursor", "↔", TextAnchor.MiddleCenter, Color.white, true, 35);
|
||||
resizeCursorObj = text.gameObject;
|
||||
var outline = text.gameObject.AddComponent<Outline>();
|
||||
Outline outline = text.gameObject.AddComponent<Outline>();
|
||||
outline.effectColor = Color.black;
|
||||
outline.effectDistance = new(1, 1);
|
||||
|
||||
|
@ -1,17 +1,14 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
using UniverseLib.Input;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib;
|
||||
using System.Collections;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
|
||||
namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
@ -33,7 +30,7 @@ namespace UnityExplorer.UI.Panels
|
||||
return;
|
||||
|
||||
// if the user is clicking
|
||||
if (DisplayManager.MouseInTargetDisplay
|
||||
if (DisplayManager.MouseInTargetDisplay
|
||||
&& (InputManager.GetMouseButtonDown(0) || InputManager.GetMouseButtonDown(1)))
|
||||
{
|
||||
int count = UIManager.PanelHolder.transform.childCount;
|
||||
@ -117,7 +114,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
if (NavButtonWanted)
|
||||
{
|
||||
var color = active ? UniversalUI.EnabledButtonColor : UniversalUI.DisabledButtonColor;
|
||||
Color color = active ? UniversalUI.EnabledButtonColor : UniversalUI.DisabledButtonColor;
|
||||
RuntimeHelper.SetColorBlock(NavButton.Component, color, color * 1.2f);
|
||||
}
|
||||
}
|
||||
@ -156,11 +153,11 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public static void EnsureValidPosition(RectTransform panel)
|
||||
{
|
||||
var pos = panel.localPosition;
|
||||
Vector3 pos = panel.localPosition;
|
||||
|
||||
// Prevent panel going oustide screen bounds
|
||||
var halfW = DisplayManager.Width * 0.5f;
|
||||
var halfH = DisplayManager.Height * 0.5f;
|
||||
float halfW = DisplayManager.Width * 0.5f;
|
||||
float halfH = DisplayManager.Height * 0.5f;
|
||||
|
||||
pos.x = Math.Max(-halfW - panel.rect.width + 50, Math.Min(pos.x, halfW - 50));
|
||||
pos.y = Math.Max(-halfH + 50, Math.Min(pos.y, halfH));
|
||||
@ -186,11 +183,11 @@ namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
try
|
||||
{
|
||||
return string.Join("|", new string[]
|
||||
{
|
||||
$"{ShouldSaveActiveState && Enabled}",
|
||||
Rect.RectAnchorsToString(),
|
||||
Rect.RectPositionToString()
|
||||
return string.Join("|", new string[]
|
||||
{
|
||||
$"{ShouldSaveActiveState && Enabled}",
|
||||
Rect.RectAnchorsToString(),
|
||||
Rect.RectPositionToString()
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -211,7 +208,7 @@ namespace UnityExplorer.UI.Panels
|
||||
if (string.IsNullOrEmpty(data))
|
||||
return;
|
||||
|
||||
var split = data.Split('|');
|
||||
string[] split = data.Split('|');
|
||||
|
||||
try
|
||||
{
|
||||
@ -240,7 +237,7 @@ namespace UnityExplorer.UI.Panels
|
||||
// create navbar button
|
||||
|
||||
NavButton = UIFactory.CreateButton(UIManager.NavbarTabButtonHolder, $"Button_{PanelType}", Name);
|
||||
var navBtn = NavButton.Component.gameObject;
|
||||
GameObject navBtn = NavButton.Component.gameObject;
|
||||
navBtn.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navBtn, false, true, true, true, 0, 0, 0, 5, 5, TextAnchor.MiddleCenter);
|
||||
UIFactory.SetLayoutElement(navBtn, minWidth: 80);
|
||||
@ -248,7 +245,7 @@ namespace UnityExplorer.UI.Panels
|
||||
RuntimeHelper.SetColorBlock(NavButton.Component, UniversalUI.DisabledButtonColor, UniversalUI.DisabledButtonColor * 1.2f);
|
||||
NavButton.OnClick += () => { UIManager.TogglePanel(PanelType); };
|
||||
|
||||
var txtObj = navBtn.transform.Find("Text").gameObject;
|
||||
GameObject txtObj = navBtn.transform.Find("Text").gameObject;
|
||||
txtObj.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
}
|
||||
|
||||
@ -269,15 +266,15 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
// Title text
|
||||
|
||||
var titleTxt = UIFactory.CreateLabel(TitleBar, "TitleBar", Name, TextAnchor.MiddleLeft);
|
||||
Text titleTxt = UIFactory.CreateLabel(TitleBar, "TitleBar", Name, TextAnchor.MiddleLeft);
|
||||
UIFactory.SetLayoutElement(titleTxt.gameObject, minWidth: 250, minHeight: 25, flexibleHeight: 0);
|
||||
|
||||
// close button
|
||||
|
||||
var closeHolder = UIFactory.CreateUIObject("CloseHolder", TitleBar);
|
||||
GameObject closeHolder = UIFactory.CreateUIObject("CloseHolder", TitleBar);
|
||||
UIFactory.SetLayoutElement(closeHolder, minHeight: 25, flexibleHeight: 0, minWidth: 30, flexibleWidth: 9999);
|
||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(closeHolder, false, false, true, true, 3, childAlignment: TextAnchor.MiddleRight);
|
||||
var closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—");
|
||||
ButtonRef closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—");
|
||||
UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 25, flexibleWidth: 0);
|
||||
RuntimeHelper.SetColorBlock(closeBtn.Component, new Color(0.33f, 0.32f, 0.31f));
|
||||
|
||||
@ -372,7 +369,7 @@ namespace UnityExplorer.UI.Panels
|
||||
// outdated save data, not worth recovering just reset it.
|
||||
throw new Exception("invalid save data, resetting.");
|
||||
|
||||
var split = stringAnchors.Split(',');
|
||||
string[] split = stringAnchors.Split(',');
|
||||
|
||||
if (split.Length != 4)
|
||||
throw new Exception($"stringAnchors split is unexpected length: {split.Length}");
|
||||
@ -407,7 +404,7 @@ namespace UnityExplorer.UI.Panels
|
||||
// outdated save data, not worth recovering just reset it.
|
||||
throw new Exception("invalid save data, resetting.");
|
||||
|
||||
var split = stringPosition.Split(',');
|
||||
string[] split = stringPosition.Split(',');
|
||||
|
||||
if (split.Length != 2)
|
||||
throw new Exception($"stringPosition split is unexpected length: {split.Length}");
|
||||
|
@ -10,8 +10,6 @@ using UniverseLib;
|
||||
using UniverseLib.Input;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI.ObjectPool;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UniverseLib.UI.Widgets.ScrollView;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
@ -108,7 +106,7 @@ namespace UnityExplorer.UI
|
||||
UIPanels.Add(Panels.UIInspectorResults, new MouseInspectorResultsPanel());
|
||||
UIPanels.Add(Panels.MouseInspector, new MouseInspector());
|
||||
|
||||
foreach (var panel in UIPanels.Values)
|
||||
foreach (UIPanel panel in UIPanels.Values)
|
||||
panel.ConstructUI();
|
||||
|
||||
// Call some initialize methods
|
||||
@ -122,7 +120,7 @@ namespace UnityExplorer.UI
|
||||
ShowMenu = !ConfigManager.Hide_On_Startup.Value;
|
||||
|
||||
// Failsafe fix, in some games all dropdowns displayed values are blank on startup for some reason.
|
||||
foreach (var dropdown in UIRoot.GetComponentsInChildren<Dropdown>(true))
|
||||
foreach (Dropdown dropdown in UIRoot.GetComponentsInChildren<Dropdown>(true))
|
||||
dropdown.RefreshShownValue();
|
||||
|
||||
Initializing = false;
|
||||
@ -167,7 +165,7 @@ namespace UnityExplorer.UI
|
||||
}
|
||||
|
||||
// check screen dimension change
|
||||
var display = DisplayManager.ActiveDisplay;
|
||||
Display display = DisplayManager.ActiveDisplay;
|
||||
if (display.renderingWidth != lastScreenWidth || display.renderingHeight != lastScreenHeight)
|
||||
OnScreenDimensionsChanged();
|
||||
}
|
||||
@ -180,7 +178,7 @@ namespace UnityExplorer.UI
|
||||
|
||||
public static void TogglePanel(Panels panel)
|
||||
{
|
||||
var uiPanel = GetPanel(panel);
|
||||
UIPanel uiPanel = GetPanel(panel);
|
||||
SetPanelActive(panel, !uiPanel.Enabled);
|
||||
}
|
||||
|
||||
@ -227,11 +225,11 @@ namespace UnityExplorer.UI
|
||||
|
||||
private static void OnScreenDimensionsChanged()
|
||||
{
|
||||
var display = DisplayManager.ActiveDisplay;
|
||||
Display display = DisplayManager.ActiveDisplay;
|
||||
lastScreenWidth = display.renderingWidth;
|
||||
lastScreenHeight = display.renderingHeight;
|
||||
|
||||
foreach (var panel in UIPanels)
|
||||
foreach (KeyValuePair<Panels, UIPanel> panel in UIPanels)
|
||||
{
|
||||
panel.Value.EnsureValidSize();
|
||||
UIPanel.EnsureValidPosition(panel.Value.Rect);
|
||||
@ -292,7 +290,7 @@ namespace UnityExplorer.UI
|
||||
PanelHolder = new GameObject("PanelHolder");
|
||||
PanelHolder.transform.SetParent(UIRoot.transform, false);
|
||||
PanelHolder.layer = 5;
|
||||
var rect = PanelHolder.AddComponent<RectTransform>();
|
||||
RectTransform rect = PanelHolder.AddComponent<RectTransform>();
|
||||
rect.sizeDelta = Vector2.zero;
|
||||
rect.anchoredPosition = Vector2.zero;
|
||||
rect.pivot = new Vector2(0.5f, 0.5f);
|
||||
@ -303,7 +301,7 @@ namespace UnityExplorer.UI
|
||||
|
||||
private static void CreateTopNavBar()
|
||||
{
|
||||
var navbarPanel = UIFactory.CreateUIObject("MainNavbar", UIRoot);
|
||||
GameObject navbarPanel = UIFactory.CreateUIObject("MainNavbar", UIRoot);
|
||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navbarPanel, false, false, true, true, 5, 4, 4, 4, 4, TextAnchor.MiddleCenter);
|
||||
navbarPanel.AddComponent<Image>().color = new Color(0.1f, 0.1f, 0.1f);
|
||||
NavBarRect = navbarPanel.GetComponent<RectTransform>();
|
||||
@ -320,7 +318,7 @@ namespace UnityExplorer.UI
|
||||
// UnityExplorer title
|
||||
|
||||
string titleTxt = $"{ExplorerCore.NAME} <i><color=grey>{ExplorerCore.VERSION}</color></i>";
|
||||
var title = UIFactory.CreateLabel(navbarPanel, "Title", titleTxt, TextAnchor.MiddleLeft, default, true, 17);
|
||||
Text title = UIFactory.CreateLabel(navbarPanel, "Title", titleTxt, TextAnchor.MiddleLeft, default, true, 17);
|
||||
UIFactory.SetLayoutElement(title.gameObject, minWidth: 170, flexibleWidth: 0);
|
||||
|
||||
// panel tabs
|
||||
@ -331,7 +329,7 @@ namespace UnityExplorer.UI
|
||||
|
||||
// Time controls
|
||||
|
||||
var timeLabel = UIFactory.CreateLabel(navbarPanel, "TimeLabel", "Time:", TextAnchor.MiddleRight, Color.grey);
|
||||
Text timeLabel = UIFactory.CreateLabel(navbarPanel, "TimeLabel", "Time:", TextAnchor.MiddleRight, Color.grey);
|
||||
UIFactory.SetLayoutElement(timeLabel.gameObject, minHeight: 25, minWidth: 50);
|
||||
|
||||
timeInput = UIFactory.CreateInputField(navbarPanel, "TimeInput", "timeScale");
|
||||
|
@ -2,8 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using UnityExplorer.CacheObject.IValues;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
@ -30,8 +28,8 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
public InputFieldRef InputField { get; }
|
||||
public bool AnchorToCaretPosition => false;
|
||||
|
||||
private readonly List<Suggestion> suggestions = new List<Suggestion>();
|
||||
private readonly HashSet<string> suggestedValues = new HashSet<string>();
|
||||
private readonly List<Suggestion> suggestions = new();
|
||||
private readonly HashSet<string> suggestedValues = new();
|
||||
|
||||
private OrderedDictionary enumValues;
|
||||
|
||||
@ -58,7 +56,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
private string GetLastSplitInput(string fullInput)
|
||||
{
|
||||
string ret = fullInput;
|
||||
|
||||
|
||||
int lastSplit = fullInput.LastIndexOf(',');
|
||||
if (lastSplit >= 0)
|
||||
{
|
||||
@ -139,13 +137,13 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
|
||||
for (int i = 0; i < this.enumValues.Count; i++)
|
||||
{
|
||||
var enumValue = (CachedEnumValue)enumValues[i];
|
||||
CachedEnumValue enumValue = (CachedEnumValue)enumValues[i];
|
||||
if (enumValue.Name.ContainsIgnoreCase(value))
|
||||
AddSuggestion(enumValue.Name);
|
||||
}
|
||||
}
|
||||
|
||||
internal static readonly Dictionary<string, string> sharedValueToLabel = new Dictionary<string, string>(4096);
|
||||
internal static readonly Dictionary<string, string> sharedValueToLabel = new(4096);
|
||||
|
||||
void AddSuggestion(string value)
|
||||
{
|
||||
|
@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI.Models;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
{
|
||||
public struct Suggestion
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
@ -67,10 +65,10 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
else
|
||||
{
|
||||
allowedTypes = new();
|
||||
foreach (var entry in ReflectionUtility.AllTypes)
|
||||
foreach (KeyValuePair<string, Type> entry in ReflectionUtility.AllTypes)
|
||||
{
|
||||
// skip <PrivateImplementationDetails> and <AnonymousClass> classes
|
||||
var type = entry.Value;
|
||||
Type type = entry.Value;
|
||||
if (type.FullName.Contains("PrivateImplementationDetails")
|
||||
|| type.FullName.Contains("DisplayClass")
|
||||
|| type.FullName.Contains('<'))
|
||||
@ -126,7 +124,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||
if (ReflectionUtility.GetTypeByName(value) is Type t && allowedTypes.Contains(t))
|
||||
AddSuggestion(t);
|
||||
|
||||
foreach (var entry in allowedTypes)
|
||||
foreach (Type entry in allowedTypes)
|
||||
{
|
||||
if (entry.FullName.ContainsIgnoreCase(value))
|
||||
AddSuggestion(entry);
|
||||
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||
using UniverseLib.UI;
|
||||
@ -41,8 +37,10 @@ namespace UnityExplorer.UI.Widgets
|
||||
inputField.Component.lineType = InputField.LineType.MultiLineNewline;
|
||||
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
|
||||
typeCompleter = new TypeCompleter(typeof(object), this.inputField);
|
||||
typeCompleter.Enabled = false;
|
||||
typeCompleter = new TypeCompleter(typeof(object), this.inputField)
|
||||
{
|
||||
Enabled = false
|
||||
};
|
||||
|
||||
CreateSpecialContent();
|
||||
|
||||
|
@ -1,16 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib;
|
||||
using UnityExplorer.CacheObject;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI.ObjectPool;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
@ -48,14 +43,14 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
public void OnReturnToPool()
|
||||
{
|
||||
foreach (var widget in paramHandlers)
|
||||
foreach (ParameterHandler widget in paramHandlers)
|
||||
{
|
||||
widget.OnReturned();
|
||||
Pool<ParameterHandler>.Return(widget);
|
||||
}
|
||||
paramHandlers = null;
|
||||
|
||||
foreach (var widget in genericHandlers)
|
||||
foreach (GenericArgumentHandler widget in genericHandlers)
|
||||
{
|
||||
widget.OnReturned();
|
||||
Pool<GenericArgumentHandler>.Return(widget);
|
||||
@ -111,9 +106,9 @@ namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
for (int i = 0; i < genericArguments.Length; i++)
|
||||
{
|
||||
var type = genericArguments[i];
|
||||
Type type = genericArguments[i];
|
||||
|
||||
var holder = genericHandlers[i] = Pool<GenericArgumentHandler>.Borrow();
|
||||
GenericArgumentHandler holder = genericHandlers[i] = Pool<GenericArgumentHandler>.Borrow();
|
||||
holder.UIRoot.transform.SetParent(this.genericArgumentsHolder.transform, false);
|
||||
holder.OnBorrowed(this, type);
|
||||
}
|
||||
@ -123,9 +118,9 @@ namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
var param = parameters[i];
|
||||
ParameterInfo param = parameters[i];
|
||||
|
||||
var holder = paramHandlers[i] = Pool<ParameterHandler>.Borrow();
|
||||
ParameterHandler holder = paramHandlers[i] = Pool<ParameterHandler>.Borrow();
|
||||
holder.UIRoot.transform.SetParent(this.parametersHolder.transform, false);
|
||||
holder.OnBorrowed(this, param);
|
||||
}
|
||||
@ -142,7 +137,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
// generic args
|
||||
this.genericArgumentsHolder = UIFactory.CreateUIObject("GenericHolder", UIRoot);
|
||||
UIFactory.SetLayoutElement(genericArgumentsHolder, flexibleWidth: 1000);
|
||||
var genericsTitle = UIFactory.CreateLabel(genericArgumentsHolder, "GenericsTitle", "Generic Arguments", TextAnchor.MiddleLeft);
|
||||
Text genericsTitle = UIFactory.CreateLabel(genericArgumentsHolder, "GenericsTitle", "Generic Arguments", TextAnchor.MiddleLeft);
|
||||
UIFactory.SetLayoutElement(genericsTitle.gameObject, minHeight: 25, flexibleWidth: 1000);
|
||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(genericArgumentsHolder, false, false, true, true, 3);
|
||||
UIFactory.SetLayoutElement(genericArgumentsHolder, minHeight: 25, flexibleHeight: 750, minWidth: 50, flexibleWidth: 9999);
|
||||
@ -151,14 +146,14 @@ namespace UnityExplorer.UI.Widgets
|
||||
// args
|
||||
this.parametersHolder = UIFactory.CreateUIObject("ArgHolder", UIRoot);
|
||||
UIFactory.SetLayoutElement(parametersHolder, flexibleWidth: 1000);
|
||||
var argsTitle = UIFactory.CreateLabel(parametersHolder, "ArgsTitle", "Arguments", TextAnchor.MiddleLeft);
|
||||
Text argsTitle = UIFactory.CreateLabel(parametersHolder, "ArgsTitle", "Arguments", TextAnchor.MiddleLeft);
|
||||
UIFactory.SetLayoutElement(argsTitle.gameObject, minHeight: 25, flexibleWidth: 1000);
|
||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(parametersHolder, false, false, true, true, 3);
|
||||
UIFactory.SetLayoutElement(parametersHolder, minHeight: 25, flexibleHeight: 750, minWidth: 50, flexibleWidth: 9999);
|
||||
//argHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
|
||||
// evaluate button
|
||||
var evalButton = UIFactory.CreateButton(UIRoot, "EvaluateButton", "Evaluate", new Color(0.2f, 0.2f, 0.2f));
|
||||
ButtonRef evalButton = UIFactory.CreateButton(UIRoot, "EvaluateButton", "Evaluate", new Color(0.2f, 0.2f, 0.2f));
|
||||
UIFactory.SetLayoutElement(evalButton.Component.gameObject, minHeight: 25, minWidth: 150, flexibleWidth: 0);
|
||||
evalButton.OnClick += () =>
|
||||
{
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UniverseLib;
|
||||
using UniverseLib.Utility;
|
||||
@ -20,10 +18,10 @@ namespace UnityExplorer.UI.Widgets
|
||||
typeCompleter.BaseType = genericType;
|
||||
typeCompleter.CacheTypes();
|
||||
|
||||
var constraints = genericType.GetGenericParameterConstraints();
|
||||
Type[] constraints = genericType.GetGenericParameterConstraints();
|
||||
typeCompleter.GenericConstraints = constraints;
|
||||
|
||||
var sb = new StringBuilder($"<color={SignatureHighlighter.CONST}>{genericType.Name}</color>");
|
||||
StringBuilder sb = new($"<color={SignatureHighlighter.CONST}>{genericType.Name}</color>");
|
||||
|
||||
for (int j = 0; j < constraints.Length; j++)
|
||||
{
|
||||
|
@ -1,11 +1,8 @@
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.CacheObject.IValues;
|
||||
using UnityExplorer.UI.Panels;
|
||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||
using UniverseLib;
|
||||
@ -38,7 +35,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
if (paramType.IsByRef)
|
||||
paramType = paramType.GetElementType();
|
||||
|
||||
this.argNameLabel.text =
|
||||
this.argNameLabel.text =
|
||||
$"{SignatureHighlighter.Parse(paramType, false)} <color={SignatureHighlighter.LOCAL_ARG}>{paramInfo.Name}</color>";
|
||||
|
||||
if (ParseUtility.CanParse(paramType) || typeof(Type).IsAssignableFrom(paramType))
|
||||
@ -105,7 +102,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
if (usingBasicLabel)
|
||||
return basicValue;
|
||||
|
||||
var input = this.inputField.Text;
|
||||
string input = this.inputField.Text;
|
||||
|
||||
if (typeof(Type).IsAssignableFrom(paramType))
|
||||
return ReflectionUtility.GetTypeByName(input);
|
||||
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
|
@ -1,17 +1,9 @@
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Inspectors;
|
||||
using UnityExplorer.UI.Widgets;
|
||||
using UniverseLib;
|
||||
using UniverseLib.UI;
|
||||
using UniverseLib.UI.Models;
|
||||
using UniverseLib.UI.Widgets;
|
||||
using UniverseLib.UI.Widgets.ScrollView;
|
||||
using UniverseLib.Utility;
|
||||
|
||||
@ -136,7 +128,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
if (int.TryParse(input.Trim(), out int index))
|
||||
this.cachedTransform.Value.SetSiblingIndex(index);
|
||||
|
||||
|
||||
this.SiblingIndex.Text = this.cachedTransform.Value.GetSiblingIndex().ToString();
|
||||
}
|
||||
|
||||
@ -168,7 +160,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
// Name button
|
||||
|
||||
GameObject nameBtnHolder = UIFactory.CreateHorizontalGroup(this.UIRoot, "NameButtonHolder",
|
||||
GameObject nameBtnHolder = UIFactory.CreateHorizontalGroup(this.UIRoot, "NameButtonHolder",
|
||||
false, false, true, true, childAlignment: TextAnchor.MiddleLeft);
|
||||
UIFactory.SetLayoutElement(nameBtnHolder, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
|
||||
nameBtnHolder.AddComponent<Mask>().showMaskGraphic = false;
|
||||
|
@ -116,7 +116,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
public void JumpAndExpandToTransform(Transform transform)
|
||||
{
|
||||
// make sure all parents of the object are expanded
|
||||
var parent = transform.parent;
|
||||
Transform parent = transform.parent;
|
||||
while (parent)
|
||||
{
|
||||
int pid = parent.GetInstanceID();
|
||||
@ -136,7 +136,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
int idx;
|
||||
for (idx = 0; idx < cachedTransforms.Count; idx++)
|
||||
{
|
||||
var cache = (CachedTransform)cachedTransforms[idx];
|
||||
CachedTransform cache = (CachedTransform)cachedTransforms[idx];
|
||||
if (cache.InstanceID == transformID)
|
||||
break;
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
private IEnumerator HighlightCellCoroutine(TransformCell cell)
|
||||
{
|
||||
var button = cell.NameButton.Component;
|
||||
UnityEngine.UI.Button button = cell.NameButton.Component;
|
||||
button.StartColorTween(new Color(0.2f, 0.3f, 0.2f), false);
|
||||
|
||||
float start = Time.realtimeSinceStartup;
|
||||
@ -191,7 +191,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
bool filtering = Filtering;
|
||||
|
||||
IEnumerable<GameObject> rootObjects = GetRootEntriesMethod();
|
||||
foreach (var gameObj in rootObjects)
|
||||
foreach (GameObject gameObj in rootObjects)
|
||||
{
|
||||
if (!gameObj)
|
||||
continue;
|
||||
@ -214,7 +214,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
traversedThisFrame.Start();
|
||||
}
|
||||
|
||||
var cached = (CachedTransform)cachedTransforms[i];
|
||||
CachedTransform cached = (CachedTransform)cachedTransforms[i];
|
||||
if (!visited.Contains(cached.InstanceID))
|
||||
{
|
||||
cachedTransforms.RemoveAt(i);
|
||||
@ -227,7 +227,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
prevDisplayIndex = displayIndex;
|
||||
refreshCoroutine = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Recursive method to check a Transform and its children (if expanded).
|
||||
// Parent and depth can be null/default.
|
||||
@ -293,7 +293,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
var enumerator = Traverse(transform.GetChild(i), cached, depth + 1, oneShot, filtering);
|
||||
IEnumerator enumerator = Traverse(transform.GetChild(i), cached, depth + 1, oneShot, filtering);
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
if (!oneShot)
|
||||
@ -350,7 +350,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
public void OnCellExpandToggled(CachedTransform cache)
|
||||
{
|
||||
var instanceID = cache.InstanceID;
|
||||
int instanceID = cache.InstanceID;
|
||||
if (expandedInstanceIDs.Contains(instanceID))
|
||||
expandedInstanceIDs.Remove(instanceID);
|
||||
else
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@ -273,7 +271,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
#region SavWav
|
||||
#region SavWav
|
||||
|
||||
// Copyright (c) 2012 Calvin Rien
|
||||
// http://the.darktable.com
|
||||
@ -404,6 +402,6 @@ namespace UnityExplorer.UI.Widgets
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Config;
|
||||
@ -223,15 +220,15 @@ namespace UnityExplorer.UI.Widgets
|
||||
|
||||
// Actual texture viewer
|
||||
|
||||
GameObject imageViewport = UIFactory.CreateVerticalGroup(textureViewerRoot, "ImageViewport", false, false, true, true,
|
||||
bgColor: new(1,1,1,0), childAlignment: TextAnchor.MiddleCenter);
|
||||
GameObject imageViewport = UIFactory.CreateVerticalGroup(textureViewerRoot, "ImageViewport", false, false, true, true,
|
||||
bgColor: new(1, 1, 1, 0), childAlignment: TextAnchor.MiddleCenter);
|
||||
UIFactory.SetLayoutElement(imageViewport, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||
|
||||
GameObject imageHolder = UIFactory.CreateUIObject("ImageHolder", imageViewport);
|
||||
imageLayout = UIFactory.SetLayoutElement(imageHolder, 1, 1, 0, 0);
|
||||
|
||||
var actualImageObj = UIFactory.CreateUIObject("ActualImage", imageHolder);
|
||||
var actualRect = actualImageObj.GetComponent<RectTransform>();
|
||||
GameObject actualImageObj = UIFactory.CreateUIObject("ActualImage", imageHolder);
|
||||
RectTransform actualRect = actualImageObj.GetComponent<RectTransform>();
|
||||
actualRect.anchorMin = new(0, 0);
|
||||
actualRect.anchorMax = new(1, 1);
|
||||
image = actualImageObj.AddComponent<Image>();
|
||||
|
@ -105,7 +105,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(UIRoot, false, false, true, true, 5);
|
||||
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||
|
||||
var nameLabel = UIFactory.CreateLabel(UIRoot, "NameLabel", "Name:", TextAnchor.MiddleLeft, Color.grey);
|
||||
Text nameLabel = UIFactory.CreateLabel(UIRoot, "NameLabel", "Name:", TextAnchor.MiddleLeft, Color.grey);
|
||||
UIFactory.SetLayoutElement(nameLabel.gameObject, minHeight: 25, minWidth: 45, flexibleWidth: 0);
|
||||
|
||||
nameInput = UIFactory.CreateInputField(UIRoot, "NameInput", "untitled");
|
||||
@ -116,7 +116,7 @@ namespace UnityExplorer.UI.Widgets
|
||||
UIFactory.SetLayoutElement(gameObjectButton.Component.gameObject, minHeight: 25, minWidth: 160);
|
||||
gameObjectButton.OnClick += OnGameObjectButtonClicked;
|
||||
|
||||
var instanceLabel = UIFactory.CreateLabel(UIRoot, "InstanceLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
|
||||
Text instanceLabel = UIFactory.CreateLabel(UIRoot, "InstanceLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
|
||||
UIFactory.SetLayoutElement(instanceLabel.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
|
||||
|
||||
instanceIdInput = UIFactory.CreateInputField(UIRoot, "InstanceIDInput", "ERROR");
|
||||
|
Reference in New Issue
Block a user