void timePanel_OnMinimize(object sender, EventArgs e)
 {
     if (timeBar.IsOpen)
     {
         timeBar.SlideIn();
     }
     else
     {
         timeBar.SlideOut();
     }
 }
        public GameInterface(Game game, Rectangle screen)
            : base(game) {
                width = screen.Width;
                height = screen.Height;

            #region Minimap and Building Panel
            minimap = new Minimap(game);
            minimap.XRelative = screen.Width - minimap.Width+5;
            minimap.YRelative = 0;
            minimap.StackOrder = 1;
            minimap.OnCategorySelected += new EventHandler<BuildingTypeEventArgs>(minimap_OnCategorySelected);
            minimap.OnCategoryUnselected += new EventHandler<BuildingTypeEventArgs>(minimap_OnCategoryUnselected);
            minimap.OnMinimize += new EventHandler(minimap_OnMinimize);

            AddChild(minimap);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);

            panel = new BuildingPanel(game);
            panel.XRelative = screen.Width - panel.Width - 42;
            panel.OpenPositionY = minimap.Height - 47;
            panel.ClosedPositionY = -100;
            panel.YRelative = panel.ClosedPositionY;
            minimap_OnMinimize(null, null);

            panel.StackOrder = 0;
            panel.OnPanelClosed += new EventHandler(panel_OnPanelClosed);
            panel.OnPanelOpened += new EventHandler(panel_OnPanelOpened);

            AddChild(panel);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            #region Time
            timePanel = new TimeTravelPanel(game);
            timePanel.XRelative = screen.Width - timePanel.Width+5;
            timePanel.YRelative = screen.Height - timePanel.Height;
            timePanel.StackOrder = 1;

            timePanel.OnMinimize += new EventHandler(timePanel_OnMinimize);
            timePanel.OnYearChanged += new EventHandler(timePanel_OnYearChanged);
            timePanel.OnYearIncreased += new EventHandler(timePanel_OnYearIncreased);
            timePanel.OnYearDecreased += new EventHandler(timePanel_OnYearDecreased);

            AddChild(timePanel);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);

            timeBar = new TimeBar(game, GameManager.StartingTravelYear, GameManager.EndTravelYear);
            timeBar.StackOrder = 0;
            timeBar.UpdateLimitPositions(screen.Width);
            timeBar.YRelative = screen.Height - timeBar.Height - 33;
            timeBar.XRelative = timeBar.ClosedPosition;
            AddChild(timeBar);
            timeBar.SlideOut();
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            #region LeftMenu
            leftMenu = new LeftMenu(game);
            leftMenu.XRelative = -5;
            leftMenu.YRelative = -5;
            leftMenu.On_SaveGame += new EventHandler(Do_OnSaveGame);
            AddChild(leftMenu);

            leftMenu.UpdateLeftPanelsPosition(screen);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            #region Year Panel
            yearPanel = new YearPanel(game);
            yearPanel.XRelative = screen.Width / 2 - yearPanel.Width / 2;
            yearPanel.YRelative = -5;
            yearPanel.OnYearReset += new EventHandler(yearPanel_OnYearReset);
            AddChild(yearPanel);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            Game.Services.AddService(typeof(GameInterface), this);
        } 
        public GameInterface(Game game, Rectangle screen)
            : base(game)
        {
            width  = screen.Width;
            height = screen.Height;

            #region Minimap and Building Panel
            minimap                       = new Minimap(game);
            minimap.XRelative             = screen.Width - minimap.Width + 5;
            minimap.YRelative             = 0;
            minimap.StackOrder            = 1;
            minimap.OnCategorySelected   += new EventHandler <BuildingTypeEventArgs>(minimap_OnCategorySelected);
            minimap.OnCategoryUnselected += new EventHandler <BuildingTypeEventArgs>(minimap_OnCategoryUnselected);
            minimap.OnMinimize           += new EventHandler(minimap_OnMinimize);

            AddChild(minimap);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);

            panel                 = new BuildingPanel(game);
            panel.XRelative       = screen.Width - panel.Width - 42;
            panel.OpenPositionY   = minimap.Height - 47;
            panel.ClosedPositionY = -100;
            panel.YRelative       = panel.ClosedPositionY;
            minimap_OnMinimize(null, null);

            panel.StackOrder     = 0;
            panel.OnPanelClosed += new EventHandler(panel_OnPanelClosed);
            panel.OnPanelOpened += new EventHandler(panel_OnPanelOpened);

            AddChild(panel);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            #region Time
            timePanel            = new TimeTravelPanel(game);
            timePanel.XRelative  = screen.Width - timePanel.Width + 5;
            timePanel.YRelative  = screen.Height - timePanel.Height;
            timePanel.StackOrder = 1;

            timePanel.OnMinimize      += new EventHandler(timePanel_OnMinimize);
            timePanel.OnYearChanged   += new EventHandler(timePanel_OnYearChanged);
            timePanel.OnYearIncreased += new EventHandler(timePanel_OnYearIncreased);
            timePanel.OnYearDecreased += new EventHandler(timePanel_OnYearDecreased);

            AddChild(timePanel);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);

            timeBar            = new TimeBar(game, GameManager.StartingTravelYear, GameManager.EndTravelYear);
            timeBar.StackOrder = 0;
            timeBar.UpdateLimitPositions(screen.Width);
            timeBar.YRelative = screen.Height - timeBar.Height - 33;
            timeBar.XRelative = timeBar.ClosedPosition;
            AddChild(timeBar);
            timeBar.SlideOut();
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            #region LeftMenu
            leftMenu              = new LeftMenu(game);
            leftMenu.XRelative    = -5;
            leftMenu.YRelative    = -5;
            leftMenu.On_SaveGame += new EventHandler(Do_OnSaveGame);
            AddChild(leftMenu);

            leftMenu.UpdateLeftPanelsPosition(screen);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            #region Year Panel
            yearPanel              = new YearPanel(game);
            yearPanel.XRelative    = screen.Width / 2 - yearPanel.Width / 2;
            yearPanel.YRelative    = -5;
            yearPanel.OnYearReset += new EventHandler(yearPanel_OnYearReset);
            AddChild(yearPanel);
            numberOfItemsCreated++;
            DisplayManager.ChangePreloaderPercent(PercentCreated);
            #endregion

            Game.Services.AddService(typeof(GameInterface), this);
        }