Beispiel #1
0
 public void AddScreen(Screen scr)
 {
     if (scr.isPersistantScreen)
     {
         this.AddChild(scr);
     }
     else
     {
         screens.Add(scr);
     }
 }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
        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;
                }
            }
        }
Beispiel #4
0
 public virtual void AddingScreen(Screen screen)
 {
 }
Beispiel #5
0
 public void RemoveScreen(Screen scr)
 {
     screens.Remove(scr);
     if (scr == curScreen)
     {
         Screen nullScreen = null;
         SetScreen(nullScreen);
     }
 }
Beispiel #6
0
 public virtual void RemovingScreen(Screen screen)
 {
 }
Beispiel #7
0
 //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();
     }
 }
Beispiel #8
0
		//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();
 }