Пример #1
0
    static void Init3DLibrary()
    {
        LibraryEditorWindow libwin = (LibraryEditorWindow)EditorWindow.GetWindow(typeof(LibraryEditorWindow));

        libwin.titleContent             = new GUIContent("AX Library");
        libwin.autoRepaintOnSceneChange = true;
    }
Пример #2
0
    /// <summary>
    /// Draws the list of player spawn position and joining characters.
    /// </summary>
    private void DrawPlayerStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);
        GUILayout.Label("Squad 1");
        for (int i = 0; i < mapValues.spawnPoints1.Count; i++)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 70;
            GUILayout.Label("Position");
            mapValues.spawnPoints1[i].x = EditorGUILayout.IntField("X", mapValues.spawnPoints1[i].x);
            mapValues.spawnPoints1[i].y = EditorGUILayout.IntField("Y", mapValues.spawnPoints1[i].y);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.spawnPoints1.RemoveAt(i);
                i--;
            }
            EditorGUIUtility.labelWidth = 120;
            GUILayout.EndHorizontal();
            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.spawnPoints1.Add(new Position());
        }

        LibraryEditorWindow.HorizontalLine(Color.black);

        GUILayout.Space(5);
        GUILayout.Label("Squad 2");
        for (int i = 0; i < mapValues.spawnPoints2.Count; i++)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 70;
            GUILayout.Label("Position");
            mapValues.spawnPoints2[i].x = EditorGUILayout.IntField("X", mapValues.spawnPoints2[i].x);
            mapValues.spawnPoints2[i].y = EditorGUILayout.IntField("Y", mapValues.spawnPoints2[i].y);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.spawnPoints2.RemoveAt(i);
                i--;
            }
            EditorGUIUtility.labelWidth = 120;
            GUILayout.EndHorizontal();
            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.spawnPoints2.Add(new Position());
        }
    }
Пример #3
0
    private void DrawCharacterLimitStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);

        GUILayout.Label("Forced Characters");
        for (int i = 0; i < mapValues.forcedCharacters.Count; i++)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth   = 70;
            mapValues.forcedCharacters[i] = (CharEntry)EditorGUILayout.ObjectField("Character", mapValues.forcedCharacters[i], typeof(CharEntry), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.forcedCharacters.RemoveAt(i);
                i--;
            }
            GUILayout.EndHorizontal();
            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.forcedCharacters.Add(null);
        }

        GUILayout.Space(5);

        GUILayout.Label("Locked Characters");
        for (int i = 0; i < mapValues.lockedCharacters.Count; i++)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth   = 70;
            mapValues.lockedCharacters[i] = (CharEntry)EditorGUILayout.ObjectField("Character", mapValues.lockedCharacters[i], typeof(CharEntry), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.lockedCharacters.RemoveAt(i);
                i--;
            }
            GUILayout.EndHorizontal();
            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.lockedCharacters.Add(null);
        }
    }
    private void ShowSupports()
    {
        CharEntry charValues = (CharEntry)entryValues;

        GUILayout.Label("Supports", EditorStyles.boldLabel);
        GUILayout.Space(5);
        for (int i = 0; i < charValues.supports.Count; i++)
        {
            GUILayout.Label("Support " + (i + 1));
            GUILayout.BeginHorizontal();
            charValues.supports[i].partner = (CharEntry)EditorGUILayout.ObjectField("Partner", charValues.supports[i].partner, typeof(CharEntry), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                charValues.supports.RemoveAt(i);
                i--;
            }
            GUILayout.EndHorizontal();

            if (charValues.supports[i].partner != null)
            {
                GUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth     = 70;
                charValues.supports[i].maxlevel = (SupportLetter)EditorGUILayout.EnumPopup("Max level", charValues.supports[i].maxlevel);
                charValues.supports[i].speed    = (SupportSpeed)EditorGUILayout.EnumPopup("Level", charValues.supports[i].speed);
                EditorGUIUtility.labelWidth     = 120;
                GUILayout.EndHorizontal();
            }

            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            charValues.supports.Add(new SupportTuple());
        }
    }
