当前位置: 首页>>代码示例>>C#>>正文


C# JSONNode.Add方法代码示例

本文整理汇总了C#中SimpleJSON.JSONNode.Add方法的典型用法代码示例。如果您正苦于以下问题:C# JSONNode.Add方法的具体用法?C# JSONNode.Add怎么用?C# JSONNode.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleJSON.JSONNode的用法示例。


在下文中一共展示了JSONNode.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddElement

		static void AddElement (JSONNode ctx, string token, string tokenName, bool tokenIsString)
		{
			if (tokenIsString) {
				if (ctx is JSONArray)
					ctx.Add (token);
				else
					ctx.Add (tokenName, token); // assume dictionary/object
			} else {
				JSONData number = Numberize (token);
				if (ctx is JSONArray)
					ctx.Add (number);
				else
					ctx.Add (tokenName, number);
				
			}
		}
开发者ID:MirandaDora,项目名称:mbc,代码行数:16,代码来源:SimpleJSON.cs

示例2: 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


注:本文中的SimpleJSON.JSONNode.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。