Example #1
0
 public BattleBanzai(Room room)
 {
     this.room          = room;
     this.banzaiTiles   = new Hashtable();
     this.banzaiStarted = false;
     this.pucks         = new QueuedDictionary <uint, RoomItem>();
 }
Example #2
0
 public GameItemHandler(Room room)
 {
     this.room            = room;
     this.rnd             = new Random();
     this.banzaiPyramids  = new QueuedDictionary <uint, RoomItem>();
     this.banzaiTeleports = new QueuedDictionary <uint, RoomItem>();
 }
        public void QueuedDictionaryEvictAccessCountMru()
        {
            QueuedDictionary<Guid, int> dict = new QueuedDictionary<Guid, int>(3, QueuedDictionaryAccessCompareMode.AccessCountDescending);
            Guid one = Guid.NewGuid(), two = Guid.NewGuid(), three = Guid.NewGuid();

            dict[one] = 1;
            dict[two] = 2;
            dict[three] = 3;

            for (int i = 0; i < 5; i++)
            {
                int value = dict[one];
                value = dict[two];
                value = dict[three];
            }

            for (int i = 0; i < 25; i++)
            {
                dict[Guid.NewGuid()] = i;
            }

            Assert.AreEqual(3, dict.Count);
            Assert.IsFalse(dict.ContainsKey(one));
            Assert.IsFalse(dict.ContainsKey(two));
            Assert.IsFalse(dict.ContainsKey(three));
        }
Example #4
0
 public GameItemHandler(Room room)
 {
     this.room = room;
     this.rnd = new Random();
     this.banzaiPyramids = new QueuedDictionary<uint, RoomItem>();
     this.banzaiTeleports = new QueuedDictionary<uint, RoomItem>();
 }
Example #5
0
 public BattleBanzai(Room room)
 {
     this.room = room;
     this.banzaiTiles = new Hashtable();
     this.banzaiStarted = false;
     this.pucks = new QueuedDictionary<uint, RoomItem>();
 }
Example #6
0
 internal void Destroy()
 {
     Array.Clear(gates, 0, gates.Length);
     gates = null;
     room = null;
     balls.Destroy();
     balls = null;
 }
Example #7
0
 internal void Destroy()
 {
     Array.Clear(this.gates, 0, this.gates.Length);
     this.gates = null;
     this.room  = null;
     this.balls.Destroy();
     this.balls = null;
 }
Example #8
0
 public BattleBanzai(Room room)
 {
     _room          = room;
     BanzaiTiles    = new HybridDictionary();
     IsBanzaiActive = false;
     _pucks         = new QueuedDictionary <uint, RoomItem>();
     _timestarted   = 0.0;
 }
Example #9
0
		internal void Destroy()
		{
			Array.Clear(this.gates, 0, this.gates.Length);
			this.gates = null;
			this.room = null;
			this.balls.Destroy();
			this.balls = null;
		}
Example #10
0
 internal void Destroy()
 {
     Array.Clear(gates, 0, gates.Length);
     gates = null;
     room  = null;
     balls.Destroy();
     balls = null;
 }
Example #11
0
 public BattleBanzai(Room room)
 {
     this.room = room;
     this.banzaiTiles = new HybridDictionary();
     this.banzaiStarted = false;
     this.pucks = new QueuedDictionary<uint, RoomItem>();
     this.timestarted = 0.0;
 }
Example #12
0
 internal void Destroy()
 {
     Array.Clear(_gates, 0, _gates.Length);
     _gates = null;
     _room = null;
     _balls.Destroy();
     _balls = null;
 }
Example #13
0
 public BattleBanzai(Room room)
 {
     _room = room;
     BanzaiTiles = new HybridDictionary();
     IsBanzaiActive = false;
     _pucks = new QueuedDictionary<uint, RoomItem>();
     _timestarted = 0.0;
 }
Example #14
0
 public BattleBanzai(Room room)
 {
     this.room          = room;
     this.banzaiTiles   = new HybridDictionary();
     this.banzaiStarted = false;
     this.pucks         = new QueuedDictionary <uint, RoomItem>();
     this.timestarted   = 0.0;
 }
Example #15
0
 internal void Destroy()
 {
     Array.Clear(_gates, 0, _gates.Length);
     _gates = null;
     _room  = null;
     _balls.Destroy();
     _balls = null;
 }
