private static Packet DoAction(GSLiveOption.CreateRoomOption options) { return(new Packet( CommandHandler.PlayerHash, CommandConst.ActionCreateRoom, JsonConvert.SerializeObject(new RoomDetail { Name = options.RoomName, Role = options.Role, Extra = options.Extra, Max = options.MaxPlayer, IsPrivate = options.IsPrivate, IsPersist = options.IsPersist, RoomPassword = options.RoomPassword, Type = CommandConst.ActionCreateRoom, GsLiveType = (int)options.GsLiveType }, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }))); }
public override void CreateRoom(GSLiveOption.CreateRoomOption option) { if (GameService.IsGuest) { throw new GameServiceException("This Function Not Working In Guest Mode").LogException <GsLiveRealTime>( DebugLocation.RealTime, "CreateRoom"); } if (option == null) { throw new GameServiceException("option Cant Be Null").LogException <GsLiveRealTime>( DebugLocation.RealTime, "CreateRoom"); } if (option.MaxPlayer < RealTimeConst.MinPlayer || option.MaxPlayer > RealTimeConst.MaxPlayer) { throw new GameServiceException("Invalid MaxPlayer Value") .LogException <GsLiveRealTime>(DebugLocation.RealTime, "CreateRoom"); } if (InAutoMatch) { throw new GameServiceException("You Can't Create Room When You are In AutoMatch State") .LogException <GsLiveRealTime>( DebugLocation.RealTime, "CreateRoom"); } if (GameService.GSLive.GetGsHandler().RealTimeHandler != null) { throw new GameServiceException("You Can't Connect To Multiple Rooms").LogException <GsLiveRealTime>( DebugLocation.RealTime, "CreateRoom"); } option.GsLiveType = GSLiveType.RealTime; GameService.GSLive.GetGsHandler().CommandHandler.Send(CreateRoomHandler.Signature, option); }
/// <summary> /// Create Room With Option Like : Name , Min , Role , IsPrivate , ... /// </summary> /// <param name="option">(NOTNULL)Create Room Option</param> public abstract void CreateRoom(GSLiveOption.CreateRoomOption option);