예제 #1
0
        public string Enqueue(Ship ship)
        {
            lock (queue)
            {
                if (queue.Count >= maxCount)
                    return "The spawn queue is full.";

                var removeList = queue.Where(i => i.Name == ship.Name).ToList();
                foreach (var remove in removeList)
                {
                    queue.Remove(remove);
                }

                queue.AddLast(ship);
                return "Your ship will spawn shortly.";
            }
        }
예제 #2
0
파일: Server.cs 프로젝트: Rohansi/Programe
        public static void HandleUpload(NetConnection connection, Packet packet)
        {
            var upload = (Upload)packet;
            var session = SessionManager.Get(connection.RemoteUniqueIdentifier);

            string message = null;
            if (session.Account == null)
                message = "You need to login to do that.";

            if (message == null)
            {
                var ship = new Ship(session.Account.Username, upload.Program);
                message = Game.SpawnQueue.Enqueue(ship);
            }

            var messagePacket = new Message()
            {
                Title = "Upload",
                Content = message
            };
            Send(messagePacket, session);
        }
예제 #3
0
파일: Game.cs 프로젝트: Rohansi/Programe
 public static void Despawn(Ship ship)
 {
     World.RemoveBody(ship.Body);
     ships.Remove(ship);
 }