コード例 #1
0
    /// <summary>
    /// Determinates what to do when action button is clicked
    /// </summary>
    public void actionButtonClick()
    {
        bool remove = true;

        if (selectedItem != null)
        {
            ItemInventoryBase item = new ItemInventoryBase();
            item = selectedItem;
            GameStateBase currentState = gameController.GetCurrentState();

            if (currentState.GetComponent <WorkBench> () != null)
            {
                remove = SendObjectToWorkbench(item);
            }

            if (currentState.GetComponent <LIAState> () != null)
            {
                remove = currentState.GetComponent <LIAState>().ReceiveProduct(item, GameObject.Find(item.index));
            }

            if (remove)
            {
                removeItem(GameObject.Find(selectedItem.gameObject.name));
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// Refreshs the action button.
    /// </summary>
    public void refreshActionButton()
    {
        GameStateBase currentState = gameController.GetCurrentState();

        //refreshs action button depending on the current state and list index
        if (currentState != null)
        {
            listButton[3].interactable = true;
            if (currentState.GetComponent <InGameState> () == null)
            {
                if ((currentState.GetComponent <GetGlasswareState> () != null && listIndex == 2) ||
                    (currentState.GetComponent <GetReagentState> () != null && listIndex == 1))
                {
                    listButton [3].GetComponent <Image> ().sprite = backgroundAction [2];
                }
                else
                {
                    if (currentState.GetComponent <WorkBench> () != null ||
                        (currentState.GetComponent <LIAState> () != null && listIndex == 0))
                    {
                        listButton [3].GetComponent <Image> ().sprite = backgroundAction [1];
                    }
                    else
                    {
                        listButton[3].interactable = false;
                        listButton [3].GetComponent <Image> ().sprite = backgroundAction [0];
                    }
                }
            }
            else
            {
                listButton[3].interactable = false;
                listButton [3].GetComponent <Image> ().sprite = backgroundAction [0];
            }
        }
        else
        {
            listButton[3].interactable = false;
            listButton [3].GetComponent <Image> ().sprite = backgroundAction [0];
        }

        if (selectedObject == null)
        {
            listButton[3].interactable = false;
            listButton [3].GetComponent <Image> ().sprite = backgroundAction [0];
        }
    }
コード例 #3
0
    public void actionButtonClick()
    {
        GameStateBase currentState = gameController.GetCurrentState();

        if (currentState.GetComponent <WorkBench> () != null)
        {
            CallWorkbenchToTable();
        }
        else
        {
            gameObject.GetComponentInParent <InventoryContent>().removeItemUI(gameObject.GetComponent <ItemStackableBehavior>());
        }
    }