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
C
Customer Support
said
over 5 years ago
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) => {
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
Customer Support
said
over 5 years ago
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) => {
Miguel Angel Cortes Sosa
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.
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
Customer Support
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
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2485 topics