public void ActionProgress(ActionProgressEvent e) { var assignment = this.CurrentAssignment; trace.TraceVerbose("ActionProgress({0}): Worker.Action = {1}, CurrentAssignment {2}, CurrentAssignment.Action = {3}", e.GUID, this.Worker.HasAction ? this.Worker.CurrentAction.ToString() : "<none>", assignment != null ? assignment.ToString() : "<none>", assignment != null && assignment.CurrentAction != null ? assignment.CurrentAction.ToString() : "<none>"); Debug.Assert(this.Worker.HasAction); Debug.Assert(e.GUID == this.Worker.CurrentAction.GUID); if (assignment == null) { trace.TraceVerbose("ActionProgress: no assignment, so not for me"); return; } if (assignment.CurrentAction == null) { // XXX this can happen when doing a multi-turn action, and the user aborts the action. throw new NotImplementedException("implement cancel work"); } // does the action originate from us? if (assignment.CurrentAction.GUID != e.GUID) { throw new NotImplementedException("implement cancel work"); } var state = assignment.ActionProgress(); trace.TraceVerbose("ActionProgress: {0} in {1}", state, assignment); }
public void HandleActionProgressEvent(ActionProgressEvent e) { Debug.Assert(this.HasAction); this.ActionTotalTicks = e.TotalTicks; this.ActionTicksUsed = e.TicksUsed; if (this.AI != null) { this.AI.ActionProgress(e); } }
void HandleActionProgress() { D("ActionProgress({0}, {1}/{2})", this.CurrentAction, this.ActionTicksUsed, this.ActionTotalTicks); var e = new ActionProgressEvent() { GUID = this.CurrentAction.GUID, TicksUsed = this.ActionTicksUsed, TotalTicks = this.ActionTotalTicks, }; if (m_ai != null) { m_ai.ActionProgress(e); } var c = new ActionProgressChange(this) { ActionProgressEvent = e, }; this.World.AddChange(c); }
void IAI.ActionProgress(ActionProgressEvent e) { }
void HandleActionProgress() { D("ActionProgress({0}, {1}/{2})", this.CurrentAction, this.ActionTicksUsed, this.ActionTotalTicks); var e = new ActionProgressEvent() { MagicNumber = this.CurrentAction.MagicNumber, UserID = this.ActionUserID, TicksUsed = this.ActionTicksUsed, TotalTicks = this.ActionTotalTicks, }; if (m_ai != null) m_ai.ActionProgress(e); var c = new ActionProgressChange(this) { ActionProgressEvent = e, }; this.World.AddChange(c); }
public void HandleActionProgressEvent(ActionProgressEvent e) { Debug.Assert(this.HasAction); this.ActionTotalTicks = e.TotalTicks; this.ActionTicksUsed = e.TicksUsed; if (this.AI != null) this.AI.ActionProgress(e); }
public void ActionProgress(ActionProgressEvent e) { var assignment = this.CurrentAssignment; trace.TraceVerbose("ActionProgress({0}): Worker.Action = {1}, CurrentAssignment {2}, CurrentAssignment.Action = {3}", e.MagicNumber, this.Worker.HasAction ? this.Worker.CurrentAction.ToString() : "<none>", assignment != null ? assignment.ToString() : "<none>", assignment != null && assignment.CurrentAction != null ? assignment.CurrentAction.ToString() : "<none>"); Debug.Assert(this.Worker.HasAction); Debug.Assert(e.MagicNumber == this.Worker.CurrentAction.MagicNumber); if (assignment == null) { trace.TraceVerbose("ActionProgress: no assignment, so not for me"); return; } if (assignment.CurrentAction == null) { // XXX this can happen when doing a multi-turn action, and the user aborts the action. throw new NotImplementedException("implement cancel work"); } // does the action originate from us? if (assignment.CurrentAction.MagicNumber != e.MagicNumber) { throw new NotImplementedException("implement cancel work"); } var state = assignment.ActionProgress(); trace.TraceVerbose("ActionProgress: {0} in {1}", state, assignment); }