Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
weeeBox committed Dec 20, 2016
1 parent 560b4bf commit 98fbb9b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Project/Assets/LunarPlugin/Editor/Core/CEditorMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static class CEditorMenu
[MenuItem("Window/Lunar/Terminal %#t")]
public static void ShowTerminal()
{
TerminalWindow.ShowWindow();
CTerminalWindow.ShowWindow();
}

[MenuItem("Window/Lunar/Console %#&c")]
Expand Down
2 changes: 1 addition & 1 deletion Project/Assets/LunarPlugin/Editor/UI/CSearchField.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace LunarEditor
{
class CSearchField : TextField
class CSearchField : CTextField
{
protected override string CreateTextField(string text)
{
Expand Down
20 changes: 10 additions & 10 deletions Project/Assets/LunarPlugin/Editor/UI/CTerminalCompositeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@

namespace LunarEditor
{
interface ITerminalCompositeViewDelegate
interface ICTerminalCompositeViewDelegate
{
void ExecCommand(string commandLine);
CTerminal Terminal { get; }
}

class TerminalCompositeView : View
class CTerminalCompositeView : View
{
private CConsoleView m_consoleView;
private TextField m_commandField;
private CTextField m_commandField;
private ToolBarLabel m_infoLabel;

private ITerminalCompositeViewDelegate m_delegate;
private ICTerminalCompositeViewDelegate m_delegate;

private float m_lastTabTimestamp;
private string m_lastUserInput;

public TerminalCompositeView(ITerminalCompositeViewDelegate del, float width, float height)
public CTerminalCompositeView(ICTerminalCompositeViewDelegate del, float width, float height)
: base(width, height)
{
if (del == null)
Expand Down Expand Up @@ -99,14 +99,14 @@ private void CreateUI()

AddSubview(toolbar);

m_commandField = new TextField();
m_commandField = new CTextField();
m_commandField.Width = Width;
AddSubview(m_commandField);
m_commandField.AlignX(View.AlignCenter);
m_commandField.AlignBottom(0);
m_commandField.AutoresizeMask = ViewAutoresizing.FlexibleTopMargin | ViewAutoresizing.FlexibleWidth;

m_commandField.TextKeyDelegate = delegate(TextField tf, KeyCode code, bool pressed)
m_commandField.TextKeyDelegate = delegate(CTextField tf, KeyCode code, bool pressed)
{
if (pressed)
{
Expand Down Expand Up @@ -204,7 +204,7 @@ private void CreateUI()
return false;
};

m_commandField.TextChangedDelegate = delegate(TextField field) {
m_commandField.TextChangedDelegate = delegate(CTextField field) {
HistoryReset();
};

Expand Down Expand Up @@ -236,7 +236,7 @@ private void HistoryPush(string commandLine)
History.Push(commandLine);
}

private bool HistoryNext(TextField tf)
private bool HistoryNext(CTextField tf)
{
string line = History.Next();
if (line != null)
Expand All @@ -248,7 +248,7 @@ private bool HistoryNext(TextField tf)
return false;
}

private bool HistoryPrev(TextField tf)
private bool HistoryPrev(CTextField tf)
{
string line = History.Prev();
if (line != null)
Expand Down
8 changes: 4 additions & 4 deletions Project/Assets/LunarPlugin/Editor/UI/CTerminalWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

namespace LunarEditor
{
class TerminalWindow : Window, ITerminalCompositeViewDelegate
class CTerminalWindow : Window, ICTerminalCompositeViewDelegate
{
public TerminalWindow()
public CTerminalWindow()
: base("Terminal")
{
this.minSize = new Vector2(320, 240);
Expand All @@ -42,7 +42,7 @@ public TerminalWindow()

protected override void CreateUI()
{
TerminalCompositeView terminalView = new TerminalCompositeView(this, this.Width, this.Height);
CTerminalCompositeView terminalView = new CTerminalCompositeView(this, this.Width, this.Height);
AddSubview(terminalView);
}

Expand All @@ -68,7 +68,7 @@ public CTerminal Terminal

internal static void ShowWindow()
{
EditorWindow.GetWindow<TerminalWindow>();
EditorWindow.GetWindow<CTerminalWindow>();
}

#endregion
Expand Down
16 changes: 8 additions & 8 deletions Project/Assets/LunarPlugin/Editor/UI/CTextField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@

namespace LunarEditor
{
delegate void TextFieldDelegate(TextField field);
delegate bool TextFieldKeyDelegate(TextField field, KeyCode code, bool pressed);
delegate void CTextFieldDelegate(CTextField field);
delegate bool CTextFieldKeyDelegate(CTextField field, KeyCode code, bool pressed);

class TextField : View
class CTextField : View
{
private string m_text;
private bool m_firstKeyDown;

public TextField(string text = "")
public CTextField(string text = "")
: this(0, 0, text)
{
}

public TextField(float x, float y, string text = "")
public CTextField(float x, float y, string text = "")
: this(x, y, UISize.TextFieldWidth, UISize.TextFieldHeight, text)
{
}

public TextField(float x, float y, float w, float h, string text = "")
public CTextField(float x, float y, float w, float h, string text = "")
: base(x, y, w, h)
{
Text = text;
Expand Down Expand Up @@ -228,8 +228,8 @@ public string Text
}
}

public TextFieldDelegate TextChangedDelegate { get; set; }
public TextFieldKeyDelegate TextKeyDelegate { get; set; }
public CTextFieldDelegate TextChangedDelegate { get; set; }
public CTextFieldKeyDelegate TextKeyDelegate { get; set; }

public bool IsCtrlPressed { get; private set; }
public bool IsAltPressed { get; private set; }
Expand Down

0 comments on commit 98fbb9b

Please sign in to comment.