예제 #1
0
        private void BoxOnClick(UIMouseEvent evt, UIElement listeningElement)
        {
            if (Main.drawingPlayerChat)
            {
                return;
            }
            if (IngameFancyUI.CanShowVirtualKeyboard(1) && UIVirtualKeyboard.KeyboardContext == 1)
            {
                return;
            }
            if (Focus)
            {
                SetValueFromText();
                return;
            }

            Focus           = true;
            focusTick       = 0;
            Main.blockInput = true;

            Main.PlaySound(Terraria.ID.SoundID.MenuOpen);
            numberBox.BackgroundColor = UIColour.darkBackgroundColour;
            numberBox.BorderColor     = UIColour.lightborderColour;
        }
예제 #2
0
 protected override void DrawSelf(SpriteBatch spriteBatch)
 {
     if (Main.gameMenu)
     {
         if (PlayerInput.UsingGamepad)
         {
             this.outerLayer2.Remove();
             if (!this.Elements.Contains(this.outerLayer1))
             {
                 this.Append(this.outerLayer1);
             }
             this.outerLayer1.Activate();
             this.outerLayer2.Deactivate();
             this.Recalculate();
             this.RecalculateChildren();
             if ((double)this._labelHeight != 0.0)
             {
                 this._textBox.Top.Pixels = this._textBoxHeight;
                 this._label.Top.Pixels   = this._labelHeight;
                 this._textBox.Recalculate();
                 this._label.Recalculate();
                 this._labelHeight = this._textBoxHeight = 0.0f;
                 UserInterface.ActiveInstance.ResetLasts();
             }
         }
         else
         {
             this.outerLayer1.Remove();
             if (!this.Elements.Contains(this.outerLayer2))
             {
                 this.Append(this.outerLayer2);
             }
             this.outerLayer2.Activate();
             this.outerLayer1.Deactivate();
             this.Recalculate();
             this.RecalculateChildren();
             if ((double)this._textBoxHeight == 0.0)
             {
                 this._textBoxHeight       = this._textBox.Top.Pixels;
                 this._labelHeight         = this._label.Top.Pixels;
                 this._textBox.Top.Pixels += 50f;
                 this._label.Top.Pixels   += 50f;
                 this._textBox.Recalculate();
                 this._label.Recalculate();
                 UserInterface.ActiveInstance.ResetLasts();
             }
         }
     }
     if (!Main.editSign && this._edittingSign)
     {
         IngameFancyUI.Close();
     }
     else if (!Main.editChest && this._edittingChest)
     {
         IngameFancyUI.Close();
     }
     else
     {
         base.DrawSelf(spriteBatch);
         this.UpdateOffsetDown();
         UIVirtualKeyboard.OffsetDown = 0;
         this.SetupGamepadPoints(spriteBatch);
         PlayerInput.WritingText = true;
         Main.instance.HandleIME();
         Vector2 position = new Vector2((float)(Main.screenWidth / 2), (float)(this._textBox.GetDimensions().ToRectangle().Bottom + 32));
         Main.instance.DrawWindowsIMEPanel(position, 0.5f);
         string inputText = Main.GetInputText(this.Text);
         if (this._edittingSign && Main.inputTextEnter)
         {
             inputText += (string)(object)'\n';
         }
         else
         {
             if (this._edittingChest && Main.inputTextEnter)
             {
                 ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                 IngameFancyUI.Close();
                 return;
             }
             if (Main.inputTextEnter && UIVirtualKeyboard.CanSubmit)
             {
                 UIVirtualKeyboard.Submit();
             }
             else if (Main.inputTextEscape)
             {
                 if (this._edittingSign)
                 {
                     Main.InputTextSignCancel();
                 }
                 if (this._edittingChest)
                 {
                     ChestUI.RenameChestCancel();
                 }
                 IngameFancyUI.Close();
                 return;
             }
         }
         if (IngameFancyUI.CanShowVirtualKeyboard(this._keyboardContext))
         {
             if (inputText != this.Text)
             {
                 this.Text = inputText;
             }
             if (this._edittingSign)
             {
                 this.CopyTextToSign();
             }
             if (this._edittingChest)
             {
                 this.CopyTextToChest();
             }
         }
         byte  num   = (byte)(((int)byte.MaxValue + (int)Main.tileColor.R * 2) / 3);
         Color color = new Color((int)num, (int)num, (int)num, (int)byte.MaxValue);
         this._textBox.TextColor = Color.Lerp(Color.White, color, 0.2f);
         this._label.TextColor   = Color.Lerp(Color.White, color, 0.2f);
         position = new Vector2((float)(Main.screenWidth / 2), (float)(this._textBox.GetDimensions().ToRectangle().Bottom + 32));
         Main.instance.DrawWindowsIMEPanel(position, 0.5f);
     }
 }
