Ejemplo n.º 1
0
 public void DrawAvailabilityProperties(ExchangeScript script, int index)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label("Call on: ", MiniLabelStyle);
     script.CallOn = (ExchangeAction)EditorGUILayout.EnumPopup(script.CallOn);
     GUILayout.Label("Availability: ", MiniLabelStyle);
     script.Availability = (AvailabilityBehavior)EditorGUILayout.EnumPopup(script.Availability);
     GUILayout.Label("Max times triggered: ", MiniLabelStyle);
     script.MaxTimesTriggered = EditorGUILayout.IntField(script.MaxTimesTriggered);
     GUILayout.EndHorizontal();
 }
Ejemplo n.º 2
0
    public void DrawScript(ExchangeScript script, int index, Color scriptsColor)
    {
        GUI.color = scriptsColor;
        MiniLabelStyle.wordWrap = false;
        string scriptType = script.GetType().Name;

        if (reflectionMode)
        {
            //List <FieldInfo> field = System.Reflection.Fiel
        }
        else
        {
            if (index == selectedScript)
            {
                GUILayout.BeginHorizontal();
                miniButtonStyle.stretchWidth = false;
                GUI.color = Color.red;
                if (GUILayout.Button("X", miniButtonStyle))
                {
                    scriptToDelete = index;
                }
                GUI.color = Color.yellow;
                GUILayout.Label(scriptType, BoldLabelStyle);
                GUILayout.Label("Num times triggered: " + script.NumTimesTriggered.ToString(), MiniLabelStyle);
                GUILayout.EndHorizontal();

                GUI.color = Color.yellow;
                miniButtonStyle.stretchWidth = true;
                miniButtonStyle.alignment    = TextAnchor.MiddleCenter;

                GUILayout.BeginHorizontal();
                GUILayout.Label("Description: ", MiniLabelStyle);
                script.Description = GUILayout.TextField(script.Description);
                GUILayout.Label("Summary: ", MiniLabelStyle);
                script.Summary = GUILayout.TextField(script.Summary);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                script.CallOn = (ExchangeAction)EditorGUILayout.EnumPopup(script.CallOn);
                script.IgnoreChoiceToLeave = GUILayout.Toggle(script.IgnoreChoiceToLeave, "Ignore choice to leave");
                GUILayout.EndHorizontal();

                switch (scriptType)
                {
                //this is out of date, obviously
                //and would be a lot better using reflection
                case "RequireWorldItem":
                    RequireWorldItem requireWorldItem = (RequireWorldItem)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("World Item Name: ", MiniLabelStyle);
                    requireWorldItem.WorldItemName = GUILayout.TextField(requireWorldItem.WorldItemName);
                    GUILayout.EndHorizontal();
                    break;

                case "RequireCharWIScript":
                    RequireCharWIScript requireCharWiScript = (RequireCharWIScript)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("WIScript Name: ", MiniLabelStyle);
                    requireCharWiScript.WIScriptName = GUILayout.TextField(requireCharWiScript.WIScriptName);
                    GUILayout.EndHorizontal();
                    break;

                case "RequireExchangeEnabled":
                    RequireExchangeEnabled requireExchangeEnabled = (RequireExchangeEnabled)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Exchange Name: ", MiniLabelStyle);
                    requireExchangeEnabled.ExchangeName = GUILayout.TextField(requireExchangeEnabled.ExchangeName);
                    requireExchangeEnabled.Enabled      = GUILayout.Toggle(requireExchangeEnabled.Enabled, "Enabled");
                    GUILayout.EndHorizontal();
                    break;

                case "ChangeCharacterEmotion":
                    ChangeCharacterEmotion changeCharacterEmotion = (ChangeCharacterEmotion)script;
                    GUILayout.BeginHorizontal();
                    changeCharacterEmotion.Emotion = (EmotionalState)EditorGUILayout.EnumPopup(changeCharacterEmotion.Emotion);
                    GUILayout.EndHorizontal();
                    break;

                case "GiveGenericItemsToPlayer":
                    GiveGenericItemsToPlayer giveGenericItemsToPlayer = (GiveGenericItemsToPlayer)script;
                    GUILayout.BeginHorizontal();
                    giveGenericItemsToPlayer.PackName   = GUILayout.TextField(giveGenericItemsToPlayer.PackName);
                    giveGenericItemsToPlayer.PrefabName = GUILayout.TextField(giveGenericItemsToPlayer.PrefabName);
                    giveGenericItemsToPlayer.NumItems   = EditorGUILayout.IntField(giveGenericItemsToPlayer.NumItems);
                    GUILayout.EndHorizontal();
                    break;

                case "ActivateMission":
                    ActivateMission activateMission = (ActivateMission)script;
                    GUILayout.BeginHorizontal();
                    activateMission.MissionName        = GUILayout.TextField(activateMission.MissionName);
                    activateMission.OriginTypeOverride = (MissionOriginType)EditorGUILayout.EnumPopup(activateMission.OriginTypeOverride);
                    activateMission.OriginNameOverride = GUILayout.TextField(activateMission.OriginNameOverride);
                    GUILayout.EndHorizontal();
                    break;

                case "ChangeMissionDescription":
                    ChangeMissionDescription changeMissionDescription = (ChangeMissionDescription)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Mission Name: ", MiniLabelStyle);
                    changeMissionDescription.MissionName = GUILayout.TextField(changeMissionDescription.MissionName);
                    GUILayout.Label("New Description: ", MiniLabelStyle);
                    changeMissionDescription.NewDescription = GUILayout.TextField(changeMissionDescription.NewDescription);
                    changeMissionDescription.OnlyFirstTime  = GUILayout.Toggle(changeMissionDescription.OnlyFirstTime, "Only First Time");
                    changeMissionDescription.OnlyWhenActive = GUILayout.Toggle(changeMissionDescription.OnlyWhenActive, "Only When Active");
                    GUILayout.EndHorizontal();
                    break;

                case "ActivateMissionObjective":
                    ActivateMissionObjective activateMissionObjective = (ActivateMissionObjective)script;
                    GUILayout.BeginHorizontal();
                    activateMissionObjective.MissionName        = GUILayout.TextField(activateMissionObjective.MissionName);
                    activateMissionObjective.ObjectiveName      = GUILayout.TextField(activateMissionObjective.ObjectiveName);
                    activateMissionObjective.OriginTypeOverride = (MissionOriginType)EditorGUILayout.EnumPopup(activateMissionObjective.OriginTypeOverride);
                    activateMissionObjective.OriginNameOverride = GUILayout.TextField(activateMissionObjective.OriginNameOverride);
                    GUILayout.EndHorizontal();
                    break;

                case "RequireMissionStatus":
                    RequireMissionStatus requireMissionStatus = (RequireMissionStatus)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Mission Name: ", MiniLabelStyle);
                    requireMissionStatus.MissionName = GUILayout.TextField(requireMissionStatus.MissionName);
                    requireMissionStatus.Status      = (MissionStatus)EditorGUILayout.EnumPopup(requireMissionStatus.Status);
                    GUILayout.EndHorizontal();
                    break;

                case "RequireObjectiveStatus":
                    RequireObjectiveStatus requireObjectiveStatus = (RequireObjectiveStatus)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Mission Name: ", MiniLabelStyle);
                    requireObjectiveStatus.MissionName = GUILayout.TextField(requireObjectiveStatus.MissionName);
                    GUILayout.Label("Objective Name: ", MiniLabelStyle);
                    requireObjectiveStatus.ObjectiveName = GUILayout.TextField(requireObjectiveStatus.ObjectiveName);
                    requireObjectiveStatus.Status        = (MissionStatus)EditorGUILayout.EnumPopup(requireObjectiveStatus.Status);
                    GUILayout.EndHorizontal();
                    break;

                case "RequireMissionVariable":
                    RequireMissionVariable requireMissionVariable = (RequireMissionVariable)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Variable Name: ", MiniLabelStyle);
                    requireMissionVariable.VariableName = GUILayout.TextField(requireMissionVariable.VariableName);
                    GUILayout.Label("Check Type: ", MiniLabelStyle);
                    requireMissionVariable.CheckType = (VariableCheckType)EditorGUILayout.EnumPopup(requireMissionVariable.CheckType);
                    switch (requireMissionVariable.CheckType)
                    {
                    case VariableCheckType.GreaterThan:
                    default:
                        GUILayout.Label("Variable is > this value: ", MiniLabelStyle);
                        break;

                    case VariableCheckType.GreaterThanOrEqualTo:
                        GUILayout.Label("Variable is >= this value: ", MiniLabelStyle);
                        break;

                    case VariableCheckType.LessThan:
                        GUILayout.Label("Variable is < this value: ", MiniLabelStyle);
                        break;

                    case VariableCheckType.LessThanOrEqualTo:
                        GUILayout.Label("Variable is <= this value: ", MiniLabelStyle);
                        break;
                    }
                    requireMissionVariable.VariableValue = EditorGUILayout.IntField(requireMissionVariable.VariableValue);
                    GUILayout.EndHorizontal();
                    break;

                case "ChangeConversationVariable":
                    ChangeConversationVariable changeConversationVariable = (ChangeConversationVariable)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Variable Name: ", MiniLabelStyle);
                    changeConversationVariable.VariableName = GUILayout.TextField(changeConversationVariable.VariableName);
                    GUILayout.Label("Change Type: ", MiniLabelStyle);
                    changeConversationVariable.ChangeType = (ChangeVariableType)EditorGUILayout.EnumPopup(changeConversationVariable.ChangeType);
                    switch (changeConversationVariable.ChangeType)
                    {
                    case ChangeVariableType.Increment:
                    default:
                        GUILayout.Label("Num times to increment: ", MiniLabelStyle);
                        changeConversationVariable.SetValue = EditorGUILayout.IntField(Mathf.Clamp(changeConversationVariable.SetValue, 1, 100));
                        break;

                    case ChangeVariableType.Decrement:
                        GUILayout.Label("Num times to decrement: ", MiniLabelStyle);
                        changeConversationVariable.SetValue = EditorGUILayout.IntField(Mathf.Clamp(changeConversationVariable.SetValue, 1, 100));
                        break;

                    case ChangeVariableType.SetValue:
                        GUILayout.Label("New Value: ", MiniLabelStyle);
                        changeConversationVariable.SetValue = EditorGUILayout.IntField(changeConversationVariable.SetValue);
                        break;
                    }
                    GUILayout.EndHorizontal();
                    break;

                case "RequireConversationVariable":
                    RequireConversationVariable requireConversationVariable = (RequireConversationVariable)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Variable Name: ", MiniLabelStyle);
                    requireConversationVariable.VariableName = GUILayout.TextField(requireConversationVariable.VariableName);
                    GUILayout.Label("Check Type: ", MiniLabelStyle);
                    requireConversationVariable.CheckType = (VariableCheckType)EditorGUILayout.EnumPopup(requireConversationVariable.CheckType);
                    switch (requireConversationVariable.CheckType)
                    {
                    case VariableCheckType.GreaterThan:
                    default:
                        GUILayout.Label("Variable is > this value: ", MiniLabelStyle);
                        break;

                    case VariableCheckType.GreaterThanOrEqualTo:
                        GUILayout.Label("Variable is >= this value: ", MiniLabelStyle);
                        break;

                    case VariableCheckType.LessThan:
                        GUILayout.Label("Variable is < this value: ", MiniLabelStyle);
                        break;

                    case VariableCheckType.LessThanOrEqualTo:
                        GUILayout.Label("Variable is <= this value: ", MiniLabelStyle);
                        break;
                    }
                    requireConversationVariable.VariableValue = EditorGUILayout.IntField(requireConversationVariable.VariableValue);
                    GUILayout.EndHorizontal();
                    break;

                case "RequireQuestItem":
                    RequireQuestItem requireQuestItem = (RequireQuestItem)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Quest Item Name: ", MiniLabelStyle);
                    requireQuestItem.ItemName = GUILayout.TextField(requireQuestItem.ItemName);
                    GUILayout.EndHorizontal();
                    break;

                case "AddWIScriptToCharacter":
                    AddWIScriptToCharacter addWIScriptToCharacter = (AddWIScriptToCharacter)script;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Character name: ", MiniLabelStyle);
                    addWIScriptToCharacter.CharacterName = GUILayout.TextField(addWIScriptToCharacter.CharacterName);
                    GUILayout.Label("Script name: ", MiniLabelStyle);
                    addWIScriptToCharacter.ScriptName = GUILayout.TextField(addWIScriptToCharacter.ScriptName);
                    GUILayout.EndHorizontal();
                    break;
                }
            }
            else
            {
                GUI.color = scriptsColor;
                GUILayout.BeginHorizontal();
                miniButtonStyle.stretchWidth = true;
                if (GUILayout.Button(scriptType))
                {
                    selectedScript = index;
                }
                miniButtonStyle.stretchWidth = false;
                GUI.color = Color.red;
                if (GUILayout.Button("X", miniButtonStyle))
                {
                    scriptToDelete = index;
                }
                GUILayout.EndHorizontal();
            }
        }

        miniButtonStyle.stretchWidth = true;
    }