Exemple #1
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "Room" /> class.
 /// </summary>
 /// <param name = "name">
 ///   The room name.
 /// </param>
 /// <param name = "executionFiber">
 ///   The execution fiber used to synchronize access to this instance.
 /// </param>
 /// <param name="roomCache">
 ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
 /// </param>
 /// <param name="emptyRoomLiveTime">
 ///   A value indicating how long the room instance will be keeped alive
 ///   in the room cache after all peers have left the room.
 /// </param>
 protected Room(string name, PoolFiber executionFiber, RoomCacheBase roomCache, int emptyRoomLiveTime = 0)
 {
     this.name              = name;
     this.ExecutionFiber    = executionFiber;
     this.Actors            = new ActorCollection();
     this.Properties        = new PropertyBag <object>();
     this.roomCache         = roomCache;
     this.emptyRoomLiveTime = emptyRoomLiveTime;
 }
Exemple #2
0
        // ReSharper restore UnaccessedField.Local

        /// <summary>
        /// Initializes a new instance of the <see cref="LiteLobbyRoom"/> class.
        /// </summary>
        /// <param name="lobbyName">
        /// Name of the lobby.
        /// </param>
        /// <param name="roomCache">
        ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
        /// </param>
        public LiteLobbyRoom(string lobbyName, RoomCacheBase roomCache)
            : base(lobbyName, roomCache)
        {
            this.roomList        = new Hashtable();
            this.changedRoomList = new Hashtable();

            // schedule sending the change list
            this.SchedulePublishChanges();
        }
 protected Room(string name, PoolFiber executionFiber, RoomCacheBase roomCache, int emptyRoomLiveTime = 0)
 {
     Name               = name;
     ExecutionFiber     = executionFiber;
     Actors             = new ActorCollection();
     Properties         = new PropertyBag <object>();
     _roomCache         = roomCache;
     _emptyRoomLiveTime = emptyRoomLiveTime;
 }
Exemple #4
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Room" /> class.
        /// </summary>
        /// <param name = "name">
        ///   The room name.
        /// </param>
        /// <param name = "executionFiber">
        ///   The execution fiber used to synchronize access to this instance.
        /// </param>
        /// <param name="roomCache">
        ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
        /// </param>
        /// <param name="gameStateFactory">Fatory for game state</param>
        /// <param name="maxEmptyRoomTTL">
        ///   A value indicating how long the room instance will be keeped alive
        ///   in the room cache after all peers have left the room.
        /// </param>
        protected Room(string name, ExtendedPoolFiber executionFiber, RoomCacheBase roomCache, IGameStateFactory gameStateFactory = null, int maxEmptyRoomTTL = 0)
        {
            this.name = name;

            this.gameStateFactory = gameStateFactory ?? defaultFactory;
            this.roomState        = this.gameStateFactory.Create();
            this.ExecutionFiber   = executionFiber ?? new ExtendedPoolFiber();

            this.roomCache       = roomCache;
            this.MaxEmptyRoomTTL = maxEmptyRoomTTL;
        }
Exemple #5
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Room" /> class.
        /// </summary>
        /// <param name = "name">
        ///   The room name.
        /// </param>
        /// <param name = "executionFiber">
        ///   The execution fiber used to synchronize access to this instance.
        /// </param>
        /// <param name="roomCache">
        ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
        /// </param>
        /// <param name="gameStateFactory">Fatory for game state</param>
        /// <param name="maxEmptyRoomTTL">
        ///   A value indicating how long the room instance will be keeped alive
        ///   in the room cache after all peers have left the room.
        /// </param>
        protected Room(string name, ExtendedPoolFiber executionFiber, RoomCacheBase roomCache, IGameStateFactory gameStateFactory = null, int maxEmptyRoomTTL = 0)
        {
            this.name = name;

            this.gameStateFactory = gameStateFactory ?? defaultFactory;
            this.roomState        = this.gameStateFactory.Create();
            this.ExecutionFiber   = executionFiber ?? new ExtendedPoolFiber();

            this.roomCache       = roomCache;
            this.MaxEmptyRoomTTL = maxEmptyRoomTTL;
            this.UtcCreated      = DateTime.UtcNow;

            this.RoomCreationTS = Stopwatch.GetTimestamp();
        }
