public virtual void cleanup()
        {
            robot = null;

            // Remove the file system and the manager
            robotFileSystemManager.cleanup();
            robotFileSystemManager = null;
        }
        public virtual void cleanup()
        {
            robot = null;

            // Remove the file system and the manager
            robotFileSystemManager.cleanup();
            robotFileSystemManager = null;
        }
Esempio n. 3
0
        /// <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;
        }
Esempio n. 4
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            IBasicEvents listener = robot.GetBasicEventListener();

            if (listener != null)
            {
                listener.OnRobotDeath(this);
            }
        }
Esempio n. 5
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            IBasicEvents listener = robot.GetBasicEventListener();

            if (listener != null)
            {
                listener.OnStatus(this);
            }
        }
Esempio n. 6
0
 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);
         }
     }
 }
Esempio n. 7
0
 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);
         }
     }
 }
Esempio n. 8
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            if (statics.IsPaintRobot())
            {
                IPaintEvents listener = ((IPaintRobot) robot).GetPaintEventListener();

                if (listener != null)
                {
                    listener.OnPaint(graphics);
                }
            }
        }
Esempio n. 9
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            if (statics.IsTeamRobot())
            {
                ITeamEvents listener = ((ITeamRobot) robot).GetTeamEventListener();

                if (listener != null)
                {
                    listener.OnMessageReceived(this);
                }
            }
        }
Esempio n. 10
0
        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);
                }
            }
        }
Esempio n. 12
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            if (statics.IsAdvancedRobot())
            {
                IAdvancedEvents listener = ((IAdvancedRobot)robot).GetAdvancedEventListener();

                if (listener != null)
                {
                    listener.OnSkippedTurn(this);
                }
            }
        }
Esempio n. 13
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            if (statics.IsInteractiveRobot())
            {
                IInteractiveEvents listener = ((IInteractiveRobot)robot).GetInteractiveEventListener();

                if (listener != null)
                {
                    listener.OnKeyTyped(this);
                }
            }
        }
Esempio n. 14
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            if (statics.IsPaintRobot())
            {
                IPaintEvents listener = ((IPaintRobot)robot).GetPaintEventListener();

                if (listener != null)
                {
                    listener.OnPaint(graphics);
                }
            }
        }
Esempio n. 15
0
        internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
        {
            if (statics.IsAdvancedRobot())
            {
                IAdvancedEvents listener = ((IAdvancedRobot) robot).GetAdvancedEventListener();

                if (listener != null)
                {
                    listener.OnSkippedTurn(this);
                }
            }
        }
Esempio n. 16
0
        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);
                }
            }
        }
        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);
                }
            }
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
 public void setRobot(IBasicRobot r)
 {
     robot = r;
 }
Esempio n. 20
0
        /// <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;
        }
        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;
        }
Esempio n. 22
0
 /// <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;
 }
Esempio n. 23
0
 /// <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);
 }
Esempio n. 25
0
 /// <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)
 {
 }
Esempio n. 26
0
 public static void Dispatch(Event evnt, IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
 {
     eventHelper.Dispatch(evnt, robot, statics, graphics);
 }