Example #1
0
        public static MissionWindowState Restore()
        {
            string             serializedState = EditorPrefs.GetString(EditorPrefKey);
            MissionWindowState state           = Snapshot <MissionWindowState> .Deserialize(serializedState);

            if (state.aiPageTreeViewState == null)
            {
                state.aiPageTreeViewState = new TreeViewState();
            }
            return(state);
        }
Example #2
0
        private void OnEnable()
        {
            state = MissionWindowState.Restore();

            if (GameDatabase.ActiveInstance != null)
            {
                GameDatabase.ActiveInstance.ClearSceneEntities();
            }

            DatabaseEditorContainer.EnsureDatabase();
            GameDatabase.ActiveInstance?.UpdateSceneEntities();
            GameDatabase.ActiveInstance?.UpdateProjectAssets();

            pages = new MissionWindowPage[] {
                new MissionPage(Save, state, GameDatabase.ActiveInstance),
                new ShipPage(state, GameDatabase.ActiveInstance),
                new AIPage(state, GameDatabase.ActiveInstance)
            };

            state.currentPageIndex = Mathf.Clamp(state.currentPageIndex, 0, pages.Length - 1);
            pages[state.currentPageIndex].OnEnable();
        }
Example #3
0
 protected MissionWindowPage(MissionWindowState state, GameDatabase db)
 {
     this.state = state;
     this.db    = db;
 }
Example #4
0
 public ShipPage(MissionWindowState state, GameDatabase db) : base(state, db)
 {
 }
Example #5
0
 public MissionPage(Action saveCallback, MissionWindowState state, GameDatabase db) : base(state, db)
 {
     this.saveCallback  = saveCallback;
     this.selectionType = SelectionType.None;
 }