void Updated() { if (!KCDatabase.Instance.Quest.IsLoaded) { return; } QuestView.SuspendLayout(); QuestView.Rows.Clear(); foreach (var q in KCDatabase.Instance.Quest.Quests.Values) { if (MenuMain_ShowRunningOnly.Checked && !(q.State == 2 || q.State == 3)) { continue; } switch (q.Type) { case 2: case 4: case 5: if (!MenuMain_ShowDaily.Checked) { continue; } break; case 3: if (!MenuMain_ShowWeekly.Checked) { continue; } break; case 6: if (!MenuMain_ShowMonthly.Checked) { continue; } break; default: if (!MenuMain_ShowOnce.Checked) { continue; } break; } DataGridViewRow row = new DataGridViewRow(); row.CreateCells(QuestView); row.Cells[QuestView_State.Index].Value = (q.State == 3) ? ((bool?)null) : (q.State == 2); row.Cells[QuestView_Type.Index].Value = q.Type; row.Cells[QuestView_Category.Index].Value = q.Category; row.Cells[QuestView_Category.Index].Style = CSCategories[Math.Min(q.Category - 1, 8 - 1)]; row.Cells[QuestView_Name.Index].Value = q.QuestID; row.Cells[QuestView_Name.Index].ToolTipText = string.Format("{0} : {1}\r\n{2}", q.QuestID, q.Name, q.Description); { string value; double tag; if (q.State == 3) { value = "達成!"; tag = 1.0; } else { if (KCDatabase.Instance.QuestProgress.Progresses.ContainsKey(q.QuestID)) { var p = KCDatabase.Instance.QuestProgress.Progresses[q.QuestID]; value = p.ToString(); tag = p.ProgressPercentage; } else { switch (q.Progress) { case 0: value = "-"; tag = 0.0; break; case 1: value = "50%以上"; tag = 0.5; break; case 2: value = "80%以上"; tag = 0.8; break; default: value = "???"; tag = 0.0; break; } } } row.Cells[QuestView_Progress.Index].Value = value; row.Cells[QuestView_Progress.Index].Tag = tag; } QuestView.Rows.Add(row); } if (KCDatabase.Instance.Quest.Quests.Count != KCDatabase.Instance.Quest.Count) { int index = QuestView.Rows.Add(); QuestView.Rows[index].Cells[QuestView_State.Index].Value = null; QuestView.Rows[index].Cells[QuestView_Name.Index].Value = string.Format("(未取得の任務 x {0})", (KCDatabase.Instance.Quest.Count - KCDatabase.Instance.Quest.Quests.Count)); } if (KCDatabase.Instance.Quest.Quests.Count == 0) { int index = QuestView.Rows.Add(); QuestView.Rows[index].Cells[QuestView_State.Index].Value = null; QuestView.Rows[index].Cells[QuestView_Name.Index].Value = "(任務完遂!)"; } //更新時にソートする if (QuestView.SortedColumn != null) { QuestView.Sort(QuestView.SortedColumn, QuestView.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } QuestView.ResumeLayout(); }
void Updated() { if (!KCDatabase.Instance.Quest.IsLoaded) { return; } QuestView.SuspendLayout(); QuestView.Rows.Clear(); foreach (var q in KCDatabase.Instance.Quest.Quests.Values) { if (MenuMain_ShowRunningOnly.Checked && !(q.State == 2 || q.State == 3)) { continue; } switch (q.Type) { case 1: if (!MenuMain_ShowDaily.Checked) { continue; } break; case 2: if (!MenuMain_ShowWeekly.Checked) { continue; } break; case 3: if (!MenuMain_ShowMonthly.Checked) { continue; } break; case 4: default: if (!MenuMain_ShowOnce.Checked) { continue; } break; case 5: if (q.QuestID == 211 || q.QuestID == 212) { // 空母3か輸送5 if (!MenuMain_ShowDaily.Checked) { continue; } } else { if (!MenuMain_ShowOther.Checked) { continue; } } break; } DataGridViewRow row = new DataGridViewRow(); row.CreateCells(QuestView); row.Height = 21; row.Cells[QuestView_State.Index].Value = (q.State == 3) ? ((bool?)null) : (q.State == 2); row.Cells[QuestView_Type.Index].Value = q.Type; row.Cells[QuestView_Category.Index].Value = q.Category; row.Cells[QuestView_Category.Index].Style = CSCategories[Math.Min(q.Category - 1, 8 - 1)]; row.Cells[QuestView_Name.Index].Value = q.QuestID; { var progress = KCDatabase.Instance.QuestProgress[q.QuestID]; row.Cells[QuestView_Name.Index].ToolTipText = $"{q.QuestID} : {q.Name}\r\n{q.Description}\r\n{progress?.GetClearCondition() ?? ""}"; } { string value; double tag; if (q.State == 3) { value = "Complete!"; tag = 1.0; } else { if (KCDatabase.Instance.QuestProgress.Progresses.ContainsKey(q.QuestID)) { var p = KCDatabase.Instance.QuestProgress[q.QuestID]; value = p.ToString(); tag = p.ProgressPercentage; } else { switch (q.Progress) { case 0: value = "-"; tag = 0.0; break; case 1: value = GeneralRes.Over50; tag = 0.5; break; case 2: value = GeneralRes.Over80; tag = 0.8; break; default: value = "???"; tag = 0.0; break; } } } row.Cells[QuestView_Progress.Index].Value = value; row.Cells[QuestView_Progress.Index].Tag = tag; } QuestView.Rows.Add(row); } if (KCDatabase.Instance.Quest.Quests.Count < KCDatabase.Instance.Quest.Count) { int index = QuestView.Rows.Add(); QuestView.Rows[index].Cells[QuestView_State.Index].Value = null; QuestView.Rows[index].Cells[QuestView_Name.Index].Value = string.Format("(other quest x {0})", (KCDatabase.Instance.Quest.Count - KCDatabase.Instance.Quest.Quests.Count)); } if (KCDatabase.Instance.Quest.Quests.Count == 0) { int index = QuestView.Rows.Add(); QuestView.Rows[index].Cells[QuestView_State.Index].Value = null; QuestView.Rows[index].Cells[QuestView_Name.Index].Value = GeneralRes.AllComplete; } //更新時にソートする if (QuestView.SortedColumn != null) { QuestView.Sort(QuestView.SortedColumn, QuestView.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } QuestView.ResumeLayout(); }