void OnUnlockAchievement(AchievementUnlockedEvent e) { if (e.ErrorInfo != null) { Debug.Log("Failed to unlock achievement:" + e.ErrorInfo.ErrorMessage); } else { Debug.Log(e.PlayerAchievement); } }
public async Task <IActionResult> SendEvent() { var achievement = new AchievementUnlockedEvent { UserId = "1", AchievementId = 1 }; await _eventSender.Send(achievement); return(NoContent()); }
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}"); } }