Skip to content

Commit

Permalink
0.4.0.3 release, right click or clear button on text input fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Oct 4, 2017
1 parent 135bdc3 commit 574da16
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RecipeBrowserPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public override void ProcessTriggers(TriggersSet triggersSet)
{
RecipeBrowserUI.instance.ShowRecipeBrowser = !RecipeBrowserUI.instance.ShowRecipeBrowser;
// Debug assistance, allows for reinitializing RecipeBrowserUI
//if (!RecipeBrowser.instance.recipeBrowserTool.visible)
//if (!RecipeBrowserUI.instance.ShowRecipeBrowser)
//{
// RecipeBrowserUI.instance.RemoveAllChildren();
// var isInitializedFieldInfo = typeof(Terraria.UI.UIElement).GetField("_isInitialized", BindingFlags.Instance | BindingFlags.NonPublic);
Expand Down
19 changes: 17 additions & 2 deletions UIElements/NewUITextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ public NewUITextBox(string hintText, string text = "")
{
this.hintText = hintText;
currentString = text;
//SetPadding(0);
SetPadding(0);
BackgroundColor = Color.White;
BorderColor = Color.White;
// keyBoardInput.newKeyEvent += KeyboardInput_newKeyEvent;

Texture2D texture = RecipeBrowser.instance.GetTexture("UIElements/closeButton");
var closeButton = new UIHoverImageButton(texture, "");
closeButton.OnClick += (a, b) => SetText("");
closeButton.Left.Set(-20f, 1f);
//closeButton.Top.Set(0f, .5f);
closeButton.VAlign = 0.5f;
//closeButton.HAlign = 0.5f;
Append(closeButton);
}

public override void Click(UIMouseEvent evt)
Expand All @@ -47,6 +56,12 @@ public override void Click(UIMouseEvent evt)
base.Click(evt);
}

public override void RightClick(UIMouseEvent evt)
{
base.RightClick(evt);
SetText("");
}

public void SetUnfocusKeys(bool unfocusOnEnter, bool unfocusOnTab)
{
this.unfocusOnEnter = unfocusOnEnter;
Expand Down Expand Up @@ -138,7 +153,7 @@ public void SetText(string text)
{
text = text.ToString().Substring(0, this._maxLength);
}
if(currentString != text)
if (currentString != text)
{
currentString = text;
OnTextChanged?.Invoke();
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = jopojelly
version = 0.4.0.2
version = 0.4.0.3
displayName = Recipe Browser
homepage = https://forums.terraria.org/index.php?threads/recipe-browser.62462/
buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, unused\*, .git\*,
Expand Down

0 comments on commit 574da16

Please sign in to comment.