public override void HandleInput(InputState input) { this.pFacilities.HandleInputNoReset(this); if (HelperFunctions.CheckIntersection(this.RightColony.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2279), this.ScreenManager); } if (HelperFunctions.CheckIntersection(this.LeftColony.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2280), this.ScreenManager); } if ((input.Right || this.RightColony.HandleInput(input)) && (PlanetScreen.screen.Debug || this.p.Owner == EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty))) { try { this.p.Owner.GetPlanets().thisLock.EnterReadLock(); int thisindex = this.p.Owner.GetPlanets().IndexOf(this.p); thisindex = (thisindex >= this.p.Owner.GetPlanets().Count - 1 ? 0 : thisindex + 1); if (this.p.Owner.GetPlanets()[thisindex] != this.p) { this.p = this.p.Owner.GetPlanets()[thisindex]; PlanetScreen.screen.workersPanel = new ColonyScreen(this.p, this.ScreenManager, this.eui); } this.p.Owner.GetPlanets().thisLock.ExitReadLock(); } catch { System.Diagnostics.Debug.WriteLine("Colony Screen Handle Inpu. Likely null reference."); } if (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } return; } if ((input.Left || this.LeftColony.HandleInput(input)) && (PlanetScreen.screen.Debug || this.p.Owner == EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty))) { int thisindex = this.p.Owner.GetPlanets().IndexOf(this.p); thisindex = (thisindex <= 0 ? this.p.Owner.GetPlanets().Count - 1 : thisindex - 1); if (this.p.Owner.GetPlanets()[thisindex] != this.p) { this.p = this.p.Owner.GetPlanets()[thisindex]; PlanetScreen.screen.workersPanel = new ColonyScreen(this.p, this.ScreenManager, this.eui); } if (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } return; } this.p.UpdateIncomes(); this.HandleDetailInfo(input); this.currentMouse = Mouse.GetState(); Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); this.buildSL.HandleInput(input); this.buildSL.Update(); this.build.HandleInput(this); if (this.p.Owner != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { this.HandleDetailInfo(input); if (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } return; } if (!HelperFunctions.CheckIntersection(this.launchTroops.Rect, input.CursorPosition)) { this.launchTroops.State = UIButton.PressState.Normal; } else { this.launchTroops.State = UIButton.PressState.Hover; if (input.InGameSelect) { bool play = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { continue; } play = true; ResourceManager.CreateTroopShipAtPoint((this.p.Owner.data.DefaultTroopShip != null) ? this.p.Owner.data.DefaultTroopShip : this.p.Owner.data.DefaultSmallTransport, this.p.Owner, this.p.Position, pgs.TroopsHere[0]); this.p.TroopsHere.Remove(pgs.TroopsHere[0]); pgs.TroopsHere[0].SetPlanet(null); pgs.TroopsHere.Clear(); this.ClickedTroop = true; this.detailInfo = null; } if (play) { AudioManager.PlayCue("sd_troop_takeoff"); } } } //fbedard: Click button to send troops if (!HelperFunctions.CheckIntersection(this.SendTroops.Rect, input.CursorPosition)) { this.SendTroops.State = UIButton.PressState.Normal; } else { this.SendTroops.State = UIButton.PressState.Hover; if (input.InGameSelect) { this.eui.empire.GetShips().thisLock.EnterReadLock(); List<Ship> troopShips = new List<Ship>(this.eui.empire.GetShips() .Where(troop => troop.TroopList.Count > 0 && troop.GetAI().State == AIState.AwaitingOrders && troop.fleet == null && !troop.InCombat).OrderBy(distance => Vector2.Distance(distance.Center, this.p.Position))); this.eui.empire.GetShips().thisLock.ExitReadLock(); this.eui.empire.GetPlanets().thisLock.EnterReadLock(); List<Planet> planetTroops = new List<Planet>(this.eui.empire.GetPlanets() .Where(troops => troops.TroopsHere.Count > 1).OrderBy(distance => Vector2.Distance(distance.Position, this.p.Position)) .Where(Name => Name.Name != this.p.Name)); this.eui.empire.GetPlanets().thisLock.ExitReadLock(); if (troopShips.Count > 0) { AudioManager.PlayCue("echo_affirm"); troopShips.First().GetAI().OrderRebase(this.p,true); } else if (planetTroops.Count > 0) { { planetTroops.First().TroopsHere.thisLock.EnterWriteLock(); Ship troop = planetTroops.First().TroopsHere.First().Launch(); if (troop != null) { AudioManager.PlayCue("echo_affirm"); troop.GetAI().OrderRebase(this.p,true); } planetTroops.First().TroopsHere.thisLock.ExitWriteLock(); } } else { AudioManager.PlayCue("blip_click"); } } } if (!HelperFunctions.CheckIntersection(this.edit_name_button, MousePos)) { this.editHoverState = 0; } else { this.editHoverState = 1; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.PlanetName.HandlingInput = true; } } if (!this.PlanetName.HandlingInput) { GlobalStats.TakingInput = false; bool empty = true; string text = this.PlanetName.Text; int num = 0; while (num < text.Length) { if (text[num] == ' ') { num++; } else { empty = false; break; } } if (empty) { int ringnum = 1; foreach (SolarSystem.Ring ring in this.p.system.RingList) { if (ring.planet == this.p) { this.PlanetName.Text = string.Concat(this.p.system.Name, " ", NumberToRomanConvertor.NumberToRoman(ringnum)); } ringnum++; } } } else { GlobalStats.TakingInput = true; this.PlanetName.HandleTextInput(ref this.PlanetName.Text, input); } this.GovernorDropdown.HandleInput(input); if (this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].@value != (int)this.p.colonyType) { this.p.colonyType = (Planet.ColonyType)this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].@value; if (this.p.colonyType != Planet.ColonyType.Colony) { this.p.FoodLocked = true; this.p.ProdLocked = true; this.p.ResLocked = true; this.p.GovernorOn = true; } else { this.p.GovernorOn = false; this.p.FoodLocked = false; this.p.ProdLocked = false; this.p.ResLocked = false; } } this.HandleSlider(); if (this.p.HasShipyard && this.build.Tabs.Count > 1 && this.build.Tabs[1].Selected) { if (HelperFunctions.CheckIntersection(this.playerDesignsToggle.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2225), this.ScreenManager); } if (this.playerDesignsToggle.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); GlobalStats.ShowAllDesigns = !GlobalStats.ShowAllDesigns; if (GlobalStats.ShowAllDesigns) { this.playerDesignsToggle.Active = true; } else { this.playerDesignsToggle.Active = false; } this.Reset = true; } } if (this.p.colonyType != Planet.ColonyType.Colony) { this.FoodLock.Locked = true; this.ProdLock.Locked = true; this.ResLock.Locked = true; } else { if (!HelperFunctions.CheckIntersection(this.FoodLock.LockRect, MousePos) || this.p.Owner == null || this.p.Owner.data.Traits.Cybernetic != 0) { this.FoodLock.Hover = false; } else { if (this.FoodLock.Locked) { this.FoodLock.Hover = false; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.FoodLocked = false; this.FoodLock.Locked = false; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else { this.FoodLock.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.FoodLocked = true; this.FoodLock.Locked = true; AudioManager.PlayCue("sd_ui_accept_alt3"); } } ToolTip.CreateTooltip(69, this.ScreenManager); } if (!HelperFunctions.CheckIntersection(this.ProdLock.LockRect, MousePos)) { this.ProdLock.Hover = false; } else { if (this.ProdLock.Locked) { this.ProdLock.Hover = false; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ProdLocked = false; this.ProdLock.Locked = false; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else { this.ProdLock.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ProdLocked = true; this.ProdLock.Locked = true; AudioManager.PlayCue("sd_ui_accept_alt3"); } } ToolTip.CreateTooltip(69, this.ScreenManager); } if (!HelperFunctions.CheckIntersection(this.ResLock.LockRect, MousePos)) { this.ResLock.Hover = false; } else { if (this.ResLock.Locked) { this.ResLock.Hover = false; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ResLocked = false; this.ResLock.Locked = false; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else { this.ResLock.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ResLocked = true; this.ResLock.Locked = true; AudioManager.PlayCue("sd_ui_accept_alt3"); } } ToolTip.CreateTooltip(69, this.ScreenManager); } } this.selector = null; this.ClickedTroop = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos)) { pgs.highlighted = false; } else { if (!pgs.highlighted) { AudioManager.PlayCue("sd_ui_mouseover"); } pgs.highlighted = true; } if (pgs.TroopsHere.Count <= 0 || !HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos)) { continue; } this.detailInfo = pgs.TroopsHere[0]; if (input.RightMouseClick && pgs.TroopsHere[0].GetOwner() == EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { AudioManager.PlayCue("sd_troop_takeoff"); ResourceManager.CreateTroopShipAtPoint((this.p.Owner.data.DefaultTroopShip != null) ? this.p.Owner.data.DefaultTroopShip : this.p.Owner.data.DefaultSmallTransport, this.p.Owner, this.p.Position, pgs.TroopsHere[0]); this.p.TroopsHere.Remove(pgs.TroopsHere[0]); pgs.TroopsHere[0].SetPlanet(null); pgs.TroopsHere.Clear(); this.ClickedTroop = true; this.detailInfo = null; rmouse = true; } return; } if (!this.ClickedTroop) { foreach (PlanetGridSquare pgs in this.p.TilesList) { if (HelperFunctions.CheckIntersection(pgs.ClickRect, input.CursorPosition)) { this.detailInfo = pgs; Rectangle bRect = new Rectangle(pgs.ClickRect.X + pgs.ClickRect.Width / 2 - 32, pgs.ClickRect.Y + pgs.ClickRect.Height / 2 - 32, 64, 64); if (pgs.building != null && pgs.building.Scrappable && HelperFunctions.CheckIntersection(bRect, input.CursorPosition) && input.RightMouseClick) { this.toScrap = pgs.building; string message = string.Concat("Do you wish to scrap ", Localizer.Token(pgs.building.NameTranslationIndex), "? Half of the building's construction cost will be recovered to your storage."); MessageBoxScreen messageBox = new MessageBoxScreen(message); messageBox.Accepted += new EventHandler<EventArgs>(this.ScrapAccepted); this.ScreenManager.AddScreen(messageBox); this.ClickedTroop = true; rmouse = true; return; } } if (pgs.TroopsHere.Count <= 0 || !HelperFunctions.CheckIntersection(pgs.TroopClickRect, input.CursorPosition)) { continue; } this.detailInfo = pgs.TroopsHere; } } if (!GlobalStats.HardcoreRuleset) { if (HelperFunctions.CheckIntersection(this.foodDropDown.r, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.foodDropDown.Toggle(); Planet planet = this.p; planet.fs = (Planet.GoodState)((int)planet.fs + (int)Planet.GoodState.IMPORT); if (this.p.fs > Planet.GoodState.EXPORT) { this.p.fs = Planet.GoodState.STORE; } AudioManager.PlayCue("sd_ui_accept_alt3"); } if (HelperFunctions.CheckIntersection(this.prodDropDown.r, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.prodDropDown.Toggle(); AudioManager.PlayCue("sd_ui_accept_alt3"); Planet planet1 = this.p; planet1.ps = (Planet.GoodState)((int)planet1.ps + (int)Planet.GoodState.IMPORT); if (this.p.ps > Planet.GoodState.EXPORT) { this.p.ps = Planet.GoodState.STORE; } } } else { foreach (ThreeStateButton b in this.ResourceButtons) { b.HandleInput(input, this.ScreenManager); } } for (int i = this.QSL.indexAtTop; i < this.QSL.Copied.Count && i < this.QSL.indexAtTop + this.QSL.entriesToDisplay; i++) { try { ScrollList.Entry e = this.QSL.Copied[i]; if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(this.ScreenManager, e.clickRect); if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; } if (HelperFunctions.CheckIntersection(e.up, MousePos)) { ToolTip.CreateTooltip(63, PlanetScreen.screen.ScreenManager); if (!input.CurrentKeyboardState.IsKeyDown(Keys.RightControl) && !input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && i > 0) { object tmp = this.p.ConstructionQueue[i - 1]; this.p.ConstructionQueue[i - 1] = this.p.ConstructionQueue[i]; this.p.ConstructionQueue[i] = tmp as QueueItem; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else if (i > 0) { LinkedList<QueueItem> copied = new LinkedList<QueueItem>(); foreach (QueueItem qi in this.p.ConstructionQueue) { copied.AddLast(qi); } copied.Remove(this.p.ConstructionQueue[i]); copied.AddFirst(this.p.ConstructionQueue[i]); this.p.ConstructionQueue.Clear(); foreach (QueueItem qi in copied) { this.p.ConstructionQueue.Add(qi); } AudioManager.PlayCue("sd_ui_accept_alt3"); break; } } if (HelperFunctions.CheckIntersection(e.down, MousePos)) { ToolTip.CreateTooltip(64, PlanetScreen.screen.ScreenManager); if (!input.CurrentKeyboardState.IsKeyDown(Keys.RightControl) && !input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && i + 1 < this.QSL.Copied.Count) { object tmp = this.p.ConstructionQueue[i + 1]; this.p.ConstructionQueue[i + 1] = this.p.ConstructionQueue[i]; this.p.ConstructionQueue[i] = tmp as QueueItem; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else if (i + 1 < this.QSL.Copied.Count) { LinkedList<QueueItem> copied = new LinkedList<QueueItem>(); foreach (QueueItem qi in this.p.ConstructionQueue) { copied.AddLast(qi); } copied.Remove(this.p.ConstructionQueue[i]); copied.AddLast(this.p.ConstructionQueue[i]); this.p.ConstructionQueue.Clear(); foreach (QueueItem qi in copied) { this.p.ConstructionQueue.Add(qi); } AudioManager.PlayCue("sd_ui_accept_alt3"); break; } } if (HelperFunctions.CheckIntersection(e.apply, MousePos) && !this.p.RecentCombat && this.p.Crippled_Turns <= 0) { if (!input.CurrentKeyboardState.IsKeyDown(Keys.RightControl) && !input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (this.p.ApplyStoredProduction(i)) { AudioManager.PlayCue("sd_ui_accept_alt3"); } else { AudioManager.PlayCue("UI_Misc20"); } } } //else if (PlanetScreen.screen.Debug) //{ // this.p.ApplyProductiontoQueue(this.p.ConstructionQueue[i].Cost - this.p.ConstructionQueue[i].productionTowards, i); //} else if (this.p.ProductionHere == 0f) { AudioManager.PlayCue("UI_Misc20"); } else { this.p.ApplyAllStoredProduction(i); AudioManager.PlayCue("sd_ui_accept_alt3"); } } if (HelperFunctions.CheckIntersection(e.cancel, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { Planet productionHere2 = this.p; productionHere2.ProductionHere = productionHere2.ProductionHere + (e.item as QueueItem).productionTowards; if (this.p.ProductionHere > this.p.MAX_STORAGE) { this.p.ProductionHere = this.p.MAX_STORAGE; } QueueItem item = (e.item as QueueItem); if (item.pgs != null) { (e.item as QueueItem).pgs.QItem = null; } if(item.Goal !=null) { if(item.Goal.GoalName=="BuildConstructionShip") { p.Owner.GetGSAI().Goals.Remove(item.Goal); } if(item.Goal.GetFleet() !=null) p.Owner.GetGSAI().Goals.Remove(item.Goal); } this.p.ConstructionQueue.Remove(e.item as QueueItem); AudioManager.PlayCue("sd_ui_accept_alt3"); } } catch { } } this.QSL.HandleInput(input, this.p); if (this.ActiveBuildingEntry != null) { foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos) || this.currentMouse.LeftButton != ButtonState.Released || this.previousMouse.LeftButton != ButtonState.Pressed) { continue; } if (pgs.Habitable && pgs.building == null && pgs.QItem == null && (this.ActiveBuildingEntry.item as Building).Name != "Biospheres") { QueueItem qi = new QueueItem(); //{ qi.isBuilding = true; qi.Building = this.ActiveBuildingEntry.item as Building; qi.Cost = ResourceManager.BuildingsDict[qi.Building.Name].Cost * UniverseScreen.GamePaceStatic; qi.productionTowards = 0f; qi.pgs = pgs; //}; pgs.QItem = qi; this.p.ConstructionQueue.Add(qi); this.ActiveBuildingEntry = null; break; } else if (pgs.Habitable || pgs.Biosphere || pgs.QItem != null || !(this.ActiveBuildingEntry.item as Building).CanBuildAnywhere) { AudioManager.PlayCue("UI_Misc20"); this.ActiveBuildingEntry = null; break; } else { QueueItem qi = new QueueItem(); //{ qi.isBuilding = true; qi.Building = this.ActiveBuildingEntry.item as Building; qi.Cost = ResourceManager.BuildingsDict[qi.Building.Name].Cost * UniverseScreen.GamePaceStatic; qi.productionTowards = 0f; qi.pgs = pgs; //}; pgs.QItem = qi; this.p.ConstructionQueue.Add(qi); this.ActiveBuildingEntry = null; break; } } if (this.ActiveBuildingEntry != null) { foreach (QueueItem qi in this.p.ConstructionQueue) { if (!qi.isBuilding || !(qi.Building.Name == (this.ActiveBuildingEntry.item as Building).Name) || !(this.ActiveBuildingEntry.item as Building).Unique) { continue; } this.ActiveBuildingEntry = null; break; } } if (this.currentMouse.RightButton == ButtonState.Pressed && this.previousMouse.RightButton == ButtonState.Released) { this.ClickedTroop = true; this.ActiveBuildingEntry = null; } if (this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { this.ClickedTroop = true; this.ActiveBuildingEntry = null; } } for (int i = this.buildSL.indexAtTop; i < this.buildSL.Copied.Count && i < this.buildSL.indexAtTop + this.buildSL.entriesToDisplay; i++) { ScrollList.Entry e = this.buildSL.Copied[i]; if (e.item is ModuleHeader) { (e.item as ModuleHeader).HandleInput(input, e); } else if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(this.ScreenManager, e.clickRect); if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed && e.item is Building && this.ActiveBuildingEntry == null) { this.ActiveBuildingEntry = e; } if (this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { if (this.ClickTimer >= this.TimerDelay) { this.ClickTimer = 0f; } else { Rectangle rectangle = e.addRect; if (!HelperFunctions.CheckIntersection(e.addRect, input.CursorPosition)) { QueueItem qi = new QueueItem(); if (e.item is Ship) { qi.isShip = true; qi.sData = (e.item as Ship).GetShipData(); qi.Cost = (e.item as Ship).GetCost(this.p.Owner); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); AudioManager.PlayCue("sd_ui_mouseover"); } else if (e.item is Troop) { qi.isTroop = true; qi.troop = e.item as Troop; qi.Cost = (e.item as Troop).GetCost(); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); AudioManager.PlayCue("sd_ui_mouseover"); } else if (e.item is Building) { this.p.AddBuildingToCQ(ResourceManager.GetBuilding((e.item as Building).Name)); AudioManager.PlayCue("sd_ui_mouseover"); } } } } } Rectangle rectangle1 = e.addRect; if (!HelperFunctions.CheckIntersection(e.addRect, MousePos)) { e.PlusHover = 0; } else { e.PlusHover = 1; ToolTip.CreateTooltip(51, this.ScreenManager); if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { QueueItem qi = new QueueItem(); if (e.item is Building) { this.p.AddBuildingToCQ(ResourceManager.GetBuilding((e.item as Building).Name)); } else if (e.item is Ship) { qi.isShip = true; qi.sData = (e.item as Ship).GetShipData(); qi.Cost = (e.item as Ship).GetCost(this.p.Owner); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); } else if (e.item is Troop) { qi.isTroop = true; qi.troop = e.item as Troop; qi.Cost = (e.item as Troop).GetCost(); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); } } } Rectangle rectangle2 = e.editRect; if (!HelperFunctions.CheckIntersection(e.editRect, MousePos)) { e.EditHover = 0; } else { e.EditHover = 1; ToolTip.CreateTooltip(52, this.ScreenManager); if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { ShipDesignScreen sdScreen = new ShipDesignScreen(this.eui); this.ScreenManager.AddScreen(sdScreen); sdScreen.ChangeHull((e.item as Ship).GetShipData()); } } } this.shipsCanBuildLast = this.p.Owner.ShipsWeCanBuild.Count; this.buildingsHereLast = this.p.BuildingList.Count; this.buildingsCanBuildLast = this.BuildingsCanBuild.Count; if (input.RightMouseClick && !this.ClickedTroop) rmouse = false; if (!rmouse && (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released)) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } this.previousMouse = this.currentMouse; }
public ScrollList.Entry AddItem(object o) { ScrollList.Entry e = new ScrollList.Entry() { item = o }; this.Entries.Add(e); this.Update(); e.ParentList = this; return e; }
public override void HandleInput(InputState input) { this.currentMouse = Mouse.GetState(); Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); bool SelectedSomethingThisFrame = false; this.assetsUI.HandleInput(input); if (this.ActiveTroop != null && this.tInfo.HandleInput(input)) { SelectedSomethingThisFrame = true; } this.selector = null; this.HoveredSquare = null; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos) || pgs.TroopsHere.Count == 0 && pgs.building == null) { continue; } this.HoveredSquare = pgs; } if (this.OrbitSL.Entries.Count > 0) { if (!HelperFunctions.CheckIntersection(this.LandAll.Rect, input.CursorPosition)) { this.LandAll.State = UIButton.PressState.Normal; } else { this.LandAll.State = UIButton.PressState.Hover; if (input.InGameSelect) { AudioManager.PlayCue("sd_troop_land"); for (int i = 0; i < this.OrbitSL.Entries.Count; i++) { ScrollList.Entry e = this.OrbitSL.Entries[i]; if (e.item is Ship) { (e.item as Ship).GetAI().OrderLandAllTroops(this.p); } else if (e.item is Troop) { (e.item as Troop).GetShip().TroopList.Remove(e.item as Troop); this.p.AssignTroopToTile(e.item as Troop); } } this.OrbitSL.Entries.Clear(); } } } if (p.TroopsHere.Where(mytroops => mytroops.GetOwner() == universeScreen.player).Count() > 0) { if (!HelperFunctions.CheckIntersection(this.LaunchAll.Rect, input.CursorPosition)) { this.LaunchAll.State = UIButton.PressState.Normal; } else { this.LaunchAll.State = UIButton.PressState.Hover; if (input.InGameSelect) { bool play = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if ( pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() !=universeScreen.player || pgs.TroopsHere[0].Launchtimer >= 0) { continue; } try { pgs.TroopsHere[0].AvailableAttackActions = 0; pgs.TroopsHere[0].AvailableMoveActions = 0; pgs.TroopsHere[0].Launchtimer = pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].AttackTimer = (float)pgs.TroopsHere[0].AttackTimerBase; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; play = true; ResourceManager.CreateTroopShipAtPoint((pgs.TroopsHere[0].GetOwner().data.DefaultTroopShip != null) ? pgs.TroopsHere[0].GetOwner().data.DefaultTroopShip : pgs.TroopsHere[0].GetOwner().data.DefaultSmallTransport, pgs.TroopsHere[0].GetOwner(), this.p.Position, pgs.TroopsHere[0]); this.p.TroopsHere.Remove(pgs.TroopsHere[0]); pgs.TroopsHere[0].SetPlanet(null); pgs.TroopsHere.Clear(); } catch { System.Diagnostics.Debug.WriteLine("Troop Launch Crash"); } } if (play) { AudioManager.PlayCue("sd_troop_takeoff"); this.ResetNextFrame = true; } } } } this.OrbitSL.HandleInput(input); foreach (ScrollList.Entry e in this.OrbitSL.Copied) { if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(this.ScreenManager, e.clickRect); if (this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { continue; } this.draggedTroop = e; } } if (this.draggedTroop != null && this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { bool foundPlace = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos)) { continue; } if (!(this.draggedTroop.item is Ship) || (this.draggedTroop.item as Ship).TroopList.Count <= 0) { if (!(this.draggedTroop.item is Troop) || (pgs.building != null || pgs.TroopsHere.Count != 0) && (pgs.building == null || pgs.building.CombatStrength != 0 || pgs.TroopsHere.Count != 0)) { continue; } try { AudioManager.PlayCue("sd_troop_land"); pgs.TroopsHere.Add(this.draggedTroop.item as Troop); pgs.TroopsHere[0].AvailableAttackActions = 0; pgs.TroopsHere[0].AvailableMoveActions = 0; pgs.TroopsHere[0].Launchtimer = pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].AttackTimer = (float)pgs.TroopsHere[0].AttackTimerBase; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; this.p.TroopsHere.Add(this.draggedTroop.item as Troop); (this.draggedTroop.item as Troop).SetPlanet(this.p); this.OrbitSL.Entries.Remove(this.draggedTroop); (this.draggedTroop.item as Troop).GetShip().TroopList.Remove(this.draggedTroop.item as Troop); foundPlace = true; this.draggedTroop = null; } catch { System.Diagnostics.Debug.WriteLine("Troop Launch Crash"); } } else { if ((pgs.building != null || pgs.TroopsHere.Count != 0) && (pgs.building == null || pgs.building.CombatStrength != 0 || pgs.TroopsHere.Count != 0)) { continue; } try { AudioManager.PlayCue("sd_troop_land"); pgs.TroopsHere.Add((this.draggedTroop.item as Ship).TroopList[0]); pgs.TroopsHere[0].AvailableAttackActions = 0; pgs.TroopsHere[0].AvailableMoveActions = 0; pgs.TroopsHere[0].Launchtimer = pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].AttackTimer = (float)pgs.TroopsHere[0].AttackTimerBase; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; this.p.TroopsHere.Add((this.draggedTroop.item as Ship).TroopList[0]); (this.draggedTroop.item as Ship).TroopList[0].SetPlanet(this.p); if (pgs.building != null && !string.IsNullOrEmpty(pgs.building.EventTriggerUID) && pgs.TroopsHere.Count > 0 && !pgs.TroopsHere[0].GetOwner().isFaction && !pgs.TroopsHere[0].GetOwner().MinorRace) { ResourceManager.EventsDict[pgs.building.EventTriggerUID].TriggerPlanetEvent(this.p, pgs.TroopsHere[0].GetOwner(), pgs, EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty), CombatScreen.universeScreen); } this.OrbitSL.Entries.Remove(this.draggedTroop); this.OrbitSL.Copied.Remove(this.draggedTroop); (this.draggedTroop.item as Ship).QueueTotalRemoval(); foundPlace = true; this.draggedTroop = null; } catch { System.Diagnostics.Debug.WriteLine("Troop Launch Crash"); } } } if (!foundPlace) { this.draggedTroop = null; AudioManager.PlayCue("UI_Misc20"); } } foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos)) { pgs.highlighted = false; } else { if (!pgs.highlighted) { AudioManager.PlayCue("sd_ui_mouseover"); } pgs.highlighted = true; } if (pgs.CanAttack) { if (!pgs.CanAttack || this.ActiveTroop == null) { continue; } if (!HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos)) { pgs.ShowAttackHover = false; } else if (this.ActiveTroop.TroopsHere.Count <= 0) { if (this.ActiveTroop.building == null || this.ActiveTroop.building.CombatStrength <= 0 || this.ActiveTroop.building.AvailableAttackActions <= 0 || this.p.Owner == null || this.p.Owner != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { continue; } if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { Building activeTroop = this.ActiveTroop.building; activeTroop.AvailableAttackActions = activeTroop.AvailableAttackActions - 1; this.ActiveTroop.building.AttackTimer = 10f; this.StartCombat(this.ActiveTroop, pgs); } pgs.ShowAttackHover = true; } else { if (this.ActiveTroop.TroopsHere[0].AvailableAttackActions <= 0 || this.ActiveTroop.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { continue; } if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (pgs.x > this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = true; } else if (pgs.x < this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = false; } Troop item = this.ActiveTroop.TroopsHere[0]; item.AvailableAttackActions = item.AvailableAttackActions - 1; this.ActiveTroop.TroopsHere[0].AttackTimer = (float)this.ActiveTroop.TroopsHere[0].AttackTimerBase; Troop availableMoveActions = this.ActiveTroop.TroopsHere[0]; availableMoveActions.AvailableMoveActions = availableMoveActions.AvailableMoveActions - 1; this.ActiveTroop.TroopsHere[0].MoveTimer = (float)this.ActiveTroop.TroopsHere[0].MoveTimerBase; this.StartCombat(this.ActiveTroop, pgs); } pgs.ShowAttackHover = true; } } else { if (pgs.TroopsHere.Count > 0) { if (HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (pgs.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty)) { this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } else { foreach (PlanetGridSquare p1 in this.p.TilesList) { p1.CanAttack = false; p1.CanMoveTo = false; p1.ShowAttackHover = false; } this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } } } else if (pgs.building != null && !pgs.CanMoveTo && HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (this.p.Owner != EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty)) { this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } else { foreach (PlanetGridSquare p1 in this.p.TilesList) { p1.CanAttack = false; p1.CanMoveTo = false; p1.ShowAttackHover = false; } this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } } if (this.ActiveTroop == null || !pgs.CanMoveTo || this.ActiveTroop.TroopsHere.Count == 0 || !HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos) || this.ActiveTroop.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released || this.ActiveTroop.TroopsHere[0].AvailableMoveActions <= 0) { continue; } if (pgs.x > this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = true; } else if (pgs.x < this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = false; } pgs.TroopsHere.Add(this.ActiveTroop.TroopsHere[0]); Troop troop = pgs.TroopsHere[0]; troop.AvailableMoveActions = troop.AvailableMoveActions - 1; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].MovingTimer = 0.75f; pgs.TroopsHere[0].SetFromRect(this.ActiveTroop.TroopClickRect); AudioManager.PlayCue(pgs.TroopsHere[0].MovementCue); this.ActiveTroop.TroopsHere.Clear(); this.ActiveTroop = null; this.ActiveTroop = pgs; pgs.CanMoveTo = false; SelectedSomethingThisFrame = true; } } if (this.ActiveTroop != null && !SelectedSomethingThisFrame && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && !HelperFunctions.CheckIntersection(this.SelectedItemRect, input.CursorPosition)) { this.ActiveTroop = null; } if (this.ActiveTroop != null) { this.tInfo.pgs = this.ActiveTroop; } this.DetermineAttackAndMove(); this.hInfo.SetPGS(this.HoveredSquare); this.previousMouse = this.currentMouse; if (input.CurrentMouseState.RightButton != ButtonState.Released || input.LastMouseState.RightButton != ButtonState.Released) { universeScreen.ShipsInCombat.Active = true; universeScreen.PlanetsInCombat.Active = true; } }
public void AddItemWithCancel(object o) { ScrollList.Entry e = new ScrollList.Entry() { item = o }; this.SubEntries.Add(e); e.cancel = new Rectangle(); }
public void AddItem(object o, int addrect, int addpencil) { ScrollList.Entry e = new ScrollList.Entry() { item = o }; if (addrect > 0) { e.Plus = 1; } if (addpencil > 0) { e.editRect = new Rectangle(); e.Edit = 1; } e.addRect = new Rectangle(); this.SubEntries.Add(e); }
public void AddItem(object o) { ScrollList.Entry e = new ScrollList.Entry(); e.item = o; this.SubEntries.Add(e); }
public bool HandleInput(InputState input, Planet p) { bool hit = false; if (HelperFunctions.CheckIntersection(this.ScrollUp, input.CursorPosition) && input.InGameSelect) { if (this.indexAtTop > 0) { ScrollList scrollList = this; scrollList.indexAtTop = scrollList.indexAtTop - 1; } hit = true; float percentViewed = (float)this.entriesToDisplay / (float)this.Copied.Count; float startingPercent = (float)this.indexAtTop / (float)this.Copied.Count; this.ScrollBar = new Rectangle(this.ScrollBarHousing.X, this.ScrollBarHousing.Y + (int)(startingPercent * (float)this.ScrollBarHousing.Height), ResourceManager.TextureDict["NewUI/scrollbar_bar_mid"].Width, (int)((float)this.ScrollBarHousing.Height * percentViewed)); } if (HelperFunctions.CheckIntersection(this.ScrollDown, input.CursorPosition) && input.InGameSelect) { if (this.indexAtTop + this.entriesToDisplay < this.Copied.Count) { ScrollList scrollList1 = this; scrollList1.indexAtTop = scrollList1.indexAtTop + 1; } hit = true; float percentViewed = (float)this.entriesToDisplay / (float)this.Copied.Count; float startingPercent = (float)this.indexAtTop / (float)this.Copied.Count; this.ScrollBar = new Rectangle(this.ScrollBarHousing.X, this.ScrollBarHousing.Y + (int)(startingPercent * (float)this.ScrollBarHousing.Height), ResourceManager.TextureDict["NewUI/scrollbar_bar_mid"].Width, (int)((float)this.ScrollBarHousing.Height * percentViewed)); } if (HelperFunctions.CheckIntersection(this.ScrollBarHousing, input.CursorPosition)) { this.ScrollBarHover = 1; //this.upScrollHover = 1; //this.downScrollHover = 1; if (HelperFunctions.CheckIntersection(this.ScrollBar, input.CursorPosition)) { this.ScrollBarHover = 2; if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Released) { this.startDragPos = (int)input.CursorPosition.Y; this.ScrollBarStartDragPos = (float)this.ScrollBar.Y; this.dragging = true; hit = true; } } } else if (!this.dragging) { this.ScrollBarHover = 0; //this.upScrollHover = 0; //this.downScrollHover = 0; } if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Pressed && this.dragging) { float difference = input.CursorPosition.Y - (float)this.startDragPos; float count = 1f / (float)this.Copied.Count; if (Math.Abs(difference) > 0f) { this.ScrollBar.Y = (int)(this.ScrollBarStartDragPos + difference); if (this.ScrollBar.Y < this.ScrollBarHousing.Y) { this.ScrollBar.Y = this.ScrollBarHousing.Y; } else if (this.ScrollBar.Y + this.ScrollBar.Height > this.ScrollBarHousing.Y + this.ScrollBarHousing.Height) { this.ScrollBar.Y = this.ScrollBarHousing.Y + this.ScrollBarHousing.Height - this.ScrollBar.Height; } } float MousePosAsPct = (input.CursorPosition.Y - (float)this.ScrollBarHousing.Y) / (float)this.ScrollBarHousing.Height; if (MousePosAsPct < 0f) { MousePosAsPct = 0f; } if (MousePosAsPct > 1f) { MousePosAsPct = 1f; } this.indexAtTop = (int)((float)this.Copied.Count * MousePosAsPct); if (this.indexAtTop + this.entriesToDisplay >= this.Copied.Count) { this.indexAtTop = this.Copied.Count - this.entriesToDisplay; } hit = true; } if (HelperFunctions.CheckIntersection(this.Parent.Menu, input.CursorPosition)) { if (input.CurrentMouseState.ScrollWheelValue > input.LastMouseState.ScrollWheelValue) { if (this.indexAtTop > 0) { ScrollList scrollList2 = this; scrollList2.indexAtTop = scrollList2.indexAtTop - 1; } hit = true; float percentViewed = (float)this.entriesToDisplay / (float)this.Copied.Count; float startingPercent = (float)this.indexAtTop / (float)this.Copied.Count; this.ScrollBar = new Rectangle(this.ScrollBarHousing.X, this.ScrollBarHousing.Y + (int)(startingPercent * (float)this.ScrollBarHousing.Height), ResourceManager.TextureDict["NewUI/scrollbar_bar_mid"].Width, (int)((float)this.ScrollBarHousing.Height * percentViewed)); } if (input.CurrentMouseState.ScrollWheelValue < input.LastMouseState.ScrollWheelValue) { if (this.indexAtTop + this.entriesToDisplay < this.Copied.Count) { ScrollList scrollList3 = this; scrollList3.indexAtTop = scrollList3.indexAtTop + 1; } hit = true; float percentViewed = (float)this.entriesToDisplay / (float)this.Copied.Count; float startingPercent = (float)this.indexAtTop / (float)this.Copied.Count; this.ScrollBar = new Rectangle(this.ScrollBarHousing.X, this.ScrollBarHousing.Y + (int)(startingPercent * (float)this.ScrollBarHousing.Height), ResourceManager.TextureDict["NewUI/scrollbar_bar_mid"].Width, (int)((float)this.ScrollBarHousing.Height * percentViewed)); } } if (input.CurrentMouseState.LeftButton == ButtonState.Released && input.LastMouseState.LeftButton == ButtonState.Pressed && this.dragging) { this.dragging = false; } if (this.IsDraggable && this.DraggedEntry == null) { for (int i = this.indexAtTop; i < this.Entries.Count && i < this.indexAtTop + this.entriesToDisplay; i++) { try { ScrollList.Entry e = this.Copied[i]; if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { if (input.CurrentMouseState.LeftButton != ButtonState.Pressed) { this.ClickTimer = 0f; } else { ScrollList clickTimer = this; clickTimer.ClickTimer = clickTimer.ClickTimer + 0.0166666675f; if (this.ClickTimer > this.TimerDelay) { this.DraggedEntry = e; this.DraggedOffset = new Vector2((float)e.clickRect.X, (float)e.clickRect.Y) - input.CursorPosition; break; } } } } catch { } } } if (input.CurrentMouseState.LeftButton == ButtonState.Released) { this.ClickTimer = 0f; this.DraggedEntry = null; } if (this.DraggedEntry != null && input.CurrentMouseState.LeftButton == ButtonState.Pressed) { int Dragged = 0; for (int i = this.indexAtTop; i < this.Entries.Count && i < this.indexAtTop + this.entriesToDisplay; i++) { ScrollList.Entry e = this.Entries[i]; if (e.clickRect == this.DraggedEntry.clickRect) { Dragged = this.Entries.IndexOf(e); } } for (int i = this.indexAtTop; i < this.Entries.Count && i < this.indexAtTop + this.entriesToDisplay; i++) { try { ScrollList.Entry e = this.Entries[i]; if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { int NewIndex = this.Entries.IndexOf(e); if (NewIndex < Dragged) { ScrollList.Entry toReplace = e; this.Entries[NewIndex] = this.Entries[Dragged]; this.Entries[NewIndex].clickRect = toReplace.clickRect; p.ConstructionQueue[NewIndex] = p.ConstructionQueue[Dragged]; this.Entries[Dragged] = toReplace; this.Entries[Dragged].clickRect = this.DraggedEntry.clickRect; p.ConstructionQueue[Dragged] = toReplace.item as QueueItem; this.DraggedEntry = this.Entries[NewIndex]; break; } else if (NewIndex > Dragged) { ScrollList.Entry toRemove = this.Entries[Dragged]; for (int j = Dragged + 1; j <= NewIndex; j++) { this.Entries[j].clickRect = this.Entries[j - 1].clickRect; this.Entries[j - 1] = this.Entries[j]; p.ConstructionQueue[j - 1] = p.ConstructionQueue[j]; } toRemove.clickRect = this.Entries[NewIndex].clickRect; this.Entries[NewIndex] = toRemove; p.ConstructionQueue[NewIndex] = toRemove.item as QueueItem; this.DraggedEntry = this.Entries[NewIndex]; } } } catch { } } } this.Update(); return hit; }
public void AddQItem(object o) { ScrollList.Entry e = new ScrollList.Entry() { item = o, Plus = 0, up = new Rectangle(), down = new Rectangle(), apply = new Rectangle(), cancel = new Rectangle(), clickRect = new Rectangle(), QItem = 1 }; this.Entries.Add(e); this.Update(); e.ParentList = this; }