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


C# JSONObject.SetField方法代码示例

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


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

示例1: SetVec2

 private void SetVec2(Vector2 value)
 {
     JSONObject vecJson = new JSONObject();
     vecJson.SetField("x",value.x);
     vecJson.SetField("y",value.y);
     VariableManager.JsonRecord.SetField(ID,vecJson);
 }
开发者ID:Doy32,项目名称:Samurai,代码行数:7,代码来源:SaveableVec2.cs

示例2: SetBoolList

 private void SetBoolList(List<bool> boolList)
 {
     JSONObject listJson = new JSONObject();
     for(int i=0;i<boolList.Count;i++)
     {
         listJson.SetField("item"+i,boolList[i]);
     }
     VariableManager.JsonRecord.SetField(ID,listJson);
 }
开发者ID:Doy32,项目名称:Samurai,代码行数:9,代码来源:SaveableBooleanList.cs

示例3: GeneratePositionUpdatePacket

 public JSONObject GeneratePositionUpdatePacket()
 {
     if (!_positionUpdatePacket)
     {
         _positionUpdatePacket = new JSONObject();
         _positionUpdatePacket.SetField("pos", new JSONObject(JSONObject.Type.ARRAY));
     }
     _positionUpdatePacket.AddField("pos", delegate(JSONObject o)
     {
         o.Add(transform.position.x);
         o.Add(transform.position.y);
     });
     return _positionUpdatePacket;
 }
开发者ID:alvyxaz,项目名称:dagger-online,代码行数:14,代码来源:PlayerCharacter.cs

示例4: MergeRecur

	/// <summary>
	/// Merge object right into left recursively
	/// </summary>
	/// <param name="left">The left (base) object</param>
	/// <param name="right">The right (new) object</param>
	static void MergeRecur(JSONObject left, JSONObject right) {
		if(left.type == JSONObject.Type.NULL)
			left.Absorb(right);
		else if(left.type == Type.OBJECT && right.type == Type.OBJECT) {
			for(int i = 0; i < right.list.Count; i++) {
				string key = (string)right.keys[i];
				if(right[i].isContainer){
					if(left.HasField(key))
						MergeRecur(left[key], right[i]);
					else
						left.AddField(key, right[i]);
				} else {
					if(left.HasField(key))
						left.SetField(key, right[i]);
					else
						left.AddField(key, right[i]);
				}
			}
		} else if(left.type == Type.ARRAY && right.type == Type.ARRAY) {
			if(right.Count > left.Count){
				Debug.LogError("Cannot merge arrays when right object has more elements");
				return;
			}
			for(int i = 0; i < right.list.Count; i++) {
				if(left[i].type == right[i].type) {			//Only overwrite with the same type
					if(left[i].isContainer)
						MergeRecur(left[i], right[i]);
					else{
						left[i] = right[i];
					}
				}
			}
		}
	}
开发者ID:rmarx,项目名称:ReverseRPG,代码行数:39,代码来源:MiniJSON.cs

示例5: MergeRecur

	static void MergeRecur(JSONObject left, JSONObject right) {
		if(right.type == JSONObject.Type.OBJECT) {
			for(int i = 0; i < right.list.Count; i++) {
				if(right.keys[i] != null) {
					string key = (string)right.keys[i];
					JSONObject val = (JSONObject)right.list[i];
					if(val.type == JSONObject.Type.ARRAY || val.type == JSONObject.Type.OBJECT) {
						if(left.HasField(key))
							MergeRecur(left[key], val);
						else
							left.AddField(key, val);
					} else {
						if(left.HasField(key))
							left.SetField(key, val);
						else
							left.AddField(key, val);
					}
				}
			}
		}// else left.list.Add(right.list);
	}
开发者ID:ruscoe,项目名称:DRPG-Unity-Client,代码行数:21,代码来源:JSONObject.cs

示例6: jsonFromCS

 public JSONObject jsonFromCS()
 {
     JSONObject j = new JSONObject("{\"method\":\"hogemethod\"}");
     Debug.Log( "j:" + j );
     j.SetField( "params", new JSONObject( "[1,2,\"hoge\"]") );
     Debug.Log( "j:" + j );
     return j;
 }
开发者ID:Ryohei-Yoshikawa,项目名称:wise9mmo,代码行数:8,代码来源:ProtocolScript.cs

示例7: MergeRecur

	/// <summary>
	/// Merge object right into left recursively
	/// </summary>
	/// <param name="left">The left (base) object</param>
	/// <param name="right">The right (new) object</param>
	static void MergeRecur(JSONObject left, JSONObject right) {
		if(left.type == Type.NULL)
			left.Absorb(right);
		else if(left.type == Type.OBJECT && right.type == Type.OBJECT) {
			for(int i = 0; i < right.list.Count; i++) {
				string key = right.keys[i];
				if(right[i].isContainer) {
					if(left.HasField(key))
						MergeRecur(left[key], right[i]);
					else
						left.AddField(key, right[i]);
				} else {
					if(left.HasField(key))
						left.SetField(key, right[i]);
					else
						left.AddField(key, right[i]);
				}
			}
		} else if(left.type == Type.ARRAY && right.type == Type.ARRAY) {
			if(right.Count > left.Count) {
				return;
			}
			for(int i = 0; i < right.list.Count; i++) {
				if(left[i].type == right[i].type) {			//Only overwrite with the same type
					if(left[i].isContainer)
						MergeRecur(left[i], right[i]);
					else {
						left[i] = right[i];
					}
				}
			}
		}
	}
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:38,代码来源:JSONObject.cs


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