public override void LoadFromResponse( string apiname, dynamic data ) {
			base.LoadFromResponse( apiname, (object)data );

			var progress = KCDatabase.Instance.QuestProgress;


			//周期任務削除
			if ( DateTimeHelper.IsCrossedDay( progress.LastUpdateTime, 5, 0, 0 ) ) {
				progress.Progresses.RemoveAll( p => ( p.QuestType == 1 || p.QuestID == 211 /* 空母3 */ || p.QuestID == 212 /* 輸送5 */ || p.QuestID == 311 /* 演習勝利7 */ ) );
				Quests.RemoveAll( q => q.Type == 1 || q.QuestID == 211 /* 空母3 */ || q.QuestID == 212 /* 輸送5 */ || q.QuestID == 311 /* 演習勝利7 */  );
			}
			if ( DateTimeHelper.IsCrossedWeek( progress.LastUpdateTime, DayOfWeek.Monday, 5, 0, 0 ) ) {
				progress.Progresses.RemoveAll( p => p.QuestType == 2 );
				Quests.RemoveAll( q => q.Type == 2 );
			}
			if ( DateTimeHelper.IsCrossedMonth( progress.LastUpdateTime, 1, 5, 0, 0 ) ) {
				progress.Progresses.RemoveAll( p => p.QuestType == 3 );
				Quests.RemoveAll( q => q.Type == 3 );
			}


			Count = (int)RawData.api_count;

			if ( RawData.api_list != null ) {	//任務完遂時orページ遷移時 null になる

				foreach ( dynamic elem in RawData.api_list ) {

					if ( !( elem is double ) ) {		//空欄は -1 になるため。

						int id = (int)elem.api_no;
						if ( !Quests.ContainsKey( id ) ) {
							var q = new QuestData();
							q.LoadFromResponse( apiname, elem );
							Quests.Add( q );

						} else {
							Quests[id].LoadFromResponse( apiname, elem );
						}

					}
				}

			}


			IsLoaded = true;

		}
示例#2
0
		public override void LoadFromResponse( string apiname, dynamic data ) {
			base.LoadFromResponse( apiname, (object)data );


			//周期任務削除
			if ( DateTimeHelper.IsCrossedDay( _prevTime, 5, 0, 0 ) ) {
				Quests.RemoveAll( q => q.Type == 2 || q.Type == 4 || q.Type == 5 );
			}
			if ( DateTimeHelper.IsCrossedWeek( _prevTime, DayOfWeek.Monday, 5, 0, 0 ) ) {
				Quests.RemoveAll( q => q.Type == 3 );
			}
			if ( DateTimeHelper.IsCrossedMonth( _prevTime, 1, 5, 0, 0 ) ) {
				Quests.RemoveAll( q => q.Type == 6 );
			}


			Count = (int)RawData.api_count;

			if ( RawData.api_list != null ) {	//任務完遂時orページ遷移時 null になる

				foreach ( dynamic elem in RawData.api_list ) {

					if ( !( elem is double ) ) {		//空欄は -1 になるため。

						int id = (int)elem.api_no;
						if ( !Quests.ContainsKey( id ) ) {
							var q = new QuestData();
							q.LoadFromResponse( apiname, elem );
							Quests.Add( q );

						} else {
							Quests[id].LoadFromResponse( apiname, elem );
						}

					}
				}

			}


			IsLoaded = true;
			_prevTime = DateTime.Now;

		}
