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); }
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)); } }
public void SetupBy(RoomRequest request) { //this.Creation(); this.RequestInfo = request; }
public Room <TPlayer> FindBy(RoomRequest request) => this._manager.FindBy(request);
public bool ExistsBy(RoomRequest request, out Room <TPlayer> item) => this._manager.ExistsBy(request, out item);
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)); }
public bool CanCreate(RoomRequest request) => GetRoomForType(request.RoomType) != null && !this._manager.ExistsBy(request, out var __);