mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-04 00:23:31 +08:00
some UI cleanups
This commit is contained in:
parent
e9acd68ee4
commit
60580c8183
@ -132,7 +132,7 @@ namespace UnityExplorer.CSConsole
|
||||
{
|
||||
try
|
||||
{
|
||||
var editor = ConsolePage.Instance.m_codeEditor;
|
||||
var editor = CSConsolePage.Instance.m_codeEditor;
|
||||
|
||||
if (!editor.InputField.isFocused)
|
||||
return;
|
||||
@ -164,7 +164,7 @@ namespace UnityExplorer.CSConsole
|
||||
|
||||
public static void CheckAutocomplete()
|
||||
{
|
||||
var m_codeEditor = ConsolePage.Instance.m_codeEditor;
|
||||
var m_codeEditor = CSConsolePage.Instance.m_codeEditor;
|
||||
string input = m_codeEditor.InputField.text;
|
||||
int caretIndex = m_codeEditor.InputField.caretPosition;
|
||||
|
||||
@ -204,7 +204,7 @@ namespace UnityExplorer.CSConsole
|
||||
{
|
||||
// Credit ManylMarco
|
||||
CodeEditor.AutoCompletes.Clear();
|
||||
string[] completions = ConsolePage.Instance.m_evaluator.GetCompletions(input, out string prefix);
|
||||
string[] completions = CSConsolePage.Instance.m_evaluator.GetCompletions(input, out string prefix);
|
||||
if (completions != null)
|
||||
{
|
||||
if (prefix == null)
|
||||
@ -301,7 +301,7 @@ namespace UnityExplorer.CSConsole
|
||||
|
||||
void UseAutocompleteButton()
|
||||
{
|
||||
ConsolePage.Instance.m_codeEditor.UseAutocomplete(hiddenText.text);
|
||||
CSConsolePage.Instance.m_codeEditor.UseAutocomplete(hiddenText.text);
|
||||
}
|
||||
|
||||
m_suggestionButtons.Add(buttonObj);
|
||||
|
@ -86,7 +86,7 @@ The following helper methods are available:
|
||||
var text = InputField.text.Trim();
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
ConsolePage.Instance.Evaluate(text);
|
||||
CSConsolePage.Instance.Evaluate(text);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ The following helper methods are available:
|
||||
{
|
||||
if (!m_fixwanted)
|
||||
{
|
||||
EventSystem.current.SetSelectedGameObject(ConsolePage.Instance.m_codeEditor.InputField.gameObject, null);
|
||||
EventSystem.current.SetSelectedGameObject(CSConsolePage.Instance.m_codeEditor.InputField.gameObject, null);
|
||||
m_fixwanted = true;
|
||||
}
|
||||
else
|
||||
@ -308,13 +308,13 @@ The following helper methods are available:
|
||||
|
||||
public void ConstructUI()
|
||||
{
|
||||
ConsolePage.Instance.Content = UIFactory.CreateUIObject("C# Console", MainMenu.Instance.PageViewport);
|
||||
CSConsolePage.Instance.Content = UIFactory.CreateUIObject("C# Console", MainMenu.Instance.PageViewport);
|
||||
|
||||
var mainLayout = ConsolePage.Instance.Content.AddComponent<LayoutElement>();
|
||||
mainLayout.preferredHeight = 9900;
|
||||
var mainLayout = CSConsolePage.Instance.Content.AddComponent<LayoutElement>();
|
||||
mainLayout.preferredHeight = 500;
|
||||
mainLayout.flexibleHeight = 9000;
|
||||
|
||||
var mainGroup = ConsolePage.Instance.Content.AddComponent<VerticalLayoutGroup>();
|
||||
var mainGroup = CSConsolePage.Instance.Content.AddComponent<VerticalLayoutGroup>();
|
||||
mainGroup.childControlHeight = true;
|
||||
mainGroup.childControlWidth = true;
|
||||
mainGroup.childForceExpandHeight = true;
|
||||
@ -324,7 +324,7 @@ The following helper methods are available:
|
||||
|
||||
// Main group object
|
||||
|
||||
var topBarObj = UIFactory.CreateHorizontalGroup(ConsolePage.Instance.Content);
|
||||
var topBarObj = UIFactory.CreateHorizontalGroup(CSConsolePage.Instance.Content);
|
||||
LayoutElement topBarLayout = topBarObj.AddComponent<LayoutElement>();
|
||||
topBarLayout.minHeight = 50;
|
||||
topBarLayout.flexibleHeight = 0;
|
||||
@ -402,7 +402,7 @@ The following helper methods are available:
|
||||
|
||||
int fontSize = 16;
|
||||
|
||||
var inputObj = UIFactory.CreateSrollInputField(ConsolePage.Instance.Content, out InputFieldScroller consoleScroll, fontSize);
|
||||
var inputObj = UIFactory.CreateSrollInputField(CSConsolePage.Instance.Content, out InputFieldScroller consoleScroll, fontSize);
|
||||
|
||||
var inputField = consoleScroll.inputField;
|
||||
|
||||
@ -431,7 +431,7 @@ The following helper methods are available:
|
||||
|
||||
#region COMPILE BUTTON
|
||||
|
||||
var compileBtnObj = UIFactory.CreateButton(ConsolePage.Instance.Content);
|
||||
var compileBtnObj = UIFactory.CreateButton(CSConsolePage.Instance.Content);
|
||||
var compileBtnLayout = compileBtnObj.AddComponent<LayoutElement>();
|
||||
compileBtnLayout.preferredWidth = 80;
|
||||
compileBtnLayout.flexibleWidth = 0;
|
||||
@ -452,7 +452,7 @@ The following helper methods are available:
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputField.text))
|
||||
{
|
||||
ConsolePage.Instance.Evaluate(inputField.text.Trim());
|
||||
CSConsolePage.Instance.Evaluate(inputField.text.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,17 +15,17 @@ namespace UnityExplorer.CSConsole
|
||||
|
||||
public static void AddUsing(string directive)
|
||||
{
|
||||
ConsolePage.Instance.AddUsing(directive);
|
||||
CSConsolePage.Instance.AddUsing(directive);
|
||||
}
|
||||
|
||||
public static void GetUsing()
|
||||
{
|
||||
ExplorerCore.Log(ConsolePage.Instance.m_evaluator.GetUsing());
|
||||
ExplorerCore.Log(CSConsolePage.Instance.m_evaluator.GetUsing());
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
ConsolePage.Instance.ResetConsole();
|
||||
CSConsolePage.Instance.ResetConsole();
|
||||
}
|
||||
|
||||
public static object CurrentTarget()
|
||||
|
@ -153,7 +153,7 @@ namespace UnityExplorer.Inspectors
|
||||
mainGroup.childForceExpandWidth = true;
|
||||
mainGroup.childControlHeight = true;
|
||||
mainGroup.childControlWidth = true;
|
||||
mainGroup.spacing = 2;
|
||||
mainGroup.spacing = 4;
|
||||
mainGroup.padding.left = 4;
|
||||
mainGroup.padding.right = 4;
|
||||
mainGroup.padding.top = 4;
|
||||
@ -184,10 +184,10 @@ namespace UnityExplorer.Inspectors
|
||||
m_tabBarContent = UIFactory.CreateGridGroup(mainObj, new Vector2(185, 20), new Vector2(5, 2), new Color(0.1f, 0.1f, 0.1f, 1));
|
||||
|
||||
var gridGroup = m_tabBarContent.GetComponent<GridLayoutGroup>();
|
||||
gridGroup.padding.top = 4;
|
||||
gridGroup.padding.left = 4;
|
||||
gridGroup.padding.right = 4;
|
||||
gridGroup.padding.bottom = 4;
|
||||
gridGroup.padding.top = 3;
|
||||
gridGroup.padding.left = 3;
|
||||
gridGroup.padding.right = 3;
|
||||
gridGroup.padding.bottom = 3;
|
||||
|
||||
// inspector content area
|
||||
|
||||
@ -204,10 +204,10 @@ namespace UnityExplorer.Inspectors
|
||||
contentGroup.childForceExpandWidth = true;
|
||||
contentGroup.childControlHeight = true;
|
||||
contentGroup.childControlWidth = true;
|
||||
contentGroup.padding.top = 5;
|
||||
contentGroup.padding.left = 5;
|
||||
contentGroup.padding.right = 5;
|
||||
contentGroup.padding.bottom = 5;
|
||||
contentGroup.padding.top = 2;
|
||||
contentGroup.padding.left = 2;
|
||||
contentGroup.padding.right = 2;
|
||||
contentGroup.padding.bottom = 2;
|
||||
|
||||
var contentLayout = m_inspectorContent.AddComponent<LayoutElement>();
|
||||
contentLayout.preferredHeight = 900;
|
||||
|
@ -294,11 +294,11 @@ namespace UnityExplorer.Inspectors
|
||||
leftLayout.flexibleWidth = 0;
|
||||
|
||||
VerticalLayoutGroup leftGroup = leftPane.GetComponent<VerticalLayoutGroup>();
|
||||
leftGroup.padding.left = 8;
|
||||
leftGroup.padding.right = 8;
|
||||
leftGroup.padding.left = 4;
|
||||
leftGroup.padding.right = 4;
|
||||
leftGroup.padding.top = 8;
|
||||
leftGroup.padding.bottom = 8;
|
||||
leftGroup.spacing = 5;
|
||||
leftGroup.padding.bottom = 4;
|
||||
leftGroup.spacing = 4;
|
||||
leftGroup.childControlWidth = true;
|
||||
leftGroup.childControlHeight = true;
|
||||
leftGroup.childForceExpandWidth = true;
|
||||
@ -430,7 +430,7 @@ namespace UnityExplorer.Inspectors
|
||||
Hiding = true;
|
||||
|
||||
hideText.text = "►";
|
||||
leftLayout.minWidth = 20;
|
||||
leftLayout.minWidth = 15;
|
||||
titleObj.SetActive(false);
|
||||
sceneDropdownObj.SetActive(false);
|
||||
scenePathGroupObj.SetActive(false);
|
||||
|
@ -39,5 +39,5 @@ using MelonLoader;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion(ExplorerCore.VERSION)]
|
||||
[assembly: AssemblyFileVersion(ExplorerCore.VERSION)]
|
||||
|
@ -57,7 +57,7 @@ namespace UnityExplorer.UI
|
||||
|
||||
Pages.Add(new HomePage());
|
||||
Pages.Add(new SearchPage());
|
||||
Pages.Add(new ConsolePage());
|
||||
Pages.Add(new CSConsolePage());
|
||||
Pages.Add(new OptionsPage());
|
||||
|
||||
ConstructMenu();
|
||||
@ -118,7 +118,7 @@ namespace UnityExplorer.UI
|
||||
m_activePage?.Content?.SetActive(false);
|
||||
|
||||
// unique case for console page, at the moment this will just go here
|
||||
if (m_activePage is ConsolePage)
|
||||
if (m_activePage is CSConsolePage)
|
||||
AutoCompleter.m_mainObj?.SetActive(false);
|
||||
|
||||
m_activePage = page;
|
||||
@ -186,7 +186,7 @@ namespace UnityExplorer.UI
|
||||
titleGroup.padding.bottom = 3;
|
||||
|
||||
LayoutElement titleLayout = titleBar.AddComponent<LayoutElement>();
|
||||
titleLayout.minHeight = 35;
|
||||
titleLayout.minHeight = 25;
|
||||
titleLayout.flexibleHeight = 0;
|
||||
|
||||
// Explorer label
|
||||
@ -198,9 +198,8 @@ namespace UnityExplorer.UI
|
||||
text.resizeTextForBestFit = true;
|
||||
text.resizeTextMinSize = 12;
|
||||
text.resizeTextMaxSize = 20;
|
||||
|
||||
LayoutElement textLayout = textObj.AddComponent<LayoutElement>();
|
||||
textLayout.flexibleWidth = 50;
|
||||
textLayout.flexibleWidth = 5000;
|
||||
|
||||
// Add PanelDragger using the label object
|
||||
|
||||
@ -226,7 +225,7 @@ namespace UnityExplorer.UI
|
||||
hideText.color = Color.white;
|
||||
hideText.resizeTextForBestFit = true;
|
||||
hideText.resizeTextMinSize = 8;
|
||||
hideText.resizeTextMaxSize = 16;
|
||||
hideText.resizeTextMaxSize = 14;
|
||||
hideText.text = $"Hide ({ModConfig.Instance.Main_Menu_Toggle})";
|
||||
|
||||
ModConfig.OnConfigChanged += ModConfig_OnConfigChanged;
|
||||
@ -242,10 +241,6 @@ namespace UnityExplorer.UI
|
||||
GameObject navbarObj = UIFactory.CreateHorizontalGroup(content);
|
||||
|
||||
HorizontalLayoutGroup navGroup = navbarObj.GetComponent<HorizontalLayoutGroup>();
|
||||
navGroup.padding.left = 3;
|
||||
navGroup.padding.right = 3;
|
||||
navGroup.padding.top = 3;
|
||||
navGroup.padding.bottom = 3;
|
||||
navGroup.spacing = 5;
|
||||
navGroup.childControlHeight = true;
|
||||
navGroup.childControlWidth = true;
|
||||
@ -253,7 +248,7 @@ namespace UnityExplorer.UI
|
||||
navGroup.childForceExpandWidth = true;
|
||||
|
||||
LayoutElement navLayout = navbarObj.AddComponent<LayoutElement>();
|
||||
navLayout.minHeight = 35;
|
||||
navLayout.minHeight = 25;
|
||||
navLayout.flexibleHeight = 0;
|
||||
|
||||
foreach (Page page in Pages)
|
||||
|
@ -7,11 +7,11 @@ using UnityExplorer.CSConsole;
|
||||
|
||||
namespace UnityExplorer.UI.Modules
|
||||
{
|
||||
public class ConsolePage : MainMenu.Page
|
||||
public class CSConsolePage : MainMenu.Page
|
||||
{
|
||||
public override string Name => "C# Console";
|
||||
|
||||
public static ConsolePage Instance { get; private set; }
|
||||
public static CSConsolePage Instance { get; private set; }
|
||||
|
||||
public CodeEditor m_codeEditor;
|
||||
public ScriptEvaluator m_evaluator;
|
@ -160,7 +160,7 @@ namespace UnityExplorer.UI.Modules
|
||||
|
||||
var bottomBarObj = UIFactory.CreateHorizontalGroup(mainObj);
|
||||
LayoutElement topBarLayout = bottomBarObj.AddComponent<LayoutElement>();
|
||||
topBarLayout.minHeight = 40;
|
||||
topBarLayout.minHeight = 30;
|
||||
topBarLayout.flexibleHeight = 0;
|
||||
|
||||
var bottomGroup = bottomBarObj.GetComponent<HorizontalLayoutGroup>();
|
||||
@ -202,7 +202,7 @@ namespace UnityExplorer.UI.Modules
|
||||
{
|
||||
logAreaObj.SetActive(false);
|
||||
hideBtnText.text = "Show";
|
||||
mainLayout.minHeight = 40;
|
||||
mainLayout.minHeight = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -267,7 +267,7 @@ namespace UnityExplorer.UI.Modules
|
||||
|
||||
var unityToggleRect = unityToggleObj.transform.Find("Background").GetComponent<RectTransform>();
|
||||
var pos = unityToggleRect.localPosition;
|
||||
pos.y = -8;
|
||||
pos.y = -4;
|
||||
unityToggleRect.localPosition = pos;
|
||||
|
||||
// // Save to disk button
|
||||
|
@ -38,11 +38,11 @@ namespace UnityExplorer.UI.Modules
|
||||
|
||||
Content = UIFactory.CreateHorizontalGroup(parent);
|
||||
var mainGroup = Content.GetComponent<HorizontalLayoutGroup>();
|
||||
mainGroup.padding.left = 3;
|
||||
mainGroup.padding.right = 3;
|
||||
mainGroup.padding.top = 3;
|
||||
mainGroup.padding.bottom = 3;
|
||||
mainGroup.spacing = 5;
|
||||
mainGroup.padding.left = 1;
|
||||
mainGroup.padding.right = 1;
|
||||
mainGroup.padding.top = 1;
|
||||
mainGroup.padding.bottom = 1;
|
||||
mainGroup.spacing = 3;
|
||||
mainGroup.childForceExpandHeight = true;
|
||||
mainGroup.childForceExpandWidth = true;
|
||||
mainGroup.childControlHeight = true;
|
||||
|
@ -35,7 +35,9 @@ namespace UnityExplorer.UI
|
||||
|
||||
ResizeTypes type;
|
||||
Vector3 resizePos = Panel.InverseTransformPoint(rawMousePos);
|
||||
|
||||
Vector3 dragPos = DragableArea.InverseTransformPoint(rawMousePos);
|
||||
bool inDragPos = DragableArea.rect.Contains(dragPos);
|
||||
|
||||
if (WasHoveringResize && s_resizeCursorImage)
|
||||
{
|
||||
@ -45,7 +47,7 @@ namespace UnityExplorer.UI
|
||||
// If Mouse pressed this frame
|
||||
if (InputManager.GetMouseButtonDown(0))
|
||||
{
|
||||
if (DragableArea.rect.Contains(dragPos))
|
||||
if (inDragPos)
|
||||
{
|
||||
OnBeginDrag();
|
||||
return;
|
||||
@ -82,7 +84,7 @@ namespace UnityExplorer.UI
|
||||
{
|
||||
OnEndResize();
|
||||
}
|
||||
else if (MouseInResizeArea(resizePos) && (type = GetResizeType(resizePos)) != ResizeTypes.NONE)
|
||||
else if (!inDragPos && MouseInResizeArea(resizePos) && (type = GetResizeType(resizePos)) != ResizeTypes.NONE)
|
||||
{
|
||||
OnHoverResize(type);
|
||||
}
|
||||
|
@ -93,15 +93,7 @@ namespace UnityExplorer.UI
|
||||
rect.anchoredPosition = Vector2.zero;
|
||||
rect.sizeDelta = Vector2.zero;
|
||||
|
||||
Image image = panelObj.AddComponent<Image>();
|
||||
image.type = Image.Type.Filled;
|
||||
image.color = new Color(0.05f, 0.05f, 0.05f);
|
||||
|
||||
VerticalLayoutGroup group = panelObj.AddComponent<VerticalLayoutGroup>();
|
||||
group.padding.left = 3;
|
||||
group.padding.right = 3;
|
||||
group.padding.bottom = 3;
|
||||
group.padding.top = 3;
|
||||
group.childControlHeight = true;
|
||||
group.childControlWidth = true;
|
||||
group.childForceExpandHeight = true;
|
||||
@ -114,12 +106,14 @@ namespace UnityExplorer.UI
|
||||
image2.type = Image.Type.Filled;
|
||||
image2.color = new Color(0.1f, 0.1f, 0.1f);
|
||||
|
||||
content.gameObject.AddComponent<Mask>();
|
||||
|
||||
VerticalLayoutGroup group2 = content.AddComponent<VerticalLayoutGroup>();
|
||||
group2.padding.left = 5;
|
||||
group2.padding.right = 5;
|
||||
group2.padding.bottom = 5;
|
||||
group2.padding.top = 5;
|
||||
group2.spacing = 5;
|
||||
group2.padding.left = 3;
|
||||
group2.padding.right = 3;
|
||||
group2.padding.bottom = 3;
|
||||
group2.padding.top = 3;
|
||||
group2.spacing = 3;
|
||||
group2.childControlHeight = true;
|
||||
group2.childControlWidth = true;
|
||||
group2.childForceExpandHeight = false;
|
||||
|
@ -24,7 +24,6 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<RootNamespace>UnityExplorer</RootNamespace>
|
||||
<AssemblyName>UnityExplorer</AssemblyName>
|
||||
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
|
||||
<BIECppGameFolder>D:\Steam\steamapps\common\Outward</BIECppGameFolder>
|
||||
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
|
||||
@ -44,6 +43,7 @@
|
||||
<!-- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> -->
|
||||
<OutputPath>..\Release\UnityExplorer.MelonLoader.Il2Cpp\</OutputPath>
|
||||
<DefineConstants>CPP,ML</DefineConstants>
|
||||
<AssemblyName>UnityExplorer.ML.IL2CPP</AssemblyName>
|
||||
<IsCpp>true</IsCpp>
|
||||
<IsMelonLoader>true</IsMelonLoader>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@ -52,6 +52,7 @@
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OutputPath>..\Release\UnityExplorer.MelonLoader.Mono\</OutputPath>
|
||||
<DefineConstants>MONO,ML</DefineConstants>
|
||||
<AssemblyName>UnityExplorer.ML.Mono</AssemblyName>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<IsCpp>false</IsCpp>
|
||||
<IsMelonLoader>true</IsMelonLoader>
|
||||
@ -69,6 +70,7 @@
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OutputPath>..\Release\UnityExplorer.BepInEx.Mono\</OutputPath>
|
||||
<DefineConstants>MONO,BIE</DefineConstants>
|
||||
<AssemblyName>UnityExplorer.BIE.Mono</AssemblyName>
|
||||
<IsCpp>false</IsCpp>
|
||||
<IsMelonLoader>false</IsMelonLoader>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@ -353,7 +355,7 @@
|
||||
<Compile Include="Inspectors\InspectorManager.cs" />
|
||||
<Compile Include="Inspectors\Reflection\ReflectionInspector.cs" />
|
||||
<Compile Include="UI\MainMenu.cs" />
|
||||
<Compile Include="UI\Modules\ConsolePage.cs" />
|
||||
<Compile Include="UI\Modules\CSConsolePage.cs" />
|
||||
<Compile Include="CSConsole\AutoCompleter.cs" />
|
||||
<Compile Include="CSConsole\CodeEditor.cs" />
|
||||
<Compile Include="CSConsole\Lexer\CommentMatch.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user