//This method is called everytime the System combobox selection is changed protected void SystemSelect (object sender, EventArgs e) { if(!isSetupFinished) return; selectedSystem = GameState.Instance.StarSystems [SystemList.Active]; setSystemType (selectedSystem.Stars.Count); starDataShown.Clear (); int starCount = 0; foreach (Entities.Star aStar in selectedSystem.Stars) { starDataShown.AppendValues (aStar.Name, aStar.Class, aStar.Radius, aStar.Mass, aStar.Luminosity, aStar.Temperature, aStar.Life, aStar.SemiMajorAxis); planetList[starCount].Clear (); foreach (Entities.Planet aPlanet in aStar.Planets) { planetList[starCount].AppendValues (aPlanet.Name, aPlanet.PlanetTypeView, aPlanet.SurfaceTemperatureView, aPlanet.SurfaceGravityView, aPlanet.MassOfGasInEarthMassesView, aPlanet.SemiMajorAxis, aPlanet.SurfacePressure, aPlanet.Radius); } switch(starCount) { case 0: StarA_Label.Text = aStar.Name; break; case 1: StarB_Label.Text = aStar.Name; break; case 2: StarC_Label.Text = aStar.Name; break; case 3: StarD_Label.Text = aStar.Name; break; } starCount++; } for (; starCount<4; starCount++) { planetList[starCount].Clear (); switch(starCount) { case 0: StarA_Label.Text = "N/A"; break; case 1: StarB_Label.Text = "N/A"; break; case 2: StarC_Label.Text = "N/A"; break; case 3: StarD_Label.Text = "N/A"; break; } } }
static void Main() { #if LOG4NET_ENABLED XmlConfigurator.Configure(); // Enables Log4net based on App.config file. logger.Info("Program Started"); #endif // gen star system: Entities.StarSystem sol = SystemGen.CreateSol(); SystemGen.CreateStressTest(); SystemGen.CreateSystem("Test"); SystemGen.CreateSystem("Foo"); SystemGen.CreateSystem("Bar"); /// <summary> /// Alpha Build related area: /// </summary> // gen Faction and a pop: Entities.Faction oNewFaction = new Entities.Faction(0); /// <summary> /// This following section should probably be moved to the Faction constructor at some point. /// </summary> oNewFaction.Populations.Add(new Entities.Population(sol.Stars.FirstOrDefault().Planets.FirstOrDefault(), oNewFaction)); oNewFaction.Populations[0].Planet.HomeworldMineralGeneration(); oNewFaction.Populations[0].ConventionalStart(); /// <summary> /// Add Contact lists. /// </summary> foreach (Entities.StarSystem CurSystem in GameState.Instance.StarSystems) { oNewFaction.AddNewContactList(CurSystem); } Entities.SystemBody P1 = new Entities.SystemBody(sol.Stars[0], Entities.SystemBody.PlanetType.Comet); ///< @tdo WTF??? Alpha Build Related Area fat fingering ^ P1.Position.X = 10.0; P1.Position.Y = 10.0; oNewFaction.Capitol = oNewFaction.Populations[0].Planet; oNewFaction.Capitol.GeoSurveyList.Add(oNewFaction, true); oNewFaction.AddNewTaskGroup("Combat Taskgroup HR", P1, sol); oNewFaction.FactionColor = System.Drawing.Color.Blue; Entities.Faction oNewFaction2 = new Entities.Faction(1); oNewFaction2.Name = "Terran Federation"; oNewFaction2.Populations.Add(new Entities.Population(sol.Stars.FirstOrDefault().Planets.FirstOrDefault(), oNewFaction2)); oNewFaction2.Populations[0].Planet.HomeworldMineralGeneration(); oNewFaction2.Populations[0].ConventionalStart(); /// <summary> /// Add Contact lists. /// </summary> foreach (Entities.StarSystem CurSystem in GameState.Instance.StarSystems) { oNewFaction2.AddNewContactList(CurSystem); } Entities.SystemBody P2 = new Entities.SystemBody(sol.Stars[0], Entities.SystemBody.PlanetType.Comet); ///< wtf??? its a fatfinger to initialize the position of Combat Taskgroup TR P2.Position.X = -10.0; P2.Position.Y = -10.0; oNewFaction2.Capitol = oNewFaction2.Populations[0].Planet; oNewFaction2.Capitol.GeoSurveyList.Add(oNewFaction2, true); oNewFaction2.AddNewTaskGroup("Combat Taskgroup TR", P2, sol); oNewFaction2.FactionColor = System.Drawing.Color.Red; oNewFaction.AddNewShipDesign("Sword"); ComponentDefListTN CL = oNewFaction.ComponentList; oNewFaction.ShipDesigns[0].AddEngine(CL.Engines[1], 8); oNewFaction.ShipDesigns[0].AddCrewQuarters(CL.CrewQuarters[0], 11); oNewFaction.ShipDesigns[0].AddFuelStorage(CL.FuelStorage[0], 10); oNewFaction.ShipDesigns[0].AddEngineeringSpaces(CL.EngineeringSpaces[0], 10); oNewFaction.ShipDesigns[0].AddOtherComponent(CL.OtherComponents[0], 1); oNewFaction.ShipDesigns[0].AddActiveSensor(CL.ActiveSensorDef[1], 1); oNewFaction.ShipDesigns[0].AddActiveSensor(CL.ActiveSensorDef[2], 1); oNewFaction.ShipDesigns[0].AddActiveSensor(CL.ActiveSensorDef[3], 1); oNewFaction.ShipDesigns[0].AddPassiveSensor(CL.PassiveSensorDef[2], 1); oNewFaction.ShipDesigns[0].AddPassiveSensor(CL.PassiveSensorDef[3], 1); oNewFaction.ShipDesigns[0].AddReactor(CL.ReactorDef[1], 10); oNewFaction.ShipDesigns[0].AddBeamFireControl(CL.BeamFireControlDef[1], 2); oNewFaction.ShipDesigns[0].AddShield(CL.ShieldDef[1], 20); oNewFaction.ShipDesigns[0].IsLocked = true; for (int loop = 1; loop < 8; loop++) { oNewFaction.ShipDesigns[0].AddBeamWeapon(CL.BeamWeaponDef[loop], 1); } oNewFaction.ShipDesigns[0].NewArmor("Composite", 8, 4); oNewFaction.AddNewShipDesign("Hammer"); oNewFaction.ShipDesigns[1].AddEngine(CL.Engines[2], 2); oNewFaction.ShipDesigns[1].AddCrewQuarters(CL.CrewQuarters[0], 8); oNewFaction.ShipDesigns[1].AddFuelStorage(CL.FuelStorage[0], 10); oNewFaction.ShipDesigns[1].AddEngineeringSpaces(CL.EngineeringSpaces[0], 10); oNewFaction.ShipDesigns[1].AddOtherComponent(CL.OtherComponents[0], 1); oNewFaction.ShipDesigns[1].AddActiveSensor(CL.ActiveSensorDef[4], 1); oNewFaction.ShipDesigns[1].AddActiveSensor(CL.ActiveSensorDef[5], 1); oNewFaction.ShipDesigns[1].AddMFC(CL.MissileFireControlDef[1], 1); oNewFaction.ShipDesigns[1].AddMFC(CL.MissileFireControlDef[2], 1); oNewFaction.ShipDesigns[1].AddMagazine(CL.MagazineDef[1], 1); oNewFaction.ShipDesigns[1].AddLauncher(CL.MLauncherDef[1], 4); oNewFaction.ShipDesigns[1].AddLauncher(CL.MLauncherDef[2], 4); oNewFaction.ShipDesigns[1].NewArmor("Collapsium", 45, 5); oNewFaction.ShipDesigns[1].SetPreferredOrdnance(CL.MissileDef[0], 100); oNewFaction.ShipDesigns[1].SetPreferredOrdnance(CL.MissileDef[1], 200); oNewFaction.ShipDesigns[1].IsLocked = true; oNewFaction.ShipDesigns[1].BuildClassSummary(); oNewFaction.TaskGroups.Last().AddShip(oNewFaction.ShipDesigns[0], "Warship"); oNewFaction.TaskGroups.Last().AddShip(oNewFaction.ShipDesigns[0], "Backup Warship"); oNewFaction.TaskGroups.Last().AddShip(oNewFaction.ShipDesigns[1], "Hammer"); oNewFaction.TaskGroups.Last().Ships[0].Refuel(1000000.0f); oNewFaction.TaskGroups.Last().Ships[1].Refuel(1000000.0f); oNewFaction.TaskGroups.Last().Ships[2].Refuel(1000000.0f); foreach (KeyValuePair <OrdnanceDefTN, int> pair in oNewFaction.ShipDesigns[1].ShipClassOrdnance) { oNewFaction.TaskGroups.Last().Ships[2].ShipOrdnance.Add(pair.Key, pair.Value); } oNewFaction.TaskGroups.Last().Ships[2].CurrentMagazineCapacity = oNewFaction.ShipDesigns[1].PreferredOrdnanceSize; oNewFaction2.AddNewShipDesign("Mace"); CL = oNewFaction2.ComponentList; oNewFaction2.ShipDesigns[0].AddEngine(CL.Engines[1], 8); oNewFaction2.ShipDesigns[0].AddCrewQuarters(CL.CrewQuarters[0], 11); oNewFaction2.ShipDesigns[0].AddFuelStorage(CL.FuelStorage[0], 10); oNewFaction2.ShipDesigns[0].AddEngineeringSpaces(CL.EngineeringSpaces[0], 10); oNewFaction2.ShipDesigns[0].AddOtherComponent(CL.OtherComponents[0], 1); oNewFaction2.ShipDesigns[0].AddActiveSensor(CL.ActiveSensorDef[1], 1); oNewFaction2.ShipDesigns[0].AddActiveSensor(CL.ActiveSensorDef[2], 1); oNewFaction2.ShipDesigns[0].AddActiveSensor(CL.ActiveSensorDef[3], 1); oNewFaction2.ShipDesigns[0].AddPassiveSensor(CL.PassiveSensorDef[2], 1); oNewFaction2.ShipDesigns[0].AddPassiveSensor(CL.PassiveSensorDef[3], 1); oNewFaction2.ShipDesigns[0].AddReactor(CL.ReactorDef[1], 10); oNewFaction2.ShipDesigns[0].AddBeamFireControl(CL.BeamFireControlDef[1], 2); oNewFaction2.ShipDesigns[0].AddShield(CL.ShieldDef[1], 20); oNewFaction2.ShipDesigns[0].IsLocked = true; for (int loop = 1; loop < 8; loop++) { oNewFaction2.ShipDesigns[0].AddBeamWeapon(CL.BeamWeaponDef[loop], 1); } oNewFaction2.ShipDesigns[0].NewArmor("Composite", 8, 4); oNewFaction2.AddNewShipDesign("Crusher"); oNewFaction2.ShipDesigns[1].AddEngine(CL.Engines[2], 2); oNewFaction2.ShipDesigns[1].AddCrewQuarters(CL.CrewQuarters[0], 8); oNewFaction2.ShipDesigns[1].AddFuelStorage(CL.FuelStorage[0], 10); oNewFaction2.ShipDesigns[1].AddEngineeringSpaces(CL.EngineeringSpaces[0], 10); oNewFaction2.ShipDesigns[1].AddOtherComponent(CL.OtherComponents[0], 1); oNewFaction2.ShipDesigns[1].AddActiveSensor(CL.ActiveSensorDef[4], 1); oNewFaction2.ShipDesigns[1].AddActiveSensor(CL.ActiveSensorDef[5], 1); oNewFaction2.ShipDesigns[1].AddMFC(CL.MissileFireControlDef[1], 1); oNewFaction2.ShipDesigns[1].AddMFC(CL.MissileFireControlDef[2], 1); oNewFaction2.ShipDesigns[1].AddMagazine(CL.MagazineDef[1], 1); oNewFaction2.ShipDesigns[1].AddLauncher(CL.MLauncherDef[1], 4); oNewFaction2.ShipDesigns[1].AddLauncher(CL.MLauncherDef[2], 4); oNewFaction2.ShipDesigns[1].NewArmor("Collapsium", 45, 5); oNewFaction2.ShipDesigns[1].SetPreferredOrdnance(CL.MissileDef[0], 100); oNewFaction2.ShipDesigns[1].SetPreferredOrdnance(CL.MissileDef[1], 200); oNewFaction2.ShipDesigns[1].IsLocked = true; oNewFaction2.ShipDesigns[1].BuildClassSummary(); oNewFaction2.TaskGroups.Last().AddShip(oNewFaction2.ShipDesigns[0], "Battleship"); oNewFaction2.TaskGroups.Last().AddShip(oNewFaction2.ShipDesigns[0], "Backup Battleship"); oNewFaction2.TaskGroups.Last().AddShip(oNewFaction.ShipDesigns[1], "Crusher"); oNewFaction2.TaskGroups.Last().Ships[0].Refuel(1000000.0f); oNewFaction2.TaskGroups.Last().Ships[1].Refuel(1000000.0f); oNewFaction2.TaskGroups.Last().Ships[2].Refuel(1000000.0f); foreach (KeyValuePair <OrdnanceDefTN, int> pair in oNewFaction2.ShipDesigns[1].ShipClassOrdnance) { oNewFaction2.TaskGroups.Last().Ships[2].ShipOrdnance.Add(pair.Key, pair.Value); } oNewFaction2.TaskGroups.Last().Ships[2].CurrentMagazineCapacity = oNewFaction2.ShipDesigns[1].PreferredOrdnanceSize; oNewFaction.GiveAllTechs(); oNewFaction2.GiveAllTechs(); /// <summary> /// End Alpha. /// </summary> Application.EnableVisualStyles(); //Initialize damage values. DamageValuesTN.init(); // Init our UI Controller: Helpers.UIController.Instance.Initialise(); //Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Forms.MainForm()); #if LOG4NET_ENABLED logger.Info("Program Ended"); #endif }
public SystemDisplayGTK () { this.Build (); //Assembles window as layed out in Designer mode // Fill Stars Frame starDataShown = new ListStore (typeof(string), typeof(string), typeof(double), typeof(double), typeof(double), typeof(double), typeof(double), typeof(double)); foreach (Entities.StarSystem systemMember in GameState.Instance.StarSystems) { SystemList.AppendText (systemMember.ToString ()); } Gtk.TreeModel systemModel = SystemList.Model; Gtk.TreeIter firstItem; systemModel.GetIterFirst (out firstItem); SystemList.SetActiveIter (firstItem); starView = new Gtk.TreeView (starDataShown); starsFrame.Add (starView); string[] starHeader = { "Name", "Class", "Radius", "Mass", "Luminosity", "Temperature", "Habitable Zone", "Orbital Radius (AU)" }; int headerIndex = 0; foreach (string header in starHeader) { starView.AppendColumn (header, new CellRendererText (), "text", headerIndex++); } starView.HeadersVisible = true; starView.ExpandAll (); // Fill Planet list frames string[] planetHeader = { "Name", "Type", "Surface\nTemp.", "Surface\nGravity", "Atmospher\n(Earth Masses)", "Orbit Dist\n(Avg)", "Pressure", "Radius" }; planetList = new List<ListStore>(); planetView = new List<TreeView>(); for (int j = 0; j < 4; j++) { planetList.Add( new Gtk.ListStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(double), typeof(double), typeof(double))); planetView.Add( new Gtk.TreeView (planetList[j])); headerIndex = 0; foreach (string header in planetHeader) { planetView [j].AppendColumn (header, new CellRendererText (), "text", headerIndex++); } } StarA_Space.Add (planetView[0]); StarB_Space.Add (planetView[1]); StarC_Space.Add (planetView[2]); StarD_Space.Add (planetView[3]); // After Setupt iniltialize data for default system isSetupFinished = true; selectedSystem = GameState.Instance.StarSystems [0]; setSystemType (selectedSystem.Stars.Count); }