2f107db...5202af9

This commit is contained in:
Joonas Rikkonen
2019-03-18 21:42:26 +02:00
parent 58c92888b7
commit 044fd3344b
395 changed files with 27417 additions and 19754 deletions
@@ -15,7 +15,7 @@ namespace Barotrauma
{
public event TextBoxEvent OnSelected;
public event TextBoxEvent OnDeselected;
bool caretVisible;
float caretTimer;
@@ -76,10 +76,24 @@ namespace Barotrauma
set { textBlock.TextGetter = value; }
}
private bool selected;
public bool Selected
{
get;
set;
get
{
return selected;
}
set
{
if (!selected && value)
{
Select();
}
else if (selected && !value)
{
Deselect();
}
}
}
public bool Wrap
@@ -326,9 +340,9 @@ namespace Barotrauma
{
memento.Store(Text);
}
Selected = true;
CaretIndex = GetCaretIndexFromScreenPos(PlayerInput.MousePosition);
ClearSelection();
selected = true;
GUI.KeyboardDispatcher.Subscriber = this;
OnSelected?.Invoke(this, Keys.None);
}
@@ -336,7 +350,8 @@ namespace Barotrauma
public void Deselect()
{
memento.Clear();
Selected = false;
selected = false;
if (GUI.KeyboardDispatcher.Subscriber == this)
{
GUI.KeyboardDispatcher.Subscriber = null;
@@ -382,6 +397,7 @@ namespace Barotrauma
}
else
{
if (PlayerInput.LeftButtonClicked() && selected) Deselect();
isSelecting = false;
state = ComponentState.None;
}