Example #16
0
 public GameManager(Room room)
 {
     TeamPoints = new int[5];
     _redTeamItems = new QueuedDictionary<uint, RoomItem>();
     _blueTeamItems = new QueuedDictionary<uint, RoomItem>();
     _greenTeamItems = new QueuedDictionary<uint, RoomItem>();
     _yellowTeamItems = new QueuedDictionary<uint, RoomItem>();
     _room = room;
 }
Example #17
0
		public GameManager(Room room)
		{
			this.TeamPoints = new int[5];
			this.redTeamItems = new QueuedDictionary<uint, RoomItem>();
			this.blueTeamItems = new QueuedDictionary<uint, RoomItem>();
			this.greenTeamItems = new QueuedDictionary<uint, RoomItem>();
			this.yellowTeamItems = new QueuedDictionary<uint, RoomItem>();
			this.room = room;
		}
Example #18
0
 public GameManager(Room room)
 {
     TeamPoints       = new int[5];
     _redTeamItems    = new QueuedDictionary <uint, RoomItem>();
     _blueTeamItems   = new QueuedDictionary <uint, RoomItem>();
     _greenTeamItems  = new QueuedDictionary <uint, RoomItem>();
     _yellowTeamItems = new QueuedDictionary <uint, RoomItem>();
     _room            = room;
 }
Example #19
0
 public GameManager(Room room)
 {
     this.TeamPoints      = new int[5];
     this.redTeamItems    = new QueuedDictionary <uint, RoomItem>();
     this.blueTeamItems   = new QueuedDictionary <uint, RoomItem>();
     this.greenTeamItems  = new QueuedDictionary <uint, RoomItem>();
     this.yellowTeamItems = new QueuedDictionary <uint, RoomItem>();
     this.room            = room;
 }
Example #20
0
 internal void Destroy()
 {
     room = null;
     usersByUserID.Clear();
     usersByUserID = null;
     OnUserEnter   = null;
     _unitList.Destroy();
     _unitList = null;
 }
Example #21
0
 internal void Destroy()
 {
     if (banzaiTeleports != null)
         banzaiTeleports.Destroy();
     if (banzaiPyramids != null)
         banzaiPyramids.Clear();
     banzaiPyramids = null;
     banzaiTeleports = null;
     room = null;
     rnd = null;
 }
Example #22
0
 internal void Destroy()
 {
     this.banzaiTiles.Clear();
     this.pucks.Clear();
     Array.Clear((Array)this.floorMap, 0, this.floorMap.Length);
     this.field.destroy();
     this.room        = (Room)null;
     this.banzaiTiles = (HybridDictionary)null;
     this.pucks       = (QueuedDictionary <uint, RoomItem>)null;
     this.floorMap    = (byte[, ])null;
     this.field       = (GameField)null;
 }
Example #23
0
 internal void Destroy()
 {
     BanzaiTiles.Clear();
     _pucks.Clear();
     Array.Clear(_floorMap, 0, _floorMap.Length);
     _field.Destroy();
     _room       = null;
     BanzaiTiles = null;
     _pucks      = null;
     _floorMap   = null;
     _field      = null;
 }
Example #24
0
 internal void Destroy()
 {
     room = null;
     usersByUsername.Clear();
     usersByUsername = null;
     usersByUserID.Clear();
     usersByUserID = null;
     OnUserEnter   = null;
     pets.Clear();
     pets = null;
     userlist.Destroy();
     userlist = null;
 }
Example #25
0
        internal void Destroy()
        {
            banzaiTiles.Clear();
            pucks.Clear();
            Array.Clear(floorMap, 0, floorMap.Length);
            field.destroy();

            room        = null;
            banzaiTiles = null;
            pucks       = null;
            floorMap    = null;
            field       = null;
        }
Example #26
0
        public RoomUnitManager(Room room)
        {
            //this.RoomUserCounter = 0;
            this.room = room;
            this._unitList = new QueuedDictionary<int, RoomUnit>(new EventHandler(UnitList_onAdd), null, new EventHandler(UnitList_onRemove), null);

            this.usersByUserID = new Hashtable();
            this.primaryPrivateUserID = 0;
            this.secondaryPrivateUserID = 0;
            this.ToRemove = new List<RoomUser>(room.UsersMax);

            this.petCount = 0;
            this.userCount = 0;
        }
