Beispiel #1
0
        public override void OnInspectorGUI()
        {
            SodaEditorHelpers.DisplayInspectorSubtitle("GameEvent");

            var descriptionProperty     = serializedObject.FindProperty("description");
            var onRaiseGloballyProperty = serializedObject.FindProperty("onRaiseGlobally");

            serializedObject.Update();
            serializedObject.DisplayAllPropertiesExcept(false, descriptionProperty, onRaiseGloballyProperty);

            EditorGUILayout.PropertyField(descriptionProperty);
            GUILayout.Space(16);

            GUI.enabled = !Application.isPlaying;
            EditorGUILayout.PropertyField(onRaiseGloballyProperty);
            GUI.enabled = true;

            DisplayDebugCheckbox();
            serializedObject.ApplyModifiedProperties();

            GUI.enabled = Application.isPlaying;

            GameEvent gameEventTarget = (GameEvent)target;

            if (GUILayout.Button("Raise"))
            {
                gameEventTarget.Raise();
            }

            if (Application.isPlaying)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Responding Objects");
                if (targets.Length == 1)
                {
                    SodaEventDrawer.DisplayListeners(gameEventTarget.onRaise);
                }
                else
                {
                    EditorGUILayout.HelpBox("Cannot display when multiple GameEvents are selected.", MessageType.Warning);
                }
            }
        }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            SodaEditorHelpers.DisplayInspectorSubtitle(subtitle);

            var originalValueProperty = serializedObject.FindProperty("originalValue");
            var descriptionProperty   = serializedObject.FindProperty("description");

            serializedObject.Update();

            if (originalValueProperty != null)
            {
                SodaEditorHelpers.DisplayExpandablePropertyField(originalValueProperty);
            }
            else
            {
                EditorGUILayout.HelpBox("The type of the value this GlobalVariable is representing does not seem to be serializable.", MessageType.Error);
            }

            serializedObject.DisplayAllPropertiesExcept(false, originalValueProperty, descriptionProperty);

            EditorGUILayout.PropertyField(descriptionProperty);

            serializedObject.ApplyModifiedProperties();

            if (Application.isPlaying)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Objects responding to onChangeValue event");
                if (targets.Length == 1)
                {
                    var globalVariableTarget = (GlobalVariableBase)target;
                    SodaEventDrawer.DisplayListeners(globalVariableTarget.GetOnChangeEvent());
                }
                else
                {
                    EditorGUILayout.HelpBox("Cannot display when multiple GlobalVariables are selected.", MessageType.Warning);
                }
            }
        }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            LazyOnEnable();

            SodaEditorHelpers.DisplayInspectorSubtitle(target.GetType().Name);

            var descriptionProperty = serializedObject.FindProperty("description");

            serializedObject.Update();
            serializedObject.DisplayAllPropertiesExcept(false, descriptionProperty);
            EditorGUILayout.PropertyField(descriptionProperty);
            serializedObject.ApplyModifiedProperties();

            if (Application.isPlaying)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Monitoring Objects");
                SodaEventDrawer.DisplayListeners(((RuntimeSetBase)target).GetOnElementCountChangeEvent(), this);

                EditorGUILayout.Space();
                DisplayElements();
            }
        }
Beispiel #4
0
        public override void OnInspectorGUI()
        {
            SodaEditorHelpers.DisplayInspectorSubtitle("GameEvent");

            var gameEventBaseTarget = (GameEventBase)target;

            var descriptionProperty          = serializedObject.FindProperty("description");
            var parameterDescriptionProperty = serializedObject.FindProperty("parameterDescription");
            var onRaiseGloballyProperty      = serializedObject.FindProperty("onRaiseGlobally");

            if (onRaiseGloballyProperty == null)
            {
                onRaiseGloballyProperty = serializedObject.FindProperty("_onRaiseGlobally");
            }

            serializedObject.Update();
            if (parameterDescriptionProperty != null)
            {
                serializedObject.DisplayAllPropertiesExcept(false, descriptionProperty, parameterDescriptionProperty, onRaiseGloballyProperty);
            }
            else
            {
                serializedObject.DisplayAllPropertiesExcept(false, descriptionProperty, onRaiseGloballyProperty);
            }

            EditorGUILayout.PropertyField(descriptionProperty);
            if (parameterDescriptionProperty != null)
            {
                EditorGUILayout.PropertyField(parameterDescriptionProperty,
                                              new GUIContent("Parameter Description (" + gameEventBaseTarget.GetParameterType().Name + ")"));
            }
            GUILayout.Space(16);

            GUI.enabled = !Application.isPlaying;
            EditorGUILayout.PropertyField(onRaiseGloballyProperty);
            GUI.enabled = true;

            DisplayDebugCheckbox();
            serializedObject.ApplyModifiedProperties();

            GUI.enabled = Application.isPlaying;

            var gameEventTarget = target as GameEvent;

            if (!gameEventTarget)
            {
                EditorGUILayout.HelpBox("Cannot raise a parameterized GameEvent via inspector.", MessageType.Info);
                GUI.enabled = false;
            }

            if (GUILayout.Button("Raise"))
            {
                gameEventTarget.Raise();
            }
            GUI.enabled = true;

            if (Application.isPlaying)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Responding Objects", EditorStyles.boldLabel);
                if (targets.Length == 1)
                {
                    var onRaiseWithParameter = GetOnRaiseWithParameterEvent(gameEventBaseTarget);
                    if (onRaiseWithParameter != null)
                    {
                        SodaEventDrawer.DisplayListeners(onRaiseWithParameter);
                        EditorGUILayout.LabelField("Responding Objects (ignoring parameter)", EditorStyles.boldLabel);
                    }
                    SodaEventDrawer.DisplayListeners(gameEventBaseTarget.onRaise);
                }
                else
                {
                    EditorGUILayout.HelpBox("Cannot display when multiple GameEvents are selected.", MessageType.Warning);
                }
            }
        }