Пример #1
0
    private void DrawReinforcementStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);
        for (int i = 0; i < mapValues.reinforcements.Count; i++)
        {
            SpawnData pos = mapValues.reinforcements[i];
            GUILayout.BeginHorizontal();
            pos.triggerType = (TriggerType)EditorGUILayout.EnumPopup("Trigger Type", pos.triggerType);
            if (pos.triggerType == TriggerType.TURN)
            {
                GUILayout.Label("End of turn");
                pos.spawnTurn = EditorGUILayout.IntField(pos.spawnTurn);
            }
            else if (pos.triggerType == TriggerType.TRIGGER)
            {
                GUILayout.Label("Trigger ID:");
                pos.triggerIndex = EditorGUILayout.Popup(mapValues.triggerAreas[i].idIndex, triggerOptions);
            }
            else if (pos.triggerType == TriggerType.PLAYER_COUNT)
            {
                GUILayout.Label("At most players:");
                pos.spawnTurn = EditorGUILayout.IntField(pos.spawnTurn);
            }
            else if (pos.triggerType == TriggerType.ALLY_COUNT)
            {
                GUILayout.Label("At most allies:");
                pos.spawnTurn = EditorGUILayout.IntField(pos.spawnTurn);
            }
            else if (pos.triggerType == TriggerType.ENEMY_COUNT)
            {
                GUILayout.Label("At most enemies:");
                pos.spawnTurn = EditorGUILayout.IntField(pos.spawnTurn);
            }
            if (GUILayout.Button("Dup", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                SpawnData rpos = new SpawnData();
                rpos.Copy(mapValues.reinforcements[i]);
                mapValues.reinforcements.Insert(i + 1, rpos);
            }
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.reinforcements.RemoveAt(i);
                i--;
                continue;
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 40;
            GUILayout.Label("Position");
            pos.x = EditorGUILayout.IntField("X", pos.x, GUILayout.Width(90));
            pos.y = EditorGUILayout.IntField("Y", pos.y, GUILayout.Width(90));
            EditorGUIUtility.labelWidth = 70;
            pos.faction = (Faction)EditorGUILayout.EnumPopup("Faction", pos.faction);
            if (pos.faction == Faction.PLAYER)
            {
                EditorGUIUtility.labelWidth = 40;
                pos.joiningSquad            = EditorGUILayout.IntField("Squad", pos.joiningSquad, GUILayout.Width(80));
                EditorGUIUtility.labelWidth = 70;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            pos.charData = (CharEntry)EditorGUILayout.ObjectField("Character", pos.charData, typeof(CharEntry), false);

            if (pos.charData != null)
            {
                EditorGUIUtility.labelWidth = 50;
                pos.level = EditorGUILayout.IntField("Level", pos.level, GUILayout.Width(80));
                GUILayout.EndHorizontal();

                // Inventory
                for (int j = 0; j < pos.inventory.Count; j++)
                {
                    EditorGUIUtility.labelWidth = 70;
                    GUILayout.BeginHorizontal();
                    pos.inventory[j].item       = (ItemEntry)EditorGUILayout.ObjectField("Item", pos.inventory[j].item, typeof(ItemEntry), false);
                    EditorGUIUtility.labelWidth = 35;
                    pos.inventory[j].droppable  = EditorGUILayout.Toggle("Drop", pos.inventory[j].droppable, GUILayout.Width(50));
                    if (GUILayout.Button("X", GUILayout.Width(50)))
                    {
                        GUI.FocusControl(null);
                        pos.inventory.RemoveAt(j);
                        j--;
                        continue;
                    }
                    GUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = 120;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(120);
                if (GUILayout.Button("Add Item"))
                {
                    pos.inventory.Add(new WeaponTuple());
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.EndHorizontal();
            }

            if (pos.hasQuotes)
            {
                // Quotes
                for (int j = 0; j < pos.quotes.Count; j++)
                {
                    EditorGUIUtility.labelWidth = 70;
                    GUILayout.BeginHorizontal();
                    pos.quotes[j].triggerer = (CharEntry)EditorGUILayout.ObjectField("Caused by", pos.quotes[j].triggerer, typeof(CharEntry), false);
                    pos.quotes[j].quote     = (DialogueEntry)EditorGUILayout.ObjectField("Quote", pos.quotes[j].quote, typeof(DialogueEntry), false);
                    if (GUILayout.Button("X", GUILayout.Width(50)))
                    {
                        GUI.FocusControl(null);
                        pos.quotes.RemoveAt(j);
                        j--;
                        continue;
                    }
                    GUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = 120;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(120);
                if (GUILayout.Button("Add Quote"))
                {
                    pos.quotes.Add(new FightQuote());
                }
                GUILayout.EndHorizontal();
            }

            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.reinforcements.Add(new SpawnData());
        }
    }
Пример #2
0
    private void DrawAllyStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);
        for (int i = 0; i < mapValues.allies.Count; i++)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 70;
            GUILayout.Label("Position");
            mapValues.allies[i].x = EditorGUILayout.IntField("X", mapValues.allies[i].x);
            mapValues.allies[i].y = EditorGUILayout.IntField("Y", mapValues.allies[i].y);
            //  = (ClassType)EditorGUILayout.EnumPopup("",entryValues.advantageType[i]);
            if (GUILayout.Button("Dup", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                SpawnData epos = new SpawnData();
                epos.Copy(mapValues.allies[i]);
                mapValues.allies.Insert(i + 1, epos);
            }
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.allies.RemoveAt(i);
                i--;
                continue;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            mapValues.allies[i].charData  = (CharEntry)EditorGUILayout.ObjectField("Character", mapValues.allies[i].charData, typeof(CharEntry), false);
            mapValues.allies[i].hasQuotes = EditorGUILayout.Toggle("Quotes", mapValues.allies[i].hasQuotes, GUILayout.Width(80));
            GUILayout.EndHorizontal();

            if (mapValues.allies[i].charData != null)
            {
                GUILayout.BeginHorizontal();
                mapValues.allies[i].level     = EditorGUILayout.IntField("Level", mapValues.allies[i].level);
                mapValues.allies[i].aggroType = (AggroType)EditorGUILayout.EnumPopup("Aggro", mapValues.allies[i].aggroType);
                GUILayout.EndHorizontal();

                if (mapValues.allies[i].aggroType == AggroType.HUNT || mapValues.allies[i].aggroType == AggroType.ESCAPE)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Hunt tile");
                    mapValues.allies[i].huntX = EditorGUILayout.IntField("", mapValues.allies[i].huntX);
                    mapValues.allies[i].huntY = EditorGUILayout.IntField("", mapValues.allies[i].huntY);
                    GUILayout.EndHorizontal();
                }
                else if (mapValues.allies[i].aggroType == AggroType.PATROL)
                {
                    for (int pos = 0; pos < mapValues.allies[i].patrolPositions.Count; pos++)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Patrol tile");
                        mapValues.allies[i].patrolPositions[pos].x = EditorGUILayout.IntField("", mapValues.allies[i].patrolPositions[pos].x);
                        mapValues.allies[i].patrolPositions[pos].y = EditorGUILayout.IntField("", mapValues.allies[i].patrolPositions[pos].y);
                        if (GUILayout.Button("X", GUILayout.Width(50)))
                        {
                            GUI.FocusControl(null);
                            mapValues.allies[i].patrolPositions.RemoveAt(i);
                            i--;
                            continue;
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Add Tile");
                    if (GUILayout.Button("+"))
                    {
                        mapValues.allies[i].patrolPositions.Add(new Position());
                    }
                    GUILayout.EndHorizontal();
                }

                // Inventory
                for (int j = 0; j < mapValues.allies[i].inventory.Count; j++)
                {
                    EditorGUIUtility.labelWidth = 70;
                    GUILayout.BeginHorizontal();
                    mapValues.allies[i].inventory[j].item      = (ItemEntry)EditorGUILayout.ObjectField("Item", mapValues.allies[i].inventory[j].item, typeof(ItemEntry), false);
                    EditorGUIUtility.labelWidth                = 35;
                    mapValues.allies[i].inventory[j].droppable = EditorGUILayout.Toggle("Drop", mapValues.allies[i].inventory[j].droppable, GUILayout.Width(50));
                    if (GUILayout.Button("X", GUILayout.Width(50)))
                    {
                        GUI.FocusControl(null);
                        mapValues.allies[i].inventory.RemoveAt(j);
                        j--;
                        continue;
                    }
                    GUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = 120;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(120);
                if (GUILayout.Button("Add Item"))
                {
                    mapValues.allies[i].inventory.Add(new WeaponTuple());
                }
                GUILayout.EndHorizontal();
            }

            if (mapValues.allies[i].hasQuotes)
            {
                // Quotes
                for (int j = 0; j < mapValues.allies[i].quotes.Count; j++)
                {
                    EditorGUIUtility.labelWidth = 70;
                    GUILayout.BeginHorizontal();
                    mapValues.allies[i].quotes[j].triggerer = (CharEntry)EditorGUILayout.ObjectField("Caused by", mapValues.allies[i].quotes[j].triggerer, typeof(CharEntry), false);
                    mapValues.allies[i].quotes[j].quote     = (DialogueEntry)EditorGUILayout.ObjectField("Quote", mapValues.allies[i].quotes[j].quote, typeof(DialogueEntry), false);
                    if (GUILayout.Button("X", GUILayout.Width(50)))
                    {
                        GUI.FocusControl(null);
                        mapValues.allies[i].quotes.RemoveAt(j);
                        j--;
                        continue;
                    }
                    GUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = 120;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(120);
                if (GUILayout.Button("Add Quote"))
                {
                    mapValues.allies[i].quotes.Add(new FightQuote());
                }
                GUILayout.EndHorizontal();

                // Talks
                for (int j = 0; j < mapValues.allies[i].talks.Count; j++)
                {
                    EditorGUIUtility.labelWidth = 70;
                    GUILayout.BeginHorizontal();
                    mapValues.allies[i].talks[j].triggerer = (CharEntry)EditorGUILayout.ObjectField("Caused by", mapValues.allies[i].talks[j].triggerer, typeof(CharEntry), false);
                    mapValues.allies[i].talks[j].quote     = (DialogueEntry)EditorGUILayout.ObjectField("Talk", mapValues.allies[i].talks[j].quote, typeof(DialogueEntry), false);
                    EditorGUIUtility.labelWidth            = 50;
                    mapValues.allies[i].talks[j].willJoin  = EditorGUILayout.Toggle("Join", mapValues.allies[i].talks[j].willJoin, GUILayout.Width(90));
                    if (GUILayout.Button("X", GUILayout.Width(50)))
                    {
                        GUI.FocusControl(null);
                        mapValues.allies[i].talks.RemoveAt(j);
                        j--;
                        continue;
                    }
                    GUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = 120;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(120);
                if (GUILayout.Button("Add Talks"))
                {
                    mapValues.allies[i].talks.Add(new FightQuote());
                }
                GUILayout.EndHorizontal();
            }

            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.allies.Add(new SpawnData());
        }
    }