public override void AutoMatch(GSLiveOption.AutoMatchOption option) { if (GameService.IsGuest) { throw new GameServiceException("This Function Not Working In Guest Mode").LogException <GsLiveTurnBased>( DebugLocation.TurnBased, "AutoMatch"); } if (option == null) { throw new GameServiceException("option Cant Be Null").LogException <GsLiveTurnBased>( DebugLocation.TurnBased, "AutoMatch"); } if (option.MinPlayer < TurnBasedConst.MinPlayer || option.MinPlayer > TurnBasedConst.MaxPlayer) { throw new GameServiceException("Invalid MinPlayer Value") .LogException <GsLiveTurnBased>(DebugLocation.TurnBased, "AutoMatch"); } if (option.MaxPlayer < TurnBasedConst.MinPlayer || option.MaxPlayer > TurnBasedConst.MaxPlayer) { throw new GameServiceException("Invalid MaxPlayer Value") .LogException <GsLiveTurnBased>(DebugLocation.TurnBased, "AutoMatch"); } if (InAutoMatch) { throw new GameServiceException("You Can't Do Multiple AutoMatch In SameTime") .LogException <GsLiveTurnBased>( DebugLocation.TurnBased, "AutoMatch"); } if (GameService.GSLive.GetGsHandler().TurnBasedHandler != null) { throw new GameServiceException("You Can't Connect To Multiple Rooms").LogException <GsLiveTurnBased>( DebugLocation.TurnBased, "AutoMatch"); } option.GsLiveType = GSLiveType.TurnBased; InAutoMatch = true; GameService.GSLive.GetGsHandler().CommandHandler.Send(AutoMatchHandler.Signature, option); }
private static Packet DoAction(GSLiveOption.AutoMatchOption options) { return(new Packet( CommandHandler.PlayerHash, Models.Consts.CommandConst.ActionAutoMatch, JsonConvert.SerializeObject(new RoomDetail { Role = options.Role, Extra = options.Extra, Min = options.MinPlayer, Max = options.MaxPlayer, Type = Models.Consts.CommandConst.ActionAutoMatch, IsPersist = options.IsPersist, GsLiveType = (int)options.GsLiveType }, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }))); }
/// <summary> /// Create AutoMatch With Option Like : Min , Max , Role , ... /// </summary> /// <param name="option">(NOTNULL)AutoMatch Option</param> public abstract void AutoMatch(GSLiveOption.AutoMatchOption option);