-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load the card with specific language #171
Comments
The following method should use First instead of FirstOrDefault public static Card FromName(string cardName)
{
return Data.Cards.FirstOrDefault(x => x.Value.Name == cardName && x.Value.Collectible).Value;
} Currently when I switch the language of Cards to zhCN var game = new Game(new GameConfig
{
StartPlayer = 1,
Player1HeroClass = CardClass.PRIEST,
Player1Deck = new List<Card>()
{
Cards.FromName("Lesser Diamond Spellstone"),
},
Player2HeroClass = CardClass.PRIEST,
Shuffle = false,
FillDecks = true,
FillDecksPredictably = true
}); The above code |
If you change it to |
Yes, I think it should throw exception if we can not find the card. Otherwise it's too late when I find the card is null. How do you think about the language setting for Cards? |
Currently |
Maybe we can get the language from App.config in static constructor? Add a app setting with key Language or CardLanguage, then read it from config file. |
From another repository, I find the card implementation https://github.com/HearthSim/HearthDb/blob/master/HearthDb/Card.cs#L26 |
Currently we did not have a chance to set the default language, it's hard coded in
https://github.com/HearthSim/SabberStone/blob/master/SabberStoneCore/src/Loader/CardLoader.cs#L109
We also need add support for the FromName method of Cards
https://github.com/HearthSim/SabberStone/blob/master/SabberStoneCore/src/Model/Cards.cs#L333
The text was updated successfully, but these errors were encountered: