// Usado só pelo esquema com Spreadsheet public void ParseData(CloudConnectorCore.QueryType query, List <string> objTypeNames, List <string> jsonData) { if (query == CloudConnectorCore.QueryType.getTable) { wineInfos.Clear(); WineInfo[] wines = GSFUJsonHelper.JsonArray <WineInfo>(jsonData[0]); for (int i = 0; i < wines.Length; i++) { wineInfos.Add(wines[i]); } } }
//every thing after is used for sending. Nothing directly used. // Parse data received from the cloud. public static void ParseData(CloudConnectorCore.QueryType query, List <string> objTypeNames, List <string> jsonData) { for (int i = 0; i < objTypeNames.Count; i++) { Debug.Log("Data type/table: " + objTypeNames[i]); } // First check the type of answer. if (query == CloudConnectorCore.QueryType.getObjects) { // In the example we will use only the first, thus '[0]', // but may return several objects depending the query parameters. // Check if the type is correct. if (string.Compare(objTypeNames[0], tableName) == 0) { try { PlayerInfo[] players = GSFUJsonHelper.JsonArray <PlayerInfo>(jsonData[0]); player = players[0]; } catch { namechange(playername); } } } // First check the type of answer. if (query == CloudConnectorCore.QueryType.getTable) { // Check if the type is correct. if (string.Compare(objTypeNames[0], tableName) == 0) { // Parse from json to the desired object type. PlayerInfo[] players = GSFUJsonHelper.JsonArray <PlayerInfo>(jsonData[0]); string logMsg = "<color=yellow>" + players.Length.ToString() + " objects retrieved from the cloud and parsed:</color>"; for (int i = 0; i < players.Length; i++) { logMsg += "\n" + "<color=blue>Name: " + players[i].name + "</color>\n"; //+ //"Level: " + players[i].level + "\n" + //"Health: " + players[i].health + "\n" + //"Role: " + players[i].role + "\n"; } Debug.Log(logMsg); } } // First check the type of answer. if (query == CloudConnectorCore.QueryType.getAllTables) { // Just dump all content to the console, sorted by table name. string logMsg = "<color=yellow>All data tables retrieved from the cloud.\n</color>"; for (int i = 0; i < objTypeNames.Count; i++) { logMsg += "<color=blue>Table Name: " + objTypeNames[i] + "</color>\n" + jsonData[i] + "\n"; } Debug.Log(logMsg); } }
public static void ParseData(CloudConnectorCore.QueryType query, List <string> objTypeNames, List <string> jsonData) { for (int i = 0; i < objTypeNames.Count; i++) { Debug.Log("Data type/table: " + objTypeNames [i]); } // First check the type of answer. if (query == CloudConnectorCore.QueryType.getObjects) { // In the example we will use only the first, thus '[0]', // but may return several objects depending the query parameters. // Check if the type is correct. if (string.Compare(objTypeNames [0], PLAYER) == 0) { // Parse from json to the desired object type. PlayerInfo[] players = GSFUJsonHelper.JsonArray <PlayerInfo> (jsonData [0]); player = players [0]; playerloaded = true; } } // First check the type of answer. else if (query == CloudConnectorCore.QueryType.getTable) { // Check if the type is correct. if (string.Compare(objTypeNames [0], ABILITIES) == 0) { // Parse from json to the desired object type. abilities = GSFUJsonHelper.JsonArray <AbilityInfo> (jsonData [0]); } else if (string.Compare(objTypeNames [0], TOWERS) == 0) { // Parse from json to the desired object type. towers = GSFUJsonHelper.JsonArray <EntityInfo> (jsonData [0]); } else if (string.Compare(objTypeNames [0], ENEMIES) == 0) { // Parse from json to the desired object type. enemies = GSFUJsonHelper.JsonArray <EntityInfo> (jsonData [0]); } } // First check the type of answer. else if (query == CloudConnectorCore.QueryType.getAllTables) { // Just dump all content to the console, sorted by table name. string logMsg = "<color=yellow>All data tables retrieved from the cloud.\n</color>"; for (int i = 0; i < objTypeNames.Count; i++) { logMsg += "<color=blue>Table Name: " + objTypeNames [i] + "</color>\n" + jsonData [i] + "\n"; } Debug.Log(logMsg); } loadVal = true; }