Example #27
0
 /// <summary>
 ///     Destroys this instance.
 /// </summary>
 internal void Destroy()
 {
     if (_banzaiTeleports != null)
     {
         _banzaiTeleports.Destroy();
     }
     if (_banzaiPyramids != null)
     {
         _banzaiPyramids.Clear();
     }
     _banzaiPyramids  = null;
     _banzaiTeleports = null;
     _room            = null;
 }
Example #28
0
        public RoomUnitManager(Room room)
        {
            //this.RoomUserCounter = 0;
            this.room      = room;
            this._unitList = new QueuedDictionary <int, RoomUnit>(new EventHandler(UnitList_onAdd), null, new EventHandler(UnitList_onRemove), null);

            this.usersByUserID          = new Hashtable();
            this.primaryPrivateUserID   = 0;
            this.secondaryPrivateUserID = 0;
            this.ToRemove = new List <RoomUser>(room.UsersMax);

            this.petCount  = 0;
            this.userCount = 0;
        }
Example #29
0
 internal void Destroy()
 {
     if (banzaiTeleports != null)
     {
         banzaiTeleports.Destroy();
     }
     if (banzaiPyramids != null)
     {
         banzaiPyramids.Clear();
     }
     banzaiPyramids  = null;
     banzaiTeleports = null;
     room            = null;
     rnd             = null;
 }
Example #30
0
 internal void Destroy()
 {
     if (this.banzaiTeleports != null)
     {
         this.banzaiTeleports.Destroy();
     }
     if (this.banzaiPyramids != null)
     {
         this.banzaiPyramids.Clear();
     }
     this.banzaiPyramids  = null;
     this.banzaiTeleports = null;
     this.room            = null;
     this.rnd             = null;
 }
Example #31
0
 public RoomUserManager(Room room)
 {
     this.room = room;
     this.userlist = new QueuedDictionary<int, RoomUser>(new EventHandler(this.OnUserAdd), null, new EventHandler(this.onRemove), null);
     this.pets = new HybridDictionary();
     this.bots = new HybridDictionary();
     this.usersByUsername = new HybridDictionary();
     this.usersByUserID = new HybridDictionary();
     this.primaryPrivateUserID = 0;
     this.secondaryPrivateUserID = 0;
     this.ToRemove = new List<RoomUser>(room.UsersMax);
     this.ToSet = new Dictionary<Point, RoomUser>();
     this.petCount = 0;
     this.userCount = 0;
 }
Example #32
0
 internal void Destroy()
 {
     Array.Clear(TeamPoints, 0, TeamPoints.Length);
     _redTeamItems.Destroy();
     _blueTeamItems.Destroy();
     _greenTeamItems.Destroy();
     _yellowTeamItems.Destroy();
     TeamPoints       = null;
     OnScoreChanged   = null;
     OnGameStart      = null;
     OnGameEnd        = null;
     _redTeamItems    = null;
     _blueTeamItems   = null;
     _greenTeamItems  = null;
     _yellowTeamItems = null;
     _room            = null;
 }
Example #33
0
 internal void Destroy()
 {
     Array.Clear(this.TeamPoints, 0, this.TeamPoints.Length);
     this.redTeamItems.Destroy();
     this.blueTeamItems.Destroy();
     this.greenTeamItems.Destroy();
     this.yellowTeamItems.Destroy();
     this.TeamPoints      = null;
     this.OnScoreChanged  = null;
     this.OnGameStart     = null;
     this.OnGameEnd       = null;
     this.redTeamItems    = null;
     this.blueTeamItems   = null;
     this.greenTeamItems  = null;
     this.yellowTeamItems = null;
     this.room            = null;
 }
Example #34
0
		public RoomItemHandling(Room room)
		{
			this.room = room;
			this.mRemovedItems = new HybridDictionary();
			this.mMovedItems = new HybridDictionary();
			this.mAddedItems = new HybridDictionary();
			this.mRollers = new QueuedDictionary<uint, RoomItem>();
			this.mWallItems = new QueuedDictionary<uint, RoomItem>();
			this.mFloorItems = new QueuedDictionary<uint, RoomItem>();
			this.roomItemUpdateQueue = new Queue();
			this.mGotRollers = false;
			this.mRoolerCycle = 0;
			this.mRollerSpeed = 4;
			this.HopperCount = 0;
			this.rollerItemsMoved = new List<uint>();
			this.rollerUsersMoved = new List<uint>();
			this.rollerMessages = new List<ServerMessage>();
		}
