コード例 #1
0
 protected BaseGameServerService(GameServerType gameServerType, MonkeyDBContext dbContext, DiscordSocketClient discordClient, ILogger <IGameServerService> logger)
 {
     this.gameServerType = gameServerType;
     this.dbContext      = dbContext;
     this.discordClient  = discordClient;
     this.logger         = logger;
 }
コード例 #2
0
 protected BaseGameServerService(GameServerType gameServerType, MonkeyDBContext dbContext, DiscordClient discordClient, ISchedulingService schedulingService, ILogger <IGameServerService> logger)
 {
     _gameServerType    = gameServerType;
     _dbContext         = dbContext;
     _discordClient     = discordClient;
     _schedulingService = schedulingService;
     _logger            = logger;
 }
コード例 #3
0
        public static IGameServer Create(GameServerType type, string teamName, string ipAddress, int port)
        {
            IGameServer server = null;

            switch (type)
            {
            case GameServerType.WebClient:
                server = new WebClientGameServerInterface(teamName, ipAddress, port);
                break;

            case GameServerType.Mock:
                server = new MockGameServerInterface(teamName, ipAddress, port);
                break;
            }

            return(server);
        }
コード例 #4
0
        protected async Task ListGameServersInternalAsync(GameServerType gameServerType)
        {
            List <GameServer> servers = (await gameServerService.ListServers(Context.Guild.Id).ConfigureAwait(false)).Where(s => s.GameServerType == gameServerType).ToList();

            if (servers == null || servers.Count < 1)
            {
                _ = await ctx.RespondAsync("No servers have been added yet.").ConfigureAwait(false);

                return;
            }
            var sb = new StringBuilder();

            foreach (GameServer server in servers)
            {
                ITextChannel feedChannel = await Context.Guild.GetTextChannelAsync(server.ChannelID).ConfigureAwait(false);

                _ = sb.AppendLine($"{feedChannel.Mention}: {server.ServerIP}");
            }
            _ = await ctx.RespondAsync($"The following feeds are listed in all channels:{Environment.NewLine}{sb}").ConfigureAwait(false);
        }
コード例 #5
0
        public override WowHttperLoginBase GetHttper(GameServerType gsType)
        {
            lock (httpLockObject)
            {
                if (null == this.HttperParamsItem)
                {
                    return(null);
                }

                WowHttperLoginBase httpHelper = null;
                switch (gsType)
                {
                case GameServerType.USBattle:
                    httpHelper = new USBattleLoginHttper(this.HttperParamsItem);
                    break;

                case GameServerType.EUBattle:
                    httpHelper = new EUBattleLoginHttper(this.HttperParamsItem);
                    break;

                case GameServerType.SEABattle:
                    httpHelper = new SeaBattleLoginHttper(this.HttperParamsItem);
                    break;

                case GameServerType.KRBattle:
                    httpHelper = new KRBattleLoginHttper(this.HttperParamsItem);
                    break;

                case GameServerType.TWBattle:
                    httpHelper = new TWBattleLoginHttper(this.HttperParamsItem);
                    break;

                default:
                    break;
                }
                return(httpHelper);
            }
        }
コード例 #6
0
        public override HttperLoginBase GetHttper(GameServerType gsType)
        {
            lock (httpLockObject)
            {
                if (null == this.HttperParamsItem)
                {
                    return(null);
                }

                HttperLoginBase httpHelper = null;
                switch (gsType)
                {
                case GameServerType.AppleServer:
                    httpHelper = new HttperLoginBase(this.HttperParamsItem);
                    break;

                default:
                    throw new NotImplementedException();
                    //break;
                }
                return(httpHelper);
            }
        }
コード例 #7
0
 public abstract P GetHttper(GameServerType serverType);
コード例 #8
0
 public ServerTypeConflictException(GameServerType conflicttype) : base(conflicttype.ToString() + "发生了冲突!")
 {
     ConflictType = conflicttype;
 }