示例#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
        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);
 }