Exemple #1
0
    public void OnGUI()
    {
        if (GUILayout.Button("Submit")) {
            DeckList deckList = new DeckList();
            deckList.Cards = CardChecked.Where(x => x.Value).Select((pair, _) => pair.Key.Name).ToArray();

            PlayerPrefs.SetString(DECK_SAVE_KEY, deckList.SerializeProtoString());

            onChooseDeck(deckList);
            this.enabled = false;
        }
        GUILayout.BeginHorizontal();
        foreach (Slot slot in Enum.GetValues(typeof(Slot))) {
            GUILayout.BeginVertical();
            GUILayout.Label(slot.ToString() + ":");

            foreach (Card option in CardOptions[slot]) {
                CardChecked[option] = GUILayout.Toggle(CardChecked[option], new GUIContent(option.Name, option.Name));
            }
            GUILayout.EndVertical();
        }
        GUILayout.EndHorizontal();

        if (!string.IsNullOrEmpty(GUI.tooltip)) {
            lastMouseOver = CardByName[GUI.tooltip];
            lastMouseOver.Charged = true;
            Card.Card = lastMouseOver;
            Card.Sprite.SetActive(true);
        }
        else {
            Card.Sprite.SetActive(false);
        }
        Card.Update();
    }