示例#1
0
 private static void DrawButtons(SpriteBatch spritebatch)
 {
     for (int ID = 0; ID < 6; ++ID)
     {
         ChestUI.DrawButton(spritebatch, ID, 506, Main.instance.invBottom + 40);
     }
 }
示例#2
0
 public static void Draw(SpriteBatch spritebatch)
 {
     if (Main.player[Main.myPlayer].chest != -1 && !Main.recBigList)
     {
         Main.inventoryScale = 0.755f;
         if (Utils.FloatIntersect((float)Main.mouseX, (float)Main.mouseY, 0.0f, 0.0f, 73f, (float)Main.instance.invBottom, 560f * Main.inventoryScale, 224f * Main.inventoryScale))
         {
             Main.player[Main.myPlayer].mouseInterface = true;
         }
         ChestUI.DrawName(spritebatch);
         ChestUI.DrawButtons(spritebatch);
         ChestUI.DrawSlots(spritebatch);
     }
     else
     {
         for (int index = 0; index < 6; ++index)
         {
             ChestUI.ButtonScale[index]   = 0.75f;
             ChestUI.ButtonHovered[index] = false;
         }
     }
 }
        public static void OpenVirtualKeyboard(int keyboardContext)
        {
            IngameFancyUI.CoverNextFrame();
            Main.PlaySound(12, -1, -1, 1, 1f, 0.0f);
            var labelText = "";

            switch (keyboardContext)
            {
            case 1:
                Main.editSign = true;
                labelText     = Language.GetTextValue("UI.EnterMessage");
                break;

            case 2:
                labelText = Language.GetTextValue("UI.EnterNewName");
                var player = Main.player[Main.myPlayer];
                Main.npcChatText = Main.chest[player.chest].name;
                if (Main.tile[player.chestX, player.chestY].type == (ushort)21)
                {
                    Main.defaultChestName =
                        Lang.chestType[(int)Main.tile[player.chestX, player.chestY].frameX / 36].Value;
                }
                if (Main.tile[player.chestX, player.chestY].type == (ushort)467)
                {
                    Main.defaultChestName =
                        Lang.chestType2[(int)Main.tile[player.chestX, player.chestY].frameX / 36].Value;
                }
                if (Main.tile[player.chestX, player.chestY].type == (ushort)88)
                {
                    Main.defaultChestName =
                        Lang.dresserType[(int)Main.tile[player.chestX, player.chestY].frameX / 54].Value;
                }
                if (Main.npcChatText == "")
                {
                    Main.npcChatText = Main.defaultChestName;
                }
                Main.editChest = true;
                break;
            }

            Main.clrInput();
            if (!IngameFancyUI.CanShowVirtualKeyboard(keyboardContext))
            {
                return;
            }
            Main.inFancyUI = true;
            switch (keyboardContext)
            {
            case 1:
                Main.InGameUI.SetState((UIState) new UIVirtualKeyboard(labelText, Main.npcChatText,
                                                                       (UIVirtualKeyboard.KeyboardSubmitEvent)(s =>
                {
                    Main.SubmitSignText();
                    IngameFancyUI.Close();
                }), (Action)(() =>
                {
                    Main.InputTextSignCancel();
                    IngameFancyUI.Close();
                }), keyboardContext, false));
                break;

            case 2:
                Main.InGameUI.SetState((UIState) new UIVirtualKeyboard(labelText, Main.npcChatText,
                                                                       (UIVirtualKeyboard.KeyboardSubmitEvent)(s =>
                {
                    ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                    IngameFancyUI.Close();
                }), (Action)(() =>
                {
                    ChestUI.RenameChestCancel();
                    IngameFancyUI.Close();
                }), keyboardContext, false));
                break;
            }

            UILinkPointNavigator.GoToDefaultPage(1);
        }
