public LevelService(LevelSettings levelSettings) { _gameDataService = ServiceLocator.GetService <GameDataService>(); _uiService = ServiceLocator.GetService <UIService>(); _levelSettings = levelSettings; MapGenerator.LevelUp += OnLevelUp; UpdateService(); }
public AdsService(AdsConfig adsConfig) { _uiService = ServiceLocator.GetService <UIService>(); _adsConfig = adsConfig; ReviveAdvertisementUpdate?.Invoke(Advertisement.IsReady(_adsConfig.ReviveVideoPlacementId)); BonusAdvertisementUpdate?.Invoke(Advertisement.IsReady(_adsConfig.BonusVideoPlacementId)); Advertisement.AddListener(this); Advertisement.Initialize(_adsConfig.GameId, _adsConfig.TestMode); Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER); }
// Start is called before the first frame update public PlayGamesService() { _uiService = ServiceLocator.GetService <UIService>(); //setting default value, if the game is played for the first time if (!PlayerPrefs.HasKey(SAVE_NAME)) { PlayerPrefs.SetString(SAVE_NAME, string.Empty); } //tells us if it's the first time that this game has been launched after install - 0 = no, 1 = yes if (!PlayerPrefs.HasKey("IsFirstTime")) { PlayerPrefs.SetInt("IsFirstTime", 1); } LoadLocal(); //we want to load local data first because loading from cloud can take quite a while, if user progresses while using local data, it will all //sync in our comparating loop in StringToGameData(string, string) PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); SignIn(); }