コード例 #1
0
 /// <summary>
 /// Set the relationship between the current logged in gamer and the given other gamer.
 /// </summary>
 /// <param name="gamerID">Identifier of the gamer with who to change the relationship.</param>
 /// <param name="relationship">Type of relationship to set.</param>
 /// <param name="notificationJson">Message to send as notification if the target gamer is offline under {"languageCode1":"text1", "languageCode2":"text2", ...} format. (optional)</param>
 public static void Handling_SetGamerRelationship(string gamerID, FriendRelationshipStatus relationship, string notificationJson = null)
 {
     // The gamer ID should not be empty
     if (string.IsNullOrEmpty(gamerID))
     {
         DebugLogs.LogError("[CotcSdkTemplate:CommunityFeatures] The gamer ID is empty ›› Please enter a valid gamer ID");
     }
     else
     {
         PushNotification pushNotification = CotcConverter.GetPushNotificationFromJson(notificationJson);
         Backend_ChangeRelationshipStatus(gamerID, relationship, SetGamerRelationship_OnSuccess, SetGamerRelationship_OnError, pushNotification);
     }
 }
コード例 #2
0
 /// <summary>
 /// Send an event from the current logged in gamer to the given other gamer.
 /// </summary>
 /// <param name="gamerID">Identifier of the gamer with who to change the relationship.</param>
 /// <param name="eventData">Details of the event to send.</param>
 /// <param name="notificationJson">Message to send as notification if the target gamer is offline under {"languageCode1":"text1", "languageCode2":"text2", ...} format. (optional)</param>
 public static void Handling_SendEventToGamer(string gamerID, string eventData, string notificationJson = null)
 {
     // The gamer ID should not be empty
     if (string.IsNullOrEmpty(gamerID))
     {
         DebugLogs.LogError("[CotcSdkTemplate:CommunityFeatures] The gamer ID is empty ›› Please enter a valid gamer ID");
     }
     // The event data should not be empty
     else if (string.IsNullOrEmpty(eventData))
     {
         DebugLogs.LogError("[CotcSdkTemplate:CommunityFeatures] The event data is empty ›› Please enter some event data");
     }
     else
     {
         Bundle           eventBundle      = new Bundle(eventData);
         PushNotification pushNotification = CotcConverter.GetPushNotificationFromJson(notificationJson);
         Backend_SendEvent(gamerID, eventBundle, SendEvent_OnSuccess, SendEvent_OnError, pushNotification);
     }
 }