public void AddScreen(Screen scr) { if (scr.isPersistantScreen) { this.AddChild(scr); } else { screens.Add(scr); } }
public void SetScreen(Screen scr) { if (curScreen != null) { prevScreen = curScreen; // can remove on fade etc here curScreen.isActive = false; //stage.RemoveChild(curScreen); } if (scr != null) { screenChanged = true; curScreenIndex = screens.IndexOf(scr); curScreen = scr; } }
public override void Update(GameTime gameTime) { //base.Update(gameTime); // dont update stage itself as it is fixed pos if (V2DGame.instance.IsActive) { foreach (DisplayObject d in children) { d.Update(gameTime); } if (prevScreen != null && children.Contains(prevScreen) && !prevScreen.isActive) { prevScreen.DestroyView(); V2DGame.instance.RemovingScreen(prevScreen); this.RemoveChild(prevScreen); prevScreen = null; } if (screenChanged)// && !children.Contains(curScreen)) { screenChanged = false; V2DGame.instance.AddingScreen(curScreen); this.AddChild(curScreen); clearColor = curScreen.Color; clearColor.A = 0; } } }
public virtual void AddingScreen(Screen screen) { }
public void RemoveScreen(Screen scr) { screens.Remove(scr); if (scr == curScreen) { Screen nullScreen = null; SetScreen(nullScreen); } }
public virtual void RemovingScreen(Screen screen) { }
//protected Screen GetContainerScreen(DisplayObject obj) //{ // Screen result = null; // while (obj.parent != null && !(obj.parent is Screen) && obj.parent is DisplayObjectContainer) // { // obj = (DisplayObjectContainer)obj.parent; // } // if (obj.parent is Screen) // { // result = (Screen)obj.parent; // } // return result; //} public virtual void SetStageAndScreen() { if (!isOnStage) { stage = GetStage(); screen = GetScreen(); } }
//protected Screen GetContainerScreen(DisplayObject obj) //{ // Screen result = null; // while (obj.parent != null && !(obj.parent is Screen) && obj.parent is DisplayObjectContainer) // { // obj = (DisplayObjectContainer)obj.parent; // } // if (obj.parent is Screen) // { // result = (Screen)obj.parent; // } // return result; //} public virtual void SetScreen() { screen = GetScreen(); }
public override void RemovingScreen(Screen screen) { base.RemovingScreen(screen); if (screen is BaseScreen && screen.Contains(gameOverlay)) { GameOverlay.Deactivate(); } }
public override void AddingScreen(Screen screen) { base.AddingScreen(screen); GameOverlay.Deactivate(); }