Esempio n. 1
0
 public JournalOutService(IGDetailPlanetService gDetailPlanetService,
                          IGGeometryPlanetService geometryPlanetService,
                          ISystemService systemService,
                          IUTaskService uTaskService,
                          IUReportService uReportService,
                          IUSpyService uSpyService,
                          IMothershipService mothershipService,
                          ISpriteImages spriteImages,
                          ISynchronizer synchronizer,
                          IMapAdressService mapAdressService,
                          IUMotherJumpService motherJumpService,
                          IGameUserService gameUserService,
                          IStoreService storeService, ILocalizerService localizer)
 {
     _gDetailPlanetService  = gDetailPlanetService;
     _geometryPlanetService = geometryPlanetService;
     _systemService         = systemService;
     _uTaskService          = uTaskService;
     _uReportService        = uReportService;
     _uSpyService           = uSpyService;
     _mothershipService     = mothershipService;
     _spriteImages          = spriteImages;
     _synchronizer          = synchronizer;
     _mapAdressService      = mapAdressService;
     _motherJumpService     = motherJumpService;
     _gameUserService       = gameUserService;
     _storeService          = storeService;
     _localizer             = localizer;
 }
Esempio n. 2
0
 public MapInfoService(IGameTypeService gameTypeService, IGGalaxyService galaxyService,
                       IAllianceService allianceService, IGGeometryPlanetService geometryPlanetService,
                       IGameUserService gameUserService, ILocalizerService localizer)
 {
     _gameTypeService       = gameTypeService;
     _galaxyService         = galaxyService;
     _allianceService       = allianceService;
     _geometryPlanetService = geometryPlanetService;
     _gameUserService       = gameUserService;
     _localizer             = localizer;
 }
Esempio n. 3
0
 public MapInfoService(IGSectorsService gSectorsService, IMoonService moonService, ISystemService systemService,
                       IGDetailPlanetService gDetailPlanetService, IGameTypeService gameTypeService, IGGalaxyService galaxyService,
                       IAllianceService allianceService, IGGeometryPlanetService geometryPlanetService,
                       IGameUserService gameUserService, ILocalizerService localizer)
 {
     _gSectorsService       = gSectorsService;
     _moonService           = moonService;
     _systemService         = systemService;
     _gDetailPlanetService  = gDetailPlanetService;
     _gameTypeService       = gameTypeService;
     _galaxyService         = galaxyService;
     _allianceService       = allianceService;
     _geometryPlanetService = geometryPlanetService;
     _gameUserService       = gameUserService;
     _localizer             = localizer;
 }
        public object AddBookmark(IDbConnection connection, BookmarkOut bm, int currentUserId, bool hasPremium,
                                  IMapInfoService mapInfoService, IGGeometryPlanetService geometryPlanetService, ISystemService systemService, IGSectorsService gSectorsService)
        {
            _saveNewBookmark(connection, bm, currentUserId, hasPremium, geometryPlanetService, systemService, gSectorsService);
            if (bm.IsFull)
            {
                return(GetPlanshetViewData(connection, mapInfoService, currentUserId));
            }

            if (string.Equals(BookmarkOut.Planet, bm.TypeName, StringComparison.CurrentCultureIgnoreCase))
            {
                var item    = GetUserBookmark(connection, currentUserId, bm.TypeId, bm.ObjectId);
                var outData = mapInfoService.GetPlanetOutData(connection, item, currentUserId);
                if (outData == null)
                {
                    throw new Exception(Error.NoData);
                }
                return(outData);
            }

            if (string.Equals(BookmarkOut.Star, bm.TypeName, StringComparison.CurrentCultureIgnoreCase))
            {
                var item    = GetUserBookmark(connection, currentUserId, bm.TypeId, bm.ObjectId);
                var outData = mapInfoService.GetSystemOutData(connection, item);
                if (outData == null)
                {
                    throw new Exception(Error.InputDataIncorrect);
                }
                return(outData);
            }

            if (string.Equals(BookmarkOut.Sector, bm.TypeName, StringComparison.CurrentCultureIgnoreCase))
            {
                var item    = GetUserBookmark(connection, currentUserId, bm.TypeId, bm.ObjectId);
                var outData = mapInfoService.GetSectorOutData(connection, item);
                if (outData == null)
                {
                    throw new Exception(Error.NoData);
                }
                return(outData);
            }
            throw new NotImplementedException();
        }
        public MapGInitializer(IGGalaxyService gGalaxyService,
                               IGDetailPlanetService gDetailPlanetService,
                               IGGeometryPlanetService gGeometryPlanetService,
                               IMoonService moonService, ISystemService systemService,
                               IGSectorsService gSectorsService,
                               IGameTypeService gameTypeService,
                               IOwnProgressInitializer iOwnProgressInitializer, ISysHelperRepository sysHelperRepository,
                               IAllianceService allianceService, IServiceProvider resolver)
        {
            _gGalaxyService          = gGalaxyService;
            _gDetailPlanetService    = gDetailPlanetService;
            _gGeometryPlanetService  = gGeometryPlanetService;
            _moonService             = moonService;
            _systemService           = systemService;
            _gSectorsService         = gSectorsService;
            _gameTypeService         = gameTypeService;
            _iOwnProgressInitializer = iOwnProgressInitializer;
            _sysHelperRepository     = sysHelperRepository;
            _allianceService         = allianceService;

            _resolver = resolver;
        }
