void OnUnlockAchievement(AchievementUnlockedEvent e)
 {
     if (e.ErrorInfo != null)
     {
         Debug.Log("Failed to unlock achievement:" + e.ErrorInfo.ErrorMessage);
     }
     else
     {
         Debug.Log(e.PlayerAchievement);
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> SendEvent()
        {
            var achievement = new AchievementUnlockedEvent
            {
                UserId        = "1",
                AchievementId = 1
            };

            await _eventSender.Send(achievement);

            return(NoContent());
        }
Exemplo n.º 3
0
        public async Task Send(AchievementUnlockedEvent achievement)
        {
            try
            {
                // Create a new message to send to the queue (serialise the payload)
                var message = new Message(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(achievement)));

                // Send the message to the queue
                await _queueClient.SendAsync(message);
            }
            catch (Exception exception)
            {
                Console.WriteLine($"{DateTime.Now} :: Exception: {exception.Message}");
            }
        }