Пример #5
0
    protected override void DrawContentWindow()
    {
        ClassEntry classValues = (ClassEntry)entryValues;

        GUILayout.Label("Sprites", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Player sprite", GUILayout.Width(130));
        GUILayout.Label("Ally sprite", GUILayout.Width(130));
        GUILayout.Label("Enemy sprite", GUILayout.Width(130));
        GUILayout.Label("Boss sprite", GUILayout.Width(130));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        classValues.playerSprite = (Sprite)EditorGUILayout.ObjectField("", classValues.playerSprite, typeof(Sprite), false, GUILayout.Width(130));
        classValues.allySprite   = (Sprite)EditorGUILayout.ObjectField("", classValues.allySprite, typeof(Sprite), false, GUILayout.Width(130));
        classValues.enemySprite  = (Sprite)EditorGUILayout.ObjectField("", classValues.enemySprite, typeof(Sprite), false, GUILayout.Width(130));
        classValues.bossSprite   = (Sprite)EditorGUILayout.ObjectField("", classValues.bossSprite, typeof(Sprite), false, GUILayout.Width(130));
        GUILayout.EndHorizontal();

        GUILayout.Label("Movement", EditorStyles.boldLabel);
        classValues.classType = (MovementType)EditorGUILayout.EnumPopup("Class type", classValues.classType);
        classValues.movespeed = EditorGUILayout.IntField("Move speed", classValues.movespeed);

        GUILayout.Space(10);

        GUILayout.Label("Base stats", EditorStyles.boldLabel);
        classValues.hp  = EditorGUILayout.IntField("HP", classValues.hp);
        classValues.dmg = EditorGUILayout.IntField("ATK", classValues.dmg);
        classValues.mnd = EditorGUILayout.IntField("MND", classValues.mnd);
        classValues.skl = EditorGUILayout.IntField("SKL", classValues.skl);
        classValues.spd = EditorGUILayout.IntField("SPD", classValues.spd);
        classValues.def = EditorGUILayout.IntField("DEF", classValues.def);
        GUILayout.Label("Total bases:  " + (classValues.hp + classValues.dmg + classValues.mnd + classValues.skl + classValues.spd + classValues.def));

        GUILayout.Label("Growth rates", EditorStyles.boldLabel);
        classValues.gHp  = 5 * (EditorGUILayout.IntSlider("HP", classValues.gHp, 0, 100) / 5);
        classValues.gDmg = 5 * (EditorGUILayout.IntSlider("DMG", classValues.gDmg, 0, 100) / 5);
        classValues.gMnd = 5 * (EditorGUILayout.IntSlider("MND", classValues.gMnd, 0, 100) / 5);
        classValues.gSkl = 5 * (EditorGUILayout.IntSlider("SKL", classValues.gSkl, 0, 100) / 5);
        classValues.gSpd = 5 * (EditorGUILayout.IntSlider("SPD", classValues.gSpd, 0, 100) / 5);
        classValues.gDef = 5 * (EditorGUILayout.IntSlider("DEF", classValues.gDef, 0, 100) / 5);
        GUILayout.Label("Total growths:  " + (classValues.gHp + classValues.gDmg + classValues.gMnd + classValues.gSkl + classValues.gSpd + classValues.gDef));

        GUILayout.Space(10);

        GUILayout.Label("Usable weapons", EditorStyles.boldLabel);
        for (int i = 0; i < classValues.weaponSkills.Count; i++)
        {
            GUILayout.BeginHorizontal();
            classValues.weaponSkills[i] = (WeaponType)EditorGUILayout.EnumPopup("Weapon " + i, classValues.weaponSkills[i]);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                classValues.weaponSkills.RemoveAt(i);
                i--;
            }
            GUILayout.EndHorizontal();
        }
        if (GUILayout.Button("+"))
        {
            classValues.weaponSkills.Add(WeaponType.NONE);
        }
        GUILayout.Space(10);

        GUILayout.Label("Skill Gains", EditorStyles.boldLabel);
        classValues.lockTouch = EditorGUILayout.Toggle("Locktouch", classValues.lockTouch);
        for (int i = 0; i < classValues.skills.Count; i++)
        {
            GUILayout.BeginHorizontal();
            classValues.skills[i] = (CharacterSkill)EditorGUILayout.ObjectField("Skill", classValues.skills[i], typeof(CharacterSkill), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                classValues.skills.RemoveAt(i);
                i--;
                continue;
            }
            GUILayout.EndHorizontal();
            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            classValues.skills.Add(null);
        }

        GUILayout.Label("Promotion gains", EditorStyles.boldLabel);
        classValues.bonusHp  = EditorGUILayout.IntField("HP", classValues.bonusHp);
        classValues.bonusDmg = EditorGUILayout.IntField("ATK", classValues.bonusDmg);
        classValues.bonusMnd = EditorGUILayout.IntField("MND", classValues.bonusMnd);
        classValues.bonusSkl = EditorGUILayout.IntField("SKL", classValues.bonusSkl);
        classValues.bonusSpd = EditorGUILayout.IntField("SPD", classValues.bonusSpd);
        classValues.bonusDef = EditorGUILayout.IntField("DEF", classValues.bonusDef);
    }
