/// <summary> /// Handles a mouse click that is somewhere in the game. /// </summary> /// <param name="e"></param> public static void MapMouseClick(MouseEventArgs e) { HistoricalInput historicalInput = Factory.Generate(new InputEventArgs(ShiftDown, CtrlDown, e)); if (historicalInput != null) { History.Enqueue(historicalInput); HandleNewSelectionHistory(); InputAddedHandler(); } }
/// <summary> /// Used to handle the new selection state as dictated by the last <see cref="HistoricalInput"/> added to <see cref="History"/>. /// </summary> private static void HandleNewSelectionHistory() { HistoricalInput lastHistory = History.Last(); if (!lastHistory.OrderedToTile) { if (lastHistory.DeselectingAll) { Selected.Clear(); } foreach (Selectable item in lastHistory.DeselectSome) { Selected.Remove(item); } Selected.AddRange(lastHistory.Selected); } }
/// <summary> /// Used to handle the new selection state as dictated by the last <see cref="HistoricalInput"/> added to <see cref="History"/>. /// </summary> private static void HandleNewSelectionHistory() { HistoricalInput lastHistory = History.Last(); if (!lastHistory.OrderedToTile) { if (lastHistory.DeselectingAll) { Selected.Clear(); MasterLog.DebugWriteLine("Deselected all"); } foreach (Selectable item in lastHistory.DeselectSome) { Selected.Remove(item); MasterLog.DebugWriteLine("Deselected: " + item.MapLocation.ToString()); } Selected.AddRange(lastHistory.Selected); } }