예제 #3
0
 protected override void DrawSelf(SpriteBatch spriteBatch)
 {
     if (Main.gameMenu)
     {
         if (PlayerInput.UsingGamepad)
         {
             this.outerLayer2.Remove();
             if (!this.Elements.Contains(this.outerLayer1))
             {
                 this.Append(this.outerLayer1);
             }
             this.outerLayer1.Activate();
             this.outerLayer2.Deactivate();
             this.Recalculate();
             this.RecalculateChildren();
             if ((double)this._labelHeight != 0.0)
             {
                 this._textBox.Top.Pixels = this._textBoxHeight;
                 this._label.Top.Pixels   = this._labelHeight;
                 this._textBox.Recalculate();
                 this._label.Recalculate();
                 this._labelHeight = this._textBoxHeight = 0.0f;
                 UserInterface.ActiveInstance.ResetLasts();
             }
         }
         else
         {
             this.outerLayer1.Remove();
             if (!this.Elements.Contains(this.outerLayer2))
             {
                 this.Append(this.outerLayer2);
             }
             this.outerLayer2.Activate();
             this.outerLayer1.Deactivate();
             this.Recalculate();
             this.RecalculateChildren();
             if ((double)this._textBoxHeight == 0.0)
             {
                 this._textBoxHeight       = this._textBox.Top.Pixels;
                 this._labelHeight         = this._label.Top.Pixels;
                 this._textBox.Top.Pixels += 50f;
                 this._label.Top.Pixels   += 50f;
                 this._textBox.Recalculate();
                 this._label.Recalculate();
                 UserInterface.ActiveInstance.ResetLasts();
             }
         }
     }
     if (!Main.editSign && this._edittingSign)
     {
         IngameFancyUI.Close();
     }
     else if (!Main.editChest && this._edittingChest)
     {
         IngameFancyUI.Close();
     }
     else
     {
         base.DrawSelf(spriteBatch);
         this.UpdateOffsetDown();
         UIVirtualKeyboard.OffsetDown = 0;
         this.SetupGamepadPoints(spriteBatch);
         PlayerInput.WritingText = true;
         Main.instance.HandleIME();
         Vector2 position;
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Vector2&  local1    = @position;
         double    num1      = (double)(Main.screenWidth / 2);
         Rectangle rectangle = this._textBox.GetDimensions().ToRectangle();
         // ISSUE: explicit reference operation
         double num2 = (double)(((Rectangle)@rectangle).get_Bottom() + 32);
         ((Vector2)local1).\u002Ector((float)num1, (float)num2);
         Main.instance.DrawWindowsIMEPanel(position, 0.5f);
         string inputText = Main.GetInputText(this.Text);
         if (this._edittingSign && Main.inputTextEnter)
         {
             inputText += "\n";
         }
         else
         {
             if (this._edittingChest && Main.inputTextEnter)
             {
                 ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                 IngameFancyUI.Close();
                 return;
             }
             if (Main.inputTextEnter && UIVirtualKeyboard.CanSubmit)
             {
                 UIVirtualKeyboard.Submit();
             }
             else if (Main.inputTextEscape)
             {
                 if (this._edittingSign)
                 {
                     Main.InputTextSignCancel();
                 }
                 if (this._edittingChest)
                 {
                     ChestUI.RenameChestCancel();
                 }
                 IngameFancyUI.Close();
                 return;
             }
         }
         if (IngameFancyUI.CanShowVirtualKeyboard(this._keyboardContext))
         {
             if (inputText != this.Text)
             {
                 this.Text = inputText;
             }
             if (this._edittingSign)
             {
                 this.CopyTextToSign();
             }
             if (this._edittingChest)
             {
                 this.CopyTextToChest();
             }
         }
         // ISSUE: explicit reference operation
         byte  num3 = (byte)(((int)byte.MaxValue + (int)((Color)@Main.tileColor).get_R() * 2) / 3);
         Color color;
         // ISSUE: explicit reference operation
         ((Color)@color).\u002Ector((int)num3, (int)num3, (int)num3, (int)byte.MaxValue);
         this._textBox.TextColor = Color.Lerp(Color.get_White(), color, 0.2f);
         this._label.TextColor   = Color.Lerp(Color.get_White(), color, 0.2f);
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Vector2& local2 = @position;
         double   num4   = (double)(Main.screenWidth / 2);
         rectangle = this._textBox.GetDimensions().ToRectangle();
         // ISSUE: explicit reference operation
         double num5 = (double)(((Rectangle)@rectangle).get_Bottom() + 32);
         ((Vector2)local2).\u002Ector((float)num4, (float)num5);
         Main.instance.DrawWindowsIMEPanel(position, 0.5f);
     }
 }
