コード例 #1
0
        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);
        }
コード例 #2
0
 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
     })));
 }
コード例 #3
0
 /// <summary>
 ///     Create AutoMatch With Option Like :  Min , Max , Role , ...
 /// </summary>
 /// <param name="option">(NOTNULL)AutoMatch Option</param>
 public abstract void AutoMatch(GSLiveOption.AutoMatchOption option);