private static void Data_Received(CloudConnectorCore.QueryType queryType, List <string> objectNames, List <string> data) { CloudConnectorCore.processedResponseCallback.RemoveListener(Data_Received); var json = "{ \"rows\" : " + data[0] + " }"; var sheet = JsonUtility.FromJson <ScriptGoogleSheet>(json); var en = new VoiceOverText(); var fr = new VoiceOverText(); var ru = new VoiceOverText(); var enLines = new List <VoiceOverLine>(); var frLines = new List <VoiceOverLine>(); var ruLines = new List <VoiceOverLine>(); foreach (var row in sheet.rows) { enLines.Add(row.English()); frLines.Add(row.French()); ruLines.Add(row.Russian()); } en.lines = enLines.ToArray(); fr.lines = frLines.ToArray(); ru.lines = ruLines.ToArray(); WriteFile("script.en.txt", en); WriteFile("script.fr.txt", fr); WriteFile("script.ru.txt", ru); }
// 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]); } } }
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.getAllTables) { // Just dump all content to the console, sorted by table name. for (int i = 0; i < objTypeNames.Count; i++) { } } }
private void OnDataReceived(CloudConnectorCore.QueryType queryType, List <string> objTypeNames, List <string> jsonData) { ReceivingData = true; try { if (queryType == CloudConnectorCore.QueryType.getAllTables) { OnParsingStarted.Invoke(); List <int> parsedIds = new List <int>(); if (CustomTableOrder.Count > 0) { //first parse data in forced order foreach (var t in CustomTableOrder) { int index = objTypeNames.IndexOf(t); ParseJson(objTypeNames[index], jsonData[index]); parsedIds.Add(index); } } for (int i = 0; i < jsonData.Count; i++) { if (parsedIds.Contains(i)) { continue; } ParseJson(objTypeNames[i], jsonData[i]); } foreach (var parsedData in SpreadSheetParsersByName) { parsedData.Value.AfterParsePass(); } } } catch (System.Exception) { CloudConnectorCore.processedResponseCallback.RemoveListener(OnDataReceived); ReceivingData = false; throw; } CloudConnectorCore.processedResponseCallback.RemoveListener(OnDataReceived); ReceivingData = false; }
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]); } if (query == CloudConnectorCore.QueryType.getAllTables) { for (int i = 0; i < objTypeNames.Count; i++) { TableName Name = FindTable(objTypeNames[i]); switch (Name) { case TableName.Version: { break; } case TableName.Quest: { break; } } } } #region Version_Check else if (query == CloudConnectorCore.QueryType.getTable) { for (int i = 0; i < objTypeNames.Count; i++) { TableName Name = FindTable(objTypeNames[i]); switch (Name) { case TableName.Version: { Version_Check(jsonData[i]); break; } } } } #endregion }
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: " + query + " : " + objTypeNames[i]); * } */ switch (query) { case CloudConnectorCore.QueryType.getAllTables: { Data_Loading(objTypeNames, jsonData); break; } case CloudConnectorCore.QueryType.getTable: { Version_Check(jsonData[0]); break; } } }
//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; }