Exemplo n.º 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.";
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static void Despawn(Ship ship)
 {
     World.RemoveBody(ship.Body);
     ships.Remove(ship);
 }