protected internal override void Execute(IOnlineConnection Sender) { IRoomInformations CreatedRoom = Owner.Database.GenerateNewRoom(RoomName, RoomType, RoomSubtype, "", Owner.IP, Owner.Port, MaxNumberOfPlayer); CreatedGroup = ClientGroupTemplate.CreateFromTemplate(CreatedRoom); CreatedGroup.Room.AddOnlinePlayer(Sender, "Host"); Owner.DicLocalRoom.Add(CreatedRoom.RoomID, CreatedGroup); Owner.DicAllRoom.Add(CreatedRoom.RoomID, CreatedRoom); Owner.ListPlayerToRemove.Add(Sender); Owner.SharedWriteBuffer.ClearWriteBuffer(); Owner.SharedWriteBuffer.WriteScript(new RoomListScriptServer(Owner, new List <IRoomInformations>() { CreatedRoom })); foreach (IOnlineConnection ActivePlayer in Owner.ListPlayer) { if (ActivePlayer == Sender) { continue; } ActivePlayer.SendWriteBuffer(); } Sender.Send(new SendRoomIDScriptServer(CreatedRoom.RoomID)); }
protected internal override void Execute(IOnlineConnection ActivePlayer) { ClientGroup ActiveTransferingRoom; if (Owner.DicTransferingRoom.TryGetValue(RoomID, out ActiveTransferingRoom) && ActiveTransferingRoom.Room.ListOnlinePlayer.Count < ActiveTransferingRoom.Room.CurrentPlayerCount) { ActiveTransferingRoom.Room.AddOnlinePlayer(ActivePlayer, "Host"); } else if (Owner.DicAllRoom.ContainsKey(RoomID)) { ClientGroup NewRoom = ClientGroupTemplate.CreateFromTemplate(Owner.TransferRoom(RoomID)); Owner.DicTransferingRoom.Add(RoomID, NewRoom); NewRoom.Room.AddOnlinePlayer(ActivePlayer, "Host"); ActivePlayer.Send(new AskGameDataScriptServer()); } }