コード例 #1
0
        public static bool DrawStorageGUI()
        {
            Player        player        = Main.player[Main.myPlayer];
            StoragePlayer modPlayer     = player.GetModPlayer <StoragePlayer>(MagicStorage.Instance);
            Point16       storageAccess = modPlayer.ViewingStorage();

            if (!Main.playerInventory || storageAccess.X < 0 || storageAccess.Y < 0)
            {
                return(true);
            }
            ModTile modTile = TileLoader.GetTile(Main.tile[storageAccess.X, storageAccess.Y].type);

            if (modTile == null || !(modTile is StorageAccess))
            {
                return(true);
            }
            TEStorageHeart heart = ((StorageAccess)modTile).GetHeart(storageAccess.X, storageAccess.Y);

            if (heart == null)
            {
                return(true);
            }
            if (modTile is CraftingAccess)
            {
                CraftingGUI.Draw(heart);
            }
            else
            {
                StorageGUI.Draw(heart);
            }
            return(true);
        }
コード例 #2
0
        private static TEStorageHeart GetHeart()
        {
            Player        player    = Main.player[Main.myPlayer];
            StoragePlayer modPlayer = player.GetModPlayer <StoragePlayer>();

            return(modPlayer.GetStorageHeart());
        }
コード例 #3
0
        public static void Draw(TEStorageHeart heart)
        {
            Player        player    = Main.player[Main.myPlayer];
            StoragePlayer modPlayer = player.GetModPlayer <StoragePlayer>(MagicStorage.Instance);

            Initialize();
            if (Main.mouseX > panelLeft && Main.mouseX < panelLeft + panelWidth && Main.mouseY > panelTop && Main.mouseY < panelTop + panelHeight)
            {
                player.mouseInterface = true;
                player.showItemIcon   = false;
                InterfaceHelper.HideItemIconCache();
            }
            basePanel.Draw(Main.spriteBatch);
            slotZone.DrawText();
            sortButtons.DrawText();
            filterButtons.DrawText();
        }
コード例 #4
0
 public override bool RecipeAvailable(Recipe recipe)
 {
     if (!active)
     {
         return(true);
     }
     try
     {
         Player        player        = Main.player[Main.myPlayer];
         StoragePlayer modPlayer     = player.GetModPlayer <StoragePlayer>(mod);
         Point16       storageAccess = modPlayer.ViewingStorage();
         return(storageAccess.X < 0 || storageAccess.Y < 0);
     }
     catch
     {
         return(true);
     }
 }
コード例 #5
0
        public static void ReceiveOperationResult(BinaryReader reader)
        {
            if (Main.netMode != 1)
            {
                return;
            }
            Player player = Main.player[Main.myPlayer];
            byte   op     = reader.ReadByte();

            if (op == 0 || op == 1 || op == 3)
            {
                Item item = ItemIO.Receive(reader, true);
                StoragePlayer.GetItem(item, op != 3);
            }
            else if (op == 2)
            {
                int count = reader.ReadByte();
                for (int k = 0; k < count; k++)
                {
                    Item item = ItemIO.Receive(reader, true);
                    StoragePlayer.GetItem(item, false);
                }
            }
        }
コード例 #6
0
        public static void RefreshItems()
        {
            if (StoragePlayer.IsStorageCrafting())
            {
                CraftingGUI.RefreshItems();
                return;
            }
            items.Clear();
            didMatCheck.Clear();
            TEStorageHeart heart = GetHeart();

            if (heart == null)
            {
                return;
            }
            InitLangStuff();
            InitSortButtons();
            InitFilterButtons();
            SortMode sortMode;

            switch (sortButtons.Choice)
            {
            case 0:
                sortMode = SortMode.Default;
                break;

            case 1:
                sortMode = SortMode.Id;
                break;

            case 2:
                sortMode = SortMode.Name;
                break;

            case 3:
                sortMode = SortMode.Quantity;
                break;

            default:
                sortMode = SortMode.Default;
                break;
            }
            FilterMode filterMode;

            switch (filterButtons.Choice)
            {
            case 0:
                filterMode = FilterMode.All;
                break;

            case 1:
                filterMode = FilterMode.Weapons;
                break;

            case 2:
                filterMode = FilterMode.Tools;
                break;

            case 3:
                filterMode = FilterMode.Equipment;
                break;

            case 4:
                filterMode = FilterMode.Potions;
                break;

            case 5:
                filterMode = FilterMode.Placeables;
                break;

            case 6:
                filterMode = FilterMode.Misc;
                break;

            default:
                filterMode = FilterMode.All;
                break;
            }
            items.AddRange(ItemSorter.SortAndFilter(heart.GetStoredItems(), sortMode, filterMode, searchBar2.Text, searchBar.Text));
            for (int k = 0; k < items.Count; k++)
            {
                didMatCheck.Add(false);
            }
        }
コード例 #7
0
 public static void Update(GameTime gameTime)
 {
     oldMouse = curMouse;
     curMouse = Mouse.GetState();
     if (Main.playerInventory && Main.player[Main.myPlayer].GetModPlayer <StoragePlayer>(MagicStorage.Instance).ViewingStorage().X >= 0 && !StoragePlayer.IsStorageCrafting())
     {
         if (StorageGUI.curMouse.RightButton == ButtonState.Released)
         {
             ResetSlotFocus();
         }
         if (basePanel != null)
         {
             basePanel.Update(gameTime);
         }
         UpdateScrollBar();
         UpdateDepositButton();
     }
     else
     {
         scrollBarFocus         = false;
         scrollBar.ViewPosition = 0f;
         ResetSlotFocus();
     }
 }