예제 #4
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            if (Main.gameMenu)
            {
                if (PlayerInput.UsingGamepad)
                {
                    outerLayer2.Remove();
                    if (!Elements.Contains(outerLayer1))
                    {
                        Append(outerLayer1);
                    }
                    outerLayer1.Activate();
                    outerLayer2.Deactivate();
                    Recalculate();
                    RecalculateChildren();
                    if (_labelHeight != 0f)
                    {
                        _textBox.Top.Pixels = _textBoxHeight;
                        _label.Top.Pixels   = _labelHeight;
                        _textBox.Recalculate();
                        _label.Recalculate();
                        _labelHeight = (_textBoxHeight = 0f);
                        UserInterface.ActiveInstance.ResetLasts();
                    }
                }
                else
                {
                    outerLayer1.Remove();
                    if (!Elements.Contains(outerLayer2))
                    {
                        Append(outerLayer2);
                    }
                    outerLayer2.Activate();
                    outerLayer1.Deactivate();
                    Recalculate();
                    RecalculateChildren();
                    if (_textBoxHeight == 0f)
                    {
                        _textBoxHeight       = _textBox.Top.Pixels;
                        _labelHeight         = _label.Top.Pixels;
                        _textBox.Top.Pixels += 50f;
                        _label.Top.Pixels   += 50f;
                        _textBox.Recalculate();
                        _label.Recalculate();
                        UserInterface.ActiveInstance.ResetLasts();
                    }
                }
            }
            if (!Main.editSign && _edittingSign)
            {
                IngameFancyUI.Close();
                return;
            }
            if (!Main.editChest && _edittingChest)
            {
                IngameFancyUI.Close();
                return;
            }
            base.DrawSelf(spriteBatch);
            UpdateOffsetDown();
            OffsetDown     = 0;
            ShouldHideText = false;
            SetupGamepadPoints(spriteBatch);
            PlayerInput.WritingText = true;
            Main.instance.HandleIME();
            Vector2 position = new Vector2(Main.screenWidth / 2, _textBox.GetDimensions().ToRectangle().Bottom + 32);

            Main.instance.DrawWindowsIMEPanel(position, 0.5f);
            string text = Main.GetInputText(Text, _edittingSign);

            if (_edittingSign && Main.inputTextEnter)
            {
                text += "\n";
            }
            else
            {
                if (_edittingChest && Main.inputTextEnter)
                {
                    ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                    IngameFancyUI.Close();
                    return;
                }
                if (Main.inputTextEnter && CanSubmit)
                {
                    Submit();
                }
                else if (_edittingChest && Main.player[Main.myPlayer].chest < 0)
                {
                    ChestUI.RenameChestCancel();
                }
                else if (Main.inputTextEscape)
                {
                    if (_edittingSign)
                    {
                        Main.InputTextSignCancel();
                    }
                    if (_edittingChest)
                    {
                        ChestUI.RenameChestCancel();
                    }
                    IngameFancyUI.Close();
                    return;
                }
            }
            if (IngameFancyUI.CanShowVirtualKeyboard(_keyboardContext))
            {
                if (text != Text)
                {
                    Text = text;
                }
                if (_edittingSign)
                {
                    CopyTextToSign();
                }
                if (_edittingChest)
                {
                    CopyTextToChest();
                }
            }
            byte  b     = (byte)((255 + Main.tileColor.R * 2) / 3);
            Color value = new Color((int)b, (int)b, (int)b, 255);

            _textBox.TextColor = Color.Lerp(Color.White, value, 0.2f);
            _label.TextColor   = Color.Lerp(Color.White, value, 0.2f);
            position           = new Vector2(Main.screenWidth / 2, _textBox.GetDimensions().ToRectangle().Bottom + 32);
            Main.instance.DrawWindowsIMEPanel(position, 0.5f);
        }