當前位置: 首頁>>代碼示例>>C#>>正文


C# JSONNode.ToString方法代碼示例

本文整理匯總了C#中SimpleJSON.JSONNode.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# JSONNode.ToString方法的具體用法?C# JSONNode.ToString怎麽用?C# JSONNode.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SimpleJSON.JSONNode的用法示例。


在下文中一共展示了JSONNode.ToString方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: assess

    public IEnumerator assess(string p_action, JSONNode p_values, Action<JSONNode> callback)
    {
        print("--- assess action (" + p_action + ") ---");

        string putDataString =
            "{" +
                "\"action\": \"" + p_action + "\"" +
                ", \"values\": " + p_values.ToString() +
                "}";

        string URL = baseURL + "/gameplay/" + idGameplay + "/assessAndScore";

        WWW www = new WWW(URL, Encoding.UTF8.GetBytes(putDataString), headers);

        // wait for the requst to finish
        yield return www;

        JSONNode returnAssess = JSON.Parse(www.text);

        feedback = returnAssess["feedback"].AsArray;
        scores = returnAssess["scores"].AsArray;
        print("Action " + putDataString + " assessed! returned: " + returnAssess.ToString());
        foreach (JSONNode f in feedback)
        {
            // log badge
            if (string.Equals(f["type"], "BADGE"))
            {
                badgesWon.Add(f);
            }
        }

        callback(returnAssess);
    }
開發者ID:dantay0803,項目名稱:SystemBuilder,代碼行數:33,代碼來源:EngAGe.cs

示例2: saveData

    public void saveData(JSONNode json, string dirName="", string fileName="")
    {
        if (dirName == "") {
            dirName = defaultDirName;
        }
        if (fileName == "") {
            fileName = defaultFileName;
        }

        Debug.Log ("Saving Data: " + json.ToString());

        if (!Directory.Exists (folderPath + dirName)) {
            Directory.CreateDirectory(folderPath + dirName);
        }
        string path = folderPath + dirName + "/" + fileName + ".json";

        Debug.Log ("Saving To: " + path);

        File.WriteAllText(path , json.ToString());
    }
開發者ID:ShadowVision,項目名稱:FOX,代碼行數:20,代碼來源:IO_Manager.cs

示例3: Send

	public void Send(JSONNode data){
		SendString(data.ToString());
	}
開發者ID:Urauth,項目名稱:Finnish-Game-Jam-2016,代碼行數:3,代碼來源:UDPSend.cs

示例4: TileProperties

        /// <summary>
        /// Initializes a new instance of the <see cref="Tiled.TileProperties"/> class.
        /// </summary>
        /// <param name="jsondata">Jsondata. A JSONNode from the Tiled2D export. </param>
        public TileProperties(JSONNode jsondata, int i)
        {
            this.index = i;
            this.primitive = "cube";
            this.collider = "None";
            if (jsondata.ToString ().Equals( "")) {
                this.back = i;
                this.bottom = i;
                this.top = i;
                this.left = i;
                this.right = i;
            } else {
                this.back = this.getProperty("back", jsondata);
                this.bottom = this.getProperty("bottom", jsondata);
                this.top = this.getProperty("top", jsondata);
                this.left = this.getProperty("left", jsondata);
                this.right = this.getProperty("right", jsondata);
                this.collider = jsondata["collider"];
            }

            Debug.Log ("Tile Properties Initialized");
            Debug.Log ("Back:  " + this.back);
        }
開發者ID:joelghill,項目名稱:RocketGirl,代碼行數:27,代碼來源:TiledLevel.cs

示例5: OnButtonDrawTenCards

	public void OnButtonDrawTenCards(){
		string[] storageJsonArray = new string[10];
		JSONNode j;
		Storage s = new Storage();
		bool[] isCounselors = new bool[10];
		int random;
		bool isRedraw = true;
		bool isMustRedraw = false;
		JSONClass json;
		int[] results = new int[10];
		do {
			isMustRedraw = false;
			for (int i=0; i<10; i++) {
				random = UnityEngine.Random.Range (1, numberOfCounselors + numberOfGenerals);
				isCounselors[i] = (random <= numberOfCounselors);
				//Debug.Log (random);
				results[i] = (isCounselors[i]) ? random : random - numberOfCounselors + 1000;
				s = new Storage (){productId= results[i], type =2, quantity =1}; //TODO: Personnel number instead of 0.
				if (isCounselors[i]){ 
					isRedraw = (counselorList[random-1].Rank != rankStopRedraw) ; // Make it false if any card Rank 6
					if (counselorList[random-1].Rank == rankNeedRedraw) isMustRedraw = true;
					storageJsonArray[i] = "{\"type\":"+results[i]+",\"level\":1}";
				}else{ // result == generals
					isRedraw = ( generalList[random-numberOfCounselors].Rank != rankStopRedraw); // Make it false if any card Rank 6
					if (generalList[random-numberOfCounselors].Rank == rankNeedRedraw) isMustRedraw = true;
					j = (JSONNode)s.toJSON ();
					storageJsonArray[i] = j.ToString();
				}
			}
		} while(isRedraw|| isMustRedraw);
		//string data = "["+ String.Join(" , ", storageJsonArray)+"]";
		json = new JSONClass ();
		for (int i = 0; i<10; i++) {
			json["data"]  = storageJsonArray [i];
			json["action"]="NEW";
			json["table"]= (isCounselors[i])? "counselors" : "storage" ;
			wsc.Send (json.ToString ());
		}

		json ["data"] = "";

	}
