private bool onRewardsReceived(RewardServiceEvents.RewardsEarned evt) { if (!string.IsNullOrEmpty(evt.RewardedUsers.sourceId) && evt.RewardedUsers.sourceId == pinataInstanceId) { if (evt.RewardedUsers.rewards.Count > 0) { coinsEffectInstance = Object.Instantiate(CoinsEffectPrefab); coinsEffectInstance.transform.position = PinataDamageObjects[currentDamageIndex].transform.position; foreach (KeyValuePair <long, Reward> reward in evt.RewardedUsers.rewards) { long key = reward.Key; playersToReward.Add(reward.Key); if (Service.Get <CPDataEntityCollection>().IsLocalPlayer(key)) { if (reward.Value.TryGetValue(out CoinReward rewardable)) { numCoinsToReward = rewardable.Coins; } else { numCoinsToReward = 0; } } } } hidePinata(); } return(false); }
private bool onRewardsEarned(RewardServiceEvents.RewardsEarned evt) { long localPlayerSessionId = Service.Get <CPDataEntityCollection>().LocalPlayerSessionId; if (evt.RewardedUsers.rewards.ContainsKey(localPlayerSessionId)) { addReward(evt.RewardedUsers.rewards[localPlayerSessionId], evt.RewardedUsers.source.ToString(), evt.RewardedUsers.sourceId); } return(false); }
private bool onRewardsReceived(RewardServiceEvents.RewardsEarned evt) { if (!string.IsNullOrEmpty(evt.RewardedUsers.sourceId) && evt.RewardedUsers.sourceId == partyBlasterId) { if (playersToReward == null) { Log.LogError(this, "Error: received rewards before party blaster experience was initialized"); return(false); } if (evt.RewardedUsers != null && evt.RewardedUsers.rewards != null && evt.RewardedUsers.rewards.Count > 0) { foreach (KeyValuePair <long, Reward> reward in evt.RewardedUsers.rewards) { playersToReward.Add(reward.Key); } rewardCoinsWithCelebration(); } } return(false); }
private bool onRewardsEarned(RewardServiceEvents.RewardsEarned evt) { if (evt.RewardedUsers != null && evt.RewardedUsers.source == RewardSource.MINI_GAME && evt.RewardedUsers.sourceId == "Targets") { List <long> list = new List <long>(); foreach (KeyValuePair <long, Reward> reward in evt.RewardedUsers.rewards) { long key = reward.Key; list.Add(reward.Key); if (!string.IsNullOrEmpty(ParticipationPlayerPrefName) && !isQuestActive()) { DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntity <SessionIdData, long>(key); if (!dataEntityHandle.IsNull && key == Service.Get <CPDataEntityCollection>().LocalPlayerSessionId) { RewardedForLocalParticipation(); } } } SceneRefs.CelebrationRunner.PlayCelebrationAnimation(list); UnityEngine.Object.Instantiate(RewardEffectsPrefab, RewardEffectsPosition.position, Quaternion.identity); } return(false); }