Sign In Register

How can we help you today?

Start a new topic
Answered

ListMessageSummaryRequest

Hi,

I need to check the recent messages sent from GS to the player, I'm doing this by using ListMessageSummaryRequest, however

I'm having a hard time trying to iterate the "messagelist". Can someone please post an example of how to read back in C# the response from 

ListMessageSummaryRequest? thanks.


Best Answer

Hi Miguel,


Here is a simple example you can run in GameSparks Test UI Scene. Paste this in over listMessageRequest in GameSparksTestUI.cs, run the scene, authenticate and click the listMessageSummaryRequest.


ArrayList messageList = new ArrayList();

 

  if (GUILayout.Button ("listMessageSummaryRequest" , GUILayout.Width (itemWidth), GUILayout.Height (itemHeight))) {

   new ListMessageSummaryRequest().Send((response) => {

    foreach(var c in response.MessageList){

     messageList.Add(c.GetString("messageId"));

     

     HandleLog("ListMessageSummaryRequest.MessageList:" + c.GetString("messageId"));

    }

   });

  }


Outside of that scene something like this should get you going.


ListMessageSummaryResponse resp = new ListMessageSummaryRequest().SetEntryCount(10).SetOffset(0).Send();


ArrayList messageList = new ArrayList();
messageList.Add(resp.messageList);
foreach(int i in messageList){
   string summary = messageList[i].summary;
   //Your Code Here!
}


Thanks,

Liam

1 Comment

Answer

Hi Miguel,


Here is a simple example you can run in GameSparks Test UI Scene. Paste this in over listMessageRequest in GameSparksTestUI.cs, run the scene, authenticate and click the listMessageSummaryRequest.


ArrayList messageList = new ArrayList();

 

  if (GUILayout.Button ("listMessageSummaryRequest" , GUILayout.Width (itemWidth), GUILayout.Height (itemHeight))) {

   new ListMessageSummaryRequest().Send((response) => {

    foreach(var c in response.MessageList){

     messageList.Add(c.GetString("messageId"));

     

     HandleLog("ListMessageSummaryRequest.MessageList:" + c.GetString("messageId"));

    }

   });

  }


Outside of that scene something like this should get you going.


ListMessageSummaryResponse resp = new ListMessageSummaryRequest().SetEntryCount(10).SetOffset(0).Send();


ArrayList messageList = new ArrayList();
messageList.Add(resp.messageList);
foreach(int i in messageList){
   string summary = messageList[i].summary;
   //Your Code Here!
}


Thanks,

Liam

Login to post a comment