Пример #1
0
    protected void DrawScript(ObjectiveScript script, ObjectiveState objective, int scriptIndex)
    {
        miniButtonStyle.stretchWidth = true;

        switch (script.GetType().Name)
        {
        //should be done with reflection
        case "ObjectiveGetQuestItem":
            ObjectiveGetQuestItem ogqe = (ObjectiveGetQuestItem)script;
            GUILayout.Label("Item Name:", MiniLabelStyle);
            ogqe.ItemName = GUILayout.TextField(ogqe.ItemName);
            break;

        case "ObjectiveConversationExchange":
            ObjectiveConversationExchange oce = (ObjectiveConversationExchange)script;
            GUILayout.Label("Conversation Name:", MiniLabelStyle);
            oce.ConversationName = GUILayout.TextField(oce.ConversationName);
            GUILayout.Label("Exchange Name:", MiniLabelStyle);
            oce.ExchangeName = GUILayout.TextField(oce.ExchangeName);
            break;

        case "ObjectiveCharacterReachQuestNode":
            ObjectiveCharacterReachQuestNode ocrqn = (ObjectiveCharacterReachQuestNode)script;
            GUILayout.Label("Character Name:", MiniLabelStyle);
            ocrqn.CharacterName = GUILayout.TextField(ocrqn.CharacterName);
            GUILayout.Label("Quest Node Name:", MiniLabelStyle);
            ocrqn.QuestNodeName = GUILayout.TextField(ocrqn.QuestNodeName);
            break;

        case "ObjectiveVisitLocation":
            ObjectiveVisitLocation ovl = (ObjectiveVisitLocation)script;
            DrawMobileReference(ovl.LocationReference);
            break;

        case "ObjectivePreventCharacterDeath":
            ObjectivePreventCharacterDeath opcd = (ObjectivePreventCharacterDeath)script;
            GUILayout.Label("Character Name:", MiniLabelStyle);
            opcd.CharacterName = GUILayout.TextField(opcd.CharacterName);
            break;

        default:
            GUILayout.Label("(Unknown script type)", MiniLabelStyle);
            break;
        }

        miniButtonStyle.stretchWidth = false;
        GUI.color = Color.red;
        if (GUILayout.Button("X"))
        {
            deleteScriptObjective        = objective;
            objectiveScriptIndexToDelete = scriptIndex;
        }
    }