Пример #1
0
    public static void ManaValueDictionaryField(string label, ManaValueDictionary dictionary)
    {
        manaFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(manaFoldout, label);
        EditorGUILayout.EndFoldoutHeaderGroup();
        if (manaFoldout)
        {
            for (int i = 0; i < dictionary.Count; i++)
            {
                GUILayout.BeginHorizontal();
                dictionary.FirstValues[i]  = (ManaType)EditorGUILayout.ObjectField(dictionary.FirstValues[i], typeof(ManaType), false);
                dictionary.SecondValues[i] = EditorGUILayout.IntField(dictionary.SecondValues[i]);
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(addManaCostButton, GUILayout.Width(buttonWidth)))
            {
                dictionary.Add(null, 0);
            }
            if (GUILayout.Button(removeManaCostButton, GUILayout.Width(buttonWidth)))
            {
                dictionary.RemoveAt(dictionary.Count - 1);
            }
            GUILayout.EndHorizontal();
        }
    }
Пример #2
0
    private static void ShowButtons(ManaValueDictionary dictionary)
    {
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button(addButtonContent, EditorStyles.miniButton, GUILayout.Width(buttonWidth)))
        {
            dictionary.Add(type, amount);

            type   = null;
            amount = 0;
        }
        if (GUILayout.Button(deleteButtonContent, EditorStyles.miniButton, GUILayout.Width(buttonWidth)))
        {
            dictionary.RemoveAt(dictionary.Count - 1);
        }
    }