Exemplo n.º 1
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (this.name == "inventory")
     {
         ToolsClick.currentTool = "arrow";
         Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/arrow2"), Vector2.zero, CursorMode.Auto);
         if (Inv.inventoryPanel.activeSelf == false)
         {
             Inv.lockPanelInv.SetActive(true);
             Inv.inventoryPanel.SetActive(true);
             Inv.filterPanel.SetActive(true);
             Shop.shopPanel.SetActive(false);
             Inv.buyFildPanel.SetActive(false);
             Inv.FillInventory("first");
         }
         else
         {
             Inv.lockPanelInv.SetActive(false);
             Inv.actionPanel.SetActive(false);
             Inv.filterPanel.SetActive(false);
             Inv.inventoryPanel.SetActive(false);
         }
     }
     else
     {
         Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/" + this.name + "2"), Vector2.zero, CursorMode.Auto);
         ToolsClick.currentTool = this.name;
     }
 }
Exemplo n.º 2
0
    public void OnPointerClick(PointerEventData eventData)
    {
        switch (this.name)
        {
        case "Sell":
            int itemId = 0;
            if (Inv.currentType == "harvest")
            {
                itemId = Inv.currentHarv.ItemId;
            }
            else if (Inv.currentType == "sead")
            {
                itemId = Inv.currentSead.ItemId;
            }
            else if (Inv.currentType == "fertilizer")
            {
                itemId = Inv.currentFert.ItemId;
            }
            Money.money += Inv.items[itemId].ItemPrice;
            Inv.items[itemId].ItemCount -= 1;
            if (Inv.items[itemId].ItemCount <= 0)
            {
                Inv.DropItem(itemId);
                Inv.actionPanel.SetActive(false);
                Inv.FillInventory("current");
            }
            else
            {
                int id = Inv.currSelect;
                Inv.FillInventory("current");
                Inv.Select(id);
            }
            GameObject.Find("Sounds").GetComponent <Sounds>().PlayBuy();
            break;

        case "Plant":
            Inv.actionPanel.SetActive(false);
            Inv.inventoryPanel.SetActive(false);
            Inv.filterPanel.SetActive(false);
            if (Inv.currentType == "fertilizer")
            {
                ToolsClick.currentTool = "fertilizer";
            }
            else
            {
                ToolsClick.currentTool = "planted";
            }
            Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/cartoon-seeds2"), Vector2.zero, CursorMode.Auto);
            Inv.lockPanelInv.SetActive(false);
            break;
        }
    }
Exemplo n.º 3
0
    public void OnPointerClick(PointerEventData eventData)
    {
        GameObject.Find("Sounds").GetComponent <Sounds>().PlaySoudTool();
        Inv.actionPanel.SetActive(false);
        switch (this.name)
        {
        case "Left":
            if (Inv.countNext > 0)
            {
                Inv.FillInventory("prev");
            }
            break;

        case "Right":
            if (Inv.NextExists())
            {
                Inv.FillInventory("next");
            }
            break;
        }
    }
Exemplo n.º 4
0
    public void OnPointerClick(PointerEventData eventData)
    {
        Inv.actionPanel.SetActive(false);
        switch (this.name)
        {
        case "Tool":
            Inv.currentType = "fertilizer";
            Inv.FillInventory("first");
            break;

        case "Sead":
            Inv.currentType = "sead";
            Inv.FillInventory("first");
            break;

        case "Fruit":
            Inv.currentType = "harvest";
            Inv.FillInventory("first");
            break;
        }
    }
Exemplo n.º 5
0
    void Update()
    {
        if (Input.GetMouseButtonDown(2) && GameMenu.settingsPanel.activeSelf == false && GameMenu.menuPanel.activeSelf == false)
        {
            ToolsClick.currentTool = "arrow";
            Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/arrow2"), Vector2.zero, CursorMode.Auto);
            if (Shop.shopPanel.activeSelf == false)
            {
                Inv.actionPanel.SetActive(false);
                Inv.filterPanel.SetActive(false);
                Inv.inventoryPanel.SetActive(false);
                Inv.buyFildPanel.SetActive(false);
                Shop.shopPanel.SetActive(true);
                Inv.lockPanelInv.SetActive(true);
                Shop.FillShop();
            }
            else
            {
                Shop.shopPanel.SetActive(false);
                Inv.lockPanelInv.SetActive(false);
            }
        }
        if (Input.GetMouseButtonDown(1) && GameMenu.settingsPanel.activeSelf == false && GameMenu.menuPanel.activeSelf == false)
        {
            ToolsClick.currentTool = "arrow";
            Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/arrow2"), Vector2.zero, CursorMode.Auto);
            if (Inv.inventoryPanel.activeSelf == false)
            {
                Inv.lockPanelInv.SetActive(true);
                Inv.inventoryPanel.SetActive(true);
                Inv.filterPanel.SetActive(true);
                Shop.shopPanel.SetActive(false);
                Inv.buyFildPanel.SetActive(false);
                Inv.FillInventory("first");
            }
            else
            {
                Inv.lockPanelInv.SetActive(false);
                Inv.actionPanel.SetActive(false);
                Inv.filterPanel.SetActive(false);
                Inv.inventoryPanel.SetActive(false);
            }
        }
        if (Inv.inventoryPanel.activeSelf == false && Shop.shopPanel.activeSelf == false &&
            GameMenu.settingsPanel.activeSelf == false && GameMenu.menuPanel.activeSelf == false && Inv.buyFildPanel.activeSelf == false)
        {
            if (Input.GetAxis("Mouse ScrollWheel") > 0)
            {
                switch (ToolsClick.currentTool)
                {
                case "arrow":
                    ToolsClick.currentTool = "dig";
                    break;

                case "dig":
                    ToolsClick.currentTool = "watering";
                    break;

                case "watering":
                    ToolsClick.currentTool = "weed";
                    break;

                case "weed":
                    ToolsClick.currentTool = "vermin";
                    break;

                case "vermin":
                    ToolsClick.currentTool = "hand";
                    break;

                case "hand":
                    ToolsClick.currentTool = "arrow";
                    break;

                case "planted":
                    ToolsClick.currentTool = "arrow";
                    break;

                case "fertilizer":
                    ToolsClick.currentTool = "arrow";
                    break;
                }
                Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/" + ToolsClick.currentTool + "2"), Vector2.zero, CursorMode.Auto);
            }
            else if (Input.GetAxis("Mouse ScrollWheel") < 0)
            {
                switch (ToolsClick.currentTool)
                {
                case "arrow":
                    ToolsClick.currentTool = "hand";
                    break;

                case "hand":
                    ToolsClick.currentTool = "vermin";
                    break;

                case "vermin":
                    ToolsClick.currentTool = "weed";
                    break;

                case "weed":
                    ToolsClick.currentTool = "watering";
                    break;

                case "watering":
                    ToolsClick.currentTool = "dig";
                    break;

                case "dig":
                    ToolsClick.currentTool = "arrow";
                    break;

                case "planted":
                    ToolsClick.currentTool = "arrow";
                    break;

                case "fertilizer":
                    ToolsClick.currentTool = "arrow";
                    break;
                }
                Cursor.SetCursor(Resources.Load <Texture2D>("Sprite/InstrumentsPanel/" + ToolsClick.currentTool + "2"), Vector2.zero, CursorMode.Auto);
            }
        }
    }