public void HandleInput(InputState input, GameScreen caller)
 {
     this.currentMouse = Mouse.GetState();
     Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y);
     foreach (EmpireUIOverlay.Button b in this.Buttons)
     {
         if (!HelperFunctions.CheckIntersection(b.Rect, MousePos))
         {
             b.State = EmpireUIOverlay.PressState.Normal;
         }
         else
         {
             if (b.State != EmpireUIOverlay.PressState.Hover && b.State != EmpireUIOverlay.PressState.Pressed)
             {
                 AudioManager.PlayCue("mouse_over4");
             }
             b.State = EmpireUIOverlay.PressState.Hover;
             if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed)
             {
                 b.State = EmpireUIOverlay.PressState.Pressed;
             }
             if (this.currentMouse.LeftButton != ButtonState.Released || this.previousMouse.LeftButton != ButtonState.Pressed)
             {
                 continue;
             }
             if (!(caller is ShipDesignScreen) && !(caller is FleetDesignScreen))
             {
                 caller.ExitScreen();
             }
             else if (b.launches != "Shipyard" && b.launches != "Fleets")
             {
                 if (caller is ShipDesignScreen)
                 {
                     (caller as ShipDesignScreen).ExitToMenu(b.launches);
                 }
                 else if (caller is FleetDesignScreen)
                 {
                     (caller as FleetDesignScreen).ExitScreen();
                 }
                 return;
             }
             else if (caller is FleetDesignScreen && b.launches != "Fleets")
             {
                 (caller as FleetDesignScreen).ExitScreen();
             }
             string str = b.launches;
             string str1 = str;
             if (str != null)
             {
                 if (str1 == "Research")
                 {
                     AudioManager.PlayCue("echo_affirm");
                     if (!(caller is ResearchScreenNew))
                     {
                         this.screen.ScreenManager.AddScreen(new ResearchScreenNew(this));
                     }
                 }
                 else if (str1 == "Budget")
                 {
                     AudioManager.PlayCue("echo_affirm");
                     if (!(caller is BudgetScreen))
                     {
                         this.screen.ScreenManager.AddScreen(new BudgetScreen(this.screen));
                     }
                 }
             }
             string str2 = b.launches;
             string str3 = str2;
             if (str2 == null)
             {
                 continue;
             }
             if (str3 == "Main Menu")
             {
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new GameplayMMScreen(this.screen, caller));
             }
             else if (str3 == "Shipyard")
             {
                 if (caller is ShipDesignScreen)
                 {
                     continue;
                 }
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new ShipDesignScreen(this));
             }
             else if (str3 == "Fleets")
             {
                 if (caller is FleetDesignScreen)
                 {
                     continue;
                 }
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new FleetDesignScreen(this));
             }
             else if (str3 == "Empire")
             {
                 this.screen.ScreenManager.AddScreen(new EmpireScreen(this.screen.ScreenManager, this));
                 AudioManager.PlayCue("echo_affirm");
             }
             else if (str3 == "Diplomacy")
             {
                 this.screen.ScreenManager.AddScreen(new MainDiplomacyScreen(this.screen));
                 AudioManager.PlayCue("echo_affirm");
             }
             else if (str3 == "?")
             {
                 AudioManager.PlayCue("sd_ui_tactical_pause");
                 InGameWiki wiki = new InGameWiki(new Rectangle(0, 0, 750, 600))
                 {
                     TitleText = "StarDrive Help",
                     MiddleText = "This help menu contains information on all of the gameplay systems contained in StarDrive. You can also watch one of several tutorial videos for a developer-guided introduction to StarDrive."
                 };
             }
         }
     }
     this.previousMouse = Mouse.GetState();
 }
 private void SaveWIPThenLaunchScreen(object sender, EventArgs e)
 {
     this.SaveWIP(sender, e);
     string str = this.screenToLaunch;
     string str1 = str;
     if (str != null)
     {
         if (str1 == "Research")
         {
             AudioManager.PlayCue("echo_affirm");
             base.ScreenManager.AddScreen(new ResearchScreenNew(this.EmpireUI));
         }
         else if (str1 == "Budget")
         {
             AudioManager.PlayCue("echo_affirm");
             base.ScreenManager.AddScreen(new BudgetScreen(ShipDesignScreen.screen));
         }
     }
     string str2 = this.screenToLaunch;
     string str3 = str2;
     if (str2 != null)
     {
         if (str3 == "Main Menu")
         {
             AudioManager.PlayCue("echo_affirm");
             ShipDesignScreen.screen.ScreenManager.AddScreen(new GameplayMMScreen(ShipDesignScreen.screen));
         }
         else if (str3 == "Shipyard")
         {
             AudioManager.PlayCue("echo_affirm");
         }
         else if (str3 == "Empire")
         {
             ShipDesignScreen.screen.ScreenManager.AddScreen(new EmpireScreen(ShipDesignScreen.screen.ScreenManager, this.EmpireUI));
             AudioManager.PlayCue("echo_affirm");
         }
         else if (str3 == "Diplomacy")
         {
             ShipDesignScreen.screen.ScreenManager.AddScreen(new MainDiplomacyScreen(ShipDesignScreen.screen));
             AudioManager.PlayCue("echo_affirm");
         }
         else if (str3 == "?")
         {
             AudioManager.PlayCue("sd_ui_tactical_pause");
             InGameWiki wiki = new InGameWiki(new Rectangle(0, 0, 750, 600))
             {
                 TitleText = "StarDrive Help",
                 MiddleText = "This help menu contains information on all of the gameplay systems contained in StarDrive. You can also watch one of several tutorial videos for a developer-guided introduction to StarDrive."
             };
         }
     }
     this.ReallyExit();
 }
 public void HandleInput(InputState input)
 {
     this.currentMouse = Mouse.GetState();
     Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y);
     if (input.CurrentKeyboardState.IsKeyDown(Keys.R) && !input.LastKeyboardState.IsKeyDown(Keys.R) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new ResearchScreenNew(this));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.T) && !input.LastKeyboardState.IsKeyDown(Keys.T) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new BudgetScreen(Ship.universeScreen));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.Y) && !input.LastKeyboardState.IsKeyDown(Keys.Y) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new ShipDesignScreen(this));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.U) && !input.LastKeyboardState.IsKeyDown(Keys.U) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new EmpireScreen(Ship.universeScreen.ScreenManager, this));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.I) && !input.LastKeyboardState.IsKeyDown(Keys.I) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new MainDiplomacyScreen(Ship.universeScreen));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.O) && !input.LastKeyboardState.IsKeyDown(Keys.O) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new GameplayMMScreen(Ship.universeScreen));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.E) && !input.LastKeyboardState.IsKeyDown(Keys.E) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("echo_affirm");
         this.screen.ScreenManager.AddScreen(new EspionageScreen(Ship.universeScreen));
     }
     if (input.CurrentKeyboardState.IsKeyDown(Keys.P) && !input.LastKeyboardState.IsKeyDown(Keys.P) && !GlobalStats.TakingInput)
     {
         AudioManager.PlayCue("sd_ui_tactical_pause");
         InGameWiki wiki = new InGameWiki(new Rectangle(0, 0, 750, 600))
         {
             TitleText = Localizer.Token(2304),
             MiddleText = Localizer.Token(2303)
         };
         this.screen.ScreenManager.AddScreen(wiki);
     }
     foreach (EmpireUIOverlay.Button b in this.Buttons)
     {
         if (!HelperFunctions.CheckIntersection(b.Rect, MousePos))
         {
             b.State = EmpireUIOverlay.PressState.Normal;
         }
         else
         {
             string str = b.launches;
             string str1 = str;
             if (str != null)
             {
                 switch (str1)
                 {
                     case "Research":
                     {
                         string res = (ResourceManager.TechTree.ContainsKey(Ship.universeScreen.player.ResearchTopic) ? Localizer.Token(ResourceManager.TechTree[Ship.universeScreen.player.ResearchTopic].NameIndex) : Localizer.Token(341));
                         string[] strArrays = new string[] { Localizer.Token(2306), "\n\n", Localizer.Token(1405), ": ", res };
                         ToolTip.CreateTooltip(string.Concat(strArrays), Ship.universeScreen.ScreenManager, "R");
                         break;
                     }
                     case "Budget":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(2305), Ship.universeScreen.ScreenManager, "T");
                         break;
                     }
                     case "Main Menu":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(2301), Ship.universeScreen.ScreenManager, "O");
                         break;
                     }
                     case "Shipyard":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(2297), Ship.universeScreen.ScreenManager, "Y");
                         break;
                     }
                     case "Empire":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(2298), Ship.universeScreen.ScreenManager, "U");
                         break;
                     }
                     case "Diplomacy":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(2299), Ship.universeScreen.ScreenManager, "I");
                         break;
                     }
                     case "Espionage":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(7043), Ship.universeScreen.ScreenManager, "E");
                         break;
                     }
                     case "ShipList":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(7044), Ship.universeScreen.ScreenManager);
                         break;
                     }
                     case "Fleets":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(7045), Ship.universeScreen.ScreenManager, "J");
                         break;
                     }
                     case "?":
                     {
                         ToolTip.CreateTooltip(Localizer.Token(2302), Ship.universeScreen.ScreenManager, "P");
                         break;
                     }
                 }
             }
             if (b.State != EmpireUIOverlay.PressState.Hover && b.State != EmpireUIOverlay.PressState.Pressed)
             {
                 AudioManager.PlayCue("mouse_over4");
             }
             b.State = EmpireUIOverlay.PressState.Hover;
             if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed)
             {
                 b.State = EmpireUIOverlay.PressState.Pressed;
             }
             if (!input.InGameSelect)
             {
                 continue;
             }
             string str2 = b.launches;
             string str3 = str2;
             if (str2 != null)
             {
                 if (str3 == "Research")
                 {
                     AudioManager.PlayCue("echo_affirm");
                     this.screen.ScreenManager.AddScreen(new ResearchScreenNew(this));
                 }
                 else if (str3 == "Budget")
                 {
                     AudioManager.PlayCue("echo_affirm");
                     this.screen.ScreenManager.AddScreen(new BudgetScreen(this.screen));
                 }
             }
             string str4 = b.launches;
             string str5 = str4;
             if (str4 == null)
             {
                 continue;
             }
             if (str5 == "Main Menu")
             {
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new GameplayMMScreen(this.screen));
             }
             else if (str5 == "Shipyard")
             {
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new ShipDesignScreen(this));
             }
             else if (str5 == "Fleets")
             {
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new FleetDesignScreen(this));
             }
             else if (str5 == "ShipList")
             {
                 AudioManager.PlayCue("echo_affirm");
                 this.screen.ScreenManager.AddScreen(new ShipListScreen(this.screen.ScreenManager, this));
             }
             else if (str5 == "Empire")
             {
                 this.screen.ScreenManager.AddScreen(new EmpireScreen(this.screen.ScreenManager, this));
                 AudioManager.PlayCue("echo_affirm");
             }
             else if (str5 == "Diplomacy")
             {
                 this.screen.ScreenManager.AddScreen(new MainDiplomacyScreen(this.screen));
                 AudioManager.PlayCue("echo_affirm");
             }
             else if (str5 == "Espionage")
             {
                 this.screen.ScreenManager.AddScreen(new EspionageScreen(this.screen));
                 AudioManager.PlayCue("echo_affirm");
             }
             else if (str5 == "?")
             {
                 AudioManager.PlayCue("sd_ui_tactical_pause");
                 InGameWiki wiki = new InGameWiki(new Rectangle(0, 0, 750, 600))
                 {
                     TitleText = Localizer.Token(2304),
                     MiddleText = Localizer.Token(2303)
                 };
                 this.screen.ScreenManager.AddScreen(wiki);
             }
         }
     }
     this.previousMouse = Mouse.GetState();
 }