示例#4
0
        public static void OpenVirtualKeyboard(int keyboardContext)
        {
            IngameFancyUI.CoverNextFrame();
            Main.PlaySound(12, -1, -1, 1, 1f, 0.0f);
            string str = "";

            if (keyboardContext != 1)
            {
                if (keyboardContext == 2)
                {
                    str = Language.GetTextValue("UI.EnterNewName");
                    Player player = Main.player[Main.myPlayer];
                    Main.npcChatText = Main.chest[player.chest].name;
                    if ((int)Main.tile[player.chestX, player.chestY].type == 21)
                    {
                        Main.defaultChestName = Lang.chestType[(int)Main.tile[player.chestX, player.chestY].frameX / 36].Value;
                    }
                    if ((int)Main.tile[player.chestX, player.chestY].type == 467)
                    {
                        Main.defaultChestName = Lang.chestType2[(int)Main.tile[player.chestX, player.chestY].frameX / 36].Value;
                    }
                    if ((int)Main.tile[player.chestX, player.chestY].type == 88)
                    {
                        Main.defaultChestName = Lang.dresserType[(int)Main.tile[player.chestX, player.chestY].frameX / 54].Value;
                    }
                    if (Main.npcChatText == "")
                    {
                        Main.npcChatText = Main.defaultChestName;
                    }
                    Main.editChest = true;
                }
            }
            else
            {
                Main.editSign = true;
                str           = Language.GetTextValue("UI.EnterMessage");
            }
            Main.clrInput();
            if (!IngameFancyUI.CanShowVirtualKeyboard(keyboardContext))
            {
                return;
            }
            Main.inFancyUI = true;
            if (keyboardContext != 1)
            {
                if (keyboardContext == 2)
                {
                    UserInterface inGameUi    = Main.InGameUI;
                    string        labelText   = str;
                    string        npcChatText = Main.npcChatText;
                    UIVirtualKeyboard.KeyboardSubmitEvent keyboardSubmitEvent = (UIVirtualKeyboard.KeyboardSubmitEvent)(s =>
                    {
                        ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                        IngameFancyUI.Close();
                    });
                    int inputMode = keyboardContext;
                    int num       = 0;
                    UIVirtualKeyboard.KeyboardSubmitEvent submitAction;
                    UIVirtualKeyboard uiVirtualKeyboard = new UIVirtualKeyboard(labelText, npcChatText, submitAction, (Action)(() =>
                    {
                        ChestUI.RenameChestCancel();
                        IngameFancyUI.Close();
                    }), inputMode, num != 0);
                    inGameUi.SetState((UIState)uiVirtualKeyboard);
                }
            }
            else
            {
                UserInterface inGameUi    = Main.InGameUI;
                string        labelText   = str;
                string        npcChatText = Main.npcChatText;
                UIVirtualKeyboard.KeyboardSubmitEvent keyboardSubmitEvent = (UIVirtualKeyboard.KeyboardSubmitEvent)(s =>
                {
                    Main.SubmitSignText();
                    IngameFancyUI.Close();
                });
                int inputMode = keyboardContext;
                int num       = 0;
                UIVirtualKeyboard.KeyboardSubmitEvent submitAction;
                UIVirtualKeyboard uiVirtualKeyboard = new UIVirtualKeyboard(labelText, npcChatText, submitAction, (Action)(() =>
                {
                    Main.InputTextSignCancel();
                    IngameFancyUI.Close();
                }), inputMode, num != 0);
                inGameUi.SetState((UIState)uiVirtualKeyboard);
            }
            UILinkPointNavigator.GoToDefaultPage(1);
        }
