예제 #1
0
    void CreateItemButton(Item item, ScrollingGrid grid)
    {
        if (grid.Grid == GroundItemsGrid.Grid)
        {
            item.OnGround = true;
        }
        else if (grid.Grid == InventoryGrid.Grid)
        {
            item.OnGround = false;
        }
        string buttonText;

        if (item.Count > 1)
        {
            buttonText = item.Name + " (" + item.Count + ")";
        }
        else
        {
            buttonText = item.Name;
        }
        GUIButton itemButton = CreateObjectButton(item, grid, item.Name, buttonText);

        itemButton.OnSingleClick = new Action(() =>
        {
            if ((itemButton.refObject as Item).Count > 0)
            {
                BigBoss.Gooey.displayItem = true;
                BigBoss.Gooey.RegenItemInfoGUI(itemButton.refObject as Item);
            }
        });
    }
예제 #2
0
 void GenerateItemActions(Item item, ScrollingGrid grid)
 {
     if (!item.itemFlags[ItemFlags.IS_EQUIPPED])
     {
         CreateEquipButton(item, grid);
     }
     else
     {
         CreateUnEquipButton(item, grid);
     }
     CreateUseButton(item, grid);
     CreateEatButton(item, grid);
     if (item.OnGround)
     {
         CreatePickUpButton(item, grid);
     }
     else
     {
         CreateDropButton(item, grid);
     }
     grid.ResetPosition();
     //itemActionClip.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
     //itemActionClip.clipRange = new Vector4(500, -400, 200, 800);
     grid.Reposition();
 }
예제 #3
0
    GUIButton CreateObjectButton(System.Object o, ScrollingGrid grid, string buttonName = "Button", string buttonText = null)
    {
        GUIButton button = CreateButton(grid, buttonName, buttonText);

        button.refObject = o;
        return(button);
    }
예제 #4
0
 internal void GenerateGroundItems(ItemChest chest, ScrollingGrid grid)
 {
     if (displayInventory && chest != null)
     {
         currentChest = chest;
         Inventory inv = chest.Location.inventory;
         GroundLabel.SetActive(true);
         grid.gameObject.SetActive(true);
         grid.Clear();
         foreach (InventoryCategory ic in inv.Values)
         {
             foreach (Item item in ic.Values)
             {
                 CreateItemButton(item, grid);
             }
         }
         CreateCloseLabel(grid);
         grid.ResetPosition();
         grid.Reposition();
     }
     else
     {
         GroundLabel.SetActive(false);
         grid.Clear();
         RegenItemInfoGUI(null);
     }
 }
예제 #5
0
 internal void RegenInventoryGUI(ScrollingGrid grid)
 {
     if (displayInventory)
     {
         InventoryLabel.SetActive(true);
         grid.gameObject.SetActive(true);
         grid.Clear();
         if (!categoryDisplay)
         {
             foreach (InventoryCategory ic in BigBoss.Player.Inventory.Values)
             {
                 CreateCategoryButton(ic, grid);
             }
         }
         else
         {
             InventoryCategory ic;
             if (BigBoss.Player.Inventory.TryGetValue(category, out ic))
             {
                 foreach (Item item in ic.Values)
                 {
                     CreateItemButton(item, grid);
                 }
             }
             CreateBackLabel(grid);
         }
         grid.Reposition();
     }
     else
     {
         InventoryLabel.SetActive(false);
         grid.Clear();
         RegenItemInfoGUI(null);
     }
 }
예제 #6
0
    void CreateCategoryButton(InventoryCategory ic, ScrollingGrid grid)
    {
        GUIButton categoryButton = CreateObjectButton(ic, grid, ic.id);

        categoryButton.OnSingleClick = new Action(() =>
        {
            BigBoss.Gooey.categoryDisplay = true;
            BigBoss.Gooey.category        = (categoryButton.refObject as InventoryCategory).id;
            BigBoss.Gooey.OpenInventoryGUI();
        });
    }
예제 #7
0
    void CreatePickUpButton(Item item, ScrollingGrid grid)
    {
        GUIButton itemButton = CreateObjectButton(item, grid, "Pick Up Item");

        itemButton.OnSingleClick = new Action(() =>
        {
            Item i = itemButton.refObject as Item;
            BigBoss.Player.pickUpItem(i, currentChest.Location);
            BigBoss.Gooey.OpenGroundGUI(currentChest);
            BigBoss.Gooey.OpenInventoryGUI();
        });
    }
예제 #8
0
    void CreateUseButton(Item item, ScrollingGrid grid)
    {
        GUIButton itemButton = CreateObjectButton(item, grid, "Use Item");

        itemButton.OnSingleClick = new Action(() =>
        {
            Item i = itemButton.refObject as Item;
            BigBoss.Player.useItem(i);
            BigBoss.Gooey.RegenItemInfoGUI(i);
            BigBoss.Gooey.OpenInventoryGUI();
        });
    }
예제 #9
0
    GUIButton CreateButton(ScrollingGrid grid, string buttonName = "Button", string buttonText = null)
    {
        if (buttonText == null)
        {
            buttonText = buttonName;
        }
        GUIButton button = CreateButton(buttonName, buttonText);

        button.UIDragPanel.draggablePanel = grid.DragPanel;
        grid.AddButton(button);
        return(button.GetComponent <GUIButton>());
    }
