本文整理汇总了C#中SimpleJSON.JSONArray.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# JSONArray.ToString方法的具体用法?C# JSONArray.ToString怎么用?C# JSONArray.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleJSON.JSONArray
的用法示例。
在下文中一共展示了JSONArray.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveXBuildData
public void SaveXBuildData(string IMG_DATA, string start_code, string update_code)
{
XDebug.Log ("Begining save..");
XBuildData xbuild = DPS.XBD;
JSONArray json = new JSONArray ();
JSONArray names = new JSONArray ();
if (xbuild.names != null) {
for (int i = 0; i < xbuild.names.GetLength(0); i++) {
JSONArray nameline = new JSONArray ();
for (int j = 0; j < xbuild.names.GetLength(1); j++) {
if (xbuild.names [i, j] != null)
nameline.Add (xbuild.names [i, j]);
else
nameline.Add ("null");
}
names.Add (nameline);
}
}
json.Add("names", names);
JSONArray types = new JSONArray ();
if (xbuild.types != null) {
for (int i = 0; i < xbuild.types.GetLength(0); i++) {
JSONArray typeline = new JSONArray ();
for (int j = 0; j < xbuild.types.GetLength(1); j++) {
if (xbuild.types [i, j] != null)
typeline.Add (xbuild.types [i, j] + "");
else
typeline.Add ("0");
}
types.Add (typeline);
}
}
json.Add("types", types);
json.Add("center_x", new JSONData(xbuild.center.x));
json.Add("center_y", new JSONData(xbuild.center.y));
XDebug.Log ("Saving... @id" + xbuild.db_id + " " + json.ToString());
XDebug.Log ("Start code: \n" + start_code);
XDebug.Log ("Update Code: \n" + update_code);
//XDebug.Log ("Image data size: \n" + IMG_DATA.Length);
Application.ExternalCall ("SaveXBuild", xbuild.db_id, xbuild.name, json.ToString (), IMG_DATA, start_code, update_code);
}
示例2: GetRespuestas
public void GetRespuestas(){
if (N ["Mensajes"] [contPreg] ["Respuestas"] != null) {
//devuelve las posibles respuestas
respuestaJSON = N ["Mensajes"] [contPreg] ["Respuestas"].AsArray;
print (respuestaJSON.ToString());
for(int i = 0;i < respuestas.Length; i++){
print(respuestaJSON[i]);
respuestas [i].GetComponentInChildren<Text> ().text = respuestaJSON[i]["Texto"];
}
}
}
示例3: ConvertListToJson
private string ConvertListToJson(List<String> list)
{
if (list == null) {
return null;
}
var jsonArray = new JSONArray ();
foreach (var listItem in list) {
jsonArray.Add (new JSONData (listItem));
}
return jsonArray.ToString ();
}
示例4: getBadgesWon
public IEnumerator getBadgesWon(int p_idSG)
{
print ("--- get Badges ---");
string URL = baseURL + "/badges/seriousgame/" + p_idSG + "/version/" + version + "/player/" + idPlayer;
WWW www = new WWW(URL);
// wait for the requst to finish
yield return www;
badgesWon = JSON.Parse(www.text).AsArray;
print ("Badges received! " + badgesWon.ToString());
}
示例5: updateFeedback
public IEnumerator updateFeedback(Action<JSONArray> callbackFeedback)
{
print ("--- update Feedback ---");
string URL = baseURL + "/gameplay/" + idGameplay + "/feedback/";
WWW www = new WWW(URL);
// wait for the requst to finish
yield return www;
feedback = JSON.Parse(www.text).AsArray;
print ("Feedback received! " + feedback.ToString());
foreach (JSONNode f in feedback)
{
// log badge
if (string.Equals(f["type"], "BADGE"))
{
badgesWon.Add(f);
}
}
callbackFeedback (feedback);
}
示例6: updateScores
public IEnumerator updateScores(Action<JSONArray> callbackScore)
{
print ("--- getScores ---");
string URL = baseURL + "/gameplay/" + idGameplay + "/scores/";
WWW www = new WWW(URL);
// wait for the requst to finish
yield return www;
scores = JSON.Parse(www.text).AsArray;
print ("Scores received! " + scores.ToString());
callbackScore(scores);
}
示例7: startGameplay
public IEnumerator startGameplay(int p_idSG, string sceneGame)
{
scores = new JSONArray ();
feedback = new JSONArray ();
seriousGame = new JSONNode();
print ("--- startGameplay ---");
string putDataString = "";
// existing player
if (idPlayer != -1)
{
putDataString =
"{" +
"\"idSG\": " + p_idSG +
", \"version\": " + version +
", \"idPlayer\": " + idPlayer +
"}";
}
// new player -> create one
else
{
putDataString =
"{" +
"\"idSG\": " + p_idSG +
", \"version\": " + version +
", \"idStudent\": " + idStudent +
", \"params\": " + parameters.ToString() +
"}";
}
print (putDataString);
string URL = baseURL + "/gameplay/start";
WWW www = new WWW(URL, Encoding.UTF8.GetBytes(putDataString), headers);
// wait for the requst to finish
yield return www;
idGameplay = int.Parse(www.text);
print ("Gameplay Started! id: " + idGameplay);
print ("--- getScores ---");
string URL2 = baseURL + "/gameplay/" + idGameplay + "/scores/";
WWW www2 = new WWW(URL2);
// wait for the requst to finish
yield return www2;
scores = JSON.Parse(www2.text).AsArray;
print ("Scores received! " + scores.ToString());
SceneManager.LoadScene(sceneGame);
}