예제 #1
0
 private void GoBackClick(UIMouseEvent evt, UIElement listeningElement)
 {
     this.ApplyListChanges();
     Main.SaveSettings();
     Main.menuMode = 0;
     IngameFancyUI.Close();
 }
        private void OpenVirtualKeyboardWhenNeeded()
        {
            int maxInputLength = 40;
            UIVirtualKeyboard uIVirtualKeyboard = new UIVirtualKeyboard(Language.GetText("UI.PlayerNameSlot").Value, _searchString, OnFinishedSettingName, GoBackHere, 3, allowEmpty: true);

            uIVirtualKeyboard.SetMaxInputLength(maxInputLength);
            IngameFancyUI.OpenUIState(uIVirtualKeyboard);
        }
        private void OpenVirtualKeyboardWhenNeeded()
        {
            int length = 40;
            UIVirtualKeyboard uiVirtualKeyboard = new UIVirtualKeyboard(Language.GetText("UI.PlayerNameSlot").Value, this._searchString, new UIVirtualKeyboard.KeyboardSubmitEvent(this.OnFinishedSettingName), new Action(this.GoBackHere), 3, true);

            uiVirtualKeyboard.SetMaxInputLength(length);
            IngameFancyUI.OpenUIState((UIState)uiVirtualKeyboard);
        }
예제 #4
0
        private static void BackClick(UIMouseEvent evt, UIElement listeningElement)
        {
            Main.PlaySound(11, -1, -1, 1);
            //Main.menuMode = 0;

            //Main.menuMode = 1127;
            IngameFancyUI.Close();
        }
예제 #5
0
 private void Click_GoBack(UIMouseEvent evt, UIElement listeningElement)
 {
     SoundEngine.PlaySound(11, -1, -1, 1, 1f, 0.0f);
     if (Main.gameMenu)
     {
         Main.menuMode = 0;
     }
     else
     {
         IngameFancyUI.Close();
     }
 }
예제 #6
0
 public override void Click(UIMouseEvent evt)
 {
     base.Click(evt);
     if (Main.netMode == 0)
     {
         EmoteBubble.NewBubble(_emoteIndex, new WorldUIAnchor(Main.LocalPlayer), 360);
         EmoteBubble.CheckForNPCsToReactToEmoteBubble(_emoteIndex, Main.LocalPlayer);
     }
     else
     {
         NetMessage.SendData(120, -1, -1, null, Main.myPlayer, _emoteIndex);
     }
     IngameFancyUI.Close();
 }
예제 #7
0
 public override void Click(UIMouseEvent evt)
 {
     base.Click(evt);
     if (Main.netMode == 0)
     {
         EmoteBubble.NewBubble(this._emoteIndex, new WorldUIAnchor((Entity)Main.LocalPlayer), 360);
         EmoteBubble.CheckForNPCsToReactToEmoteBubble(this._emoteIndex, Main.LocalPlayer);
     }
     else
     {
         NetMessage.SendData(120, -1, -1, (NetworkText)null, Main.myPlayer, (float)this._emoteIndex, 0.0f, 0.0f, 0, 0, 0);
     }
     IngameFancyUI.Close();
 }
        /// <summary>
        /// Loads the UI for mod configs.
        /// </summary>
        /// <param name="config"></param>
        public static void OpenModConfigUI(ModConfig config)
        {
            Type interfaceType = ReflectionHelpers.GetMainAssembly()
                                 .GetType("Terraria.ModLoader.UI.Interface");

            if (!Main.gameMenu)
            {
                IngameOptions.Close();
                IngameFancyUI.CoverNextFrame();
                Main.playerInventory = false;
                Main.editChest       = false;
                Main.npcChatText     = "";
                Main.inFancyUI       = true;
            }
            else
            {
                if (!ReflectionHelpers.Get(interfaceType, null, "modConfigID", out Main.menuMode))
                {
                    LogHelpers.Warn("Could not get Interface.modConfigID");
                    return;
                }
            }

            UIState modConfigInterfaceObj;

            if (!ReflectionHelpers.Get(interfaceType, null, "modConfig", out modConfigInterfaceObj) || modConfigInterfaceObj == null)
            {
                LogHelpers.Warn("Could not get Interface.modConfig");
                return;
            }

            object _;

            if (!ReflectionHelpers.RunMethod(modConfigInterfaceObj, "SetMod", new object[] { config.mod, config }, out _))
            {
                LogHelpers.Warn("Could not run Interface.modConfig.SetMod");
                return;
            }

            Main.InGameUI.SetState(modConfigInterfaceObj);

            Main.PlaySound(SoundID.MenuTick);
        }