Example #35
0
        public RoomUserManager(Room room)
        {
            //this.RoomUserCounter = 0;
            this.room = room;
            this.userlist = new QueuedDictionary<int, RoomUser>(new EventHandler(OnUserAdd), null, new EventHandler(onRemove), null);
            this.pets = new Hashtable();
            this.bots = new Hashtable();

            this.usersByUsername = new Hashtable();
            this.usersByUserID = new Hashtable();
            this.primaryPrivateUserID = 0;
            this.secondaryPrivateUserID = 0;
            this.ToRemove = new List<RoomUser>(room.UsersMax);
            this.cycledUsers = new List<int>();

            this.petCount = 0;
            this.userCount = 0;
        }
Example #36
0
        internal void Destroy()
        {
            mFloorItems.Clear();
            mWallItems.Clear();
            mRemovedItems.Clear();
            mMovedItems.Clear();
            mAddedItems.Clear();
            roomItemUpdateQueue.Clear();

            room                = null;
            mFloorItems         = null;
            mWallItems          = null;
            mRemovedItems       = null;
            mMovedItems         = null;
            mAddedItems         = null;
            mWallItems          = null;
            roomItemUpdateQueue = null;
        }
Example #37
0
        public RoomItemHandling(Room room)
        {
            this.room = room;

            this.mRemovedItems = new Hashtable();
            this.mMovedItems   = new Hashtable();
            this.mAddedItems   = new Hashtable();
            this.mRollers      = new QueuedDictionary <uint, RoomItem>();

            this.mWallItems          = new QueuedDictionary <uint, RoomItem>();
            this.mFloorItems         = new QueuedDictionary <uint, RoomItem>();
            this.roomItemUpdateQueue = new Queue();
            this.mGotRollers         = false;
            this.mRoolerCycle        = 0;
            this.mRollerSpeed        = 4;

            rollerItemsMoved = new List <uint>();
            rollerUnitsMoved = new List <int>();
            rollerMessages   = new List <ServerMessage>();
        }
Example #38
0
		internal void Destroy()
		{
			if (this.banzaiTeleports != null)
			{
				this.banzaiTeleports.Destroy();
			}
			if (this.banzaiPyramids != null)
			{
				this.banzaiPyramids.Clear();
			}
			this.banzaiPyramids = null;
			this.banzaiTeleports = null;
			this.room = null;
			this.rnd = null;
		}
Example #39
0
 public Soccer(Room room)
 {
     _room = room;
     _gates = new RoomItem[4];
     _balls = new QueuedDictionary<uint, RoomItem>();
 }
Example #40
0
		internal void Destroy()
		{
			Array.Clear(this.TeamPoints, 0, this.TeamPoints.Length);
			this.redTeamItems.Destroy();
			this.blueTeamItems.Destroy();
			this.greenTeamItems.Destroy();
			this.yellowTeamItems.Destroy();
			this.TeamPoints = null;
			this.OnScoreChanged = null;
			this.OnGameStart = null;
			this.OnGameEnd = null;
			this.redTeamItems = null;
			this.blueTeamItems = null;
			this.greenTeamItems = null;
			this.yellowTeamItems = null;
			this.room = null;
		}
        public void QueuedDictionaryEvictCreationDateMru()
        {
            QueuedDictionary<Guid, int> dict = new QueuedDictionary<Guid, int>(3, QueuedDictionaryAccessCompareMode.CreationDateDescending);
            Queue<Guid> queue = new Queue<Guid>();

            for (int i = 0; i < 25; i++)
            {
                Guid key = Guid.NewGuid();
                dict[key] = i;
                queue.Enqueue(key);
                Thread.Sleep(1);
            }

            Assert.AreEqual(3, dict.Count);
            Assert.IsTrue(dict.ContainsKey(queue.Dequeue()));
            Assert.IsTrue(dict.ContainsKey(queue.Dequeue()));
            Assert.IsTrue(dict.ContainsKey(queue.Dequeue()));
        }
