Hello PlayFab Community,
I have a question about the syntax of storing Shared Group Data. I am staring off using Shared Group Data to store the gamestate of a persistent asynchronous turn-based game in Unity.
Currently my solution is to create a Shared Group Data that has keys of "Player1" and "Player2" and those values contain their playfabIDs. The Shared Group Data also contains a blank "GameState". At the same time, I add the ID of that Shared Group Data to both players's User Data in a comma-separated value called "Games"
If I want to retrieve a list of Shared Group Datas as a list of dictionaries, what would the syntax for that be? I already have declared and parsed a List<string> called myGamesList that contains all the individual game names in "Games" as their own strings. Then for redundancy, I want to add a Key&Value pair to this dictionary like this: {"GroupID", SharedGroupId} that stores its own name of the game;
In addition, are there any limitations to using Shared Group Data in this way that I should know about?
public List<string> myGamesList = new List<string>(); // public List<Dictionary<string, string>> myGamesDetails = new List<Dictionary<string, string>>(); // What is the proper way to declare this? public void GetMyGamesDetails() { foreach (var game in myGamesList) { PlayFabClientAPI.GetSharedGroupData(new GetSharedGroupDataRequest { SharedGroupId = game, Keys = null }, gotSharedDataResult => { //myGamesDetails.Add(gotSharedDataResult.Data as Dictionary<string, string>); // How do I convert this? // // Then I want to add a Key & Value to this dictionary called {"GroupID", SharedGroupId} }, getSharedDataError => { Debug.Log("Error Getting Shared Group Data") }); }
Thank you for your help :)
-Doug