示例#1
0
        public override void RefreshItems(TEStorageCenter center = null)
        {
            if (Main.player[Main.myPlayer].GetModPlayer <StoragePlayer>().tileType == typeof(TCraftingStorageAccess))
            {
                MagicStorageTwo.Instance.guiM?.CraftingGUI.RefreshItems();
            }
            if (StoragePlayer.IsOnlyStorageCrafting())
            {
                return;
            }
            items.Clear();
            TEStorageHeart heart = center as TEStorageHeart ?? GetHeart();

            if (heart == null)
            {
                return;
            }
            InitLangStuff();
            InitSortButtons();
            InitFilterButtons();
            SortMode   sortMode   = (SortMode)sortButtons.Choice;
            FilterMode filterMode = (FilterMode)filterButtons.Choice;

            items.AddRange(ItemSorter.SortAndFilter(heart.GetStoredItems(), sortMode, filterMode, modSearchBar.Text, nameSearchBar.Text));
        }
示例#2
0
        private TEStorageHeart GetHeart()
        {
            Player        player    = Main.player[Main.myPlayer];
            StoragePlayer modPlayer = player.GetModPlayer <StoragePlayer>();

            return(modPlayer.GetStorageHeart());
        }
示例#3
0
        private void OpenStorage(Player player)
        {
            StoragePlayer modPlayer = player.GetModPlayer <StoragePlayer>();

            if (player.sign > -1)
            {
                Main.PlaySound(11, -1, -1, 1);
                player.sign      = -1;
                Main.editSign    = false;
                Main.npcChatText = string.Empty;
            }
            if (Main.editChest)
            {
                Main.PlaySound(12, -1, -1, 1);
                Main.editChest   = false;
                Main.npcChatText = string.Empty;
            }
            if (player.editedChestName)
            {
                NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0);
                player.editedChestName = false;
            }
            if (player.talkNPC > -1)
            {
                player.talkNPC         = -1;
                Main.npcChatCornerItem = 0;
                Main.npcChatText       = string.Empty;
            }
            bool hadChestOpen = player.chest != -1;

            player.chest    = -1;
            Main.stackSplit = 600;
            Point16 toOpen   = location;
            Point16 prevOpen = modPlayer.ViewingStorage();

            if (prevOpen == toOpen)
            {
                modPlayer.CloseStorage();
                Main.PlaySound(11, -1, -1, 1);
                Recipe.FindRecipes();
            }
            else
            {
                bool hadOtherOpen = prevOpen.X >= 0 && prevOpen.Y >= 0;
                modPlayer.OpenStorage(toOpen, true);
                modPlayer.timeSinceOpen = 0;
                Main.playerInventory    = true;
                Main.recBigList         = false;
                Main.PlaySound(hadChestOpen || hadOtherOpen ? 12 : 10, -1, -1, 1);
                Recipe.FindRecipes();
            }
        }
示例#4
0
        public void Draw(TEStorageHeart heart, bool offset = false)
        {
            OffseLeft = offset;
            Player        player    = Main.player[Main.myPlayer];
            StoragePlayer modPlayer = player.GetModPlayer <StoragePlayer>();

            Initialize();
            if (Main.mouseX > panelLeft && Main.mouseX < panelLeft + panelWidth && Main.mouseY > panelTop && Main.mouseY < panelTop + panelHeight)
            {
                player.mouseInterface = true;
                player.showItemIcon   = false;
                GUIHelper.HideItemIconCache();
            }

            storagePanel.Draw(Main.spriteBatch);
            itemsZone.DrawText();
            sortButtons.DrawText();
            filterButtons.DrawText();
        }
    /// <summary>
    /// [AddPlayer]
    /// Playerを登録する
    /// 引数1: Player object
    /// 引数2: Player PlayerTerritoryIntermediary
    /// 引数3: Player PlayerMaualCollisionAdministrator
    /// 引数4: Player follow points
    /// 引数5: This main player?, default = true
    /// </summary>
    public void AddPlayer(GameObject player, PlayerTerritoryIntermediary territoryIntermediary,
                          PlayerMaualCollisionAdministrator maualCollisionAdministrator, GameObject[] followPoints, bool isMainPlayer = true)
    {
        //debug only, invalid key対策
#if UNITY_EDITOR
        if (m_players.ContainsKey(player.GetInstanceID()))
        {
            Debug.LogError("Error!! PlayerAndTerritoryManager->AddPlayer\n ContainsKey(instanceID) == true");
            return;
        }
#endif

        StoragePlayer info = new StoragePlayer(player, territoryIntermediary, maualCollisionAdministrator, followPoints);

        m_players.Add(player.GetInstanceID(), info);
        if (isMainPlayer)
        {
            mainPlayer = info.playerInfo;
        }

        ServantManager.instance.RegisterPlayer(info.playerInfo.instanceID);
    }
示例#6
0
        public override bool NewRightClick(int i, int j)
        {
            if (Main.tile[i, j].frameX % 36 == 18)
            {
                i--;
            }
            if (Main.tile[i, j].frameY % 36 == 18)
            {
                j--;
            }
            Player player = Main.player[Main.myPlayer];

            if (GetHeart(i, j) == null)
            {
                Main.NewText("This access is not connected to a Storage Heart!");
                return(true);
            }
            StoragePlayer modPlayer = player.GetModPlayer <StoragePlayer>();

            Main.mouseRightRelease = false;
            if (player.sign > -1)
            {
                Main.PlaySound(11, -1, -1, 1);
                player.sign      = -1;
                Main.editSign    = false;
                Main.npcChatText = string.Empty;
            }
            if (Main.editChest)
            {
                Main.PlaySound(12, -1, -1, 1);
                Main.editChest   = false;
                Main.npcChatText = string.Empty;
            }
            if (player.editedChestName)
            {
                NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0);
                player.editedChestName = false;
            }
            if (player.talkNPC > -1)
            {
                player.talkNPC         = -1;
                Main.npcChatCornerItem = 0;
                Main.npcChatText       = string.Empty;
            }
            bool hadChestOpen = player.chest != -1;

            player.chest    = -1;
            Main.stackSplit = 600;
            Point16 toOpen   = new Point16(i, j);
            Point16 prevOpen = modPlayer.ViewingStorage();

            if (prevOpen == toOpen)
            {
                modPlayer.CloseStorage();
                Main.PlaySound(11, -1, -1, 1);
                Recipe.FindRecipes();
            }
            else
            {
                bool hadOtherOpen = prevOpen.X >= 0 && prevOpen.Y >= 0;
                modPlayer.OpenStorage(toOpen);
                modPlayer.timeSinceOpen = 0;
                if (PlayerInput.GrappleAndInteractAreShared)
                {
                    PlayerInput.Triggers.JustPressed.Grapple = false;
                }
                Main.recBigList = false;
                Main.PlaySound(hadChestOpen || hadOtherOpen ? 12 : 10, -1, -1, 1);
                Recipe.FindRecipes();
            }
            return(true);
        }