Пример #1
0
    //remove button from UI
    public void RemoveButton(KeyValuePair <string, AlimentState> keyToRemove)
    {
        KeyValuePair <ColdRoom_Button, KeyValuePair <string, AlimentState> > toDel = buttons.First(x => x.Value.Equals(keyToRemove));

        if (selectedButton == toDel.Key)
        {
            selectedButton = null;
        }
        Destroy(toDel.Key.gameObject);
        buttons.Remove(toDel.Key);
    }
Пример #2
0
    //remove button from UI
    public bool RemoveButton(out KeyValuePair <string, AlimentState> keyToRemove)
    {
        if (selectedButton != null)
        {
            keyToRemove = buttons[selectedButton];
            Destroy(selectedButton.gameObject);
            buttons.Remove(selectedButton);
            selectedButton = null;
            return(true);
        }

        return(false);
    }
Пример #3
0
    public void DisplayChoiceMenu(ColdRoom_Button _button)
    {
        AlimentState alimentState = buttons[_button].Value;

        if (alimentState == AlimentState.Box || alimentState == AlimentState.Stack)
        {
            buttonTakeOne.interactable = true;
            buttonTakeAll.interactable = true;
        }
        else
        {
            buttonTakeOne.interactable = true;
            buttonTakeAll.interactable = false;
        }
    }
Пример #4
0
    //add button in dictionnary and UI with good sprite
    public void AddButton(KeyValuePair <string, AlimentState> _keyFood)
    {
        if (!buttons.ContainsValue(_keyFood))
        {
            ColdRoom_Button newButton = (Instantiate(buttonPrefab, buttonsContent) as GameObject).GetComponent <ColdRoom_Button>();

            Sprite sprite = FoodDatabase.mapSpriteAliment[_keyFood];

            if (sprite == null)
            {
                Debug.LogError("Sprite for button not found");
            }

            newButton.Init(this, sprite);
            buttons.Add(newButton, _keyFood);
        }
    }
Пример #5
0
 // selectedButton = button click
 public void SetSelectedButton(ColdRoom_Button _button)
 {
     selectedButton = _button;
 }