Exemple #6
0
 public GameCreateOptions(string gameName,
                          RoomCacheBase roomCache,
                          IPluginManager pluginManager,
                          int maxEmptyRoomTtl = 0, IGameStateFactory gameStateFactory = null)
     : this()
 {
     this.logMessagesCounter      = NullPluginLogMessageCounter.Instance;
     this.GameName                = gameName;
     this.RoomCache               = roomCache;
     this.PluginManager           = pluginManager;
     this.MaxEmptyRoomTTL         = maxEmptyRoomTtl;
     this.GameStateFactory        = gameStateFactory;
     this.Environment             = null;
     this.HttpRequestQueueOptions = new HttpRequestQueueOptions();
     this.ExecutionFiber          = null;
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MyGame"/> class.
 /// </summary>
 /// <param name="gameName">The name of the game.</param>
 /// <param name="roomCache">
 ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
 /// </param>
 public MyGame(string gameName, RoomCacheBase roomCache)
     : base(gameName, roomCache)
 {
 }
Exemple #8
0
 public TestGame(GameApplication application, string gameId, RoomCacheBase roomCache = null,
                 IPluginManager pluginManager = null, string pluginName = "", Dictionary <string, object> environment = null)
     : base(application, gameId, roomCache, pluginManager, pluginName, environment)
 {
 }
Exemple #9
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "LiteGame" /> class.
        /// </summary>
        /// <param name = "gameName">
        ///   The name of the game.
        /// </param>
        /// <param name="roomCache">
        ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
        /// </param>
        /// <param name="emptyRoomLiveTime">
        ///   A value indicating how long the room instance will be keeped alive
        ///   in the room cache after all peers have left the room.
        /// </param>

        public LiteGame(string gameName, RoomCacheBase roomCache, int emptyRoomLiveTime = 0)
            : base(gameName, roomCache, emptyRoomLiveTime)
        {
            this.LogQueue = new LogQueue("Game " + gameName, LogQueue.DefaultCapacity);
        }
Exemple #10
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "Room" /> class without a room name.
 /// </summary>
 /// <param name = "name">
 ///   The room name.
 /// </param>
 /// <param name="roomCache">
 ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
 /// </param>
 /// <param name="gameStateFactory">Fatory for game state</param>
 /// <param name="maxEmptyRoomTTL">
 ///   A value indicating how long the room instance will be keeped alive
 ///   in the room cache after all peers have left the room.
 /// </param>
 /// <param name="executionFiber">Fiber which will execute rooms actions</param>
 public Room(string name, RoomCacheBase roomCache = null, IGameStateFactory gameStateFactory = null, int maxEmptyRoomTTL = 0, ExtendedPoolFiber executionFiber = null)
     : this(name, executionFiber, roomCache, gameStateFactory, maxEmptyRoomTTL)
 {
     this.ExecutionFiber.Start();
     RemoveRoomPath = RemoveState.Alive;
 }
 public TestGame(GameApplication application, string gameId, RoomCacheBase roomCache = null,
                 IPluginManager pluginManager = null, Dictionary <string, object> environment = null)
     : base(new LBGameCreateOptions(application, gameId, roomCache, pluginManager, environment))
 {
 }
Exemple #12
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "Room" /> class without a room name.
 /// </summary>
 /// <param name = "name">
 ///   The room name.
 /// </param>
 /// <param name="roomCache">
 ///   The <see cref="RoomCacheBase"/> instance to which the room belongs.
 /// </param>
 /// <param name="emptyRoomLiveTime">
 ///   A value indicating how long the room instance will be keeped alive
 ///   in the room cache after all peers have left the room.
 /// </param>
 public Room(string name, RoomCacheBase roomCache = null, int emptyRoomLiveTime = 0)
     : this(name, new PoolFiber(), roomCache, emptyRoomLiveTime)
 {
     this.ExecutionFiber.Start();
 }
Exemple #13
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "LiteLobbyGame" /> class.
 /// </summary>
 /// <param name = "gameName">
 ///   The name of the game.
 /// </param>
 /// <param name = "lobbyName">
 ///   The name of the lobby for the game.
 /// </param>
 public LiteLobbyGame(string gameName, string lobbyName, RoomCacheBase parent)
     : base(gameName, parent)
 {
     // get the reference to the lobby
     this.lobbyReference = LiteLobbyRoomCache.Instance.GetRoomReference(lobbyName, null);
 }