Cleanup CSConsole, add start of Options and Log panels

This commit is contained in:
Sinai
2021-05-13 03:55:08 +10:00
parent 70d66f93a5
commit 3e44317861
5 changed files with 108 additions and 35 deletions

View File

@ -276,8 +276,6 @@ The following helper methods are available:
int endIdx = Input.Text.Length - 1; int endIdx = Input.Text.Length - 1;
int topLine = 0; int topLine = 0;
try
{
// Calculate visible text if necessary // Calculate visible text if necessary
if (Input.Rect.rect.height > Panel.InputScroll.ViewportRect.rect.height) if (Input.Rect.rect.height > Panel.InputScroll.ViewportRect.rect.height)
{ {
@ -308,13 +306,6 @@ The following helper methods are available:
? Input.Text.Length - 1 ? Input.Text.Length - 1
: (Input.TextGenerator.lines[bottomLine + 1].startCharIdx - 1); : (Input.TextGenerator.lines[bottomLine + 1].startCharIdx - 1);
} }
}
catch (Exception ex)
{
ExplorerCore.Log("Exception on HighlightVisibleText: " + ex.GetType().Name + ", " + ex.Message);
}
// Highlight the visible text with the LexerBuilder // Highlight the visible text with the LexerBuilder
Panel.HighlightText.text = Lexer.BuildHighlightedString(Input.Text, startIdx, endIdx, topLine); Panel.HighlightText.text = Lexer.BuildHighlightedString(Input.Text, startIdx, endIdx, topLine);

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UnityExplorer.UI.Panels
{
public class ConsoleLogPanel : UIPanel
{
public override string Name => "Console Log";
public override UIManager.Panels PanelType => UIManager.Panels.ConsoleLog;
public override int MinWidth => 300;
public override int MinHeight => 75;
public override void ConstructPanelContent()
{
throw new NotImplementedException();
}
public override void DoSaveToConfigElement()
{
throw new NotImplementedException();
}
public override string GetSaveData()
{
throw new NotImplementedException();
}
protected internal override void DoSetDefaultPosAndAnchors()
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UnityExplorer.UI.Panels
{
public class OptionsPanel : UIPanel
{
public override string Name => "Options";
public override UIManager.Panels PanelType => UIManager.Panels.Options;
public override int MinWidth => 400;
public override int MinHeight => 200;
public override void ConstructPanelContent()
{
throw new NotImplementedException();
}
public override void DoSaveToConfigElement()
{
throw new NotImplementedException();
}
public override string GetSaveData()
{
throw new NotImplementedException();
}
protected internal override void DoSetDefaultPosAndAnchors()
{
throw new NotImplementedException();
}
}
}

View File

@ -43,6 +43,8 @@ namespace UnityExplorer.UI
public static ObjectExplorerPanel Explorer { get; private set; } public static ObjectExplorerPanel Explorer { get; private set; }
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 OptionsPanel Options { get; private set; }
public static ConsoleLogPanel ConsoleLog { get; private set; }
public static AutoCompleteModal AutoCompleter { get; private set; } public static AutoCompleteModal AutoCompleter { get; private set; }
@ -180,6 +182,12 @@ namespace UnityExplorer.UI
CSharpConsole.ConstructUI(); CSharpConsole.ConstructUI();
ConsoleController.Init(); ConsoleController.Init();
Options = new OptionsPanel();
Options.ConstructUI();
ConsoleLog = new ConsoleLogPanel();
ConsoleLog.ConstructUI();
ShowMenu = !ConfigManager.Hide_On_Startup.Value; ShowMenu = !ConfigManager.Hide_On_Startup.Value;
ExplorerCore.Log("UI initialized."); ExplorerCore.Log("UI initialized.");

View File

@ -262,8 +262,10 @@
<Compile Include="UI\Models\InputFieldRef.cs" /> <Compile Include="UI\Models\InputFieldRef.cs" />
<Compile Include="UI\ObjectPool\IPooledObject.cs" /> <Compile Include="UI\ObjectPool\IPooledObject.cs" />
<Compile Include="UI\ObjectPool\Pool.cs" /> <Compile Include="UI\ObjectPool\Pool.cs" />
<Compile Include="UI\Panels\ConsoleLogPanel.cs" />
<Compile Include="UI\Panels\CSConsolePanel.cs" /> <Compile Include="UI\Panels\CSConsolePanel.cs" />
<Compile Include="Core\Utility\IOUtility.cs" /> <Compile Include="Core\Utility\IOUtility.cs" />
<Compile Include="UI\Panels\OptionsPanel.cs" />
<Compile Include="UI\Widgets\AutoComplete\ISuggestionProvider.cs" /> <Compile Include="UI\Widgets\AutoComplete\ISuggestionProvider.cs" />
<Compile Include="UI\Widgets\AutoComplete\Suggestion.cs" /> <Compile Include="UI\Widgets\AutoComplete\Suggestion.cs" />
<Compile Include="Core\Config\ConfigElement.cs" /> <Compile Include="Core\Config\ConfigElement.cs" />