예제 #1
0
    private IEnumerator runEvent(CustomEventTree[] treesArray, int index)
    {
        CustomEventDetails currentEvent = treesArray[eventTreeIndex].events[index];
        CustomEventDetails nextEvent    = null;

        if (index + 1 < treesArray[eventTreeIndex].events.Length)
        {
            //if not the last event
            nextEvent = treesArray[eventTreeIndex].events[index + 1];
        }

        NPCHandler targetNPC = null;

        CustomEventDetails.CustomEventType ty = currentEvent.eventType;

        Debug.Log("Run event. Type: " + ty.ToString());

        switch (ty)
        {
        case (CustomEventDetails.CustomEventType.Wait):
            yield return(new WaitForSeconds(currentEvent.float0));

            break;

        case (CustomEventDetails.CustomEventType.Walk):
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();

                int initialDirection = targetNPC.direction;
                targetNPC.direction = (int)currentEvent.dir;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    targetNPC.direction = (int)currentEvent.dir;
                    Vector3 forwardsVector = targetNPC.getForwardsVector(true);
                    if (currentEvent.bool0)
                    {
                        //if direction locked in
                        targetNPC.direction = initialDirection;
                    }
                    while (forwardsVector == new Vector3(0, 0, 0))
                    {
                        targetNPC.direction = (int)currentEvent.dir;
                        forwardsVector      = targetNPC.getForwardsVector(true);
                        if (currentEvent.bool0)
                        {
                            //if direction locked in
                            targetNPC.direction = initialDirection;
                        }
                        yield return(new WaitForSeconds(0.1f));
                    }

                    targetNPC.setOverrideBusy(true);
                    yield return(StartCoroutine(targetNPC.move(forwardsVector, currentEvent.float0)));

                    targetNPC.setOverrideBusy(false);
                }
                targetNPC.setFrameStill();
            }     //Move the player if set to player
            if (currentEvent.object0 == PlayerMovement.player.gameObject)
            {
                int initialDirection = PlayerMovement.player.direction;

                PlayerMovement.player.speed = (currentEvent.float0 > 0)
                        ? PlayerMovement.player.walkSpeed / currentEvent.float0
                        : PlayerMovement.player.walkSpeed;
                for (int i = 0; i < currentEvent.int0; i++)
                {
                    PlayerMovement.player.updateDirection((int)currentEvent.dir);
                    Vector3 forwardsVector = PlayerMovement.player.getForwardVector();
                    if (currentEvent.bool0)
                    {
                        //if direction locked in
                        PlayerMovement.player.updateDirection(initialDirection);
                    }

                    PlayerMovement.player.setOverrideAnimPause(true);
                    yield return
                        (StartCoroutine(PlayerMovement.player.move(forwardsVector, false, currentEvent.bool0)));

                    PlayerMovement.player.setOverrideAnimPause(false);
                }
                PlayerMovement.player.speed = PlayerMovement.player.walkSpeed;
            }
            break;

        case (CustomEventDetails.CustomEventType.TurnTo):
            int   direction;
            float xDistance;
            float zDistance;
            if (currentEvent.object0.GetComponent <NPCHandler>() != null)
            {
                targetNPC = currentEvent.object0.GetComponent <NPCHandler>();
            }
            if (targetNPC != null)
            {
                if (currentEvent.object1 != null)
                {
                    //calculate target objects's position relative to this objects's and set direction accordingly.
                    xDistance = targetNPC.hitBox.position.x - currentEvent.object1.transform.position.x;
                    zDistance = targetNPC.hitBox.position.z - currentEvent.object1.transform.position.z;
                    if (xDistance >= Mathf.Abs(zDistance))
                    {
                        //Mathf.Abs() converts zDistance to a positive always.
                        direction = 3;
                    }     //this allows for better accuracy when checking orientation.
                    else if (xDistance <= Mathf.Abs(zDistance) * -1)
                    {
                        direction = 1;
                    }
                    else if (zDistance >= Mathf.Abs(xDistance))
                    {
                        direction = 2;
                    }
                    else
                    {
                        direction = 0;
                    }
                    targetNPC.setDirection(direction);
                }
                if (currentEvent.int0 != 0)
                {
                    direction = targetNPC.direction + currentEvent.int0;
                    while (direction > 3)
                    {
                        direction -= 4;
                    }
                    while (direction < 0)
                    {
                        direction += 4;
                    }
                    targetNPC.setDirection(direction);
                }
            }
            break;

        case (CustomEventDetails.CustomEventType.Dialog):
            for (int i = 0; i < currentEvent.strings.Length; i++)
            {
                Dialog.drawDialogBox();
                yield return(StartCoroutine(Dialog.drawText(currentEvent.strings[i])));

                if (i < currentEvent.strings.Length - 1)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                }
            }
            if (nextEvent != null)
            {
                if (nextEvent.eventType != CustomEventDetails.CustomEventType.Choice)
                {
                    while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                    {
                        yield return(null);
                    }
                    if (!EventRequiresDialogBox(nextEvent.eventType))
                    {
                        Dialog.undrawDialogBox();
                    }     // do not undraw the box if the next event needs it
                }
            }
            else
            {
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
                Dialog.undrawDialogBox();
            }
            break;

        case (CustomEventDetails.CustomEventType.Choice):
            if (currentEvent.strings.Length > 1)
            {
                Dialog.drawChoiceBox(currentEvent.strings);
                yield return(StartCoroutine(Dialog.choiceNavigate(currentEvent.strings)));
            }
            else
            {
                Dialog.drawChoiceBox();
                yield return(StartCoroutine(Dialog.choiceNavigate()));
            }
            int chosenIndex = Dialog.chosenIndex;
            chosenIndex = currentEvent.ints.Length - 1 - chosenIndex;     //flip it to reflect the original input
            Dialog.undrawChoiceBox();
            Dialog.undrawDialogBox();
            if (chosenIndex < currentEvent.ints.Length)
            {
                //only change tree if index is valid
                if (currentEvent.ints[chosenIndex] != eventTreeIndex &&
                    currentEvent.ints[chosenIndex] < treesArray.Length)
                {
                    JumpToTree(currentEvent.ints[chosenIndex]);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.Sound:
            SfxHandler.Play(currentEvent.sound);
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            //Play Good for TM, Average for Item
            AudioClip itemGetMFX = (currentEvent.bool0)
                    ? Resources.Load <AudioClip>("Audio/mfx/GetGood")
                    : Resources.Load <AudioClip>("Audio/mfx/GetDecent");
            BgmHandler.main.PlayMFX(itemGetMFX);

            string firstLetter = currentEvent.string0.Substring(0, 1).ToLowerInvariant();
            Dialog.drawDialogBox();
            if (currentEvent.bool0)
            {
                Dialog.StartCoroutine(Dialog.drawText(
                                          SaveData.currentSave.playerName + " received TM" +
                                          ItemDatabase.getItem(currentEvent.string0).getTMNo() + ": " + currentEvent.string0 + "!"));
            }
            else
            {
                if (currentEvent.int0 > 1)
                {
                    Dialog.StartCoroutine(Dialog.drawText(
                                              SaveData.currentSave.playerName + " received " + currentEvent.string0 + "s!"));
                }
                else if (firstLetter == "a" || firstLetter == "e" || firstLetter == "i" || firstLetter == "o" ||
                         firstLetter == "u")
                {
                    Dialog.StartCoroutine(Dialog.drawText(
                                              SaveData.currentSave.playerName + " received an " + currentEvent.string0 + "!"));
                }
                else
                {
                    Dialog.StartCoroutine(Dialog.drawText(
                                              SaveData.currentSave.playerName + " received a " + currentEvent.string0 + "!"));
                }
            }
            yield return(new WaitForSeconds(itemGetMFX.length));

            bool itemAdd = SaveData.currentSave.Bag.addItem(currentEvent.string0, currentEvent.int0);

            Dialog.drawDialogBox();
            if (itemAdd)
            {
                if (currentEvent.bool0)
                {
                    yield return
                        (Dialog.StartCoroutine(Dialog.drawTextSilent(
                                                   SaveData.currentSave.playerName + " put the TM" +
                                                   ItemDatabase.getItem(currentEvent.string0).getTMNo() + " \\away into the bag.")));
                }
                else
                {
                    if (currentEvent.int0 > 1)
                    {
                        yield return
                            (Dialog.StartCoroutine(Dialog.drawTextSilent(
                                                       SaveData.currentSave.playerName + " put the " + currentEvent.string0 +
                                                       "s \\away into the bag.")));
                    }
                    else
                    {
                        yield return
                            (Dialog.StartCoroutine(Dialog.drawTextSilent(
                                                       SaveData.currentSave.playerName + " put the " + currentEvent.string0 +
                                                       " \\away into the bag.")));
                    }
                }
                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            else
            {
                yield return(Dialog.StartCoroutine(Dialog.drawTextSilent("But there was no room...")));

                while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
                {
                    yield return(null);
                }
            }
            Dialog.undrawDialogBox();
            break;

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            if (SaveData.currentSave.PC.hasSpace(0))
            {
                //Play Great for Pokemon
                AudioClip pokeGetMFX = Resources.Load <AudioClip>("Audio/mfx/GetGreat");

                PokemonData pkd = PokemonDatabase.getPokemon(currentEvent.ints[0]);

                string         pkName   = pkd.getName();
                Pokemon.Gender pkGender = Pokemon.Gender.CALCULATE;

                if (pkd.getMaleRatio() == -1)
                {
                    pkGender = Pokemon.Gender.NONE;
                }
                else if (pkd.getMaleRatio() == 0)
                {
                    pkGender = Pokemon.Gender.FEMALE;
                }
                else if (pkd.getMaleRatio() == 100)
                {
                    pkGender = Pokemon.Gender.MALE;
                }
                else
                {
//if not a set gender
                    if (currentEvent.ints[2] == 0)
                    {
                        pkGender = Pokemon.Gender.MALE;
                    }
                    else if (currentEvent.ints[2] == 1)
                    {
                        pkGender = Pokemon.Gender.FEMALE;
                    }
                }

                Dialog.drawDialogBox();
                yield return
                    (Dialog.StartCoroutine(Dialog.drawText(
                                               SaveData.currentSave.playerName + " received the " + pkName + "!")));

                BgmHandler.main.PlayMFX(pokeGetMFX);
                yield return(new WaitForSeconds(pokeGetMFX.length));

                string nickname = currentEvent.strings[0];
                if (currentEvent.strings[1].Length == 0)
                {
                    //If no OT set, allow nicknaming of Pokemon

                    Dialog.drawDialogBox();
                    yield return
                        (StartCoroutine(
                             Dialog.drawTextSilent("Would you like to give a nickname to \nthe " + pkName +
                                                   " you received?")));

                    Dialog.drawChoiceBox();
                    yield return(StartCoroutine(Dialog.choiceNavigate()));

                    int nicknameCI = Dialog.chosenIndex;
                    Dialog.undrawDialogBox();
                    Dialog.undrawChoiceBox();

                    if (nicknameCI == 1)
                    {
                        //give nickname
                        //SfxHandler.Play(selectClip);
                        yield return(StartCoroutine(ScreenFade.main.Fade(false, 0.4f)));

                        Scene.main.Typing.gameObject.SetActive(true);
                        StartCoroutine(Scene.main.Typing.control(10, "", pkGender,
                                                                 Pokemon.GetIconsFromID_(currentEvent.ints[0], currentEvent.bool0)));
                        while (Scene.main.Typing.gameObject.activeSelf)
                        {
                            yield return(null);
                        }
                        if (Scene.main.Typing.typedString.Length > 0)
                        {
                            nickname = Scene.main.Typing.typedString;
                        }

                        yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));
                    }
                }
                if (!EventRequiresDialogBox(nextEvent.eventType))
                {
                    Dialog.undrawDialogBox();
                }

                int[] IVs = new int[]
                {
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32),
                    Random.Range(0, 32), Random.Range(0, 32), Random.Range(0, 32)
                };
                if (currentEvent.bool1)
                {
                    //if using Custom IVs
                    IVs[0] = currentEvent.ints[5];
                    IVs[1] = currentEvent.ints[6];
                    IVs[2] = currentEvent.ints[7];
                    IVs[3] = currentEvent.ints[8];
                    IVs[4] = currentEvent.ints[9];
                    IVs[5] = currentEvent.ints[10];
                }

                string pkNature = (currentEvent.ints[3] == 0)
                        ? NatureDatabase.getRandomNature().getName()
                        : NatureDatabase.getNature(currentEvent.ints[3] - 1).getName();

                string[] pkMoveset = pkd.GenerateMoveset(currentEvent.ints[1]);
                for (int i = 0; i < 4; i++)
                {
                    if (currentEvent.strings[4 + i].Length > 0)
                    {
                        pkMoveset[i] = currentEvent.strings[4 + i];
                    }
                }

                Debug.Log(pkMoveset[0] + ", " + pkMoveset[1] + ", " + pkMoveset[2] + ", " + pkMoveset[3]);


                Pokemon pk = new Pokemon(currentEvent.ints[0], nickname, pkGender, currentEvent.ints[1],
                                         currentEvent.bool0, currentEvent.strings[2], currentEvent.strings[3],
                                         currentEvent.strings[1], IVs[0], IVs[1], IVs[2], IVs[3], IVs[4], IVs[5], 0, 0, 0, 0, 0, 0,
                                         pkNature, currentEvent.ints[4],
                                         pkMoveset, new int[4]);

                SaveData.currentSave.PC.addPokemon(pk);
            }
            else
            {
                //jump to new tree
                JumpToTree(currentEvent.int0);
            }
            break;

        case (CustomEventDetails.CustomEventType.SetActive):
            if (currentEvent.bool0)
            {
                currentEvent.object0.SetActive(true);
            }
            else
            {
                if (currentEvent.object0 == this.gameObject)
                {
                    deactivateOnFinish = true;
                }
                else if (currentEvent.object0 != PlayerMovement.player.gameObject)
                {
                    //important to never deactivate the player
                    currentEvent.object0.SetActive(false);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            SaveData.currentSave.setCVariable(currentEvent.string0, currentEvent.float0);
            break;

        case (CustomEventDetails.CustomEventType.LogicCheck):
            bool passedCheck = false;

            CustomEventDetails.Logic lo = currentEvent.logic;

            switch (lo)
            {
            case CustomEventDetails.Logic.CVariableEquals:
                if (currentEvent.float0 == SaveData.currentSave.getCVariable(currentEvent.string0))
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableGreaterThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) > currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.CVariableLessThan:
                if (SaveData.currentSave.getCVariable(currentEvent.string0) < currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.GymBadgeNoOwned:
                if (Mathf.FloorToInt(currentEvent.float0) < SaveData.currentSave.gymsBeaten.Length &&
                    Mathf.FloorToInt(currentEvent.float0) >= 0)
                {
                    //ensure input number is valid
                    if (SaveData.currentSave.gymsBeaten[Mathf.FloorToInt(currentEvent.float0)])
                    {
                        passedCheck = true;
                    }
                }
                break;

            case CustomEventDetails.Logic.GymBadgesEarned:
                int badgeCount = 0;
                for (int bi = 0; bi < SaveData.currentSave.gymsBeaten.Length; bi++)
                {
                    if (SaveData.currentSave.gymsBeaten[bi])
                    {
                        badgeCount += 1;
                    }
                }
                if (badgeCount >= currentEvent.float0)
                {
                    passedCheck = true;
                }
                break;

            case CustomEventDetails.Logic.PokemonIDIsInParty:
                for (int pi = 0; pi < 6; pi++)
                {
                    if (SaveData.currentSave.PC.boxes[0][pi] != null)
                    {
                        if (SaveData.currentSave.PC.boxes[0][pi].getID() ==
                            Mathf.FloorToInt(currentEvent.float0))
                        {
                            passedCheck = true;
                            pi          = 6;
                        }
                    }
                }
                break;

            case CustomEventDetails.Logic.SpaceInParty:
                if (currentEvent.bool0)
                {
                    if (!SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                else
                {
                    if (SaveData.currentSave.PC.hasSpace(0))
                    {
                        passedCheck = true;
                    }
                }
                break;
            }

            if (passedCheck)
            {
                int newTreeIndex = currentEvent.int0;
                if (newTreeIndex != eventTreeIndex &&     //only change tree if index is valid
                    newTreeIndex < treesArray.Length)
                {
                    JumpToTree(newTreeIndex);
                }
            }
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:

            //custom cutouts not yet implemented
            StartCoroutine(ScreenFade.main.FadeCutout(false, ScreenFade.slowedSpeed, null));

            //Automatic LoopStart usage not yet implemented
            Scene.main.Battle.gameObject.SetActive(true);

            Trainer trainer = currentEvent.object0.GetComponent <Trainer>();

            if (trainer.battleBGM != null)
            {
                Debug.Log(trainer.battleBGM.name);
                BgmHandler.main.PlayOverlay(trainer.battleBGM, trainer.samplesLoopStart);
            }
            else
            {
                BgmHandler.main.PlayOverlay(Scene.main.Battle.defaultTrainerBGM,
                                            Scene.main.Battle.defaultTrainerBGMLoopStart);
            }
            Scene.main.Battle.gameObject.SetActive(false);
            yield return(new WaitForSeconds(1.6f));

            Scene.main.Battle.gameObject.SetActive(true);
            StartCoroutine(Scene.main.Battle.control(true, trainer, currentEvent.bool0));

            while (Scene.main.Battle.gameObject.activeSelf)
            {
                yield return(null);
            }

            //yield return new WaitForSeconds(sceneTransition.FadeIn(0.4f));
            yield return(StartCoroutine(ScreenFade.main.Fade(true, 0.4f)));

            if (currentEvent.bool0)
            {
                if (Scene.main.Battle.victor == 1)
                {
                    int newTreeIndex = currentEvent.int0;
                    if (newTreeIndex != eventTreeIndex &&     //only change tree if index is valid
                        newTreeIndex < treesArray.Length)
                    {
                        JumpToTree(newTreeIndex);
                    }
                }
            }

            break;
        }
    }
예제 #2
0
    private string GetEventDescription(SerializedProperty currentSEvent)
    {
        SetEventProps(currentSEvent);

        //add more details according to which type of event it is
        CustomEventDetails.CustomEventType ty = (CustomEventDetails.CustomEventType)eventType_Prop.enumValueIndex;

        //set the event description to be the enum name
        string eventDescription = ty.ToString();

        switch (ty)
        {
        case CustomEventDetails.CustomEventType.Walk:
            eventDescription  = (bool0_Prop.boolValue) ? "Move " : "Walk ";
            eventDescription += (object0_Prop.objectReferenceValue != null)
                    ? "\"" + object0_Prop.objectReferenceValue.name + "\" "
                    : "\"null\" ";
            eventDescription += dir_Prop.enumDisplayNames[dir_Prop.enumValueIndex].ToLowerInvariant() + " " +
                                int0_Prop.intValue + " spaces.";
            break;

        case CustomEventDetails.CustomEventType.TurnTo:
            int turns = int0_Prop.intValue;
            while (turns > 3)
            {
                turns -= 4;
            }
            while (turns < 0)
            {
                turns += 4;
            }
            eventDescription = (object0_Prop.objectReferenceValue != null)
                    ? "Turn \"" + object0_Prop.objectReferenceValue.name + "\""
                    : "Turn \"null\"";
            if (object1_Prop.objectReferenceValue != null)
            {
                eventDescription += " towards \"" + object1_Prop.objectReferenceValue.name + "\"";
                if (turns != 0)
                {
                    eventDescription += ", then";
                }
            }
            switch (turns)
            {
            case 1:
                eventDescription += " clockwise.";
                break;

            case 2:
                eventDescription += " around.";
                break;

            case 3:
                eventDescription += " counter clockwise.";
                break;
            }
            break;

        case CustomEventDetails.CustomEventType.Wait:
            eventDescription = "Wait " + float0_Prop.floatValue + " seconds.";
            break;

        case CustomEventDetails.CustomEventType.Dialog:
            if (strings_Prop.arraySize > 0)
            {
                //check for invalid values before attempting to use any.
                if (strings_Prop.GetArrayElementAtIndex(0).stringValue != null)
                {
                    if (strings_Prop.GetArrayElementAtIndex(0).stringValue.Length <= 32)
                    {
                        eventDescription = "\"" + strings_Prop.GetArrayElementAtIndex(0).stringValue + "\"";
                    }
                    else
                    {
                        eventDescription = "\"" +
                                           strings_Prop.GetArrayElementAtIndex(0).stringValue.Substring(0, 32) +
                                           "... \"";
                    }
                }
            }
            break;

        case CustomEventDetails.CustomEventType.Choice:
            eventDescription = "Choices: ";
            int i = 0;
            while (eventDescription.Length < 32 && i < strings_Prop.arraySize)
            {
                if (strings_Prop.GetArrayElementAtIndex(i).stringValue != null)
                {
                    eventDescription += strings_Prop.GetArrayElementAtIndex(i).stringValue;
                    if (i + 1 < strings_Prop.arraySize)
                    {
                        eventDescription += ", ";
                    }
                }
                i += 1;
            }
            if (eventDescription.Length > 32)
            {
                eventDescription = eventDescription.Substring(0, 32) + "...";
            }
            break;

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            eventDescription = "Receive a Lv. " + ints_Prop.GetArrayElementAtIndex(1).intValue + " \"";
            PokemonData pkd = PokemonDatabase.getPokemon(ints_Prop.GetArrayElementAtIndex(0).intValue);
            eventDescription += (pkd != null) ? pkd.getName() : "null";
            eventDescription += "\" or Jump to " + int0_Prop.intValue + ".";
            break;

        case CustomEventDetails.CustomEventType.LogicCheck:
            CustomEventDetails.Logic lo = (CustomEventDetails.Logic)logic_Prop.enumValueIndex;

            if (lo == CustomEventDetails.Logic.CVariableEquals)
            {
                eventDescription = "If \"" + string0_Prop.stringValue + "\" == " + float0_Prop.floatValue +
                                   ", Jump to " + int0_Prop.intValue + ".";
            }
            else if (lo == CustomEventDetails.Logic.CVariableGreaterThan)
            {
                eventDescription = "If \"" + string0_Prop.stringValue + "\" > " + float0_Prop.floatValue +
                                   ", Jump to " + int0_Prop.intValue + ".";
            }
            else if (lo == CustomEventDetails.Logic.CVariableLessThan)
            {
                eventDescription = "If \"" + string0_Prop.stringValue + "\" < " + float0_Prop.floatValue +
                                   ", Jump to " + int0_Prop.intValue + ".";
            }
            //Boolean Logic Checks
            else if (lo == CustomEventDetails.Logic.SpaceInParty)
            {
                eventDescription  = (bool0_Prop.boolValue) ? "If NOT " : "If ";
                eventDescription += logic_Prop.enumDisplayNames[logic_Prop.enumValueIndex] + ", Jump to " +
                                    int0_Prop.intValue + ".";
            }
            else
            {
                eventDescription = "If " + float0_Prop.floatValue + " " +
                                   logic_Prop.enumDisplayNames[logic_Prop.enumValueIndex] + ", Jump to " +
                                   int0_Prop.intValue + ".";
            }
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            eventDescription = "Set C Variable \"" + string0_Prop.stringValue + "\" to " + float0_Prop.floatValue +
                               ".";
            break;

        case CustomEventDetails.CustomEventType.SetActive:
            eventDescription  = (bool0_Prop.boolValue) ? "Activate \"" : "Deactivate \"";
            eventDescription += (object0_Prop.objectReferenceValue != null)
                    ? object0_Prop.objectReferenceValue.name + "\""
                    : "null\"";
            break;

        case CustomEventDetails.CustomEventType.Sound:
            eventDescription  = "Play sound: \"";
            eventDescription += (sound_Prop.objectReferenceValue != null)
                    ? sound_Prop.objectReferenceValue.name + "\""
                    : "null\"";
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            eventDescription = "Receive " + int0_Prop.intValue + " x \"" + string0_Prop.stringValue + "\"";
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:
            eventDescription  = "Battle with ";
            eventDescription += (object0_Prop.objectReferenceValue != null)
                    ? object0_Prop.objectReferenceValue.name + "\""
                    : "null\"";
            if (bool0_Prop.boolValue)
            {
                eventDescription += ", Jump To " + int0_Prop.intValue + " on Loss";
            }
            break;

        case CustomEventDetails.CustomEventType.ReturnToTitle:
            eventDescription = "Return to Title Screen";
            break;

        case CustomEventDetails.CustomEventType.JumpTo:
            eventDescription = "Jump To " + int0_Prop.intValue;;
            break;

        case CustomEventDetails.CustomEventType.MoveCamera:
            eventDescription = "Move camera to " + ints_Prop.GetArrayElementAtIndex(0).intValue + ", " + ints_Prop.GetArrayElementAtIndex(1).intValue + ", " + ints_Prop.GetArrayElementAtIndex(2).intValue + "";;
            break;
        }


        return(eventDescription);
    }
예제 #3
0
    private void UpdateUnfoldedEventData(SerializedProperty currentSEvent)
    {
        SetEventProps(currentSEvent);

        /* Draw a line */
        GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });

        EditorGUILayout.PropertyField(eventType_Prop);

        EditorGUILayout.Space();

        CustomEventDetails.CustomEventType ty = (CustomEventDetails.CustomEventType)eventType_Prop.enumValueIndex;

        switch (ty)
        {
        case CustomEventDetails.CustomEventType.Dialog:
            strings_Prop.arraySize = EditorGUILayout.IntField(new GUIContent("Lines"), strings_Prop.arraySize);
            EditorGUILayout.Space();
            for (int i = 0; i < strings_Prop.arraySize; i++)
            {
                strings_Prop.GetArrayElementAtIndex(i).stringValue =
                    EditorGUILayout.TextField(new GUIContent("Dialog " + (i + 1)),
                                              strings_Prop.GetArrayElementAtIndex(i).stringValue);
            }
            break;

        case CustomEventDetails.CustomEventType.Choice:
            strings_Prop.arraySize = EditorGUILayout.IntField(new GUIContent("Choices"), strings_Prop.arraySize);
            ints_Prop.arraySize    = strings_Prop.arraySize;
            EditorGUILayout.Space();
            for (int i = 0; i < strings_Prop.arraySize; i++)
            {
                strings_Prop.GetArrayElementAtIndex(i).stringValue =
                    EditorGUILayout.TextField(new GUIContent("Choice " + (i + 1)),
                                              strings_Prop.GetArrayElementAtIndex(i).stringValue);
                ints_Prop.GetArrayElementAtIndex(i).intValue =
                    EditorGUILayout.IntField(new GUIContent("Jump to Tree:"),
                                             ints_Prop.GetArrayElementAtIndex(i).intValue);
            }
            break;

        case CustomEventDetails.CustomEventType.Walk:
            EditorGUILayout.PropertyField(runSimul_Prop, new GUIContent("Run Simultaneously"));
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Character"));
            EditorGUILayout.PropertyField(dir_Prop, new GUIContent("Direction"));
            EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Steps"));
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Lock Direction"));

            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Speed Multiplier"));
            break;

        case CustomEventDetails.CustomEventType.TurnTo:
            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Character"));
            EditorGUILayout.PropertyField(object1_Prop, new GUIContent("Turn Towards"));
            int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Direction Mod"), int0_Prop.intValue);
            break;

        case CustomEventDetails.CustomEventType.Wait:
            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Seconds"));
            break;

        case CustomEventDetails.CustomEventType.LogicCheck:
            CustomEventDetails.Logic lo = (CustomEventDetails.Logic)logic_Prop.enumValueIndex;

            //Boolean Logic Checks
            if (lo == CustomEventDetails.Logic.SpaceInParty)
            {
                EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("NOT"));
            }
            else
            {
                EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Check Value:"));
            }

            EditorGUILayout.PropertyField(logic_Prop, new GUIContent("Computation"));

            //CVariable Logic Checks
            if (lo == CustomEventDetails.Logic.CVariableEquals ||
                lo == CustomEventDetails.Logic.CVariableGreaterThan ||
                lo == CustomEventDetails.Logic.CVariableLessThan)
            {
                EditorGUILayout.PropertyField(string0_Prop, new GUIContent("C Variable"));
            }

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Jump to Tree:"));
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            EditorGUILayout.PropertyField(string0_Prop, new GUIContent("Set Variable:"));
            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("To Value:"));
            break;

        case CustomEventDetails.CustomEventType.Sound:
            EditorGUILayout.PropertyField(sound_Prop, new GUIContent("Sound"));
            break;

        case CustomEventDetails.CustomEventType.SetActive:
            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Game Object"));
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Set Active"));
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Is TM"));
            string0_Prop.stringValue = EditorGUILayout.TextField(new GUIContent("Item"), string0_Prop.stringValue);
            if (!bool0_Prop.boolValue)
            {
                int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Quantity"), int0_Prop.intValue);
            }
            break;

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            ints_Prop.arraySize    = 11;
            strings_Prop.arraySize = 8;

            int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Jump To on Fail"), int0_Prop.intValue);
            EditorGUILayout.Space();

            ints_Prop.GetArrayElementAtIndex(0).intValue = EditorGUILayout.IntField(new GUIContent("Pokemon ID"),
                                                                                    ints_Prop.GetArrayElementAtIndex(0).intValue);
            PokemonData pkd         = PokemonDatabase.getPokemon(ints_Prop.GetArrayElementAtIndex(0).intValue);
            string      pokemonName = (pkd != null) ? pkd.getName() : "null";
            EditorGUILayout.LabelField(new GUIContent(" "), new GUIContent(pokemonName));
            EditorGUILayout.Space();
            strings_Prop.GetArrayElementAtIndex(0).stringValue =
                EditorGUILayout.TextField(new GUIContent("Nickname"),
                                          strings_Prop.GetArrayElementAtIndex(0).stringValue);
            ints_Prop.GetArrayElementAtIndex(1).intValue = EditorGUILayout.IntSlider(new GUIContent("Level"),
                                                                                     ints_Prop.GetArrayElementAtIndex(1).intValue, 1, 100);
            //Gender
            if (pkd != null)
            {
                if (pkd.getMaleRatio() == -1)
                {
                    EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Genderless"));
                }
                else if (pkd.getMaleRatio() == 0)
                {
                    EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Female"));
                }
                else if (pkd.getMaleRatio() == 100)
                {
                    EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Male"));
                }
                else
                {
//if not a set gender
                    ints_Prop.GetArrayElementAtIndex(2).intValue = EditorGUILayout.Popup(new GUIContent("Gender"),
                                                                                         ints_Prop.GetArrayElementAtIndex(2).intValue, new GUIContent[]
                    {
                        new GUIContent("Male"), new GUIContent("Female"), new GUIContent("Calculate")
                    });
                }
            }
            else
            {
                EditorGUILayout.LabelField(new GUIContent("Gender"));
            }
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Is Shiny"));
            strings_Prop.GetArrayElementAtIndex(1).stringValue =
                EditorGUILayout.TextField(new GUIContent("Original Trainer"),
                                          strings_Prop.GetArrayElementAtIndex(1).stringValue);
            strings_Prop.GetArrayElementAtIndex(2).stringValue =
                EditorGUILayout.TextField(new GUIContent("Poké Ball"),
                                          strings_Prop.GetArrayElementAtIndex(2).stringValue);
            strings_Prop.GetArrayElementAtIndex(3).stringValue =
                EditorGUILayout.TextField(new GUIContent("Held Item"),
                                          strings_Prop.GetArrayElementAtIndex(3).stringValue);
            //Nature
            string[]     natureNames = NatureDatabase.getNatureNames();
            GUIContent[] natures     = new GUIContent[natureNames.Length + 1];
            natures[0] = new GUIContent("Random");
            for (int i = 1; i < natures.Length; i++)
            {
                natures[i] =
                    new GUIContent(natureNames[i - 1].Substring(0, 1) +
                                   natureNames[i - 1].Substring(1, natureNames[i - 1].Length - 1).ToLower() +
                                   "\t | " + NatureDatabase.getNature(i - 1).getUpStat() + "+ | " +
                                   NatureDatabase.getNature(i - 1).getDownStat() + "-");
            }
            ints_Prop.GetArrayElementAtIndex(3).intValue = EditorGUILayout.Popup(new GUIContent("Nature"),
                                                                                 ints_Prop.GetArrayElementAtIndex(3).intValue, natures);
            //Ability
            if (pkd != null)
            {
                ints_Prop.GetArrayElementAtIndex(4).intValue = EditorGUILayout.Popup(new GUIContent("Ability"),
                                                                                     ints_Prop.GetArrayElementAtIndex(4).intValue, new GUIContent[]
                {
                    new GUIContent("1: " + pkd.getAbility(0)), new GUIContent("2: " + pkd.getAbility(1)),
                    new GUIContent("(HA) " + pkd.getAbility(2))
                });
            }
            else
            {
                EditorGUILayout.LabelField(new GUIContent("Ability"));
            }

            EditorGUILayout.Space();

            EditorGUILayout.LabelField(new GUIContent("Custom Moveset"), new GUIContent("(Blanks will be default)"));
            EditorGUILayout.BeginHorizontal();
            strings_Prop.GetArrayElementAtIndex(4).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(4).stringValue);
            strings_Prop.GetArrayElementAtIndex(5).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(5).stringValue);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            strings_Prop.GetArrayElementAtIndex(6).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(6).stringValue);
            strings_Prop.GetArrayElementAtIndex(7).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(7).stringValue);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            string IVstring = (bool1_Prop.boolValue) ? "Using Custom IVs" : "Using Random IVs";
            bool1_Prop.boolValue = EditorGUILayout.Foldout(bool1_Prop.boolValue, new GUIContent(IVstring));
            if (bool1_Prop.boolValue)
            {
                ints_Prop.GetArrayElementAtIndex(5).intValue = EditorGUILayout.IntSlider(new GUIContent("HP"),
                                                                                         ints_Prop.GetArrayElementAtIndex(5).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(6).intValue = EditorGUILayout.IntSlider(new GUIContent("ATK"),
                                                                                         ints_Prop.GetArrayElementAtIndex(6).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(7).intValue = EditorGUILayout.IntSlider(new GUIContent("DEF"),
                                                                                         ints_Prop.GetArrayElementAtIndex(7).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(8).intValue = EditorGUILayout.IntSlider(new GUIContent("SPA"),
                                                                                         ints_Prop.GetArrayElementAtIndex(8).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(9).intValue = EditorGUILayout.IntSlider(new GUIContent("SPD"),
                                                                                         ints_Prop.GetArrayElementAtIndex(9).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(10).intValue = EditorGUILayout.IntSlider(new GUIContent("SPE"),
                                                                                          ints_Prop.GetArrayElementAtIndex(10).intValue, 0, 31);
            }
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:
            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Trainer Script"));
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Loss Allowed?"));
            if (bool0_Prop.boolValue)
            {
                int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Jump To on Loss"), int0_Prop.intValue);
            }
            break;

        case CustomEventDetails.CustomEventType.JumpTo:
            EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Jump to Tree:"));
            break;

        case CustomEventDetails.CustomEventType.MoveCamera:
            ints_Prop.arraySize = 4;
            EditorGUILayout.PropertyField(runSimul_Prop, new GUIContent("Run Simultaneously"));
            EditorGUILayout.PropertyField(ints_Prop.GetArrayElementAtIndex(0), new GUIContent("X"));
            EditorGUILayout.PropertyField(ints_Prop.GetArrayElementAtIndex(1), new GUIContent("Y"));
            EditorGUILayout.PropertyField(ints_Prop.GetArrayElementAtIndex(2), new GUIContent("Z"));
            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Speed"));
            break;
        }

        /* Draw a line */
        GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
        EditorGUILayout.Space();
    }
    private void UpdateUnfoldedEventData(SerializedProperty currentSEvent)
    {
        SetEventProps(currentSEvent);

        /* Draw a line */
        GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });

        EditorGUILayout.PropertyField(eventType_Prop);

        EditorGUILayout.Space();

        CustomEventDetails.CustomEventType ty = (CustomEventDetails.CustomEventType)eventType_Prop.enumValueIndex;

        switch (ty)
        {
        case CustomEventDetails.CustomEventType.Dialog:
            strings_Prop.arraySize = EditorGUILayout.IntField(new GUIContent("Lines"), strings_Prop.arraySize);
            EditorGUILayout.Space();
            for (int i = 0; i < strings_Prop.arraySize; i++)
            {
                strings_Prop.GetArrayElementAtIndex(i).stringValue =
                    EditorGUILayout.TextField(new GUIContent("Dialog " + (i + 1)),
                                              strings_Prop.GetArrayElementAtIndex(i).stringValue);
            }
            break;

        case CustomEventDetails.CustomEventType.Choice:
            strings_Prop.arraySize = EditorGUILayout.IntField(new GUIContent("Choices"), strings_Prop.arraySize);
            ints_Prop.arraySize    = strings_Prop.arraySize;
            EditorGUILayout.Space();
            for (int i = 0; i < strings_Prop.arraySize; i++)
            {
                strings_Prop.GetArrayElementAtIndex(i).stringValue =
                    EditorGUILayout.TextField(new GUIContent("Choice " + (i + 1)),
                                              strings_Prop.GetArrayElementAtIndex(i).stringValue);
                ints_Prop.GetArrayElementAtIndex(i).intValue =
                    EditorGUILayout.IntField(new GUIContent("Jump to Tree:"),
                                             ints_Prop.GetArrayElementAtIndex(i).intValue);
            }
            break;

        case CustomEventDetails.CustomEventType.Walk:
            EditorGUILayout.PropertyField(runSimul_Prop, new GUIContent("Run Simultaneously"));
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Character"));
            EditorGUILayout.PropertyField(dir_Prop, new GUIContent("Direction"));
            EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Steps"));
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Lock Direction"));

            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Speed Multiplier"));
            break;

        case CustomEventDetails.CustomEventType.TurnTo:
            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Character"));
            EditorGUILayout.PropertyField(object1_Prop, new GUIContent("Turn Towards"));
            int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Direction Mod"), int0_Prop.intValue);
            break;

        case CustomEventDetails.CustomEventType.Wait:
            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Seconds"));
            break;

        case CustomEventDetails.CustomEventType.LogicCheck:
            CustomEventDetails.Logic lo = (CustomEventDetails.Logic)logic_Prop.enumValueIndex;

            //Boolean Logic Checks
            if (lo == CustomEventDetails.Logic.SpaceInParty)
            {
                EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("NOT"));
            }
            else
            {
                EditorGUILayout.PropertyField(float0_Prop, new GUIContent("Check Value:"));
            }

            EditorGUILayout.PropertyField(logic_Prop, new GUIContent("Computation"));

            //CVariable Logic Checks
            if (lo == CustomEventDetails.Logic.CVariableEquals ||
                lo == CustomEventDetails.Logic.CVariableGreaterThan ||
                lo == CustomEventDetails.Logic.CVariableLessThan)
            {
                EditorGUILayout.PropertyField(string0_Prop, new GUIContent("C Variable"));
            }

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(int0_Prop, new GUIContent("Jump to Tree:"));
            break;

        case CustomEventDetails.CustomEventType.SetCVariable:
            EditorGUILayout.PropertyField(string0_Prop, new GUIContent("Set Variable:"));
            EditorGUILayout.PropertyField(float0_Prop, new GUIContent("To Value:"));
            break;

        case CustomEventDetails.CustomEventType.Sound:
            EditorGUILayout.PropertyField(sound_Prop, new GUIContent("Sound"));
            break;

        case CustomEventDetails.CustomEventType.SetActive:
            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Game Object"));
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Set Active"));
            break;

        case CustomEventDetails.CustomEventType.ReceiveItem:
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Is TM"));
            string0_Prop.stringValue = EditorGUILayout.TextField(new GUIContent("Item"), string0_Prop.stringValue);
            if (!bool0_Prop.boolValue)
            {
                int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Quantity"), int0_Prop.intValue);
            }
            break;

        case CustomEventDetails.CustomEventType.ReceivePokemon:
            ints_Prop.arraySize    = 11;
            strings_Prop.arraySize = 8;

            int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Jump To on Fail"), int0_Prop.intValue);
            EditorGUILayout.Space();

            ints_Prop.GetArrayElementAtIndex(0).intValue = EditorGUILayout.IntField(new GUIContent("Pokemon ID"),
                                                                                    ints_Prop.GetArrayElementAtIndex(0).intValue);

            // ToDO: change ints_Prop.
            var    pkmn        = GameController.Instance.PokemonDb.GetPokemonSpeciesByGameId(ints_Prop.GetArrayElementAtIndex(0).intValue.ToString());
            string pokemonName = (pkmn != null) ? pkmn.Name : "null";
            EditorGUILayout.LabelField(new GUIContent(" "), new GUIContent(pokemonName));
            EditorGUILayout.Space();
            strings_Prop.GetArrayElementAtIndex(0).stringValue =
                EditorGUILayout.TextField(new GUIContent("Nickname"),
                                          strings_Prop.GetArrayElementAtIndex(0).stringValue);
            ints_Prop.GetArrayElementAtIndex(1).intValue = EditorGUILayout.IntSlider(new GUIContent("Level"),
                                                                                     ints_Prop.GetArrayElementAtIndex(1).intValue, 1, 100);
            //Gender
            if (pkmn != null)
            {
                if (pkmn.MaleRatio < 0)
                {
                    EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Genderless"));
                }
                else if (pkmn.MaleRatio == 0)
                {
                    EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Female"));
                }
                else if (pkmn.MaleRatio == 100)
                {
                    EditorGUILayout.LabelField(new GUIContent("Gender"), new GUIContent("Male"));
                }
                else
                {
                    //if not a set gender
                    ints_Prop.GetArrayElementAtIndex(2).intValue = EditorGUILayout.Popup(new GUIContent("Gender"),
                                                                                         ints_Prop.GetArrayElementAtIndex(2).intValue, new GUIContent[]
                    {
                        new GUIContent("Male"), new GUIContent("Female"), new GUIContent("Calculate")
                    });
                }
            }
            else
            {
                EditorGUILayout.LabelField(new GUIContent("Gender"));
            }
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Is Shiny"));
            var stringsArrayElementAt1 = strings_Prop.GetArrayElementAtIndex(1);
            stringsArrayElementAt1.stringValue =
                EditorGUILayout.TextField(new GUIContent("Original Trainer"),
                                          stringsArrayElementAt1.stringValue);
            var stringsArrayElementAt2 = strings_Prop.GetArrayElementAtIndex(2);
            stringsArrayElementAt2.stringValue =
                EditorGUILayout.TextField(new GUIContent("Poké Ball"),
                                          stringsArrayElementAt2.stringValue);
            var stringsArrayElementAt3 = strings_Prop.GetArrayElementAtIndex(3);
            stringsArrayElementAt3.stringValue =
                EditorGUILayout.TextField(new GUIContent("Held Item"),
                                          stringsArrayElementAt3.stringValue);

            //Nature
            string[]     natureNames = PokemonNatureHelper.GetAllNatureNames();
            GUIContent[] natures     = new GUIContent[natureNames.Length + 1];
            natures[0] = new GUIContent("Random");
            for (int i = 0, iMax = natures.Length - 1; i != iMax; ++i)
            {
                string text = string.Format("{0}{1}\t | {2}+ | {3}-",
                                            natureNames[i][0],
                                            natureNames[i].Substring(1, natureNames[i].Length - 1).ToLower(),
                                            PokemonNatureHelper.GetUpgradedStat(i),
                                            PokemonNatureHelper.GetDowngradedStat(i));

                natures[i + 1] = new GUIContent(text);
            }
            var intsArrayElementAt3 = ints_Prop.GetArrayElementAtIndex(3);
            intsArrayElementAt3.intValue = EditorGUILayout.Popup(
                new GUIContent("Nature"),
                ints_Prop.GetArrayElementAtIndex(3).intValue,
                natures);

            //Ability
            //if (pkmn != null)
            //{
            //    var intsArrayElementAt4 = ints_Prop.GetArrayElementAtIndex(4);
            //    intsArrayElementAt4.intValue = EditorGUILayout.Popup(new GUIContent("Ability"),
            //        intsArrayElementAt4.intValue, new GUIContent[]
            //        {
            //            new GUIContent("1: " + pkmn.getAbility(0)), new GUIContent("2: " + pkd.getAbility(1)),
            //            new GUIContent("(HA) " + pkmn.getAbility(2))
            //        });
            //}
            //else
            //{
            //    EditorGUILayout.LabelField(new GUIContent("Ability"));
            //}

            EditorGUILayout.Space();

            EditorGUILayout.LabelField(new GUIContent("Custom Moveset"), new GUIContent("(Blanks will be default)"));
            EditorGUILayout.BeginHorizontal();
            strings_Prop.GetArrayElementAtIndex(4).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(4).stringValue);
            strings_Prop.GetArrayElementAtIndex(5).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(5).stringValue);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            strings_Prop.GetArrayElementAtIndex(6).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(6).stringValue);
            strings_Prop.GetArrayElementAtIndex(7).stringValue =
                EditorGUILayout.TextField(strings_Prop.GetArrayElementAtIndex(7).stringValue);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            string IVstring = (bool1_Prop.boolValue) ? "Using Custom IVs" : "Using Random IVs";
            bool1_Prop.boolValue = EditorGUILayout.Foldout(bool1_Prop.boolValue, new GUIContent(IVstring));
            if (bool1_Prop.boolValue)
            {
                ints_Prop.GetArrayElementAtIndex(5).intValue = EditorGUILayout.IntSlider(new GUIContent("HP"),
                                                                                         ints_Prop.GetArrayElementAtIndex(5).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(6).intValue = EditorGUILayout.IntSlider(new GUIContent("ATK"),
                                                                                         ints_Prop.GetArrayElementAtIndex(6).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(7).intValue = EditorGUILayout.IntSlider(new GUIContent("DEF"),
                                                                                         ints_Prop.GetArrayElementAtIndex(7).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(8).intValue = EditorGUILayout.IntSlider(new GUIContent("SPA"),
                                                                                         ints_Prop.GetArrayElementAtIndex(8).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(9).intValue = EditorGUILayout.IntSlider(new GUIContent("SPD"),
                                                                                         ints_Prop.GetArrayElementAtIndex(9).intValue, 0, 31);
                ints_Prop.GetArrayElementAtIndex(10).intValue = EditorGUILayout.IntSlider(new GUIContent("SPE"),
                                                                                          ints_Prop.GetArrayElementAtIndex(10).intValue, 0, 31);
            }
            break;

        case CustomEventDetails.CustomEventType.TrainerBattle:
            EditorGUILayout.PropertyField(object0_Prop, new GUIContent("Trainer Script"));
            EditorGUILayout.PropertyField(bool0_Prop, new GUIContent("Loss Allowed?"));
            if (bool0_Prop.boolValue)
            {
                int0_Prop.intValue = EditorGUILayout.IntField(new GUIContent("Jump To on Loss"), int0_Prop.intValue);
            }
            break;
        }

        /* Draw a line */
        GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
        EditorGUILayout.Space();
    }