コード例 #1
0
        public WorldServer(ServerSpecification specifications) : base(specifications.Id)
        {
            Logger.Information($"Created WorldServer on PID {Process.GetCurrentProcess().Id.ToString()}");

            Zones = new List <Zone>();

            _zoneId = specifications.ZoneId;

            MaxPlayerCount = specifications.MaxUserCount;

            _gameMessageHandlerMap = new GameMessageHandlerMap();
        }
コード例 #2
0
ファイル: GraphQLService.cs プロジェクト: ygo74/Inventory.API
        public async Task <IReadOnlyList <ServerDto> > GetAllServersAsync(ServerFilter filter)
        {
            var serverSpec = new ServerSpecification(filter);
            var servers    = await _serverRepository.ListAsync(serverSpec);

            // Load Server Additional Data and calculate list of groups in this inventory
            var serversDto = new System.Collections.Concurrent.ConcurrentBag <ServerDto>();

            Parallel.ForEach <Server>(servers, async currentServer =>
            {
                var serverDto = await GetOrFillServerData(currentServer);
                serversDto.Add(serverDto);
            });

            return(serversDto.ToList());
        }
コード例 #3
0
        private async Task LoadZone(ServerSpecification zone)
        {
            if (ZoneParser.Zones == default)
            {
                await ZoneParser.LoadZoneDataAsync((int)zone.ZoneId);
            }

            Logger.Information($"Starting {zone.ZoneId}");

            var info = ZoneParser.Zones?[zone.ZoneId];

            if (info == default)
            {
                throw new Exception($"Failed to find info for {zone.ZoneId}");
            }

            var zoneInstance = new Zone(info, this, zone.ZoneInstanceId, zone.ZoneCloneId);

            Zones.Add(zoneInstance);

            await zoneInstance.InitializeAsync();
        }