Esempio n. 6
0
        public MainGameHub(IServiceProvider svp)
        {
            #region Main

            _svp      = svp;
            _hubCache = _svp.GetService <IMainGameHubLocalStorageCache>();

            #endregion

            #region Main User

            _gameUserService = _svp.GetService <IGameUserService>();
            _allianceService = _svp.GetService <IAllianceService>();
            _channelService  = (ChannelService)_svp.GetService <IChannelService>();

            _mothershipService = _svp.GetService <IMothershipService>();
            _motherJumpService = _svp.GetService <IUMotherJumpService>();
            _storeService      = _svp.GetService <IStoreService>();

            #endregion

            #region World

            _gameTypeService        = _svp.GetService <IGameTypeService>();
            _gGeometryPlanetService = _svp.GetService <IGGeometryPlanetService>();
            _gDetailPlanetService   = _svp.GetService <IGDetailPlanetService>();
            _gSectorsService        = _svp.GetService <IGSectorsService>();
            _mapInfoService         = _svp.GetService <IMapInfoService>();
            _systemService          = _svp.GetService <ISystemService>();
            _worldService           = _svp.GetService <IWorldService>();
            _gUserBookmarkService   = (GUserBookmarkService)_svp.GetService <IGUserBookmarkService>();

            #endregion

            #region builds

            //collections
            _commandCenter     = _svp.GetService <ICommandCenter>();
            _industrialComplex = _svp.GetService <IIndustrialComplex>();
            _laboratory        = _svp.GetService <ILaboratory>();
            _shipyard          = _svp.GetService <IShipyard>();


            //items
            _energyConverter  = _svp.GetService <IEnergyConverter>();
            _extractionModule = _svp.GetService <IExtractionModule>();
            _extractionModule = _svp.GetService <IExtractionModule>();
            _spaceShipyard    = _svp.GetService <ISpaceShipyard>();
            _storage          = _svp.GetService <IStorage>();
            _turels           = _svp.GetService <ITurels>();

            //common
            _unit                    = _svp.GetService <IUnit>();
            _storageResources        = _svp.GetService <IStorageResourcesService>();
            _transferResourceService = _svp.GetService <ITransferResourceService>();

            #endregion

            #region Global User

            _estateOwnService  = _svp.GetService <IEstateOwnService>();
            _synchronizer      = _svp.GetService <ISynchronizer>();
            _estateListService = _svp.GetService <IEstateListService>();
            _journalOutService = _svp.GetService <IJournalOutService>();
            _gameRunner        = _svp.GetService <IGameRunner>();
            _dbProvider        = _svp.GetService <IDbProvider>();

            #endregion

            #region Confederation

            _confederationService = _svp.GetService <IConfederationService>();

            #endregion
        }
        private void _saveNewBookmark(IDbConnection connection, BookmarkOut bm, int currentUserId, bool hasPremium, IGGeometryPlanetService geometryPlanetService, ISystemService systemService, IGSectorsService gSectorsService)
        {
            var hasData = false;

            if (_isFull(connection, currentUserId, hasPremium))
            {
                throw new Exception(Error.BookMarkLimitDone);
            }

            if (string.Equals(BookmarkOut.Planet, bm.TypeName, StringComparison.CurrentCultureIgnoreCase))
            {
                var planetTypeId = geometryPlanetService.GetPlanetType(connection, bm.ObjectId);
                if (planetTypeId == 0)
                {
                    throw new Exception(Error.InputDataIncorrect);
                }
                hasData =
                    (GetUserBookmark(connection, currentUserId, planetTypeId, bm.ObjectId) !=
                     null);
                bm.TypeId = planetTypeId;
            }

            else if (string.Equals(BookmarkOut.Star, bm.TypeName, StringComparison.CurrentCultureIgnoreCase))
            {
                var starTypeId = systemService.GetDetailSystemBySystemId(connection, bm.ObjectId, i => i.TypeId);

                if (starTypeId == 0)
                {
                    throw new Exception(Error.InputDataIncorrect);
                }
                hasData   = (GetUserBookmark(connection, currentUserId, starTypeId, bm.ObjectId) != null);
                bm.TypeId = starTypeId;
            }

            else if (string.Equals(BookmarkOut.Sector, bm.TypeName, StringComparison.CurrentCultureIgnoreCase))
            {
                var sectorTypeId = gSectorsService.GetById(connection, (short)bm.ObjectId, i => i.TypeId);
                if (sectorTypeId == 0)
                {
                    throw new Exception(Error.InputDataIncorrect);
                }

                hasData   = (GetUserBookmark(connection, currentUserId, sectorTypeId, bm.ObjectId) != null);
                bm.TypeId = sectorTypeId;
            }
            else
            {
                throw new NotImplementedException();
            }

            if (hasData)
            {
                throw new Exception(Error.BookmarkIsExist);
            }
            AddOrUpdate(connection, new UserBookmarkDataModel
            {
                UserId   = currentUserId,
                TypeId   = bm.TypeId,
                ObjectId = bm.ObjectId
            });
        }