Example #42
0
        private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int Category,
                                int State, int UsersMax, string ModelName, string CCTs, int Score, List <string> pTags, bool AllowPets,
                                bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor,
                                string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness)
        {
            this.mDisposed   = false;
            this.Id          = Id;
            this.Name        = Name;
            this.Description = Description;
            this.Owner       = Owner;
            this.Category    = Category;
            this.Type        = Type;
            this.State       = State;
            this.UsersNow    = 0;
            this.UsersMax    = UsersMax;
            this.ModelName   = ModelName;
            this.CCTs        = CCTs;
            this.Score       = Score;

            tagCount  = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.AllowPets        = AllowPets;
            this.AllowPetsEating  = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall         = Hidewall;


            this.myIcon             = Icon;
            this.Password           = Password;
            this.Bans               = new Dictionary <UInt32, double>();
            this.Wallpaper          = Wallpaper;
            this.Floor              = Floor;
            this.Landscape          = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.groups             = new QueuedDictionary <int, Group>();
            this.ActiveTrades       = new ArrayList();


            this.mCycleEnded = false;

            this.mRoomData         = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages     = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

            this.roomMessages       = new Queue();
            this.roomAlerts         = new Queue();
            this.roomBadge          = new Queue();
            this.roomKick           = new Queue();
            this.roomServerMessages = new Queue();
            this.IdleTime           = 0;
            this.RoomMuted          = false;
            this.WallThickness      = walltickness;
            this.FloorThickness     = floorthickness;

            this.gamemap          = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager  = new RoomUserManager(this);
            this.wiredHandler     = new WiredHandler(this);

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Pici.Storage.Database.DatabaseType.MySQL)
                {
                    dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
                }
                else
                {
                    dbClient.runFastQuery("IF EXISTS (SELECT roomid FROM room_active WHERE roomid = " + Id + ") " +
                                          "UPDATE room_active SET active_users = 1 WHERE roomid = " + Id + " " +
                                          "ELSE " +
                                          "INSERT INTO room_active VALUES (" + Id + ",1)");
                }
            }

            PiciEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
Example #43
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="GameItemHandler" /> class.
 /// </summary>
 /// <param name="room">The room.</param>
 public GameItemHandler(Room room)
 {
     _room            = room;
     _banzaiPyramids  = new ConcurrentDictionary <uint, RoomItem>();
     _banzaiTeleports = new QueuedDictionary <uint, RoomItem>();
 }
Example #44
0
		public Soccer(Room room)
		{
			this.room = room;
			this.gates = new RoomItem[4];
			this.balls = new QueuedDictionary<uint, RoomItem>();
		}
Example #45
0
 internal void Destroy()
 {
     this.room = null;
     this.usersByUsername.Clear();
     this.usersByUsername = null;
     this.usersByUserID.Clear();
     this.usersByUserID = null;
     this.OnUserEnter = null;
     this.pets.Clear();
     this.bots.Clear();
     this.pets = null;
     this.bots = null;
     this.userlist.Destroy();
     this.userlist = null;
 }
Example #46
0
 internal void Destroy()
 {
     room = null;
     usersByUsername.Clear();
     usersByUsername = null;
     usersByUserID.Clear();
     usersByUserID = null;
     OnUserEnter = null;
     pets.Clear();
     pets = null;
     userlist.Destroy();
     userlist = null;
 }
Example #47
0
 internal void Destroy()
 {
     this.banzaiTiles.Clear();
     this.pucks.Clear();
     Array.Clear((Array)this.floorMap, 0, this.floorMap.Length);
     this.field.destroy();
     this.room = (Room)null;
     this.banzaiTiles = (HybridDictionary)null;
     this.pucks = (QueuedDictionary<uint, RoomItem>)null;
     this.floorMap = (byte[,])null;
     this.field = (GameField)null;
 }
Example #48
0
 public Soccer(Room room)
 {
     this.room  = room;
     this.gates = new RoomItem[4];
     this.balls = new QueuedDictionary <uint, RoomItem>();
 }
Example #49
0
        internal void Destroy()
        {
            mFloorItems.Clear();
            mWallItems.Clear();
            mRemovedItems.Clear();
            mMovedItems.Clear();
            mAddedItems.Clear();
            roomItemUpdateQueue.Clear();

            room = null;
            mFloorItems = null;
            mWallItems = null;
            mRemovedItems = null;
            mMovedItems = null;
            mAddedItems = null;
            mWallItems = null;
            roomItemUpdateQueue = null;
        }
Example #50
0
		internal void Destroy()
		{
			this.mFloorItems.Clear();
			this.mWallItems.Clear();
			this.mRemovedItems.Clear();
			this.mMovedItems.Clear();
			this.mAddedItems.Clear();
			this.roomItemUpdateQueue.Clear();
			this.room = null;
			this.mFloorItems = null;
			this.mWallItems = null;
			this.mRemovedItems = null;
			this.mMovedItems = null;
			this.mAddedItems = null;
			this.mWallItems = null;
			this.roomItemUpdateQueue = null;
		}