예제 #9
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;
        }
        /// <summary>
        /// Switches to the list of mod configs menu.
        /// </summary>
        public static void OpenModConfigListUI()
        {
            Type interfaceType = ReflectionLibraries.GetMainAssembly()
                                 .GetType("Terraria.ModLoader.UI.Interface");

            if (!Main.gameMenu)
            {
                IngameOptions.Close();
                IngameFancyUI.CoverNextFrame();
                Main.playerInventory = false;
                Main.editChest       = false;
                Main.npcChatText     = "";
                Main.inFancyUI       = true;
            }
            else
            {
                if (!ReflectionLibraries.Get(interfaceType, null, "modConfigID", out Main.menuMode))
                {
                    LogLibraries.Warn("Could not get Interface.modConfigID");
                    return;
                }
            }

            UIState modConfigListInterfaceObj;

            if (!ReflectionLibraries.Get(interfaceType, null, "modConfigList", out modConfigListInterfaceObj) ||
                modConfigListInterfaceObj == null)
            {
                LogLibraries.Warn("Could not get Interface.modConfigList");
                return;
            }

            Main.InGameUI.SetState(modConfigListInterfaceObj);

            Main.PlaySound(SoundID.MenuTick);
        }
예제 #11
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();
         double    num2      = (double)(rectangle.Bottom + 32);
예제 #12
0
 public override void OnClick()
 {
     IngameOptions.Close();
     IngameFancyUI.OpenAchievementsAndGoto(this._achievement);
 }
예제 #13
0
        public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers)
        {
            PlayerInput.SetZoom_Unscaled();
            PlayerInput.SetZoom_MouseInWorld();
            Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.mouseX + (double)Main.screenPosition.X), (int)((double)Main.mouseY + (double)Main.screenPosition.Y), 1, 1);
            if ((double)Main.player[Main.myPlayer].gravDir == -1.0)
            {
                rectangle1.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY;
            }
            PlayerInput.SetZoom_UI();
            IngameOptions.MouseOver();
            IngameFancyUI.MouseOver();

            for (int index1 = 0; index1 < 200; ++index1)
            {
                if (Main.npc[index1].active)
                {
                    Rectangle rectangle2 = new Rectangle((int)Main.npc[index1].Bottom.X - Main.npc[index1].frame.Width / 2,
                                                         (int)Main.npc[index1].Bottom.Y - Main.npc[index1].frame.Height,
                                                         Main.npc[index1].frame.Width,
                                                         Main.npc[index1].frame.Height);
                    if (Main.npc[index1].type >= 87 && Main.npc[index1].type <= 92)
                    {
                        rectangle2 = new Rectangle((int)((double)Main.npc[index1].position.X + (double)Main.npc[index1].width * 0.5 - 32.0),
                                                   (int)((double)Main.npc[index1].position.Y + (double)Main.npc[index1].height * 0.5 - 32.0),
                                                   64,
                                                   64);
                    }
                    bool flag1 = rectangle1.Intersects(rectangle2);
                    bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1;
                    if (flag2 && (
                            Main.npc[index1].type != 85 &&
                            Main.npc[index1].type != 341 &&
                            Main.npc[index1].aiStyle != 87 ||
                            Main.npc[index1].ai[0] != 0.0) &&
                        Main.npc[index1].type != 488)
                    {
                        if (flag1)
                        {
                            ElementHelper elementHelper = new ElementHelper();

                            float buffer = 4 * Main.UIScale;
                            float prev   = 0;

                            Element Primary    = elementHelper.Primary(Main.npc[index1]);
                            Element Secondary  = elementHelper.Secondary(Main.npc[index1]);
                            Element Tertiary   = elementHelper.Tertiary(Main.npc[index1]);
                            Element Quatrinary = elementHelper.Quatrinary(Main.npc[index1]);

                            var icon1 = GetTexture("Types/" + Formal.Name[Primary]);
                            var icon2 = GetTexture("Types/" + Formal.Name[Secondary]);
                            var icon3 = GetTexture("Types/" + Formal.Name[Tertiary]);
                            var icon4 = GetTexture("Types/" + Formal.Name[Quatrinary]);

                            int yOffset = 38;
                            int xOffset = 12;
                            Main.spriteBatch.Begin();
                            int x = (int)((Main.mouseX + xOffset) * Main.UIScale);
                            int y = (int)((Main.mouseY + yOffset) * Main.UIScale);
                            if (Primary != Element.none && Primary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon1, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                                prev += icon1.Width * Main.UIScale + buffer;
                            }
                            if (Secondary != Element.none && Secondary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon2, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                                prev += icon2.Width * Main.UIScale + buffer;
                            }
                            if (Tertiary != Element.none && Tertiary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon3, new Vector2(Main.mouseX + prev, Main.mouseY), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                            }
                            if (Quatrinary != Element.none && Quatrinary != Element.levitate)
                            {
                                Main.spriteBatch.Draw(icon4, new Vector2(x, y + icon1.Width * Main.UIScale + buffer), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0);
                            }
                            Main.spriteBatch.End();
                            break;
                        }
                        break;
                    }
                }
            }

            //PlayerInput.SetZoom_UI();
            base.ModifyInterfaceLayers(layers);
        }
