Example #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GameEventCollection e = target as GameEventCollection;

            EditorGUILayout.Space();
            e.UseInEditMode = GUILayout.Toggle(e.UseInEditMode, "Use In Editor Mode");
            EditorGUILayout.Space();

            if (GUILayout.Button("Raise"))
            {
                if ((e.UseInEditMode && !Application.isPlaying) ||
                    (!e.UseInEditMode && Application.isPlaying))
                {
                    e.Raise();
                }
            }
        }
Example #2
0
        private void OnInspectorUpdate()
        {
            if (EditorStyles.helpBox != null)
            {
                EditorStyles.helpBox.fontSize = 12;
            }

            if (EditorStyles.toolbar != null)
            {
                EditorStyles.toolbar.fontSize = 12;
            }

            if (gec && pickedEvent)
            {
                gec.Events.Add(pickedEvent);
                pickedEvent  = null;
                gec          = null;
                searchString = "";

                GUI.FocusControl("");
            }

            if (pickedScene)
            {
                if (EventManager)
                {
                    bool alreadyThere = false;
                    for (int i = 0; i < EventManager._Scenes.Count; i++)
                    {
                        var guid1 = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(EventManager._Scenes[i]));
                        var guid2 = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(pickedScene));
                        if (guid1.Equals(guid2))
                        {
                            alreadyThere = true;
                            break;
                        }
                    }

                    if (!alreadyThere)
                    {
                        EventManager._Scenes.Add(pickedScene);
                    }

                    pickedScene = null;

                    GUI.FocusControl("");

                    searchString = "";
                }
            }

            if (collectionToDeleteFrom && toBeDeletedEvent)
            {
                collectionToDeleteFrom.RemoveEvent(toBeDeletedEvent);

                toBeDeletedEvent       = null;
                collectionToDeleteFrom = null;

                GUI.FocusControl("");

                searchString = "";
            }

            if (toBeDeletedScene)
            {
                if (EventManager)
                {
                    EventManager.RemoveScene(toBeDeletedScene);
                    toBeDeletedScene = null;

                    GUI.FocusControl("");

                    searchString = "";
                }
            }

            if (CurrentTab == 1)
            {
                if (EventManager)
                {
                    EventManager.FindAllEvents();
                }
            }
        }