Exemplo n.º 1
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<SystemBody>();

            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 ss = SystemGen.CreateSystem("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);
        }
        public CommanderNameTheme AddNewTheme(string name)
        {
            var theme = new CommanderNameTheme()
            {
                Id = Guid.NewGuid(),
                Name = name
            };
            CommanderNameThemes.Instance.NameThemes.Add(theme);

            //update binding list
            NameThemes.Add(theme);

            CurrentTheme = theme;
            return theme;
        }