예제 #10
0
 void GenerateItemInfo(Item item, ScrollingGrid grid)
 {
     if (item.Count > 0)
     {
         foreach (KeyValuePair <string, string> kvp in item.GetGUIDisplays())
         {
             //display the info on the item
         }
         CreateBackLabel(grid);
         grid.ResetPosition();
         grid.Reposition();
     }
 }
예제 #11
0
    void CreateBackLabel(ScrollingGrid grid)
    {
        GUIButton button = CreateButton(grid, "BackButton", "Back");

        button.OnSingleClick = new Action(() =>
        {
            BigBoss.Gooey.category        = "";
            BigBoss.Gooey.categoryDisplay = false;
            BigBoss.Gooey.OpenInventoryGUI();
            BigBoss.Gooey.displayItem = false;
            BigBoss.Gooey.RegenItemInfoGUI(null);
        });
    }
예제 #12
0
    private void CreateCloseLabel(ScrollingGrid grid)
    {
        GUIButton button = CreateButton(grid, "CloseButton", "Close");

        button.OnSingleClick = new Action(() =>
        {
            BigBoss.Gooey.category        = "";
            BigBoss.Gooey.categoryDisplay = false;
            BigBoss.Gooey.OpenGroundGUI(null);
            BigBoss.Gooey.displayItem = false;
            BigBoss.Gooey.RegenItemInfoGUI(null);
        });
    }
예제 #13
0
    void CreateUnEquipButton(Item item, ScrollingGrid grid)
    {
        GUIButton itemButton = CreateObjectButton(item, grid, "UnEquip Item");

        itemButton.OnSingleClick = new Action(() =>
        {
            Item i = itemButton.refObject as Item;
            Item itemAlreadyEquipped = BigBoss.Player.getEquippedItems().Find(items => items.Name.Equals(i.Name));
            if (itemAlreadyEquipped != null)
            {
                BigBoss.Player.unequipItem(itemAlreadyEquipped);
                BigBoss.Gooey.RegenItemInfoGUI(itemAlreadyEquipped);
            }
        });
    }
예제 #14
0
    void CreateEquipButton(Item item, ScrollingGrid grid)
    {
        GUIButton itemButton = CreateObjectButton(item, grid, "Equip Item");

        itemButton.OnSingleClick = new Action(() =>
        {
            Item i = itemButton.refObject as Item;
            if (i.OnGround == true)
            {
                BigBoss.Player.Inventory.Add(i);
                BigBoss.Player.GridSpace.Remove(i);
                BigBoss.Gooey.OpenGroundGUI(currentChest);
            }
            BigBoss.Player.equipItem(i);
            BigBoss.Gooey.RegenItemInfoGUI(i);
        });
    }
예제 #15
0
 internal void RegenSpellGUI(ScrollingGrid grid)
 {
     if (displaySpells)
     {
         grid.gameObject.SetActive(true);
         grid.Clear();
         foreach (string key in BigBoss.Player.KnownSpells.Keys)
         {
             GUIButton spellButton = CreateObjectButton(key, grid, key);
             spellButton.OnSingleClick = new Action(() =>
             {
                 currentSpell = spellButton.refObject as string;
                 if (BigBoss.Player.Stats.CurrentPower > GetCurrentSpellCost())
                 {
                     BigBoss.PlayerInput.defaultPlayerInput = false;
                     BigBoss.PlayerInput.spellInput         = true;
                     spellButton.defaultColor = spellButton.hover;
                     selectedButton           = spellButton;
                     spellButton.UpdateColor(true, true);
                 }
                 else
                 {
                     CreateTextPop(BigBoss.PlayerInfo.transform.position, "You do not have enough power to cast " + currentSpell + "!");
                     currentSpell = null;
                 }
             });
         }
         GUIButton cancelSpellButton = CreateButton(grid, "Cancel Spell");
         cancelSpellButton.OnSingleClick = new Action(() =>
         {
             BigBoss.PlayerInput.defaultPlayerInput = true;
             BigBoss.PlayerInput.spellInput         = false;
             currentSpell = null;
             selectedButton.defaultColor = cancelSpellButton.defaultColor;
             selectedButton.UpdateColor(true, true);
         });
         GUIButton castSpellButton = CreateButton(grid, "Cast Spell");
         castSpellButton.OnSingleClick = new Action(() =>
         {
             BigBoss.Player.CastSpell(currentSpell, spellTargets.ToArray());
             BigBoss.PlayerInput.defaultPlayerInput = true;
             BigBoss.PlayerInput.spellInput         = false;
             foreach (IAffectable target in spellTargets)
             {
                 if (target is NPC)
                 {
                     foreach (GameObject block in ((NPC)target).GridSpace.Blocks)
                     {
                         block.renderer.sharedMaterial = NormalShaderGridspace;
                     }
                 }
             }
             spellTargets.Clear();
             currentSpell = null;
             selectedButton.defaultColor = cancelSpellButton.defaultColor;
             selectedButton.UpdateColor(true, true);
         });
         grid.Reposition();
     }
     else
     {
         grid.Clear();
     }
 }