Пример #6
0
    private void DrawTurnEventStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);
        for (int i = 0; i < mapValues.turnEvents.Count; i++)
        {
            TurnEvent pos = mapValues.turnEvents[i];
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 120;
            pos.triggerType             = (TriggerType)EditorGUILayout.EnumPopup("Event Type", pos.triggerType);
            if (pos.triggerType == TriggerType.TURN)
            {
                pos.turn = EditorGUILayout.IntField("Turn", pos.turn);
            }
            else if (pos.triggerType == TriggerType.TRIGGER)
            {
                pos.triggerIndex = EditorGUILayout.Popup("Trigger ID", pos.triggerIndex, triggerOptions);
            }
            else if (pos.triggerType == TriggerType.PLAYER_COUNT)
            {
                pos.turn = EditorGUILayout.IntField("Players remaining", pos.turn);
            }
            else if (pos.triggerType == TriggerType.ALLY_COUNT)
            {
                pos.turn = EditorGUILayout.IntField("Allies remaining", pos.turn);
            }
            else if (pos.triggerType == TriggerType.ENEMY_COUNT)
            {
                pos.turn = EditorGUILayout.IntField("Enemies remaining", pos.turn);
            }
            EditorGUIUtility.labelWidth = 70;
            pos.factionTurn             = (Faction)EditorGUILayout.EnumPopup("Faction", pos.factionTurn);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.turnEvents.RemoveAt(i);
                i--;
                continue;
            }
            EditorGUIUtility.labelWidth = 120;
            GUILayout.EndHorizontal();

            pos.type = (TurnEventType)EditorGUILayout.EnumPopup("Type", pos.type);

            switch (pos.type)
            {
            case TurnEventType.MAPCHANGE:
                GUILayout.BeginHorizontal();
                GUILayout.Label("Position");
                pos.x = EditorGUILayout.IntField("X", pos.x);
                pos.y = EditorGUILayout.IntField("Y", pos.y);
                GUILayout.EndHorizontal();
                pos.changeTerrain = (TerrainTile)EditorGUILayout.ObjectField("New Tile", pos.changeTerrain, typeof(TerrainTile), false);
                break;

            case TurnEventType.DIALOGUE:
                pos.dialogue = (DialogueEntry)EditorGUILayout.ObjectField("Dialogue", pos.dialogue, typeof(DialogueEntry), false);
                break;

            case TurnEventType.MONEY:
                pos.value = EditorGUILayout.IntField("Money", pos.value);
                break;

            case TurnEventType.SCRAP:
                pos.value = EditorGUILayout.IntField("Scrap", pos.value);
                break;
            }

            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.turnEvents.Add(new TurnEvent());
        }
    }
