public virtual void cleanup() { robot = null; // Remove the file system and the manager robotFileSystemManager.cleanup(); robotFileSystemManager = null; }
/// <summary> /// Cleans up the event queue. /// </summary> /// <remarks> /// This method should be called when the event queue is no longer needed, /// i.e. before it must be garbage collected. /// </remarks> public void Cleanup() { // Remove all events Reset(); // Remove all references to robots robot = null; robotProxy = null; }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { IBasicEvents listener = robot.GetBasicEventListener(); if (listener != null) { listener.OnRobotDeath(this); } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { IBasicEvents listener = robot.GetBasicEventListener(); if (listener != null) { listener.OnStatus(this); } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (robot != null) { var listener = robot.GetBasicEventListener() as IBasicEvents2; if (listener != null) { listener.OnBattleEnded(this); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsPaintRobot()) { IPaintEvents listener = ((IPaintRobot) robot).GetPaintEventListener(); if (listener != null) { listener.OnPaint(graphics); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsTeamRobot()) { ITeamEvents listener = ((ITeamRobot) robot).GetTeamEventListener(); if (listener != null) { listener.OnMessageReceived(this); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsTeamRobot()) { ITeamEvents listener = ((ITeamRobot)robot).GetTeamEventListener(); if (listener != null) { listener.OnMessageReceived(this); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsInteractiveRobot()) { IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener(); if (listener != null) { listener.OnMouseWheelMoved(this); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsAdvancedRobot()) { IAdvancedEvents listener = ((IAdvancedRobot)robot).GetAdvancedEventListener(); if (listener != null) { listener.OnSkippedTurn(this); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsInteractiveRobot()) { IInteractiveEvents listener = ((IInteractiveRobot)robot).GetInteractiveEventListener(); if (listener != null) { listener.OnKeyTyped(this); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsPaintRobot()) { IPaintEvents listener = ((IPaintRobot)robot).GetPaintEventListener(); if (listener != null) { listener.OnPaint(graphics); } } }
internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (statics.IsAdvancedRobot()) { IAdvancedEvents listener = ((IAdvancedRobot) robot).GetAdvancedEventListener(); if (listener != null) { listener.OnSkippedTurn(this); } } }
internal override sealed void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { if (robot != null) { IBasicEvents3 listener = robot.GetBasicEventListener() as IBasicEvents3; if (listener != null) { listener.OnRoundEnded(this); } } }
private bool loadRobotRound() { robot = null; try { object instance = Activator.CreateInstance(robotType); robot = instance as IBasicRobot; if (robot == null) { println("SYSTEM: Skipping robot: " + statics.getName()); return(false); } robot.SetOut(output); robot.SetPeer((IBasicRobotPeer)this); Console.SetOut(output); Console.SetError(output); eventManager.SetRobot(robot); } catch (MissingMethodException e) { punishSecurityViolation(statics.getName() + " " + e.Message); return(false); } catch (SecurityException e) { punishSecurityViolation(statics.getName() + " " + e.Message); return(false); } catch (Exception e) { if (e.InnerException is SecurityException) { } println("SYSTEM: An error occurred during initialization of " + statics.getName()); println("SYSTEM: " + e); println(e); robot = null; LoggerN.logMessage(e); return(false); } return(true); }
public void setRobot(IBasicRobot r) { robot = r; }
private bool loadRobotRound() { robot = null; try { object instance = Activator.CreateInstance(robotType); robot = instance as IBasicRobot; if (robot == null) { println("SYSTEM: Skipping robot: " + statics.getName()); return false; } robot.SetOut(output); robot.SetPeer((IBasicRobotPeer) this); Console.SetOut(output); Console.SetError(output); eventManager.SetRobot(robot); } catch (MissingMethodException e) { punishSecurityViolation(statics.getName() + " " + e.Message); return false; } catch (SecurityException e) { punishSecurityViolation(statics.getName() + " " + e.Message); return false; } catch (Exception e) { if (e.InnerException is SecurityException) { } println("SYSTEM: An error occurred during initialization of " + statics.getName()); println("SYSTEM: " + e); println(e); robot = null; LoggerN.logMessage(e); return false; } return true; }
/// <summary> /// Sets the robot that will receive events dispatched from the event queue. /// </summary> /// <param name="robot">is the robot that will receive event dispatched from the event queue.</param> public void SetRobot(IBasicRobot robot) { this.robot = robot; }
public static void Dispatch(Event evnt, IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { eventHelper.Dispatch(evnt, robot, statics, graphics); }
/// <summary> /// Dispatch this event for a robot, it's statistics, and graphics context. /// </summary> /// <param name="robot">the robot to dispatch to.</param> /// <param name="statics">the robot to statistics to.</param> /// <param name="graphics">the robot to graphics to.</param> // This method must be invisible on Robot API internal virtual void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics) { }