コード例 #1
0
        async void LoadData(int id)
        {
            if (Monster == null)
            {
                Monster = await MHDatabaseHelper.GetMonster(id);
            }
            if (Damages == null)
            {
                Damages = await MHDatabaseHelper.GetMonsterDamageForMonster(id);
            }
            if (Statuses == null)
            {
                Statuses = await MHDatabaseHelper.GetMonsterStatusForMonster(id);
            }

            if (Habitats == null)
            {
                Habitats = await MHDatabaseHelper.GetHabitatForMonster(id);
            }

            //Crazy LINQ queries that get the hunting rewards grouped by condition.
            if (LowHuntingRewardGroup == null)
            {
                LowHuntingRewardGroup = (from item in (await MHDatabaseHelper.GetHuntingRewardsForMonsterRank(id, "LR"))
                                         group item by item.condition into huntGroup
                                         select new HuntingRewardGroup(huntGroup)
                {
                    Condition = huntGroup.Key
                }).ToList();
            }
            if (HighHuntingRewardGroup == null)
            {
                HighHuntingRewardGroup = (from item in (await MHDatabaseHelper.GetHuntingRewardsForMonsterRank(id, "HR"))
                                          group item by item.condition into huntGroup
                                          select new HuntingRewardGroup(huntGroup)
                {
                    Condition = huntGroup.Key
                }).ToList();
            }
            if (GHuntingRewardGroup == null)
            {
                GHuntingRewardGroup = (from item in (await MHDatabaseHelper.GetHuntingRewardsForMonsterRank(id, "G"))
                                       group item by item.condition into huntGroup
                                       select new HuntingRewardGroup(huntGroup)
                {
                    Condition = huntGroup.Key
                }).ToList();
            }

            if (Quests == null)
            {
                Quests = await MHDatabaseHelper.GetQuestsForMonster(id);
            }
        }