Example #51
0
File: Game.cs Project: habb0/Bfly
        internal void Destroy()
        {
            Array.Clear(TeamPoints, 0, TeamPoints.Length);
            redTeamItems.Destroy();
            blueTeamItems.Destroy();
            greenTeamItems.Destroy();
            yellowTeamItems.Destroy();

            TeamPoints = null;
            OnScoreChanged = null;
            OnGameStart = null;
            OnGameEnd = null;
            redTeamItems = null;
            blueTeamItems = null;
            greenTeamItems = null;
            yellowTeamItems = null;
            room = null;
        }
Example #52
0
File: Room.cs Project: habb0/Bfly
        private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int Category,
            int State, int UsersMax, string ModelName, string CCTs, int Score, List<string> pTags, bool AllowPets,
            bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor,
            string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.Category = Category;
            this.Type = Type;
            this.State = State;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.CCTs = CCTs;
            this.Score = Score;

            tagCount = 0;
            this.Tags = new ArrayList();
            foreach (string tag in pTags)
            {
                tagCount++;
                Tags.Add(tag);
            }

            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;

            this.myIcon = Icon;
            this.Password = Password;
            this.Bans = new Dictionary<UInt32, double>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.chatMessageManager = new ChatMessageManager();
            this.groups = new QueuedDictionary<int, Group>();
            this.ActiveTrades = new ArrayList();

            this.mCycleEnded = false;

            this.mRoomData = RoomData;
            this.EveryoneGotRights = RightOverride;

            this.roomMessages = new Queue();
            this.chatMessageQueue = new Queue();
            this.rnd = new Random();

            this.roomMessages = new Queue();
            this.roomAlerts = new Queue();
            this.roomBadge = new Queue();
            this.roomKick = new Queue();
            this.roomServerMessages = new Queue();
            this.IdleTime = 0;
            this.RoomMuted = false;
            this.WallThickness = walltickness;
            this.FloorThickness = floorthickness;

            this.gamemap = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUserManager(this);
            this.wiredHandler = new WiredHandler(this);

            LoadRights();
            GetRoomItemHandler().LoadFurniture();
            wiredHandler.LoadWired();
            GetGameMap().GenerateMaps();
            LoadMusic();
            //LoadBots();
            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
                {
                    dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)");
                }
                else
                {
                    dbClient.runFastQuery("IF EXISTS (SELECT roomid FROM room_active WHERE roomid = " + Id + ") " +
                                            "UPDATE room_active SET active_users = 1 WHERE roomid = " + Id + " " +
                                            "ELSE " +
                                            "INSERT INTO room_active VALUES (" + Id + ",1)");
                }
            }

            ButterflyEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData);
        }
Example #53
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="GameItemHandler" /> class.
 /// </summary>
 /// <param name="room">The room.</param>
 public GameItemHandler(Room room)
 {
     _room = room;
     _banzaiPyramids = new ConcurrentDictionary<uint, RoomItem>();
     _banzaiTeleports = new QueuedDictionary<uint, RoomItem>();
 }
Example #54
0
 internal void Destroy()
 {
     BanzaiTiles.Clear();
     _pucks.Clear();
     Array.Clear(_floorMap, 0, _floorMap.Length);
     _field.Destroy();
     _room = null;
     BanzaiTiles = null;
     _pucks = null;
     _floorMap = null;
     _field = null;
 }
Example #55
0
 public Soccer(Room room)
 {
     _room  = room;
     _gates = new RoomItem[4];
     _balls = new QueuedDictionary <uint, RoomItem>();
 }
        public void QueuedDictionaryEvictAccessDateLru()
        {
            QueuedDictionary<Guid, int> dict = new QueuedDictionary<Guid, int>(3, QueuedDictionaryAccessCompareMode.LastAccessDateAscending);
            Stack<Guid> stack = new Stack<Guid>();

            for (int i = 0; i < 25; i++)
            {
                Guid key = Guid.NewGuid();
                dict[key] = i;
                stack.Push(key);
                Thread.Sleep(1);
            }

            Assert.AreEqual(3, dict.Count);
            Assert.IsTrue(dict.ContainsKey(stack.Pop()));
            Assert.IsTrue(dict.ContainsKey(stack.Pop()));
            Assert.IsTrue(dict.ContainsKey(stack.Pop()));
        }