public void CoinsEarned(int coins, int delta, CoinSourceType sourceType) { if (ShouldSkipSendEvent) { DebugLog($"[ANALYTICS] [Skip] {Constants.Analytics.Events.CoinsEarn}: {MapCoinSource(sourceType).ToString()} " + $"{Constants.Analytics.Parameters.CoinsAwarded}: {delta} " + $"{Constants.Analytics.Parameters.PlayerCoins}: {coins} " + $"{Constants.Analytics.Parameters.GameId}: {GameId} " + $"{Constants.Analytics.Parameters.GameLevel}: {LevelID}"); return; } QLCoinsEarned coinsEarned = new QLCoinsEarned(MapCoinSource(sourceType), delta, coins, GameId, LevelID); TrackEvent(coinsEarned); if (delta < 0) //coins spent { AdjustEvent adjustEvent = new AdjustEvent(Constants.Analytics.AdjustEvents.CoinSpent); adjustEvent.addPartnerParameter("quantity", $"{delta * -1}"); Adjust.trackEvent(adjustEvent); DebugLog($"[ADJUST] coins spent : {delta * -1}"); } DebugLog($"[ANALYTICS] coins spent : {delta}"); DebugLog($"[ANALYTICS]][COINS] {Constants.Analytics.Events.CoinsEarn}: {MapCoinSource(sourceType).ToString()} " + $"{Constants.Analytics.Parameters.CoinsAwarded}: {delta} " + $"{Constants.Analytics.Parameters.PlayerCoins}: {coins} " + $"{Constants.Analytics.Parameters.GameId}: {GameId} " + $"{Constants.Analytics.Parameters.GameLevel}: {LevelID}"); }
// Coins earned private QLCoinSourceType MapCoinSource(CoinSourceType source) { switch (source) { case CoinSourceType.NewLocationUnlocked: return(QLCoinSourceType.QLCoinSourceTypeNewLocationUnlocked); case CoinSourceType.PuzzleSolved: return(QLCoinSourceType.QLCoinSourceTypePuzzleSolved); case CoinSourceType.VideoWatched: return(QLCoinSourceType.QLCoinSourceTypeVideoWatched); case CoinSourceType.GoldCollectionComplete: return(QLCoinSourceType.QLCoinSourceTypeGoldCollectionComplete); case CoinSourceType.Store: return(QLCoinSourceType.QLCoinSourceTypeStore); case CoinSourceType.PostGameVideo: return(QLCoinSourceType.QLCoinSourceTypePostGameVideo); default: //TODO add asset here? -> SHouldn't reach here return(QLCoinSourceType.QLCoinSourceTypePuzzleSolved); } }
public void CoinsGrantedHandler(int coinCount, CoinSourceType coinSourceType) { player.Coins += coinCount; serverController.PersistPlayerProgress(player); // coin analytics analyticsController.CoinsEarned(player.Coins, coinCount, coinSourceType); }
public void CoinsSpentHandler(int coinCount, CoinSourceType coinSourceType) { //COINS SPENT - TODO ADD ANALYTIC FOR ADJUST player.Coins -= coinCount; serverController.PersistPlayerProgress(player); //analyticsController.SendCoinSpent(coinCount); DebugLog($"Coins spent handler: {coinCount * -1}"); analyticsController.CoinsEarned(player.Coins, coinCount * -1, coinSourceType); }
public void ShowClaimPopup(string message, int rewardAmount, CoinSourceType CoinSourceType, Action claimed) { SoundController.Instance.PlayAudioClip(Settings.Autogenerated.SoundSettingsKey.Popupappear); claimButton.SetInteractability(true); coinSourceType = CoinSourceType; popupMessage.text = message; rewardClaimed = claimed; // set action popupWindow.SetActive(true); coinRewardCount = rewardAmount; coinAmountText.text = coinRewardCount.ToString(); Show(); }
//private int GetCoinEmissionRate(int rewardAmount) //{ // switch (rewardAmount) // { // case 25: // return 16; // case 10: // return 10; // case 5: // return 4; // case 1: // return 1; // default: // return 1; // } //} private void PersistCoins(int coinAmount, CoinSourceType coinSource) { SceneActivationBehaviour <GameLogicActivator> .Instance.GameController.CoinsGrantedHandler(coinAmount, coinSource); }