示例#5
0
        public static void OpenVirtualKeyboard(int keyboardContext)
        {
            CoverNextFrame();
            ClearChat();
            SoundEngine.PlaySound(12);
            string labelText = "";

            switch (keyboardContext)
            {
            case 1:
                Main.editSign = true;
                labelText     = Language.GetTextValue("UI.EnterMessage");
                break;

            case 2:
            {
                labelText = Language.GetTextValue("UI.EnterNewName");
                Player player = Main.player[Main.myPlayer];
                Main.npcChatText = Main.chest[player.chest].name;
                Tile tile = Main.tile[player.chestX, player.chestY];
                if (tile.type == 21)
                {
                    Main.defaultChestName = Lang.chestType[tile.frameX / 36].Value;
                }
                else if (tile.type == 467 && tile.frameX / 36 == 4)
                {
                    Main.defaultChestName = Lang.GetItemNameValue(3988);
                }
                else if (tile.type == 467)
                {
                    Main.defaultChestName = Lang.chestType2[tile.frameX / 36].Value;
                }
                else if (tile.type == 88)
                {
                    Main.defaultChestName = Lang.dresserType[tile.frameX / 54].Value;
                }
                if (Main.npcChatText == "")
                {
                    Main.npcChatText = Main.defaultChestName;
                }
                Main.editChest = true;
                break;
            }
            }
            Main.clrInput();
            if (CanShowVirtualKeyboard(keyboardContext))
            {
                Main.inFancyUI = true;
                switch (keyboardContext)
                {
                case 1:
                    Main.InGameUI.SetState(new UIVirtualKeyboard(labelText, Main.npcChatText, delegate
                    {
                        Main.SubmitSignText();
                        Close();
                    }, delegate
                    {
                        Main.InputTextSignCancel();
                        Close();
                    }, keyboardContext));
                    break;

                case 2:
                    Main.InGameUI.SetState(new UIVirtualKeyboard(labelText, Main.npcChatText, delegate
                    {
                        ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                        Close();
                    }, delegate
                    {
                        ChestUI.RenameChestCancel();
                        Close();
                    }, keyboardContext));
                    break;
                }
                UILinkPointNavigator.GoToDefaultPage(1);
            }
        }
示例#6
0
        public static void OpenVirtualKeyboard(int keyboardContext)
        {
            IngameFancyUI.CoverNextFrame();
            Main.PlaySound(12, -1, -1, 1, 1f, 0.0f);
            string str = "";

            switch (keyboardContext)
            {
            case 1:
                Main.editSign = true;
                str           = Language.GetTextValue("UI.EnterMessage");
                break;

            case 2:
                str = Language.GetTextValue("UI.EnterNewName");
                Player player = Main.player[Main.myPlayer];
                Main.npcChatText = Main.chest[player.chest].name;
                if ((int)Main.tile[player.chestX, player.chestY].type == 21)
                {
                    Main.defaultChestName = Lang.chestType[(int)Main.tile[player.chestX, player.chestY].frameX / 36].Value;
                }
                if ((int)Main.tile[player.chestX, player.chestY].type == 467)
                {
                    Main.defaultChestName = Lang.chestType2[(int)Main.tile[player.chestX, player.chestY].frameX / 36].Value;
                }
                if ((int)Main.tile[player.chestX, player.chestY].type == 88)
                {
                    Main.defaultChestName = Lang.dresserType[(int)Main.tile[player.chestX, player.chestY].frameX / 54].Value;
                }
                if (Main.npcChatText == "")
                {
                    Main.npcChatText = Main.defaultChestName;
                }
                Main.editChest = true;
                break;
            }
            Main.clrInput();
            if (!IngameFancyUI.CanShowVirtualKeyboard(keyboardContext))
            {
                return;
            }
            Main.inFancyUI = true;
            switch (keyboardContext)
            {
            case 1:
                UserInterface inGameUi1    = Main.InGameUI;
                string        labelText1   = str;
                string        npcChatText1 = Main.npcChatText;
                UIVirtualKeyboard.KeyboardSubmitEvent submitAction1 = (UIVirtualKeyboard.KeyboardSubmitEvent)(s =>
                {
                    Main.SubmitSignText();
                    IngameFancyUI.Close();
                });
                // ISSUE: reference to a compiler-generated field
                if (IngameFancyUI.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate5 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: method pointer
                    IngameFancyUI.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate5 = new Action((object)null, __methodptr(\u003COpenVirtualKeyboard\u003Eb__1));
                }
                // ISSUE: reference to a compiler-generated field
                Action            anonymousMethodDelegate5 = IngameFancyUI.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate5;
                int               inputMode1         = keyboardContext;
                int               num1               = 0;
                UIVirtualKeyboard uiVirtualKeyboard1 = new UIVirtualKeyboard(labelText1, npcChatText1, submitAction1, anonymousMethodDelegate5, inputMode1, num1 != 0);
                inGameUi1.SetState((UIState)uiVirtualKeyboard1);
                break;

            case 2:
                UserInterface inGameUi2    = Main.InGameUI;
                string        labelText2   = str;
                string        npcChatText2 = Main.npcChatText;
                UIVirtualKeyboard.KeyboardSubmitEvent submitAction2 = (UIVirtualKeyboard.KeyboardSubmitEvent)(s =>
                {
                    ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                    IngameFancyUI.Close();
                });
                // ISSUE: reference to a compiler-generated field
                if (IngameFancyUI.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate7 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: method pointer
                    IngameFancyUI.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate7 = new Action((object)null, __methodptr(\u003COpenVirtualKeyboard\u003Eb__3));
                }
                // ISSUE: reference to a compiler-generated field
                Action            anonymousMethodDelegate7 = IngameFancyUI.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate7;
                int               inputMode2         = keyboardContext;
                int               num2               = 0;
                UIVirtualKeyboard uiVirtualKeyboard2 = new UIVirtualKeyboard(labelText2, npcChatText2, submitAction2, anonymousMethodDelegate7, inputMode2, num2 != 0);
                inGameUi2.SetState((UIState)uiVirtualKeyboard2);
                break;
            }
            UILinkPointNavigator.GoToDefaultPage(1);
        }