開發者ID:marcochiu2-c,項目名稱:MainMenu_uFrame1.6,代碼行數:42,代碼來源:DrawCards.cs

示例6: OnButtonDrawSingleCard

	public void OnButtonDrawSingleCard(){
		int random = UnityEngine.Random.Range (1, numberOfCounselors + numberOfGenerals);
		bool isCounselors = (random <= numberOfCounselors);
		int result = (isCounselors) ? random : random - numberOfCounselors + 1000;

		//Debug.Log ("Random Number: "+random);

		//Debug.Log ("Result Number: "+ result);

		Storage s = new Storage(){productId= result, type =2, quantity =1}; //TODO: Personnel number instead of 0.

		json = new JSONClass ();
		if (isCounselors) {
			json["data"].Add ("userId",new JSONData(game.login.id));
			json["data"].Add ("type" , new JSONData(result));
			json["data"].Add ("level", new JSONData(1));
		} else {
			json.Add ("data", (JSONNode)s.toJSON ());
			json["data"].Add ("userId",new JSONData (game.login.id));
		}
		if (isCounselors) {
			json ["action"] = "NEW";
			json ["table"] = (isCounselors) ? "counselors" : "storage";
			Debug.Log (json.ToString ());
			wsc.Send (json.ToString ());
		}
	}
開發者ID:marcochiu2-c,項目名稱:MainMenu_uFrame1.6,代碼行數:27,代碼來源:DrawCards.cs

示例7: Start

	void Start(){


		json = new JSONClass ();
		json ["data"] = "3";

		json ["action"] = "GET";
		json ["table"] = "users";
		//json ["table"] = "private_chat_histories";
		//Debug.Log (json.ToString ());//{"action":"GET", "table":"users", "data":"3"}
		if (wsc.conn.IsAlive) {
			wsc.Send (json.ToString ()); 
		} else {
			Debug.Log ("Connection Lost!");
		}
	}
開發者ID:marcochiu2-c,項目名稱:MainMenu_uFrame1.6,代碼行數:16,代碼來源:DrawCards.cs

示例8: ParseJson

    /**
     * Parse json response from blockscan
     * call asset's function if same name asset are found in json response
     * */
    public void ParseJson(JSONNode jsonResponse)
    {
        //check if asset has been found at this address (bad format address?)
        if (jsonResponse == null) {
            Debug.Log ("no asset found at this address");
            return;
        }

        Debug.Log ("jsonReponse text: " + jsonResponse.ToString ());
        Debug.Log ("jsonResponse data count: " + jsonResponse ["data"].Count);

        //store number of asset found in json response
        int nbrOfAsset = jsonResponse ["data"].Count;

        //iterate to check if asset name are the same in assetName array and asset from json response
        for (int i = 0; i < nbrOfAsset; i++) {
            for (int y = 0; y < assetName.Length; y++){
                if (jsonResponse ["data"] [i] ["asset"].Value == assetName[y]){
                    string methodName = "Asset"+i;

                    //Get the method information using the method info class
                    MethodInfo mi = this.GetType().GetMethod(methodName);

                    //Invoke the method Asset1, Asset2, etc..
                    var arguments = new object[] { y };
                    mi.Invoke(this, arguments);
                }
            }
            Debug.Log ("asset name: " + jsonResponse ["data"] [i] ["asset"].Value);
            Debug.Log ("asset balance: " + jsonResponse ["data"] [i] ["balance"].Value);
        }
    }
開發者ID:Joul1285,項目名稱:UnityDecentralizedAsset,代碼行數:36,代碼來源:BlockscanCheckAsset.cs

示例9: JsonEncode

 /// <summary>
 /// Encodes a set of key-value pairs into JSON string.
 /// </summary>
 public static string JsonEncode(JSONNode parameters)
 {
     return parameters.ToString ();
 }
開發者ID:uptredlabs,項目名稱:Mobile,代碼行數:7,代碼來源:Core.cs

示例10: getLeaderboard

	public IEnumerator getLeaderboard(int p_idSG)
	{
		print ("--- get Leader Board ---");
		
		string URL = baseURL + "/learninganalytics/leaderboard/seriousgame/" + p_idSG + "/version/" + version;
		
		WWW www = new WWW(URL);
		
		// wait for the requst to finish
		yield return www;

		leaderboard = JSON.Parse(www.text);
		print ("Leader board received! " + leaderboard.ToString());
	}
開發者ID:RBrNx,項目名稱:MathMathRevolution,代碼行數:14,代碼來源:EngAGe.cs

示例11: getGameDesc

	public IEnumerator getGameDesc(int p_idSG)
	{
		print ("--- get SG ---");
		
		string URL = baseURL + "/seriousgame/" + p_idSG + "/version/" + version;
		
		WWW www = new WWW(URL);
		
		// wait for the requst to finish
		yield return www;

		seriousGame = JSON.Parse(www.text);
		print ("Serious game detailed received! " + seriousGame.ToString());
	}
開發者ID:RBrNx,項目名稱:MathMathRevolution,代碼行數:14,代碼來源:EngAGe.cs


注:本文中的SimpleJSON.JSONNode.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。