Пример #7
0
    private void DrawTriggerStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);
        GUILayout.Label("Trigger IDs", EditorStyles.boldLabel);
        for (int i = 0; i < mapValues.triggerIds.Count; i++)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 70;
            mapValues.triggerIds[i].id  = EditorGUILayout.TextField("ID", mapValues.triggerIds[i].id);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.triggerIds.RemoveAt(i);
                i--;
                continue;
            }
            EditorGUIUtility.labelWidth = 120;
            GUILayout.EndHorizontal();
        }
        if (GUILayout.Button("+"))
        {
            mapValues.triggerIds.Add(new TriggerTuple());
        }

        GUILayout.Space(10);


        GUILayout.Label("Trigger Areas", EditorStyles.boldLabel);
        EditorGUIUtility.labelWidth = 70;
        for (int i = 0; i < mapValues.triggerAreas.Count; i++)
        {
            EditorGUIUtility.labelWidth = 120;
            GUILayout.BeginHorizontal();
            mapValues.triggerAreas[i].idIndex = EditorGUILayout.Popup("Trigger ID", mapValues.triggerAreas[i].idIndex, triggerOptions);
            mapValues.triggerAreas[i].faction = (Faction)EditorGUILayout.EnumPopup("Trigger Faction", mapValues.triggerAreas[i].faction);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.triggerAreas.RemoveAt(i);
                i--;
                continue;
            }
            GUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = 70;
            GUILayout.BeginHorizontal();
            GUILayout.Label("Area width");
            mapValues.triggerAreas[i].xMin = EditorGUILayout.IntField(mapValues.triggerAreas[i].xMin);
            mapValues.triggerAreas[i].xMax = EditorGUILayout.IntField(mapValues.triggerAreas[i].xMax);
            GUILayout.Label("Area height");
            mapValues.triggerAreas[i].yMin = EditorGUILayout.IntField(mapValues.triggerAreas[i].yMin);
            mapValues.triggerAreas[i].yMax = EditorGUILayout.IntField(mapValues.triggerAreas[i].yMax);
            GUILayout.EndHorizontal();
            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        EditorGUIUtility.labelWidth = 120;

        if (GUILayout.Button("+"))
        {
            mapValues.triggerAreas.Add(new TriggerArea());
        }
    }
Пример #8
0
    private void DrawInteractStuff()
    {
        MapEntry mapValues = (MapEntry)entryValues;

        GUILayout.Space(5);
        for (int i = 0; i < mapValues.interactions.Count; i++)
        {
            InteractPosition pos = mapValues.interactions[i];
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 70;
            GUILayout.Label("Position");
            pos.x = EditorGUILayout.IntField("X", pos.x);
            pos.y = EditorGUILayout.IntField("Y", pos.y);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                mapValues.interactions.RemoveAt(i);
                i--;
                continue;
            }
            EditorGUIUtility.labelWidth = 120;
            GUILayout.EndHorizontal();

            pos.interactType = (InteractType)EditorGUILayout.EnumPopup("Type", pos.interactType);

            switch (pos.interactType)
            {
            case InteractType.BLOCK:
                pos.health = EditorGUILayout.IntField("Health", pos.health);
                break;

            case InteractType.VILLAGE:
                pos.dialogue = (DialogueEntry)EditorGUILayout.ObjectField("Dialogue", pos.dialogue, typeof(DialogueEntry), false);
                GUILayout.BeginHorizontal();
                pos.gift.money = EditorGUILayout.IntField("Money", pos.gift.money);
                pos.gift.scrap = EditorGUILayout.IntField("Scrap", pos.gift.scrap);
                GUILayout.EndHorizontal();
                if (pos.gift.items.Count < 1)
                {
                    pos.gift.items.Add(null);
                }
                pos.gift.items[0] = (ItemEntry)EditorGUILayout.ObjectField("Item", pos.gift.items[0], typeof(ItemEntry), false);
                pos.ally.charData = (CharEntry)EditorGUILayout.ObjectField("New ally", pos.ally.charData, typeof(CharEntry), false);
                if (pos.ally.charData != null)
                {
                    pos.ally.level = EditorGUILayout.IntField("Level", pos.ally.level);

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

            case InteractType.DATABASE:
                GUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth = 55;
                pos.gift.money = EditorGUILayout.IntField("Money", pos.gift.money, GUILayout.Width(120));
                pos.gift.scrap = EditorGUILayout.IntField("Scrap", pos.gift.scrap, GUILayout.Width(120));
                if (pos.gift.items.Count < 1)
                {
                    pos.gift.items.Add(null);
                }
                pos.gift.items[0] = (ItemEntry)EditorGUILayout.ObjectField("Item", pos.gift.items[0], typeof(ItemEntry), false);
                GUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = 120;
                break;
            }

            LibraryEditorWindow.HorizontalLine(Color.black);
        }
        if (GUILayout.Button("+"))
        {
            mapValues.interactions.Add(new InteractPosition());
        }
    }
Пример #9
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());
        }
    }
Пример #10
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());
        }
    }
