Beispiel #1
0
 private GameSession()
 {
     SettingsRaw = ConfigReader.ParseSettingsRaw();
     Settings    = new UserSettings(SettingsRaw);
     Armory      = ConfigReader.ParseArmory();
     DecksRaw    = ConfigReader.ParseDecksRaw();
     Decks       = new Dictionary <string, Deck>();
     foreach (KeyValuePair <string, DeckConfig> kv in DecksRaw)
     {
         Decks.Add(kv.Key, new Deck(kv.Value, Armory));
     }
 }
Beispiel #2
0
        public Deck(DeckConfig deckConfig, Armory armory)
        {
            Categories = new List <Unit> [(int)UnitCategory._SIZE];

            for (int i = 0; i < (int)UnitCategory._SIZE; i++)
            {
                Categories[i] = new List <Unit>();
            }

            foreach (string unitId in deckConfig.UnitIds)
            {
                bool exists = armory.Units.TryGetValue(unitId, out Unit unit);
                if (!exists)
                {
                    Logger.LogConfig(LogLevel.ERROR, $"deck refers to non-existent unit {unitId}");
                }

                Categories[unit.CategoryId].Add(unit);
            }
        }