private void on_robotData_msg(NetworkMsg msg, Robot robot) { Log.INFO("client {0} receivesd ROBOT_DATA msg from server", robot.m_clientSocket.m_socketId); robot.m_robotGame.reset(); foreach (RobotData robotData in msg.RobotData) { if (robotData.ClientInfo.RobotSocketId == robot.m_clientSocket.m_socketId) { robot.m_mapComponent.m_pos.X = robotData.Position.X; robot.m_mapComponent.m_pos.Y = robotData.Position.Y; } else { int nearbyRobotId = robotData.ClientInfo.RobotSocketId; VisualRobot visualRobot = new VisualRobot(nearbyRobotId); visualRobot.m_mapComponent.m_pos.X = robotData.Position.X; visualRobot.m_mapComponent.m_pos.Y = robotData.Position.Y; robot.m_robotGame.add_visual_robot(nearbyRobotId, visualRobot); } } }
//public void remove_robot(int socketId) //{ // if (m_nearbyAreaRobots.ContainsKey(socketId)) // { // m_nearbyAreaRobots.Remove(socketId); // } //} public void add_visual_robot(int socketId, VisualRobot robot) { m_nearbyAreaRobots.Add(socketId, robot); }