Пример #11
0
    protected override void DrawContentWindow()
    {
        MissionEntry missionValues = (MissionEntry)entryValues;

        GUILayout.Label("Mission Info", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        missionValues.mapLocation = (MapLocation)EditorGUILayout.EnumPopup("Location", missionValues.mapLocation);
        missionValues.duration    = EditorGUILayout.IntField("Map Duration", missionValues.duration);
        GUILayout.EndHorizontal();
        GUILayout.Label("Mission description");
        EditorStyles.textField.wordWrap = true;
        missionValues.mapDescription    = EditorGUILayout.TextArea(missionValues.mapDescription, GUILayout.Width(500), GUILayout.Height(30));
        EditorStyles.textField.wordWrap = false;

        GUILayout.Space(10);

        GUILayout.Label("Mission Unlocking", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        missionValues.unlockReq = (MissionEntry.Unlocking)EditorGUILayout.EnumPopup("Unlock requirement", missionValues.unlockReq);
        switch (missionValues.unlockReq)
        {
        case MissionEntry.Unlocking.TIME:
            missionValues.unlockDay = EditorGUILayout.IntField("Unlocked on day", missionValues.unlockDay);
            break;

        case MissionEntry.Unlocking.SQUADSIZE:
            missionValues.squadSize = EditorGUILayout.IntField("Max squad size", missionValues.squadSize);
            break;

        case MissionEntry.Unlocking.DEATH:
            missionValues.characterReq = (CharEntry)EditorGUILayout.ObjectField("Dead Character", missionValues.characterReq, typeof(CharEntry), false);
            break;

        case MissionEntry.Unlocking.RECRUITED:
            missionValues.characterReq = (CharEntry)EditorGUILayout.ObjectField("Recruited Character", missionValues.characterReq, typeof(CharEntry), false);
            break;

        case MissionEntry.Unlocking.MISSION:
            missionValues.clearedMission = (MissionEntry)EditorGUILayout.ObjectField("Cleared Mission", missionValues.clearedMission, typeof(MissionEntry), false);
            break;
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Rewards", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        missionValues.reward.money = EditorGUILayout.IntField("Money", missionValues.reward.money);
        missionValues.reward.scrap = EditorGUILayout.IntField("Scrap", missionValues.reward.scrap);
        GUILayout.EndHorizontal();
        GUILayout.Space(5);
        for (int i = 0; i < missionValues.reward.items.Count; i++)
        {
            GUILayout.BeginHorizontal();
            missionValues.reward.items[i] = (ItemEntry)EditorGUILayout.ObjectField("Item", missionValues.reward.items[i], typeof(ItemEntry), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                missionValues.reward.items.RemoveAt(i);
                i--;
                continue;
            }
            GUILayout.EndHorizontal();
        }
        if (GUILayout.Button("+"))
        {
            missionValues.reward.items.Add(null);
        }

        GUILayout.Space(20);

        GUILayout.Label("Maps", EditorStyles.boldLabel);

        for (int i = 0; i < missionValues.maps.Count; i++)
        {
            LibraryEditorWindow.HorizontalLine(Color.black);
            GUILayout.BeginHorizontal();
            missionValues.maps[i] = (MapEntry)EditorGUILayout.ObjectField("Map", missionValues.maps[i], typeof(MapEntry), false);
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                GUI.FocusControl(null);
                missionValues.RemoveMap(i);
                i--;
                continue;
            }
            GUILayout.EndHorizontal();
            if (missionValues.maps[i] == null)
            {
                continue;
            }

            MapEntry map = missionValues.maps[i];
            missionValues.squads[i].squad1Size = map.spawnPoints1.Count;
            missionValues.squads[i].squad2Size = map.spawnPoints2.Count;
            GUILayout.BeginHorizontal();
            if (missionValues.squads[i].squad1Size > 0)
            {
                GUILayout.Label("Squad 1 size: " + missionValues.squads[i].squad1Size);
            }
            if (missionValues.squads[i].squad2Size > 0)
            {
                GUILayout.Label("Squad 2 size: " + missionValues.squads[i].squad2Size);
            }
            if (missionValues.squads[i].squad1Size == 0 && missionValues.squads[i].squad2Size == 0)
            {
                GUILayout.Label("No spawn points added!", EditorStyles.boldLabel);
            }
            GUILayout.EndHorizontal();
        }
        LibraryEditorWindow.HorizontalLine(Color.black);
        if (GUILayout.Button("+"))
        {
            missionValues.AddMap();
        }
    }