private void ProcessCleanQueue(bool onClose = false) { var workbooks = Application.Workbooks.Cast <Excel.Workbook>().ToArray(); while (CleanQueue.Count > 0) { var closedBookName = ""; if (!CleanQueue.TryDequeue(out closedBookName)) { continue; } if (!onClose && workbooks.Any(x => x.Name == closedBookName)) { continue; } PaneAndControl pane_control; if (Panes.TryRemove(closedBookName, out pane_control)) { CleanUpPaneAndControl(pane_control); } } }
public void OnBeforeClose(Excel.Workbook wb) { // 掃除キューに登録 CleanQueue.Enqueue(wb.Name); }
public void ApplyCombustExplosion(Cell C, List <Cell> UsedCells, List <GameObject> Hit, int Force, bool bLocal, bool bShow, GameObject Owner, string BonusDamage, bool?Phase, bool Neutron = false, float DamageModifier = 1f) { TextConsole textConsole = Look._TextConsole; ScreenBuffer scrapBuffer = TextConsole.ScrapBuffer; if (bShow) { TextConsole.LoadScrapBuffers(); XRLCore.Core.RenderMapToBuffer(scrapBuffer); } CleanQueue <Cell> cleanQueue = new CleanQueue <Cell>(); CleanQueue <int> cleanQueue2 = new CleanQueue <int>(); CleanQueue <string> cleanQueue3 = new CleanQueue <string>(); cleanQueue.Enqueue(C); cleanQueue2.Enqueue(Force); cleanQueue3.Enqueue("."); UsedCells.Add(C); while (cleanQueue.Count > 0) { Cell cell = cleanQueue.Dequeue(); int num = cleanQueue2.Dequeue(); string text = cleanQueue3.Dequeue(); for (int i = 0; i < UsedCells.Count; i++) { Cell cell2 = UsedCells[i]; if (cell2 == null) { return; } if (cell2.ParentZone == XRLCore.Core.Game.ZoneManager.ActiveZone) { scrapBuffer.Goto(cell2.X, cell2.Y); int num2 = Stat.Random(1, 3); if (num2 == 1) { scrapBuffer.Write((Phase != null) ? ((!(Phase == true)) ? "&Y*" : "&K*") : "&M*"); } else if (num2 == 2) { scrapBuffer.Write((Phase != null) ? ((!(Phase == true)) ? "&R*" : "&b*") : "&G*"); } else { scrapBuffer.Write((Phase != null) ? ((!(Phase == true)) ? "&W*" : "&c*") : "&m*"); } } } if (bShow && C.ParentZone != null && C.ParentZone.IsActive()) { textConsole.DrawBuffer(scrapBuffer, null, false); if (Force < 100000) { Thread.Sleep(5); } } List <Cell> list; if (bLocal) { list = cell.GetLocalAdjacentCells(1, false); } else { list = cell.GetAdjacentCells(true); } for (int j = 0; j < UsedCells.Count; j++) { Cell item = UsedCells[j]; if (list.CleanContains(item)) { list.Remove(item); } } int num3 = 0; Damage damage = null; Event @event = null; foreach (GameObject gameObject in cell.GetObjectsWithPart("Physics")) { if (!Hit.Contains(gameObject)) { Hit.Add(gameObject); if (gameObject.PhaseMatches(0)) { num3 += gameObject.Weight; if (damage == null || !string.IsNullOrEmpty(BonusDamage)) { damage = new Damage((int)(DamageModifier * (float)num / 250f)); if (!string.IsNullOrEmpty(BonusDamage)) { damage.Amount += BonusDamage.RollCached(); } damage.AddAttribute("Explosion"); damage.AddAttribute("Heat"); damage.AddAttribute("Fire"); damage.AddAttribute("Concussion"); if (cell != C) { damage.AddAttribute("Accidental"); } } if (@event == null || !string.IsNullOrEmpty(BonusDamage)) { @event = Event.New("TakeDamage", 0, 0, 0); @event.SetParameter("Damage", damage); @event.SetParameter("Owner", Owner); @event.SetParameter("Attacker", Owner); if (Neutron) { if (gameObject.IsPlayer()) { gameObject.pPhysics.LastDeathReason = "Crushed under the weight of a thousand suns."; } @event.SetParameter("Message", "from being crushed under the weight of a thousand suns."); } else { @event.SetParameter("Message", "from %t explosion!"); } } gameObject.FireEvent(@event); } } } System.Random random = new System.Random(); for (int k = 0; k < list.Count; k++) { int index = random.Next(0, list.Count); Cell value = list[k]; list[k] = list[index]; list[index] = value; } Damage damage2 = null; Event event2 = null; for (; ;) { IL_44B: int l = 0; while (l < list.Count) { Cell cell3 = list[l]; if (!bLocal) { goto IL_4AD; } if (cell3.X != 0) { if (cell3.X != 79) { if (cell3.Y != 0) { if (cell3.Y != 24) { goto IL_4AD; } } } } IL_68C: l++; continue; IL_4AD: foreach (GameObject gameObject2 in cell3.GetObjectsWithPart("Physics")) { if (!Hit.Contains(gameObject2)) { Hit.Add(gameObject2); if (gameObject2.PhaseMatches(0)) { if (damage2 == null || !string.IsNullOrEmpty(BonusDamage)) { damage2 = new Damage(num / 250); if (!string.IsNullOrEmpty(BonusDamage)) { damage2.Amount += BonusDamage.RollCached(); } damage2.AddAttribute("Explosion"); damage2.AddAttribute("Accidental"); damage2.AddAttribute("Heat"); damage2.AddAttribute("Fire"); damage2.AddAttribute("Concussion"); } if (event2 == null || !string.IsNullOrEmpty(BonusDamage)) { event2 = Event.New("TakeDamage", 0, 0, 0); event2.SetParameter("Damage", damage2); event2.SetParameter("Owner", Owner); event2.SetParameter("Attacker", Owner); if (Neutron) { if (gameObject2.IsPlayer()) { gameObject2.pPhysics.LastDeathReason = "Crushed under the weight of a thousand suns."; } event2.SetParameter("Message", "from being crushed under the weight of a thousand suns."); } else { event2.SetParameter("Message", "from %t explosion!"); } } gameObject2.FireEvent(event2); } } if (gameObject2.PhaseMatches(0)) { int weight = gameObject2.Weight; if (weight > num) { list.Remove(cell3); goto IL_44B; } if (weight > 0) { gameObject2.Move((!(text == ".")) ? text : Directions.GetRandomDirection(), EnergyCost: 1000); } } } if (cell3.IsSolid()) { list.Remove(cell3); goto IL_44B; } goto IL_68C; } break; } if (list.Count > 0) { int num4 = (num - num3) / list.Count; if (num4 > 100) { foreach (Cell cell4 in list) { if (cell4 != null && !UsedCells.Contains(cell4)) { UsedCells.Add(cell4); cleanQueue.Enqueue(cell4); cleanQueue2.Enqueue(num4); cleanQueue3.Enqueue(cell.GetDirectionFromCell(cell4)); } } } } } }