public void HandleInput(InputState input, GameScreen caller)
 {
     for (int i = this.ResponseSL.indexAtTop; i < this.ResponseSL.Entries.Count && i < this.ResponseSL.indexAtTop + this.ResponseSL.entriesToDisplay; i++)
     {
         ScrollList.Entry e = this.ResponseSL.Entries[i];
         if (!HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition))
         {
             e.clickRectHover = 0;
         }
         else
         {
             e.clickRectHover = 1;
             if (input.InGameSelect)
             {
                 Response r = e.item as Response;
                 if (r.DefaultIndex != -1)
                 {
                     this.CurrentMessage = r.DefaultIndex;
                 }
                 else
                 {
                     bool OK = true;
                     if (r.MoneyToThem > 0 && this.playerEmpire.Money < (float)r.MoneyToThem)
                     {
                         OK = false;
                     }
                     if (r.RequiredTech != null && !this.playerEmpire.GetTDict()[r.RequiredTech].Unlocked)
                     {
                         OK = false;
                     }
                     if (r.FailIfNotAlluring && (double)this.playerEmpire.data.Traits.DiplomacyMod < 0.2)
                     {
                         OK = false;
                     }
                     if (!OK)
                     {
                         this.CurrentMessage = r.FailIndex;
                     }
                     else
                     {
                         this.CurrentMessage = r.SuccessIndex;
                         if (r.MoneyToThem > 0 && this.playerEmpire.Money >= (float)r.MoneyToThem)
                         {
                             Empire money = this.playerEmpire;
                             money.Money = money.Money - (float)r.MoneyToThem;
                         }
                     }
                 }
                 if (this.MessageList[this.CurrentMessage].SetWar)
                 {
                     this.empToDiscuss.GetGSAI().DeclareWarFromEvent(this.playerEmpire, WarType.SkirmishWar);
                 }
                 if (this.MessageList[this.CurrentMessage].EndWar)
                 {
                     this.empToDiscuss.GetGSAI().EndWarFromEvent(this.playerEmpire);
                 }
                 this.playerEmpire.GetRelations()[this.empToDiscuss].EncounterStep = this.MessageList[this.CurrentMessage].SetEncounterStep;
                 this.SetResponses();
             }
         }
     }
     if (this.MessageList[this.CurrentMessage].EndTransmission && (input.Escaped || input.CurrentMouseState.RightButton == ButtonState.Released && input.LastMouseState.RightButton == ButtonState.Pressed))
     {
         caller.ExitScreen();
     }
 }
 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();
 }