示例#7
0
        public static void QuickStack()
        {
            Player player = Main.player[Main.myPlayer];

            if (player.chest == -3)
            {
                ChestUI.MoveCoins(player.inventory, player.bank2.item);
            }
            else if (player.chest == -2)
            {
                ChestUI.MoveCoins(player.inventory, player.bank.item);
            }
            Item[] objArray1 = player.inventory;
            Item[] objArray2 = player.bank.item;
            if (player.chest > -1)
            {
                objArray2 = Main.chest[player.chest].item;
            }
            else if (player.chest == -2)
            {
                objArray2 = player.bank.item;
            }
            else if (player.chest == -3)
            {
                objArray2 = player.bank2.item;
            }
            List <int>            list1      = new List <int>();
            List <int>            list2      = new List <int>();
            List <int>            list3      = new List <int>();
            Dictionary <int, int> dictionary = new Dictionary <int, int>();
            List <int>            list4      = new List <int>();

            bool[] flagArray = new bool[objArray2.Length];
            for (int index = 0; index < 40; ++index)
            {
                if (objArray2[index].itemId > 0 && objArray2[index].stack > 0 && objArray2[index].maxStack > 1 && (objArray2[index].itemId < 71 || objArray2[index].itemId > 74))
                {
                    list2.Add(index);
                    list1.Add(objArray2[index].netID);
                }
                if (objArray2[index].itemId == 0 || objArray2[index].stack <= 0)
                {
                    list3.Add(index);
                }
            }
            int num1 = 50;

            if (player.chest <= -2)
            {
                num1 += 4;
            }
            for (int key = 0; key < num1; ++key)
            {
                if (list1.Contains(objArray1[key].netID) && !objArray1[key].favorited)
                {
                    dictionary.Add(key, objArray1[key].netID);
                }
            }
            for (int index1 = 0; index1 < list2.Count; ++index1)
            {
                int index2 = list2[index1];
                int num2   = objArray2[index2].netID;
                foreach (KeyValuePair <int, int> keyValuePair in dictionary)
                {
                    if (keyValuePair.Value == num2 && objArray1[keyValuePair.Key].netID == num2)
                    {
                        int num3 = objArray1[keyValuePair.Key].stack;
                        int num4 = objArray2[index2].maxStack - objArray2[index2].stack;
                        if (num4 != 0)
                        {
                            if (num3 > num4)
                            {
                                num3 = num4;
                            }
                            Main.PlaySound(7, -1, -1, 1);
                            objArray2[index2].stack           += num3;
                            objArray1[keyValuePair.Key].stack -= num3;
                            if (objArray1[keyValuePair.Key].stack == 0)
                            {
                                objArray1[keyValuePair.Key].SetDefaults(0, false);
                            }
                            flagArray[index2] = true;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            foreach (KeyValuePair <int, int> keyValuePair in dictionary)
            {
                if (objArray1[keyValuePair.Key].stack == 0)
                {
                    list4.Add(keyValuePair.Key);
                }
            }
            foreach (int key in list4)
            {
                dictionary.Remove(key);
            }
            for (int index1 = 0; index1 < list3.Count; ++index1)
            {
                int  index2 = list3[index1];
                bool flag   = true;
                int  num2   = objArray2[index2].netID;
                foreach (KeyValuePair <int, int> keyValuePair in dictionary)
                {
                    if (keyValuePair.Value == num2 && objArray1[keyValuePair.Key].netID == num2 || flag && objArray1[keyValuePair.Key].stack > 0)
                    {
                        Main.PlaySound(7, -1, -1, 1);
                        if (flag)
                        {
                            num2 = keyValuePair.Value;
                            objArray2[index2]           = objArray1[keyValuePair.Key];
                            objArray1[keyValuePair.Key] = new Item();
                        }
                        else
                        {
                            int num3 = objArray1[keyValuePair.Key].stack;
                            int num4 = objArray2[index2].maxStack - objArray2[index2].stack;
                            if (num4 != 0)
                            {
                                if (num3 > num4)
                                {
                                    num3 = num4;
                                }
                                objArray2[index2].stack           += num3;
                                objArray1[keyValuePair.Key].stack -= num3;
                                if (objArray1[keyValuePair.Key].stack == 0)
                                {
                                    objArray1[keyValuePair.Key] = new Item();
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        flagArray[index2] = true;
                        flag = false;
                    }
                }
            }
            if (Main.netMode == 1 && player.chest >= 0)
            {
                for (int index = 0; index < flagArray.Length; ++index)
                {
                    NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0);
                }
            }
            list1.Clear();
            list2.Clear();
            list3.Clear();
            dictionary.Clear();
            list4.Clear();
        }
示例#8
0
        public static void DepositAll()
        {
            Player player = Main.player[Main.myPlayer];

            if (player.chest > -1)
            {
                ChestUI.MoveCoins(player.inventory, Main.chest[player.chest].item);
            }
            else if (player.chest == -3)
            {
                ChestUI.MoveCoins(player.inventory, player.bank2.item);
            }
            else
            {
                ChestUI.MoveCoins(player.inventory, player.bank.item);
            }
            for (int index1 = 49; index1 >= 10; --index1)
            {
                if (player.inventory[index1].stack > 0 && player.inventory[index1].itemId > 0 && !player.inventory[index1].favorited)
                {
                    if (player.inventory[index1].maxStack > 1)
                    {
                        for (int index2 = 0; index2 < 40; ++index2)
                        {
                            if (player.chest > -1)
                            {
                                Chest chest = Main.chest[player.chest];
                                if (chest.item[index2].stack < chest.item[index2].maxStack && player.inventory[index1].IsTheSameAs(chest.item[index2]))
                                {
                                    int num = player.inventory[index1].stack;
                                    if (player.inventory[index1].stack + chest.item[index2].stack > chest.item[index2].maxStack)
                                    {
                                        num = chest.item[index2].maxStack - chest.item[index2].stack;
                                    }
                                    player.inventory[index1].stack -= num;
                                    chest.item[index2].stack       += num;
                                    Main.PlaySound(7, -1, -1, 1);
                                    if (player.inventory[index1].stack <= 0)
                                    {
                                        player.inventory[index1].SetDefaults(0, false);
                                        if (Main.netMode == 1)
                                        {
                                            NetMessage.SendData(32, -1, -1, "", player.chest, (float)index2, 0.0f, 0.0f, 0, 0, 0);
                                            break;
                                        }
                                        break;
                                    }
                                    if (chest.item[index2].itemId == 0)
                                    {
                                        chest.item[index2] = player.inventory[index1].Clone();
                                        player.inventory[index1].SetDefaults(0, false);
                                    }
                                    if (Main.netMode == 1)
                                    {
                                        NetMessage.SendData(32, -1, -1, "", player.chest, (float)index2, 0.0f, 0.0f, 0, 0, 0);
                                    }
                                }
                            }
                            else if (player.chest == -3)
                            {
                                if (player.bank2.item[index2].stack < player.bank2.item[index2].maxStack && player.inventory[index1].IsTheSameAs(player.bank2.item[index2]))
                                {
                                    int num = player.inventory[index1].stack;
                                    if (player.inventory[index1].stack + player.bank2.item[index2].stack > player.bank2.item[index2].maxStack)
                                    {
                                        num = player.bank2.item[index2].maxStack - player.bank2.item[index2].stack;
                                    }
                                    player.inventory[index1].stack  -= num;
                                    player.bank2.item[index2].stack += num;
                                    Main.PlaySound(7, -1, -1, 1);
                                    if (player.inventory[index1].stack <= 0)
                                    {
                                        player.inventory[index1].SetDefaults(0, false);
                                        break;
                                    }
                                    if (player.bank2.item[index2].itemId == 0)
                                    {
                                        player.bank2.item[index2] = player.inventory[index1].Clone();
                                        player.inventory[index1].SetDefaults(0, false);
                                    }
                                }
                            }
                            else if (player.bank.item[index2].stack < player.bank.item[index2].maxStack && player.inventory[index1].IsTheSameAs(player.bank.item[index2]))
                            {
                                int num = player.inventory[index1].stack;
                                if (player.inventory[index1].stack + player.bank.item[index2].stack > player.bank.item[index2].maxStack)
                                {
                                    num = player.bank.item[index2].maxStack - player.bank.item[index2].stack;
                                }
                                player.inventory[index1].stack -= num;
                                player.bank.item[index2].stack += num;
                                Main.PlaySound(7, -1, -1, 1);
                                if (player.inventory[index1].stack <= 0)
                                {
                                    player.inventory[index1].SetDefaults(0, false);
                                    break;
                                }
                                if (player.bank.item[index2].itemId == 0)
                                {
                                    player.bank.item[index2] = player.inventory[index1].Clone();
                                    player.inventory[index1].SetDefaults(0, false);
                                }
                            }
                        }
                    }
                    if (player.inventory[index1].stack > 0)
                    {
                        if (player.chest > -1)
                        {
                            for (int index2 = 0; index2 < 40; ++index2)
                            {
                                if (Main.chest[player.chest].item[index2].stack == 0)
                                {
                                    Main.PlaySound(7, -1, -1, 1);
                                    Main.chest[player.chest].item[index2] = player.inventory[index1].Clone();
                                    player.inventory[index1].SetDefaults(0, false);
                                    if (Main.netMode == 1)
                                    {
                                        NetMessage.SendData(32, -1, -1, "", player.chest, (float)index2, 0.0f, 0.0f, 0, 0, 0);
                                        break;
                                    }
                                    break;
                                }
                            }
                        }
                        else if (player.chest == -3)
                        {
                            for (int index2 = 0; index2 < 40; ++index2)
                            {
                                if (player.bank2.item[index2].stack == 0)
                                {
                                    Main.PlaySound(7, -1, -1, 1);
                                    player.bank2.item[index2] = player.inventory[index1].Clone();
                                    player.inventory[index1].SetDefaults(0, false);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            for (int index2 = 0; index2 < 40; ++index2)
                            {
                                if (player.bank.item[index2].stack == 0)
                                {
                                    Main.PlaySound(7, -1, -1, 1);
                                    player.bank.item[index2] = player.inventory[index1].Clone();
                                    player.inventory[index1].SetDefaults(0, false);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
示例#9
0
        private static void DrawButton(SpriteBatch spriteBatch, int ID, int X, int Y)
        {
            Player player = Main.player[Main.myPlayer];

            if (ID == 4 && player.chest < -1 || ID == 5 && !Main.editChest)
            {
                ChestUI.UpdateHover(ID, false);
            }
            else
            {
                Y += ID * 26;
                float  num  = ChestUI.ButtonScale[ID];
                string text = "";
                switch (ID)
                {
                case 0:
                    text = Lang.inter[29];
                    break;

                case 1:
                    text = Lang.inter[30];
                    break;

                case 2:
                    text = Lang.inter[31];
                    break;

                case 3:
                    text = Lang.inter[82];
                    break;

                case 4:
                    text = Lang.inter[Main.editChest ? 47 : 61];
                    break;

                case 5:
                    text = Lang.inter[63];
                    break;
                }
                Vector2 vector2   = Main.fontMouseText.MeasureString(text);
                Color   color     = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor) * num;
                Color   baseColor = Color.White * 0.97f * (float)(1.0 - ((double)byte.MaxValue - (double)Main.mouseTextColor) / (double)byte.MaxValue * 0.5);
                baseColor.A = byte.MaxValue;
                X          += (int)((double)vector2.X * (double)num / 2.0);
                ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, text, new Vector2((float)X, (float)Y), baseColor, 0.0f, vector2 / 2f, new Vector2(num), -1f, 1.5f);
                vector2 *= num;
                if (!Utils.FloatIntersect((float)Main.mouseX, (float)Main.mouseY, 0.0f, 0.0f, (float)X - vector2.X / 2f, (float)Y - vector2.Y / 2f, vector2.X, vector2.Y))
                {
                    ChestUI.UpdateHover(ID, false);
                }
                else
                {
                    ChestUI.UpdateHover(ID, true);
                    player.mouseInterface = true;
                    if (!Main.mouseLeft || !Main.mouseLeftRelease)
                    {
                        return;
                    }
                    switch (ID)
                    {
                    case 0:
                        ChestUI.LootAll();
                        break;

                    case 1:
                        ChestUI.DepositAll();
                        break;

                    case 2:
                        ChestUI.QuickStack();
                        break;

                    case 3:
                        ChestUI.Restock();
                        break;

                    case 4:
                        ChestUI.RenameChest();
                        break;

                    case 5:
                        ChestUI.RenameChestCancel();
                        break;
                    }
                    Recipe.FindRecipes();
                }
            }
        }
示例#10
0
        // Token: 0x06000BBC RID: 3004 RVA: 0x003CF118 File Offset: 0x003CD318
        public static void OpenVirtualKeyboard(int keyboardContext)
        {
            IngameFancyUI.CoverNextFrame();
            Main.PlaySound(12, -1, -1, 1, 1f, 0f);
            string text = "";

            if (keyboardContext != 1)
            {
                if (keyboardContext == 2)
                {
                    text = Language.GetTextValue("UI.EnterNewName");
                    Player player = Main.player[Main.myPlayer];
                    Main.npcChatText = Main.chest[player.chest].name;
                    if (Main.tile[player.chestX, player.chestY].type == 21)
                    {
                        Main.defaultChestName = Lang.chestType[(int)(Main.tile[player.chestX, player.chestY].frameX / 36)].Value;
                    }
                    if (Main.tile[player.chestX, player.chestY].type == 467)
                    {
                        Main.defaultChestName = Lang.chestType2[(int)(Main.tile[player.chestX, player.chestY].frameX / 36)].Value;
                    }
                    if (Main.tile[player.chestX, player.chestY].type == 88)
                    {
                        Main.defaultChestName = Lang.dresserType[(int)(Main.tile[player.chestX, player.chestY].frameX / 54)].Value;
                    }
                    if (Main.npcChatText == "")
                    {
                        Main.npcChatText = Main.defaultChestName;
                    }
                    Main.editChest = true;
                }
            }
            else
            {
                Main.editSign = true;
                text          = Language.GetTextValue("UI.EnterMessage");
            }
            Main.clrInput();
            if (!IngameFancyUI.CanShowVirtualKeyboard(keyboardContext))
            {
                return;
            }
            Main.inFancyUI = true;
            if (keyboardContext != 1)
            {
                if (keyboardContext == 2)
                {
                    UserInterface arg_243_0 = Main.InGameUI;
                    string        arg_23E_0 = text;
                    string        arg_23E_1 = Main.npcChatText;
                    arg_243_0.SetState(new UIVirtualKeyboard(arg_23E_0, arg_23E_1, (s) => {
                        ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]);
                        IngameFancyUI.Close();
                    }, () => {
                        ChestUI.RenameChestCancel();
                        IngameFancyUI.Close();
                    }, keyboardContext, false));
                }
            }
            else
            {
                UserInterface arg_1EC_0 = Main.InGameUI;
                string        arg_1E7_0 = text;
                string        arg_1E7_1 = Main.npcChatText;
                arg_1EC_0.SetState(new UIVirtualKeyboard(arg_1E7_0, arg_1E7_1, (s) => {
                    Main.SubmitSignText();
                    IngameFancyUI.Close();
                }, () => {
                    Main.InputTextSignCancel();
                    IngameFancyUI.Close();
                }, keyboardContext, false));
            }
            UILinkPointNavigator.GoToDefaultPage(1);
        }