/// <summary> /// Initializes a new instance of the <see cref="CardGameBase" /> class. /// </summary> /// <param name="octgnGame">The octgn game.</param> /// <param name="gameType">Type of the game.</param> /// <param name="gameName">Name of the game.</param> protected CardGameBase(Game octgnGame, CardGameType gameType, string gameName) { OctgnGame = octgnGame; GameType = gameType; GameName = gameName; TranslationTable = new TranslationTable(gameType); AllCardsOfSelectedGame = octgnGame.AllCards() .Select(c => new WrappedMultiCard(1, c, TranslationTable)) .ToList(); }
public void TestTranslationTable() { var foreign = TestContext.DataRow["Foreign"].ToString(); var english = TestContext.DataRow["English"].ToString(); var target = new TranslationTable(Games.CardGameType.WarhammerInvasion); var found = target.Translations.Where(i => i.Value.NameDe.Equals(foreign, StringComparison.InvariantCultureIgnoreCase)).Select(i => i.Value.NameEn).ToArray(); Assert.AreEqual(1, found.Length, string.Format("Wrong count {0} -> {1}", english, foreign)); Assert.AreEqual(english, found.First(), string.Format("Wrong value {0} -> {1}", english, foreign)); }
public WrappedMultiCard(int quantity, ICard card, TranslationTable translationTable) { Quantity = quantity; Card = card; // IsRestricted = RestrictedListCheck.FindRestrictedCards(new[] { this }).Any(); LocalizedNames = translationTable.GetTranslateItemFromEn(Name); if (LocalizedNames == null) { LocalizedNames = new TranslationItem(); } LocalizationProvider.LocaleChanged += LocalizationProvider_LocaleChanged; }