static void Main()
        {
            //AppDomain.CurrentDomain.FirstChanceException += new EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>(CurrentDomain_FirstChanceException);
            //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            // Create Splash Scrren:
            #if SPLASHSCREEN
            Forms.StartupSplashScreen.ShowSplashScreen();
            Forms.StartupSplashScreen.SetStatus("Loading Configuration...");
            Forms.StartupSplashScreen.Progress = 0.2;
            #endif

            XmlConfigurator.Configure();

            logger.Info("Program Started");

            #if SPLASHSCREEN
            Forms.StartupSplashScreen.SetStatus("Initializing data...");
            Forms.StartupSplashScreen.Progress = 0.3;
            #endif
            var ssf = new StarSystemFactory(true);
            GameState.Instance.StarSystems.Add(ssf.Create("Test"));
            GameState.Instance.StarSystems.Add(ssf.Create("Foo"));
            GameState.Instance.StarSystems.Add(ssf.Create("Bar"));

            #if SPLASHSCREEN
            Forms.StartupSplashScreen.SetStatus("Initialising Controls...");
            Forms.StartupSplashScreen.Progress = 0.45;
            #endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Pulsar4X.WinForms.Controls.UIController UIComponentControler = new Controls.UIController();

            #if SPLASHSCREEN
            Forms.StartupSplashScreen.SetStatus("Testing For OpenGL...");
            Forms.StartupSplashScreen.Progress = 0.7;
            #endif
            #if OPENGL
            bool bOpenTKInitOK = OpenTKUtilities.Instance.Initialise();      // Get the best possible version of OpenGL
            //bool bOpenTKInitOK = OpenTKUtilities.Instance.Initialise(OpenTKUtilities.GLVersion.OpenGL2X); // force GL2.0
            if (bOpenTKInitOK == false)
            {
                // Log error with open TK:
                logger.Warn("Error Initialising OpenTK and OpenGL. System and Glaaxy Maps May not work correctly!");
            }
            #endif

            // Starting:
            #if SPLASHSCREEN
            Forms.StartupSplashScreen.SetStatus("Starting...");
            Forms.StartupSplashScreen.Progress = 0.8;
            #endif
            // note that main form will close the splash screen on load!!
            Application.Run(Controls.UIController.g_aMainForm);

            logger.Info("Program Ended");
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            Application.Init();

            XmlConfigurator.Configure();
            logger.Info("Program Started");

            var ssf = new StarSystemFactory(true);

            GameState.Instance.StarSystems.Add(ssf.Create("Test"));
            GameState.Instance.StarSystems.Add(ssf.Create("Foo"));
            GameState.Instance.StarSystems.Add(ssf.Create("Bar"));

            MainWindowGTK win = new MainWindowGTK();

            win.Show();
            Application.Run();
        }
Exemple #3
0
        public void Stargen_Default_StarSystem_With_No_Name_Throws()
        {
            var ssf = new StarSystemFactory(true);

            var ss = ssf.Create("");

            Assert.IsNotNull(ss);
            Assert.AreEqual("", ss.Name);
            Assert.IsNotNull(ss.Stars);
            Assert.GreaterOrEqual(ss.Stars.Count, 1);


            PrintSummary(ss);
        }
Exemple #4
0
        public void Stargen_Default_StarSystem_Without_Moons()
        {
            var        ssf = new StarSystemFactory(false);
            StarSystem ss  = null;

            for (int i = 0; i < 200; i++)
            {
                ss = ssf.Create("Proxima");

                Assert.IsNotNull(ss);
                Assert.AreEqual("Proxima", ss.Name);
                Assert.IsNotNull(ss.Stars);
                Assert.GreaterOrEqual(ss.Stars.Count, 1);
            }

            PrintSummary(ss);
        }
