Пример #1
0
    public override void OnInspectorGUI()
    {
        Faction faction = (Faction)target;

        //base.OnInspectorGUI();

        EditorGUILayout.LabelField("Name", faction.Name);
        EditorGUILayout.Toggle("Exclusive", faction.Exclusive);

        ViewCards = EditorGUILayout.Foldout(ViewCards, "Cards");
        if (ViewCards)
        {
            if (ActiveCards == null)
            {
                ActiveCards = new bool[faction.Cards.Count];
                for (int i = 0; i < ActiveCards.Length; i++)
                {
                    ActiveCards[i] = false;
                }
            }
            for (int i = 0; i < faction.Cards.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(20);
                ActiveCards[i] = EditorGUILayout.Foldout(ActiveCards[i], faction.Cards[i].Name);
                EditorGUILayout.EndHorizontal();

                if (ActiveCards[i])
                {
                    EditorGUILayout.BeginHorizontal(); //Horizontal contains tab + ints

                    GUILayout.Space(40);               //Tab in 20 pixels //https://forum.unity.com/threads/indenting-guilayout-objects.113494/

                    EditorGUILayout.BeginVertical();   //Vertical contains ints
                    if (faction.Cards[i].Special)
                    {
                        SpecialCardEditor.DrawInspector((SpecialCard)faction.Cards[i]);
                    }
                    else
                    {
                        UnitCardEditor.DrawInspector((UnitCard)faction.Cards[i]);
                    }
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.EndHorizontal();
                }
            }
        }
    }
Пример #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();


        Card card = ((CardGO)target).Card;

        if (card != null)
        {
            if (card.Special)
            {
                SpecialCardEditor.DrawInspector((SpecialCard)card);
            }
            else
            {
                UnitCardEditor.DrawInspector((UnitCard)card);
            }
        }
    }
Пример #3
0
    public static void DrawCardFoldout(Zone zone, ref bool[] ActiveCards)
    {
        if (zone.Cards != null)
        {
            if (ActiveCards == null || ActiveCards.Length != zone.Cards.Count)
            {
                ActiveCards = new bool[zone.Cards.Count];
                for (int i = 0; i < ActiveCards.Length; i++)
                {
                    ActiveCards[i] = false;
                }
            }
            for (int i = 0; i < zone.Cards.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(20);
                ActiveCards[i] = EditorGUILayout.Foldout(ActiveCards[i], zone.Cards[i].Card.Name);
                EditorGUILayout.EndHorizontal();

                if (ActiveCards[i])
                {
                    EditorGUILayout.BeginHorizontal(); //Horizontal contains tab + ints

                    GUILayout.Space(40);               //Tab in 20 pixels //https://forum.unity.com/threads/indenting-guilayout-objects.113494/

                    EditorGUILayout.BeginVertical();   //Vertical contains ints
                    if (zone.Cards[i].Card.Special)
                    {
                        SpecialCardEditor.DrawInspector((SpecialCard)zone.Cards[i].Card);
                    }
                    else
                    {
                        UnitCardEditor.DrawInspector((UnitCard)zone.Cards[i].Card);
                    }
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.EndHorizontal();
                }
            }
        }
    }