Example #1
0
        static void OnBeforeSceneLoadRuntimeMethod()
        {
            SettingsObject settings = SettingsHandler.Load();

            if (!settings.checkBeforePlay)
            {
                return;
            }

            Session session = new Session();

            session.Refresh();
            for (int i = 0; i < session.fields.Count; i++)
            {
                //Todo: Make this not an abomination.
                Field field     = session.fields[i];
                bool  confirmed = (field.preCheck == Field.Check.ConfirmedValue ||
                                   ((field.allowNull || !settings.warnIfNull) && field.preCheck == Field.Check.ConfirmedNull));
                if (!confirmed)
                {
                    EditorApplication.ExitPlaymode();
                    EditorApplication.playModeStateChanged += Changed;
                    break;
                }
            }
        }
        private void OnEnable()
        {
            settings     = SettingsHandler.Load();
            session      = new Session(); //Debug.Log("Created new session");
            titleContent = new GUIContent("Compopulate");

            InitialiseToolbar();
            rootVisualElement.RegisterCallback <KeyDownEvent>(OnKeyDown, TrickleDown.TrickleDown);
            InitiateListView();
            RefreshSession();
            Undo.undoRedoPerformed += OnUndoRedo;

            rootVisualElement.RegisterCallback <MouseUpEvent>(HandleRightClick);
        }