//TODO is this really the right script for this to live? //Called when there is an exception void LogCallback(string condition, string stackTrace, LogType type) { if (type == LogType.Error || type == LogType.Exception) { AnalyticsLogger.UpdateLogFile(condition + " - " + stackTrace); } }
private void ActivateCurrentLevel() { AnalyticsLogger.UpdateLogFile("--------Level " + (currentLevelNumber + 1) + " activated--------", false, true); int highscore = GameManager.GetHighscore(currentLevelNumber); uiManager.UpdateInfo(currentLevelNumber, highscore); levelManagers[currentLevelNumber].ActivateLevel(); }
public virtual void DeactivateLevel() { HideAllLevelText(); levelActive = false; gameObjectsHolder.SetActive(false); foodPrompt.enabled = false; questionsManager.HideQuestion(); voiceover.Stop(); AnalyticsLogger.UpdateLogFile("Fps over last level: " + numberOfFrames / (Time.time - framerateTimer)); }
/// <summary> /// Track event, first ensure Analytics has been init /// </summary> public void TrackEvent(string eventName, params Parameter[] parameters) { if (Instance == null) { eventsQueue.Enqueue(eventName); } else { AnalyticsLogger.TrackEvent(eventName, parameters); } }
/// <summary> /// Track scene, first ensure Analytics has been init /// </summary> public void TrackScene(string sceneName) { if (Instance == null) { scenesQueue.Enqueue(sceneName); } else { AnalyticsLogger.TrackScene(sceneName); } }
private void RandomizeMaze() { AnalyticsLogger.UpdateLogFile("Round " + (currentRound + 1)); int activeMazeVariation = Random.Range(0, 3); for (int i = 0; i < NUMBER_OF_ROUNDS; i++) { mazes[currentRound][i].SetActive(i == activeMazeVariation); } spiderSpotlight.SetTarget(ceilingSpider); }
/// <summary> /// If anything has been queued of events/scene tracking before singleton initiation, track everything that has been accumulated in the queue. /// </summary> public void init() { AnalyticsLogger.OnSession(); while (scenesQueue.Count > 0) { AnalyticsLogger.TrackScene(scenesQueue.Dequeue()); } while (eventsQueue.Count > 0) { AnalyticsLogger.TrackEvent(eventsQueue.Dequeue()); } }
private void StartNextRound() { AnalyticsLogger.UpdateLogFile("Round " + (currentRound + 1)); raceStartTime = -1; for (int i = 0; i < NUMBER_OF_ROUNDS; i++) { bool indexAtCurrentRound = i == currentRound; spiders[i].SetActive(indexAtCurrentRound); mazes[i].SetActive(indexAtCurrentRound); } spiderSpotlight.SetTarget(spiders[currentRound]); //Debug.Log("SET POS " + spiders[currentRound].gameObject.name); }
public void Begin() { currentLevelNumber = GameManager.startingLevel; AnalyticsLogger.UpdateLogFile("--------Level " + (currentLevelNumber + 1) + " activated--------", false, true); Debug.Log("LEVEL: " + (currentLevelNumber + 1) + "/" + levelManagers.Count); levelManagers[currentLevelNumber].ActivateLevel(); int highscore = GameManager.GetHighscore(currentLevelNumber); if (uiManager == null) { Debug.Log("Warning - UI Manager null in " + gameObject.name + "'s PSM"); uiManager = GameObject.FindGameObjectWithTag("UIManagerObject").GetComponent <UIManager>(); } uiManager.ToggleLevelSelectionUI(false); uiManager.UpdateInfo(currentLevelNumber, highscore); }
public void NextLevel(int suds) { AnalyticsLogger.UpdateLogFile("Level " + (currentLevelNumber + 1) + " completed, score: " + (int)Math.Round(LevelManager.score) + ", SUDS: " + suds); GameManager.UpdateSave(currentLevelNumber, (int)Math.Round(LevelManager.score), suds); //Don't need to deactivate the level here as that happens when the SUDS UI switches on currentLevelNumber++; if (currentLevelNumber < levelManagers.Count) { ActivateCurrentLevel(); } else { //TODO show some kind of special "you finished this mode" screen, return to level selection? } }
private void OnEnable() { AnalyticsLogger.UpdateLogFile("--------Main Menu--------"); for (int i = 0; i < 10; i++) { levelRowManager[i] = LevelRowGO[i].GetComponent <LevelSelectionRowManager>(); //TODO deal with 2 and 3 stars float score = GameManager.GetHighscore(i); if (score == 100) { //Debug.Log("Setting stars"); levelRowManager[i].SetNumberOfStars(1); } else { levelRowManager[i].SetScore(GameManager.GetHighscore(i)); //TODO deal with stars } } }
private SpiderManager GetSpiderManager() { SpiderManager[] spiderManagers = gameObject.GetComponents <SpiderManager>(); //If we have two spider managers, disable the ceiling spider manager and return the other one if (spiderManagers.Length > 1) { foreach (SpiderManager managerInArray in spiderManagers) { if (managerInArray is CeilingSpiderFollowController && managerInArray.enabled) { AnalyticsLogger.UpdateLogFile("Ceiling spider grabbed off silk"); ((CeilingSpiderFollowController)managerInArray).SwitchToRandomPathing(); } else { spiderManager = managerInArray; } } } return(spiderManager); }
public override void Awake() { base.Awake(); //Setup initial prefs if (PlayerPrefs.GetInt(SettingsManager.graphicsSettingName) == 0) { //If this is the first boot of the system, and player is using a quest, turn on performance lighting if (OVRPlugin.GetSystemHeadsetType() == OVRPlugin.SystemHeadset.Oculus_Quest || OVRPlugin.GetSystemHeadsetType() == OVRPlugin.SystemHeadset.Oculus_Quest_2 || OVRPlugin.GetSystemHeadsetType() == OVRPlugin.SystemHeadset.Oculus_Link_Quest || OVRPlugin.GetSystemHeadsetType() == OVRPlugin.SystemHeadset.Oculus_Link_Quest_2) { AnalyticsLogger.UpdateLogFile("Detecting Oculus Quest - lowering lighting quality"); PlayerPrefs.SetInt(SettingsManager.graphicsSettingName, 1); TogglePerformanceLighting(true); } else { PlayerPrefs.SetInt(SettingsManager.graphicsSettingName, 2); } } else if (PlayerPrefs.GetInt(SettingsManager.graphicsSettingName) == 1) { TogglePerformanceLighting(true); } if (PlayerPrefs.GetInt(SettingsManager.colorblindSettingName) == 0) { PlayerPrefs.SetInt(SettingsManager.colorblindSettingName, 1); } if (PlayerPrefs.GetInt(SettingsManager.usageDataSettingName) == 0) { PlayerPrefs.SetInt(SettingsManager.usageDataSettingName, 2); } }
public AnalyticsManager(AnalyticConfiguration analyticsConfigurations, IAnalyticsHttpService analyticsHttpService, AnalyticsLogger analyticsLogger) : base(analyticsConfigurations, analyticsHttpService, analyticsLogger) { }
protected virtual void BumpOffSurface() { rb.AddForce(localUp * BUMP_FORCE, ForceMode.Impulse); AnalyticsLogger.UpdateLogFile("Spider fell off surface"); }
static App() { try { Container = new Container(); var analyticsSvc = DependencyService.Get <IAnalyticsService>(); var userService = new CurrentUserService(); var orderService = new AzureOrderService(new HttpClient(), _orderEndpoint, _apiKey); var propertyService = new PropertyService(new HttpClient(), _propertyEndpoint, new AnalyticsLogger <PropertyService>(analyticsSvc, userService)); var imageService = new BlobImageService(new HttpClient(), _blobEndpoint, new AnalyticsLogger <BlobImageService>(analyticsSvc, userService)); var subService = new SubscriptionService(new HttpClient(), _subEndpoint, new AnalyticsLogger <SubscriptionService>(analyticsSvc, userService)); var prService = new PurchasedReportService(new HttpClient(), _purchasedReportsEndpoint, new AnalyticsLogger <PurchasedReportService>(analyticsSvc, userService)); var authenticator = new OAuth2Authenticator(Configuration.ClientId, null, Configuration.Scope, new Uri(GoogleAuthorizeUrl), new Uri(Configuration.RedirectNoPath + ":" + Configuration.RedirectPath), new Uri(GoogleAccessTokenUrl), null, true); var notifyService = new NotificationService(new HttpClient(), _notifyEndpoint, _apiKey); var purchaseEmailLogger = new EmailLogger <PurchasingService>(notifyService, userService); var purchaseService = new PurchasingService(CrossInAppBilling.Current, purchaseEmailLogger); authenticator.Completed += (s, e) => { if (e.IsAuthenticated) { userService.LogIn(e.Account); } }; // Setup caches and begin process of filling them. var dbBasePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var propertyCache = new LocalSqlCache <PropertyModel>(Path.Combine(dbBasePath, "property.db3"), new AnalyticsLogger <LocalSqlCache <PropertyModel> >(analyticsSvc, userService)); var orderCache = new LocalSqlCache <Models.Order>(Path.Combine(dbBasePath, "order.db3"), new AnalyticsLogger <LocalSqlCache <Models.Order> >(analyticsSvc, userService)); var imageCache = new LocalSqlCache <ImageModel>(Path.Combine(dbBasePath, "images.db3"), new AnalyticsLogger <LocalSqlCache <ImageModel> >(analyticsSvc, userService)); var subCache = new LocalSqlCache <SubscriptionModel>(Path.Combine(dbBasePath, "subs.db3"), new AnalyticsLogger <LocalSqlCache <SubscriptionModel> >(analyticsSvc, userService)); var settingsCache = new LocalSqlCache <SettingsModel>(Path.Combine(dbBasePath, "sets.db3"), new AnalyticsLogger <LocalSqlCache <SettingsModel> >(analyticsSvc, userService)); var prCache = new LocalSqlCache <PurchasedReportModel>(Path.Combine(dbBasePath, "purchasedreports.db3"), new AnalyticsLogger <LocalSqlCache <PurchasedReportModel> >(analyticsSvc, userService)); var startUpLogger = new AnalyticsLogger <App>(analyticsSvc, userService); Action ClearCaches = () => { try { orderCache.Clear(); propertyCache.Clear(); imageCache.Clear(); subCache.Clear(); prCache.Clear(); } catch { } }; Func <AccountModel, Task> RefreshCaches = user => { var userId = user.UserId; var prTask = Task.Run(() => { try { var prs = prService.GetPurchasedReports(userId); prCache.Put(prs.ToDictionary(x => x.PurchaseId, x => x)); } catch (Exception ex) { startUpLogger.LogError("Failed to get purchased reports on refresh.", ex); } }); var orderTask = Task.Run(async() => { try { var orders = await orderService.GetMemberOrders(userId); var unCached = orders.Except(orderCache.GetAll().Select(x => x.Value).ToList(), new OrderEqualityComparer()).ToList(); orderCache.Put(orders.ToDictionary(x => x.OrderId, x => x)); var subTask = Task.Run(() => { try { DependencyService.Get <IMessagingSubscriber>().Subscribe(orders.Select(x => $"{(Device.RuntimePlatform == Device.Android ? App.TopicPrefix : "")}{x.OrderId}").ToList()); } catch { } }); var propTask = Task.Run(async() => { if (!orders.Any()) { propertyCache.Clear(); return; } var properties = await propertyService.GetProperties(unCached.Select(x => x.OrderId).ToList()); propertyCache.Update(properties); }); var imgTask = Task.Run(() => { if (!orders.Any()) { imageCache.Clear(); return; } var images = imageService.GetImages(unCached.Select(x => x.OrderId).ToList()); imageCache.Update(images); }); var subscriptionTask = Task.Run(async() => { try { // TODO: Refactor this so it can be tested. var allSubs = subService.GetSubscriptions(userId).OrderBy(x => x.StartDateTime).ToList(); var recentSub = allSubs.LastOrDefault(); var purchases = new List <InAppBillingPurchase>(); SubscriptionModel newSub = null; // Check app store purchases to see if they auto-renewed if (recentSub != null && !SubscriptionUtility.SubscriptionActive(recentSub)) { try { purchases = (await purchaseService.GetPurchases(ItemType.Subscription)).ToList(); } catch (Exception ex) { purchaseEmailLogger.LogError($"Error occurred while getting purchases.", ex); } var mostRecent = purchases.OrderBy(x => x.TransactionDateUtc)?.LastOrDefault(); if (mostRecent != null) { newSub = SubscriptionUtility.GetModelFromIAP(mostRecent, user, recentSub); if (newSub != null) { allSubs.Add(newSub); subService.AddSubscription(newSub); } } } if (!allSubs.Any()) { subCache.Clear(); } else { subCache.Put(allSubs.ToDictionary(x => x.PurchaseId, x => x)); } } catch (Exception ex) { startUpLogger.LogError("Failed to get subscriptions on refresh.", ex); } }); await Task.WhenAll(new[] { propTask, imgTask, subTask, subscriptionTask }); } catch (Exception ex) { startUpLogger.LogError($"Failed to fill caches.\n{ex.ToString()}", ex); } }); return(Task.WhenAll(new[] { prTask, orderTask })); }; var refresher = new CacheRefresher(new AnalyticsLogger <CacheRefresher>(analyticsSvc, userService), RefreshCaches); refresher.Invalidate(); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed refresher.RefreshCaches(userService.GetLoggedInAccount()); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed userService.OnLoggedIn += async(s, e) => { ClearCaches(); await refresher.RefreshCaches(e.Account); }; userService.OnLoggedOut += (s, e) => ClearCaches(); // Register services Container.Register <IOrderService>(() => orderService, Lifestyle.Singleton); Container.Register <IPropertyService>(() => propertyService, Lifestyle.Singleton); Container.Register <IImageService>(() => imageService, Lifestyle.Singleton); Container.Register <INotificationService>(() => notifyService, Lifestyle.Singleton); Container.Register <ILogger <SingleReportPurchaseViewModel> >(() => new EmailLogger <SingleReportPurchaseViewModel>(notifyService, userService), Lifestyle.Singleton); Container.RegisterConditional(typeof(ILogger <>), typeof(AnalyticsLogger <>), c => !c.Handled); Container.Register <OAuth2Authenticator>(() => authenticator, Lifestyle.Singleton); Container.Register <AccountStore>(() => AccountStore.Create(), Lifestyle.Singleton); Container.Register <ICurrentUserService>(() => userService, Lifestyle.Singleton); Container.Register <IPurchasingService>(() => purchaseService, Lifestyle.Singleton); Container.Register <ICacheRefresher>(() => refresher, Lifestyle.Singleton); Container.Register <ISubscriptionService>(() => subService, Lifestyle.Singleton); Container.Register <IOrderValidationService, OrderValidationService>(); Container.Register <IPageFactory, PageFactory>(Lifestyle.Singleton); Container.Register <IToastService>(() => DependencyService.Get <IToastService>(), Lifestyle.Singleton); Container.Register <IMessagingSubscriber>(() => DependencyService.Get <IMessagingSubscriber>(), Lifestyle.Singleton); Container.Register <IMessagingCenter>(() => MessagingCenter.Instance, Lifestyle.Singleton); Container.Register <IPurchasedReportService>(() => prService, Lifestyle.Singleton); Container.Register <IAnalyticsService>(() => analyticsSvc, Lifestyle.Singleton); Container.Register <LaunchedFromPushModel>(() => App.PushModel ?? new LaunchedFromPushModel(), Lifestyle.Singleton); // Finish registering created caches Container.Register <ICache <PropertyModel> >(() => propertyCache, Lifestyle.Singleton); Container.Register <ICache <Models.Order> >(() => orderCache, Lifestyle.Singleton); Container.Register <ICache <ImageModel> >(() => imageCache, Lifestyle.Singleton); Container.Register <ICache <SubscriptionModel> >(() => subCache, Lifestyle.Singleton); Container.Register <ICache <SettingsModel> >(() => settingsCache, Lifestyle.Singleton); Container.Register <ICache <PurchasedReportModel> >(() => prCache, Lifestyle.Singleton); Container.RegisterConditional(typeof(ICache <>), typeof(MemoryCache <>), c => !c.Handled); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); throw; } }
public void ResetLevel(int suds) { AnalyticsLogger.UpdateLogFile("---Level " + (currentLevelNumber + 1) + " reset with score " + (int)LevelManager.score + " and SUDS " + suds + "---"); SubmitLevelDetails(suds); ResetLevel(); }
public void ResetLevel() { AnalyticsLogger.UpdateLogFile("---Level " + (currentLevelNumber + 1) + " reset with score " + (int)LevelManager.score + "---"); levelManagers[currentLevelNumber].ResetLevel(); }
void OnEnable() { //isStatusPopupShow = false; NextButton.interactable = true; RetryButton.interactable = true; RetryFailButton.interactable = true; MapButton.interactable = true; GameCompleteButton.interactable = true; hideGageIcons(); MonsterGageSliderA.gameObject.SetActive(false); //MonsterGageSliderB.gameObject.SetActive (false); isWin = GameplayController.Instance.CurrentLevelStars > 0; GameObject go = GameObject.Find("monster"); if (go != null) { MonsterSpritesController msc = go.GetComponent <MonsterSpritesController>(); if (msc != null && msc.monster != null) { monster = msc.monster; } Animator animController; animController = go.GetComponentInChildren <Animator>(); if (animController != null) { animController.SetInteger("IdleState", 0); //animController.SetInteger ("EmotionState", 0); animController.SetInteger("EatState", 0); animController.SetInteger("EmotionState", (isWin) ? monster.HappyStates[UnityEngine.Random.Range(0, monster.HappyStates.Count)] : monster.SadStates[UnityEngine.Random.Range(0, monster.SadStates.Count)]); } } particles.enabled = isWin; transform.GetChild(0).gameObject.GetComponent <Image>().sprite = isWin ? WinScreen : LoseScreen; if (!addAddVoiceTutorial(isWin)) { onVoiceTutorialDone(); } if (isWin) { AudioController.Instance.PlaySound(GameWonFanfare); Invoke("UnPauseMusic", 1.4f); Analytics.Instance.TrackScene(FirebaseCustomSceneNames.LevelWinScene); AnalyticsLogger.TrackSpecificLevelComplete(GameplayController.Instance.CurrentLevelIndex + 1); Analytics.Instance.TrackEvent(FirebaseCustomEventNames.EventLevelWin, new Parameter(FirebaseCustomParameterNames.ParameterLevel, GameplayController.Instance.CurrentLevelIndex + 1)); } else { AudioController.Instance.PlaySound(GameLostFanfare); Analytics.Instance.TrackScene(FirebaseCustomSceneNames.LevelFailScene); Analytics.Instance.TrackEvent(FirebaseCustomEventNames.EventLevelFail, new Parameter(FirebaseCustomParameterNames.ParameterLevel, GameplayController.Instance.CurrentLevelIndex + 1)); } UIController.Instance.ClosePopup(UIController.Instance.GamePanel); //if (GameplayController.Instance != null && GameplayController.Instance.CurrentActive != null) { //GameplayController.Instance.CurrentActive.SetMonsterState (isWin ? MonsterCalloutController.MonsterState.Happy : MonsterCalloutController.MonsterState.Sad); //} if (isWin && GameAssets.Instance.NumOfLevels >= GameplayController.Instance.CurrentLevelIndex + 1) { if (UsersController.Instance.userData().setHighestOpenLevel(GameplayController.Instance.CurrentLevelIndex + 1)) { int newItemId = DressingController.Instance.isNewItemAvailable(GameplayController.Instance.CurrentLevelIndex); if (newItemId > 0) { UsersController.Instance.userData().setNewAvailableAccessorie(newItemId); } } } //NextButton.gameObject.SetActive (UserInfo.Instance.GetHighestOpenLevel() >= GameplayController.Instance.CurrentLevelIndex + 1 ); bool hasNextLevel = GameplayController.Instance.CurrentLevelIndex != GameAssets.Instance.NumOfLevels - 1; if (isWin && !hasNextLevel) { GameCompleteButton.gameObject.SetActive(true); NextButton.gameObject.SetActive(false); RetryButton.gameObject.SetActive(false); RetryFailButton.gameObject.SetActive(false); MapButton.gameObject.SetActive(false); } else { GameCompleteButton.gameObject.SetActive(false); // button for win NextButton.gameObject.SetActive(isWin && hasNextLevel); RetryButton.gameObject.SetActive(isWin); // buttons for lose RetryFailButton.gameObject.SetActive(!isWin); MapButton.gameObject.SetActive(true); } Stars.SetActive(isWin); ScoreText.text = GameplayController.Instance.CurrentLevelScore.ToString(); transform.localScale = new Vector3(3.1f, 3.1f, 3.1f); Camera.main.orthographicSize = 5f; }
private void Awake() { AnalyticsLogger.UpdateLogFile("------------------- NEW SESSION " + OVRPlugin.GetSystemHeadsetType().ToString() + " -------------------", true); }