public void GenerateList() { PeopleList = new List <People>(); TravelNode car = new TravelNode { VehicleName = "Car" }; TravelNode bus = new TravelNode { VehicleName = "Bus" }; TravelNode bike = new TravelNode { VehicleName = "Bike" }; TravelNode train = new TravelNode { VehicleName = "Train" }; People john = new People(); john.Name = "John"; john.TravelNodes = new List <TravelNode>(); john.TravelNodes.Add(car); john.TravelNodes.Add(bike); People jerry = new People(); jerry.Name = "Jerry"; jerry.TravelNodes = new List <TravelNode>(); jerry.TravelNodes.Add(bus); jerry.TravelNodes.Add(train); PeopleList.Add(john); PeopleList.Add(jerry); }
private void DrawETA(TravelNode node, bool isTentative) { if (isTentative) { _tentativeETA.MoveTo((int)((node.StarSystem.X - _camera.CameraX) * _camera.ZoomDistance), (int)((node.StarSystem.Y - _camera.CameraY - 32) * _camera.ZoomDistance)); if (node.Angle > 180) { _tentativeETA.SetAlignment(true); } else { _tentativeETA.SetAlignment(false); } _tentativeETA.Draw(); } else { _travelETA.MoveTo((int)((node.StarSystem.X - _camera.CameraX) * _camera.ZoomDistance), (int)((node.StarSystem.Y - _camera.CameraY - 32) * _camera.ZoomDistance)); if (node.Angle > 180) { _travelETA.SetAlignment(true); } else { _travelETA.SetAlignment(false); } _travelETA.Draw(); } }
public override bool MouseUp(int x, int y) { if (!_isOwnedSystem) { return base.MouseUp(x, y); } if (IsTransferring) { if (_popTransferSlider.MouseUp(x, y)) { _transferLabel.SetText("Moving " + _popTransferSlider.TopIndex + " Population"); return true; } if (_transferToButton.MouseUp(x, y)) { if (TransferSystem != null && TransferSystem.IsValid) { if (TransferSystem.StarSystem == _currentSystem) { _currentSystem.Planets[0].TransferSystem = new KeyValuePair<TravelNode, int>(new TravelNode(), 0); } else { _currentSystem.Planets[0].TransferSystem = new KeyValuePair<TravelNode, int>(TransferSystem, _popTransferSlider.TopIndex); } _transferLabel.SetText("Moving " + _currentSystem.Planets[0].TransferSystem.Value + " Pop"); _transferLabel.MoveTo(_xPos + 10, _yPos + 440); TransferSystem = null; //Done setting transfer } IsTransferring = false; return true; } } if (IsRelocating) { if (_relocateToButton.MouseUp(x, y)) { if (RelocateSystem.IsValid) { _currentSystem.Planets[0].RelocateToSystem = RelocateSystem; IsRelocating = false; RelocateSystem = null; } } } if (_name.MouseUp(x, y)) { return true; } if (_infrastructureSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.INFRASTRUCTURE, _infrastructureSlider.TopIndex, false); Refresh(); return true; } if (_researchSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.RESEARCH, _researchSlider.TopIndex, false); Refresh(); return true; } if (_environmentSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.ENVIRONMENT, _environmentSlider.TopIndex, false); Refresh(); return true; } if (_defenseSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.DEFENSE, _defenseSlider.TopIndex, false); Refresh(); return true; } if (_constructionSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.CONSTRUCTION, _constructionSlider.TopIndex, false); Refresh(); return true; } if (_infrastructureLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].InfrastructureLocked = !_currentSystem.Planets[0].InfrastructureLocked; _infrastructureSlider.SetEnabledState(!_currentSystem.Planets[0].InfrastructureLocked); _infrastructureLockButton.Selected = _currentSystem.Planets[0].InfrastructureLocked; return true; } if (_researchLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].ResearchLocked = !_currentSystem.Planets[0].ResearchLocked; _researchSlider.SetEnabledState(!_currentSystem.Planets[0].ResearchLocked); _researchLockButton.Selected = _currentSystem.Planets[0].ResearchLocked; return true; } if (_environmentLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].EnvironmentLocked = !_currentSystem.Planets[0].EnvironmentLocked; _environmentSlider.SetEnabledState(!_currentSystem.Planets[0].EnvironmentLocked); _environmentLockButton.Selected = _currentSystem.Planets[0].EnvironmentLocked; return true; } if (_defenseLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].DefenseLocked = !_currentSystem.Planets[0].DefenseLocked; _defenseSlider.SetEnabledState(!_currentSystem.Planets[0].DefenseLocked); _defenseLockButton.Selected = _currentSystem.Planets[0].DefenseLocked; return true; } if (_constructionLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].ConstructionLocked = !_currentSystem.Planets[0].ConstructionLocked; _constructionSlider.SetEnabledState(!_currentSystem.Planets[0].ConstructionLocked); _constructionLockButton.Selected = _currentSystem.Planets[0].ConstructionLocked; return true; } if (_relocateToButton.MouseUp(x, y)) { IsRelocating = true; _generalPurposeText.SetText("Select a friendly system to send newly built ships"); _relocateToButton.Active = false; return true; } if (_transferToButton.MouseUp(x, y)) { IsTransferring = true; _transferLabel.MoveTo(_xPos + 20, _yPos + 370); _transferLabel.SetText("Moving 0 Population"); _popTransferSlider.SetAmountOfItems((int)(_currentSystem.Planets[0].TotalPopulation / 2)); _generalPurposeText.SetText("Select a colonized planet to send population"); return true; } if (_constructionProjectButton.MouseUp(x, y)) { _currentSystem.Planets[0].ShipBeingBuilt = _currentEmpire.FleetManager.GetNextShipDesign(_currentSystem.Planets[0].ShipBeingBuilt); Refresh(); } return base.MouseUp(x, y); }
public override bool MouseUp(int x, int y) { if (!_isOwnedSystem) { return(base.MouseUp(x, y)); } if (IsTransferring) { if (_popTransferSlider.MouseUp(x, y)) { _transferLabel.SetText("Moving " + _popTransferSlider.TopIndex + " Population"); return(true); } if (_transferToButton.MouseUp(x, y)) { if (TransferSystem != null && TransferSystem.IsValid) { if (TransferSystem.StarSystem == _currentSystem) { _currentSystem.Planets[0].TransferSystem = new KeyValuePair <TravelNode, int>(new TravelNode(), 0); } else { _currentSystem.Planets[0].TransferSystem = new KeyValuePair <TravelNode, int>(TransferSystem, _popTransferSlider.TopIndex); } _transferLabel.SetText("Moving " + _currentSystem.Planets[0].TransferSystem.Value + " Pop"); _transferLabel.MoveTo(_xPos + 10, _yPos + 440); TransferSystem = null; //Done setting transfer } IsTransferring = false; return(true); } } if (IsRelocating) { if (_relocateToButton.MouseUp(x, y)) { if (RelocateSystem.IsValid) { _currentSystem.Planets[0].RelocateToSystem = RelocateSystem; IsRelocating = false; RelocateSystem = null; } } } if (_name.MouseUp(x, y)) { return(true); } if (_infrastructureSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.INFRASTRUCTURE, _infrastructureSlider.TopIndex, false); Refresh(); return(true); } if (_researchSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.RESEARCH, _researchSlider.TopIndex, false); Refresh(); return(true); } if (_environmentSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.ENVIRONMENT, _environmentSlider.TopIndex, false); Refresh(); return(true); } if (_defenseSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.DEFENSE, _defenseSlider.TopIndex, false); Refresh(); return(true); } if (_constructionSlider.MouseUp(x, y)) { _currentSystem.Planets[0].SetOutputAmount(OUTPUT_TYPE.CONSTRUCTION, _constructionSlider.TopIndex, false); Refresh(); return(true); } if (_infrastructureLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].InfrastructureLocked = !_currentSystem.Planets[0].InfrastructureLocked; _infrastructureSlider.SetEnabledState(!_currentSystem.Planets[0].InfrastructureLocked); _infrastructureLockButton.Selected = _currentSystem.Planets[0].InfrastructureLocked; return(true); } if (_researchLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].ResearchLocked = !_currentSystem.Planets[0].ResearchLocked; _researchSlider.SetEnabledState(!_currentSystem.Planets[0].ResearchLocked); _researchLockButton.Selected = _currentSystem.Planets[0].ResearchLocked; return(true); } if (_environmentLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].EnvironmentLocked = !_currentSystem.Planets[0].EnvironmentLocked; _environmentSlider.SetEnabledState(!_currentSystem.Planets[0].EnvironmentLocked); _environmentLockButton.Selected = _currentSystem.Planets[0].EnvironmentLocked; return(true); } if (_defenseLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].DefenseLocked = !_currentSystem.Planets[0].DefenseLocked; _defenseSlider.SetEnabledState(!_currentSystem.Planets[0].DefenseLocked); _defenseLockButton.Selected = _currentSystem.Planets[0].DefenseLocked; return(true); } if (_constructionLockButton.MouseUp(x, y)) { _currentSystem.Planets[0].ConstructionLocked = !_currentSystem.Planets[0].ConstructionLocked; _constructionSlider.SetEnabledState(!_currentSystem.Planets[0].ConstructionLocked); _constructionLockButton.Selected = _currentSystem.Planets[0].ConstructionLocked; return(true); } if (_relocateToButton.MouseUp(x, y)) { IsRelocating = true; _generalPurposeText.SetText("Select a friendly system to send newly built ships"); _relocateToButton.Active = false; return(true); } if (_transferToButton.MouseUp(x, y)) { IsTransferring = true; _transferLabel.MoveTo(_xPos + 20, _yPos + 370); _transferLabel.SetText("Moving 0 Population"); _popTransferSlider.SetAmountOfItems((int)(_currentSystem.Planets[0].TotalPopulation / 2)); _generalPurposeText.SetText("Select a colonized planet to send population"); return(true); } if (_constructionProjectButton.MouseUp(x, y)) { _currentSystem.Planets[0].ShipBeingBuilt = _currentEmpire.FleetManager.GetNextShipDesign(_currentSystem.Planets[0].ShipBeingBuilt); Refresh(); } return(base.MouseUp(x, y)); }
private void HandleNavigationInteract(TravelNode node) { SetTravelLocation(node.transform); }