Exemplo n.º 1
0
        private Room <TPlayer> Create(Type t, RoomRequest request)
        {
            var rm = (Room <TPlayer>)Activator.CreateInstance(t);

            rm.SetupBy(request);
            this._manager.UnlockedAdd(rm);
            rm.Creation();

            return(rm);
        }
Exemplo n.º 2
0
        public Room <TPlayer> FindOrCreateBy(RoomRequest request)
        {
            lock (this._manager._lock) {
                var t = GetRoomForType(request.RoomType);
                if (t == null)
                {
                    return(null);
                }

                var rm = (Room <TPlayer>)Activator.CreateInstance(t);
                rm.SetupBy(request);

                return(this._manager.UnlockedExistsBy(request, out var __) ? __ : this.Create(t, request));
            }
        }
Exemplo n.º 3
0
 public void SetupBy(RoomRequest request)
 {
     //this.Creation();
     this.RequestInfo = request;
 }
Exemplo n.º 4
0
 public Room <TPlayer> FindBy(RoomRequest request) => this._manager.FindBy(request);
Exemplo n.º 5
0
 public bool ExistsBy(RoomRequest request, out Room <TPlayer> item) => this._manager.ExistsBy(request, out item);
Exemplo n.º 6
0
        public Room <TPlayer> CreateBy(RoomRequest request)
        {
            var t = GetRoomForType(request.RoomType) ?? throw new InvalidOperationException("No room of the roomtype requested exists.");

            return(Create(t, request));
        }
Exemplo n.º 7
0
 public bool CanCreate(RoomRequest request) => GetRoomForType(request.RoomType) != null && !this._manager.ExistsBy(request, out var __);