コード例 #1
0
ファイル: MissionModel.cs プロジェクト: Niroh99/WFDTO
        private MissionRewardsModel ParseRewards()
        {
            var missionRewards = new MissionRewardsModel();

            if (Rewards.Type == JTokenType.Array)
            {
                var children = Rewards.Children <JObject>().ToList();

                missionRewards.AddRange(GetItemModels(children));
            }
            else if (Rewards.Type == JTokenType.Object)
            {
                var jObject = Rewards as JObject;

                var properties = jObject.Properties().ToList();

                if (properties.Count == 3)
                {
                    var children = properties[0].Value.Children <JObject>().ToList();

                    missionRewards.A = GetItemModels(children);

                    children = properties[1].Value.Children <JObject>().ToList();

                    missionRewards.B = GetItemModels(children);

                    children = properties[2].Value.Children <JObject>().ToList();

                    missionRewards.C = GetItemModels(children);
                }
            }

            return(missionRewards);
        }