Exemple #1
0
        private void LoadCards()
        {
            TriadCardDB cardDB = TriadCardDB.Get();

            cards.Clear();

            for (int idx = 0; idx < cardDB.cards.Count; idx++)
            {
                var cardEntry = cardDB.cards[idx];
                if (cardEntry != null)
                {
                    cards.Add(new CardModelProxy(cardEntry));
                }
            }
        }
Exemple #2
0
        private void LoadCardImages()
        {
            mapCardImages = new List<BitmapImage>();

            string nullImagePath = "icons/082500.png";
            var nullImg = LoadImageFromAsset(nullImagePath);

            TriadCardDB cardDB = TriadCardDB.Get();
            for (int idx = 0; idx < cardDB.cards.Count; idx++)
            {
                if (cardDB.cards[idx] != null)
                {
                    string loadPath = "icons/" + cardDB.cards[idx].IconPath;
                    var loadedImage = LoadImageFromAsset(loadPath);
                    mapCardImages.Add(loadedImage);
                }
                else
                {
                    mapCardImages.Add(nullImg);
                }
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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));
        }