void Target_OnResourceCleared(TargetProgram.ResourcePoolType pool) { string tPoolName = pool == TargetProgram.ResourcePoolType.Global ? "全局" : "关卡"; for (int i = 0; i < _ResourceStatusListView.Count(); ++i) { List <ListViewItem> tItemsToRemove = new List <ListViewItem>(); foreach (ListViewItem item in _ResourceStatusListView[i].Items) { if (item.SubItems[0].Text == tPoolName) { tItemsToRemove.Add(item); } } ListViewItem tCounter = listView_resourceCounter.Items[i]; double tTotalTime = 0; int tTotalCount = 0; foreach (ListViewItem item in tItemsToRemove) { tTotalTime += Convert.ToDouble(item.SubItems[3].Text); ++tTotalCount; _ResourceStatusListView[i].Items.Remove(item); } double tNewTime = Math.Max(0, Convert.ToDouble(tCounter.SubItems[1].Text) - tTotalTime); if (tNewTime < 0.00001) { tNewTime = 0; } tCounter.SubItems[1].Text = tNewTime.ToString(); tCounter.SubItems[2].Text = (Convert.ToInt32(tCounter.SubItems[2].Text) - tTotalCount).ToString(); } }
void Target_OnResourceLoaded(TargetProgram.ResourceType type, TargetProgram.ResourcePoolType pool, string name, string path, float time) { if ((int)type < 1 || (int)type > _ResourceStatusListView.Count()) { return; } ListViewItem tNewItem = new ListViewItem(pool == TargetProgram.ResourcePoolType.Global ? "全局" : "关卡"); tNewItem.SubItems.Add(new ListViewItem.ListViewSubItem(tNewItem, name)); tNewItem.SubItems.Add(new ListViewItem.ListViewSubItem(tNewItem, path)); tNewItem.SubItems.Add(new ListViewItem.ListViewSubItem(tNewItem, time.ToString())); _ResourceStatusListView[(int)type - 1].Items.Add(tNewItem); ListViewItem tCounter = listView_resourceCounter.Items[(int)type - 1]; tCounter.SubItems[1].Text = (Convert.ToDouble(tCounter.SubItems[1].Text) + time).ToString(); tCounter.SubItems[2].Text = (Convert.ToInt32(tCounter.SubItems[2].Text) + 1).ToString(); }