public void Initialize() { var settingsDB = PlayerSettingsDB.Get(); var modelProxyDB = ModelProxyDB.Get(); favDecks.SuspendNotifies(); foreach (var favDeckOb in settingsDB.favDecks) { var deck = new CardCollectionViewModel() { Name = favDeckOb.Name }; foreach (var cardOb in favDeckOb.knownCards) { var cardVM = new CardViewModel() { CardModel = modelProxyDB.GetCardProxy(cardOb) }; deck.Cards.Add(cardVM); } var favDeck = new SolvableDeckViewModel() { Deck = deck }; favDecks.Add(favDeck); favDeck.RefreshSolver(gameModel, favDeckOb); } favDecks.ResumeNotifies(); }
private bool LoadAssets() { bool bResult = false; try { var resManager = new ResourceManager("FFTriadBuddy.Properties.Resources", Assembly.GetExecutingAssembly()); var assets = (byte[])resManager.GetObject("assets"); if (AssetManager.Get().Init(assets)) { LocalizationDB.SetCurrentUserLanguage(CultureInfo.CurrentCulture.Name); bResult = TriadCardDB.Get().Load(); bResult = bResult && TriadNpcDB.Get().Load(); bResult = bResult && ImageHashDB.Get().Load(); bResult = bResult && TriadTournamentDB.Get().Load(); bResult = bResult && LocalizationDB.Get().Load(); if (bResult) { SettingsModel.Initialize(); IconDB.Get().Load(); ModelProxyDB.Get().Load(); TriadGameSession.StaticInitialize(); } } } catch (Exception ex) { Logger.WriteLine("Init failed: " + ex); bResult = false; } return(bResult); }
private void GenerateMatches() { if (listMatches.Count > 0) { return; } var modelProxyDB = ModelProxyDB.Get(); switch (hashData.type) { case EImageHashType.Rule: foreach (var rule in modelProxyDB.Rules) { if ((rule.modOb is TriadGameModifierNone) == false) { listMatches.Add(rule); } } listMatches.Sort(); break; case EImageHashType.Cactpot: if (listCactpotNumbers == null) { listCactpotNumbers = new List <NumberVM>(); for (int idx = 1; idx <= 9; idx++) { listCactpotNumbers.Add(new NumberVM() { Value = idx }); } } listMatches.AddRange(listCactpotNumbers); break; case EImageHashType.CardImage: var sameNumberId = ((TriadCard)hashData.ownerOb).SameNumberId; foreach (var cardOb in TriadCardDB.Get().sameNumberMap[sameNumberId]) { listMatches.Add(modelProxyDB.GetCardProxy(cardOb)); } listMatches.Sort(); break; case EImageHashType.CardNumber: if (listCardNumbers == null) { listCardNumbers = new List <NumberVM>(); for (int idx = 1; idx <= 10; idx++) { listCardNumbers.Add(new NumberVM() { Value = idx }); } } listMatches.AddRange(listCardNumbers); break; default: break; } currentMatch = listMatches.Find(x => x.GetMatchOwner().Equals(hashData.ownerOb)); }