Exemple #1
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI("Conversation:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID   = 0;
                conversation = null;
            }
            else
            {
                conversation = (Conversation)EditorGUILayout.ObjectField("Conversation:", conversation, typeof(Conversation), true);

                constantID   = FieldToID <Conversation> (conversation, constantID);
                conversation = IDToField <Conversation> (conversation, constantID, false);
            }

            if (conversation)
            {
                conversation.Upgrade();

                overrideOptions = EditorGUILayout.Toggle("Override defaults?", overrideOptions);
                if (overrideOptions)
                {
                    numSockets = conversation.options.Count;
                }
                else
                {
                    numSockets = 0;
                }
            }
            else
            {
                numSockets = 0;
            }
        }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            if (_target)
            {
                _target.Upgrade();
            }
            else
            {
                return;
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Conversation settings", EditorStyles.boldLabel);
            _target.interactionSource = (AC.InteractionSource)EditorGUILayout.EnumPopup("Interaction source:", _target.interactionSource);
            _target.autoPlay          = EditorGUILayout.Toggle("Auto-play lone option?", _target.autoPlay);
            _target.isTimed           = EditorGUILayout.Toggle("Is timed?", _target.isTimed);
            if (_target.isTimed)
            {
                _target.timer = EditorGUILayout.FloatField("Timer length (s):", _target.timer);

                if (_target.options != null && _target.options.Count > 0)
                {
                    bool noDefault = (_target.defaultOption < 0);
                    noDefault = EditorGUILayout.Toggle("End if timer runs out?", noDefault);
                    if (noDefault)
                    {
                        _target.defaultOption = -1;
                    }
                    else if (_target.defaultOption < 0)
                    {
                        _target.defaultOption = 0;
                    }
                }
                else
                {
                    _target.defaultOption = -1;
                }
            }
            if (GUILayout.Button("Conversation Editor"))
            {
                ConversationEditorWindow window = (ConversationEditorWindow)EditorWindow.GetWindow(typeof(ConversationEditorWindow));
                window.Repaint();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            CreateOptionsGUI();
            EditorGUILayout.Space();

            if (_target.selectedOption != null && _target.options.Contains(_target.selectedOption))
            {
                EditorGUILayout.LabelField("Dialogue option '" + _target.selectedOption.label + "' properties", EditorStyles.boldLabel);
                EditOptionGUI(_target.selectedOption, _target.interactionSource);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
        public override void OnInspectorGUI()
        {
            if (_target)
            {
                _target.Upgrade();
            }
            else
            {
                return;
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Conversation settings", EditorStyles.boldLabel);
            _target.interactionSource = (AC.InteractionSource)CustomGUILayout.EnumPopup("Interaction source:", _target.interactionSource, "", "The source of the commands that are run when an option is chosen");
            _target.autoPlay          = CustomGUILayout.Toggle("Auto-play lone option?", _target.autoPlay, "", "If True, and only one option is available, then the option will be chosen automatically");
            _target.isTimed           = CustomGUILayout.Toggle("Is timed?", _target.isTimed, "", "If True, then the Conversation is timed, and the options will only be shown for a fixed period");
            if (_target.isTimed)
            {
                _target.timer = CustomGUILayout.FloatField("Timer length (s):", _target.timer, "", "The duration, in seconds, that the Conversation is active");

                if (_target.options != null && _target.options.Count > 0)
                {
                    bool noDefault = (_target.defaultOption < 0);
                    noDefault = CustomGUILayout.Toggle("End if timer runs out?", noDefault, "", "If True, the Conversation will end when the timer runs out - and no option will be chosen");
                    if (noDefault)
                    {
                        _target.defaultOption = -1;
                    }
                    else if (_target.defaultOption < 0)
                    {
                        _target.defaultOption = 0;
                    }
                }
                else
                {
                    _target.defaultOption = -1;
                }
            }
            if (GUILayout.Button("Conversation Editor"))
            {
                ConversationEditorWindow window = (ConversationEditorWindow)EditorWindow.GetWindow(typeof(ConversationEditorWindow));
                window.Repaint();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            CreateOptionsGUI();
            EditorGUILayout.Space();

            if (_target.selectedOption != null && _target.options.Contains(_target.selectedOption))
            {
                EditorGUILayout.LabelField("Dialogue option '" + _target.selectedOption.label + "' properties", EditorStyles.boldLabel);
                EditOptionGUI(_target.selectedOption, _target.interactionSource);
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
Exemple #4
0
        public override void ShowGUI(List <ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI("Conversation:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID   = 0;
                conversation = null;
            }
            else
            {
                conversation = (Conversation)EditorGUILayout.ObjectField("Conversation:", conversation, typeof(Conversation), true);

                constantID   = FieldToID <Conversation> (conversation, constantID);
                conversation = IDToField <Conversation> (conversation, constantID, false);
            }

            if (conversation)
            {
                conversation.Upgrade();
                overrideOptions = EditorGUILayout.Toggle("Override options?", overrideOptions);

                if (overrideOptions)
                {
                    numSockets = conversation.options.Count;
                }
                else
                {
                    numSockets = 0;
                }
            }
            else
            {
                if (isAssetFile && overrideOptions && constantID != 0)
                {
                    EditorGUILayout.HelpBox("Cannot find linked Conversation - please open its scene file.", MessageType.Warning);
                }
                else
                {
                    numSockets = 0;
                }
            }

            if (!overrideOptions && !KickStarter.settingsManager.allowGameplayDuringConversations)
            {
                willWait = EditorGUILayout.Toggle("Wait until finish?", willWait);
                if (willWait)
                {
                    numSockets = 1;
                }
            }
        }
        public override void OnInspectorGUI()
        {
            if (!sideIcon)
            {
                sideIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof(Texture2D));
            }

            if (_target)
            {
                _target.Upgrade();
            }
            else
            {
                return;
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Conversation settings", EditorStyles.boldLabel);
            _target.interactionSource = (InteractionSource)EditorGUILayout.EnumPopup("Interaction source:", _target.interactionSource);
            _target.autoPlay          = EditorGUILayout.Toggle("Auto-play lone option?", _target.autoPlay);
            _target.isTimed           = EditorGUILayout.Toggle("Is timed?", _target.isTimed);
            if (_target.isTimed)
            {
                _target.timer = EditorGUILayout.FloatField("Timer length (s):", _target.timer);
            }
            if (GUILayout.Button("Conversation Editor"))
            {
                ConversationEditorWindow window = (ConversationEditorWindow)EditorWindow.GetWindow(typeof(ConversationEditorWindow));
                window.Repaint();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            CreateOptionsGUI();
            EditorGUILayout.Space();

            if (_target.selectedOption != null && _target.options.Contains(_target.selectedOption))
            {
                EditorGUILayout.LabelField("Dialogue option '" + _target.selectedOption.label + "' properties", EditorStyles.boldLabel);
                EditOptionGUI(_target.selectedOption, _target.interactionSource);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_target);
            }
        }
Exemple #6
0
        public override void ShowGUI()
        {
            linkedConversation = (Conversation)EditorGUILayout.ObjectField("Conversation:", linkedConversation, typeof(Conversation), true);

            if (linkedConversation)
            {
                linkedConversation.Upgrade();
            }

            constantID         = FieldToID <Conversation> (linkedConversation, constantID);
            linkedConversation = IDToField <Conversation> (linkedConversation, constantID, true);

            if (linkedConversation)
            {
                optionID = ShowOptionGUI(linkedConversation.options, optionID);
                newLabel = EditorGUILayout.TextField("New label text:", newLabel);
            }

            AfterRunningOption();
        }
Exemple #7
0
        public override void ShowGUI()
        {
            linkedConversation = (Conversation)EditorGUILayout.ObjectField("Conversation:", linkedConversation, typeof(Conversation), true);

            if (linkedConversation)
            {
                linkedConversation.Upgrade();
            }

            constantID         = FieldToID <Conversation> (linkedConversation, constantID);
            linkedConversation = IDToField <Conversation> (linkedConversation, constantID, true);

            if (linkedConversation)
            {
                optionNumber = ShowOptionGUI(linkedConversation.options, optionNumber);
            }

            switchType = (SwitchType)EditorGUILayout.EnumPopup("Set to:", switchType);

            AfterRunningOption();
        }
		public override void ShowGUI ()
		{
			linkedConversation = (Conversation) EditorGUILayout.ObjectField ("Conversation:", linkedConversation, typeof (Conversation), true);

			if (linkedConversation)
			{
				linkedConversation.Upgrade ();
			}

			constantID = FieldToID <Conversation> (linkedConversation, constantID);
			linkedConversation = IDToField <Conversation> (linkedConversation, constantID, true);

			if (linkedConversation)
			{
				optionNumber = ShowOptionGUI (linkedConversation.options, optionNumber);
			}

			switchType = (SwitchType) EditorGUILayout.EnumPopup ("Set to:", switchType);
			
			AfterRunningOption ();
		}
        private void OnGUI()
        {
            if (Selection.activeGameObject && Selection.activeGameObject.GetComponent <Conversation>() && (conversation == null || Selection.activeGameObject != conversation.gameObject))
            {
                if (conversation != null)
                {
                    lastConversation = conversation;
                }
                conversation = Selection.activeGameObject.GetComponent <Conversation>();
            }

            if (conversation)
            {
                conversation.Upgrade();
            }

            if (lastConversation != null && lastConversation == conversation)
            {
                lastConversation = null;
            }

            if (conversation != null)
            {
                OptionsGUI();
            }
            else if (lastConversation != null)
            {
                conversation = lastConversation;
            }
            else
            {
                GUILayout.Label("Please select a Conversation in your scene");
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(conversation);
            }
        }