예제 #14
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);
     }
 }
 private void GoBackHere()
 {
     IngameFancyUI.Close();
     _searchBar.ToggleTakingText();
     Main.CreativeMenu.GamepadMoveToSearchButtonHack = true;
 }
예제 #16
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);
     }
 }
예제 #17
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);
        }
예제 #18
0
 private void GoBackClick(UIMouseEvent evt, UIElement listeningElement)
 {
     Main.menuMode = 0;
     IngameFancyUI.Close();
 }
예제 #19
0
        public void GetDetails()
        {
            PlayerInput.SetZoom_Unscaled();
            PlayerInput.SetZoom_MouseInWorld();
            Rectangle mouseRectangle = new Rectangle((int)((float)Main.mouseX + Main.screenPosition.X), (int)((float)Main.mouseY + Main.screenPosition.Y), 1, 1);

            if (Main.player[Main.myPlayer].gravDir == -1f)
            {
                mouseRectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY;
            }
            Rectangle screenRectangle = new Rectangle((int)(Main.screenPosition.X), (int)(Main.screenPosition.Y), Main.screenWidth, Main.screenHeight);

            PlayerInput.SetZoom_UI();
            IngameOptions.MouseOver();
            IngameFancyUI.MouseOver();

            Main.HoveringOverAnNPC = false;
            NPC    ActualNPC;
            string TempText = "";
            UIText panel;

            for (int k = 0; k < 200; k++)
            {
                ActualNPC = Main.npc[k];
                if (ActualNPC.active && !ActualNPC.dontCountMe)
                {
                    int       type   = Main.npc[k].type;
                    Rectangle NPCPos = new Rectangle((int)ActualNPC.Bottom.X - ActualNPC.frame.Width / 2, (int)ActualNPC.Bottom.Y - ActualNPC.frame.Height, ActualNPC.frame.Width, ActualNPC.frame.Height);
                    if (ActualNPC.type >= 87 && ActualNPC.type <= 92)
                    {
                        NPCPos = new Rectangle((int)(ActualNPC.position.X + ActualNPC.width * 0.5 - 32.0), (int)(ActualNPC.position.Y + ActualNPC.height * 0.5 - 32.0), 64, 64);
                    }
                    bool IsMouseOver = mouseRectangle.Intersects(NPCPos);
                    bool IsOnScreen  = screenRectangle.Intersects(NPCPos);
                    if (IsMouseOver)
                    {
                        Main.player[Main.myPlayer].showItemIcon = false;

                        ARPGGlobalNPC Rnpc   = ActualNPC.GetGlobalNPC <ARPGGlobalNPC>();
                        string        preFix = "";
                        if (Rnpc.getLevel >= 0 && ActualNPC.damage > 0)
                        {
                            preFix = "Level : " + (Rnpc.getLevel + Rnpc.getTier) + "\n";

                            //  if (NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) > 0)
                            //      preFix += "World bonus level : +" + NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) + "\n";
                        }
                        TempText = "";

                        if (Main.npc[k].lifeMax > 1 && !Main.npc[k].dontTakeDamage)
                        {
                            TempText = string.Concat(new object[]
                            {
                                preFix,
                                "Rank : ",
                                (NPCRank)Rnpc.getRank,
                                "\nDamage : ",
                                Main.npc[k].damage,
                                "\nDef : ",
                                Main.npc[k].defense
                            });
                        }
                        panel = new UIText(TempText);


                        NPCDetails = new NPCInfoUI(TempText, Color.White, new Vector2(Main.mouseX, Main.mouseY));
                    }
                    else if (IsOnScreen && ((Config.vConfig.DisplayNpcName && !ActualNPC.townNPC) || (Config.vConfig.DisplayTownName && ActualNPC.townNPC)))
                    {
                        Main.player[Main.myPlayer].showItemIcon = false;
                        TempText = ActualNPC.GivenOrTypeName;
                        RPGModule.Entities.ARPGGlobalNPC Rnpc = ActualNPC.GetGlobalNPC <RPGModule.Entities.ARPGGlobalNPC>();
                        string preFix = "";
                        if (Rnpc.getLevel >= 0 && ActualNPC.damage > 0)
                        {
                            preFix = "Lvl." + (Rnpc.getLevel + Rnpc.getTier);

                            /*
                             * if (NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) > 0)
                             *  preFix += "( + " + RPGModule.Entities.NPCUtils.GetWorldTier(ActualNPC, Rnpc.getLevel) + " )";
                             */
                        }

                        TempText = "";

                        if (Main.npc[k].lifeMax > 1 && !Main.npc[k].dontTakeDamage)
                        {
                            TempText = string.Concat(new object[]
                            {
                                preFix,
                                " | ",
                                //ActualNPC.GivenOrTypeName,
                                //": ",
                                Main.npc[k].life,
                                "/",
                                Main.npc[k].lifeMax
                            });
                        }
                        int NpcColor    = 0;
                        int LevelOffSet = (ActualNPC.GetGlobalNPC <ARPGGlobalNPC>().getLevel + ActualNPC.GetGlobalNPC <RPGModule.Entities.ARPGGlobalNPC>().getTier) - Main.LocalPlayer.GetModPlayer <RPGModule.Entities.RPGPlayer>().GetLevel();
                        if (LevelOffSet < -100)
                        {
                            NpcColor = 0;
                        }
                        else if (LevelOffSet < -50)
                        {
                            NpcColor = 1;
                        }
                        else if (LevelOffSet < -15)
                        {
                            NpcColor = 2;
                        }
                        else if (LevelOffSet < -5)
                        {
                            NpcColor = 3;
                        }
                        else if (LevelOffSet < 5)
                        {
                            NpcColor = 4;
                        }
                        else if (LevelOffSet < 20)
                        {
                            NpcColor = 5;
                        }
                        else if (LevelOffSet < 40)
                        {
                            NpcColor = 6;
                        }
                        else if (LevelOffSet < 75)
                        {
                            NpcColor = 7;
                        }
                        else if (LevelOffSet < 100)
                        {
                            NpcColor = 8;
                        }
                        else
                        {
                            NpcColor = 9;
                        }

                        switch (ActualNPC.GetGlobalNPC <ARPGGlobalNPC>().getRank)
                        {
                        case 0:
                            NpcColor--;
                            break;

                        case 2:
                        case 3:
                            NpcColor++;
                            break;

                        case 4:
                        case 5:
                            NpcColor += 2;
                            break;

                        case 6:
                        case 7:
                            NpcColor += 3;
                            break;
                        }

                        if (ActualNPC.townNPC)
                        {
                            NpcColor = 0;
                        }
                        NPCName.Add(new NPCInfoUI(TempText, ColorDic[NpcColor], new Vector2(ActualNPC.Bottom.X - Main.screenPosition.X, ActualNPC.Bottom.Y - Main.screenPosition.Y)));
                    }
                }
            }
        }