public WorldService(IGDetailPlanetService gDetailPlanetService, IGSectorsService gSectorsService, IMapInfoService mapInfoService, ISystemService systemService) { _gDetailPlanetService = gDetailPlanetService; _gSectorsService = gSectorsService; _mapInfoService = mapInfoService; _systemService = systemService; }
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 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 }
public IPlanshetViewData GetPlanshetViewData(IDbConnection connection, IMapInfoService mapInfoService, int currentUserId) { var bookmarks = GetUserBookmarks(connection, currentUserId); bookmarks = bookmarks.OrderByDescending(i => i.Id).ToList(); var planets = new List <PlanetInfoOut>(); var stars = new List <StarInfoOut>(); var sectors = new List <SectorInfoOut>(); #region For var types = _gameTypeService.GetAllGGameTypes(connection); foreach (var item in bookmarks) { var type = types.Single(i => i.Id == item.TypeId); var typeName = type.Type; #region Planet Type if (typeName == BookmarkOut.Planet) { var planetOutData = mapInfoService.GetPlanetOutData(connection, item, currentUserId); if (planetOutData == null) { continue; } planets.Add(planetOutData); } #endregion #region StarType if (typeName == BookmarkOut.Star) { var outSystemData = mapInfoService.GetSystemOutData(connection, item); if (outSystemData == null) { continue; } stars.Add(outSystemData); } #endregion #region SectorType if (typeName != BookmarkOut.Sector) { continue; } var sectorOutData = mapInfoService.GetSectorOutData(connection, item); if (sectorOutData == null) { continue; } sectors.Add(sectorOutData); #endregion } #endregion var tabs = mapInfoService.InitialTabs(planets, stars, sectors); return(tabs); }