示例#3
0
        public override void LoadFromResponse(string apiname, dynamic data)
        {
            base.LoadFromResponse(apiname, (object)data);

            var progress = KCDatabase.Instance.QuestProgress;


            //周期任務削除
            if (DateTimeHelper.IsCrossedDay(progress.LastUpdateTime, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => (p.QuestType == 1 || p.QuestID == 211 /* 空母3 */ || p.QuestID == 212 /* 輸送5 */ || p.QuestID == 311 /* 演習勝利7 */));
                Quests.RemoveAll(q => q.Type == 1 || q.QuestID == 211 /* 空母3 */ || q.QuestID == 212 /* 輸送5 */ || q.QuestID == 311 /* 演習勝利7 */);
            }
            if (DateTimeHelper.IsCrossedWeek(progress.LastUpdateTime, DayOfWeek.Monday, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => p.QuestType == 2);
                Quests.RemoveAll(q => q.Type == 2);
            }
            if (DateTimeHelper.IsCrossedMonth(progress.LastUpdateTime, 1, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => p.QuestType == 3);
                Quests.RemoveAll(q => q.Type == 3);
            }
            if (DateTimeHelper.IsCrossedQuarter(progress.LastUpdateTime, 0, 1, 5, 0, 0))
            {
                progress.Progresses.RemoveAll(p => p.QuestType == 5);
                Quests.RemoveAll(p => p.Type == 5);
            }
            for (int i = 1; i <= 12; i++)
            {
                if (DateTimeHelper.IsCrossedYear(progress.LastUpdateTime, i, 1, 5, 0, 0))
                {
                    progress.Progresses.RemoveAll(p => p.QuestType == 100 + i);
                    Quests.RemoveAll(p => p.LabelType == 100 + i);
                }
            }

            Count = (int)RawData.api_count;

            if (RawData.api_list != null)
            {               //任務完遂時orページ遷移時 null になる
                foreach (dynamic elem in RawData.api_list)
                {
                    if (!(elem is double))
                    {                           //空欄は -1 になるため。
                        int id = (int)elem.api_no;
                        if (!Quests.ContainsKey(id))
                        {
                            var q = new QuestData();
                            q.LoadFromResponse(apiname, elem);
                            Quests.Add(q);
                        }
                        else
                        {
                            Quests[id].LoadFromResponse(apiname, elem);
                        }
                    }
                }
            }


            IsLoaded = true;
        }
        public override void LoadFromResponse(string apiname, dynamic data)
        {
            base.LoadFromResponse(apiname, (object)data);


            //周期任務削除
            if (DateTimeHelper.IsCrossedDay(_prevTime, 5, 0, 0))
            {
                KCDatabase.Instance.QuestProgress.Progresses.RemoveAll(p => {
                    var q = Quests[p.QuestID];
                    return(q != null && (q.Type == 2 || q.Type == 4 || q.Type == 5));
                });
                Quests.RemoveAll(q => q.Type == 2 || q.Type == 4 || q.Type == 5);
            }
            if (DateTimeHelper.IsCrossedWeek(_prevTime, DayOfWeek.Monday, 5, 0, 0))
            {
                KCDatabase.Instance.QuestProgress.Progresses.RemoveAll(p => {
                    var q = Quests[p.QuestID];
                    return(q != null && (q.Type == 3));
                });
                Quests.RemoveAll(q => q.Type == 3);
            }
            if (DateTimeHelper.IsCrossedMonth(_prevTime, 1, 5, 0, 0))
            {
                KCDatabase.Instance.QuestProgress.Progresses.RemoveAll(p => {
                    var q = Quests[p.QuestID];
                    return(q != null && (q.Type == 6));
                });
                Quests.RemoveAll(q => q.Type == 6);
            }


            Count = (int)RawData.api_count;

            if (RawData.api_list != null)                       //任務完遂時orページ遷移時 null になる

            {
                foreach (dynamic elem in RawData.api_list)
                {
                    if (!(elem is double))                                      //空欄は -1 になるため。

                    {
                        int id = (int)elem.api_no;
                        if (!Quests.ContainsKey(id))
                        {
                            var q = new QuestData();
                            q.LoadFromResponse(apiname, elem);
                            Quests.Add(q);
                        }
                        else
                        {
                            Quests[id].LoadFromResponse(apiname, elem);
                        }
                    }
                }
            }


            IsLoaded  = true;
            _prevTime = DateTime.Now;
        }