Exemple #5
0
        public void Stargen_Default_StarSystem_With_Moons()
        {
            var        ssf = new StarSystemFactory(true);
            StarSystem ss  = null;

            for (int i = 0; i < 200; i++)
            {
                ss = ssf.Create("Proxima");
                GameState.Instance.StarSystemCurrentIndex++;

                Assert.IsNotNull(ss);
                Assert.AreEqual("Proxima", ss.Name);
                Assert.IsNotNull(ss.Stars);
                Assert.GreaterOrEqual(ss.Stars.Count, 1);
            }

            PrintSummary(ss);
        }
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            m_oSW.Start();

            int iNoOfSystemsToGenerate = 1000;

            int.TryParse(NoOfSystemsTextBox.Text, out iNoOfSystemsToGenerate);
            int iNoOfSystemsDiv4 = iNoOfSystemsToGenerate / 4;

            GenProgressBar.Minimum = 0;
            GenProgressBar.Maximum = iNoOfSystemsToGenerate;

            for (int i = 0; i < iNoOfSystemsToGenerate; ++i)
            {
                GameState.Instance.StarSystems.Add(ssf.Create(GalaxyNameTextBox.Text + i.ToString()));
                GenProgressBar.Value = i;
            }

            m_oSW.Stop();
            Timelabel.Text = m_oSW.Elapsed.Hours.ToString() + ":" + m_oSW.Elapsed.Minutes.ToString() + ":" + m_oSW.Elapsed.Seconds.ToString() + ":" + m_oSW.Elapsed.Milliseconds.ToString();
        }
Exemple #7
0
        public void TestSetup()
        {
            _gameState             = GameState.Instance;
            _gameState.Name        = "Test Game";
            _gameState.Species     = new BindingList <Species>();
            _gameState.Factions    = new BindingList <Faction>();
            _gameState.StarSystems = new BindingList <StarSystem>();
            _gameState.Stars       = new BindingList <Star>();
            _gameState.Planets     = new BindingList <Planet>();

            var species = new Species {
                Id = Guid.NewGuid(), Name = "Test Humans"
            };

            _gameState.Species.Add(species);
            var theme = new FactionTheme {
                Id = Guid.NewGuid(), Name = "Test Theme"
            };

            _gameState.Factions.Add(new Faction(0)
            {
                Id = Guid.NewGuid(), Name = "Test Faction", Species = species, Title = "Mighty Humans", FactionTheme = theme
            });

            var ssf = new StarSystemFactory(true);
            var ss  = ssf.Create("Test Sol");

            GameState.Instance.StarSystemCurrentIndex++;
            ss.Stars.ToList().ForEach(x => _gameState.Stars.Add(x));
            ss.Stars.ToList().SelectMany(x => x.Planets).ToList().ForEach(p => _gameState.Planets.Add(p));

            UriBuilder uri = new UriBuilder(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

            _appPath    = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path));
            _saveFolder = Path.Combine(_appPath, "Test");

            _nameThemes = new List <CommanderNameTheme>();
            var ct1 = new CommanderNameTheme()
            {
                Id          = Guid.NewGuid(),
                Name        = "Test Theme 1",
                NameEntries =
                {
                    new NameEntry()
                    {
                        IsFemale = false, Name = "Bob", NamePosition = NamePosition.FirstName
                    },
                    new NameEntry()
                    {
                        IsFemale = false, Name = "Smith", NamePosition = NamePosition.LastName
                    }
                }
            };

            _nameThemes.Add(ct1);
            var ct2 = new CommanderNameTheme()
            {
                Id          = Guid.NewGuid(),
                Name        = "Test Theme 2",
                NameEntries =
                {
                    new NameEntry()
                    {
                        IsFemale = true, Name = "Sarah", NamePosition = NamePosition.FirstName
                    },
                    new NameEntry()
                    {
                        IsFemale = false, Name = "Connor", NamePosition = NamePosition.LastName
                    }
                }
            };

            _nameThemes.Add(ct2);
        }
Exemple #8
0
 private void GenSystemButton_Click(object sender, EventArgs e)
 {
     m_iNumberOfNewSystemsGened++;
     GameState.Instance.StarSystems.Add(ssf.Create("New System " + m_iNumberOfNewSystemsGened.ToString()));
 }
Exemple #9
0
 private void Start()
 {
     StarSystemFactory.Create(Seed);
 }