当前位置: 首页>>代码示例>>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;未经允许,请勿转载。