示例#1
0
 public override bool RemoveAgent(HexSpaceReservationAgent agent)
 {
     if (agent is null)
     {
         throw new ArgumentNullException(nameof(agent));
     }
     if (!spaceReservationAgents.Remove(agent))
     {
         return(false);
     }
     agent.GotFocus  -= HexSpaceReservationAgent_GotFocus;
     agent.LostFocus -= HexSpaceReservationAgent_LostFocus;
     agent.Hide();
     AgentChanged?.Invoke(this, new HexSpaceReservationAgentChangedEventArgs(agent, null));
     UpdateAggregateFocus();
     wpfHexView.QueueSpaceReservationStackRefresh();
     return(true);
 }
示例#2
0
 public override void AddAgent(HexSpaceReservationAgent agent)
 {
     if (wpfHexView.IsClosed)
     {
         throw new InvalidOperationException();
     }
     if (agent is null)
     {
         throw new ArgumentNullException(nameof(agent));
     }
     if (spaceReservationAgents.Contains(agent))
     {
         throw new InvalidOperationException();
     }
     spaceReservationAgents.Add(agent);
     agent.GotFocus  += HexSpaceReservationAgent_GotFocus;
     agent.LostFocus += HexSpaceReservationAgent_LostFocus;
     AgentChanged?.Invoke(this, new HexSpaceReservationAgentChangedEventArgs(null, agent));
     UpdateAggregateFocus();
     wpfHexView.QueueSpaceReservationStackRefresh();
 }
示例#3
0
 private void ActiveAgentChanged(GameObject agent)
 {
     AgentChanged?.Invoke(agent);
 }