• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SimpleJSON.JSONClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



JSONClass类属于SimpleJSON命名空间,在下文中一共展示了JSONClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ToJSON

	//JSON Format:

	/*
	{
		"session": {
			"id": "session1234",
			"player": "user123",
			"game": "game1",
			"version": "version 1.0"
		},
		
		"play_events" :
		[ 
		{  "time": "2015-02-17T22:43:45-5:00", "event": "PowerUp.FireBall", "value": "1.0", "level": "1-1"},
		{  "time": "2015-02-17T22:45:45-5:00", "event": "PowerUp.Mushroom", "value": "2.0", "level": "1-1"}
		 ]
	}
	*/

	public static string ToJSON(Gloggr_Report r)
	{
	
		JSONNode n = new JSONClass();
		
		
		
		n.Add ("session",  Gloggr_SessionHeader.ToJSONObject(r.session)  );
		
		JSONArray a = new JSONArray();
		
		foreach(Gloggr_PlayEvent e in r.play_events)
		{
			a.Add(Gloggr_PlayEvent.ToJSONObject(e));
		}
		
		n.Add ("play_events", a);
		
		return n.ToString();	
	
//		string json = JsonConvert.SerializeObject(e, Formatting.Indented);
//		//from Gloggr_SessionHeader.ToJSON
//		//json = Gloggr_SessionHeader.FormatJSONKeys(json);
//		//from Gloggr_PlayEvent.ToJSON
//		//json = Gloggr_PlayEvent.FormatJSONKeys(json);
//		return json;
	}
开发者ID:game-design,项目名称:independent-study,代码行数:46,代码来源:Gloggr_Report.cs


示例2: addGameVersion

    public void addGameVersion(string id)
    {
        JSONClass json = new JSONClass ();
        json.Add ("gameId", id);

        net.POST (url + "/" + id + "/versions" , System.Text.Encoding.UTF8.GetBytes (json.ToString ()), trackHeaders, new GameVersionCreatorListener ());
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:7,代码来源:AddGameWindow.cs


示例3: ExportResource

    static void ExportResource()
    {
        int StageNum = 1;
        string fileName = "Stage" + StageNum + ".json";

        Transform tf = GameObject.Find("BlockRoot").transform;

        string seedString = "{\"blocks\":[]}";

        JSONNode node = JSON.Parse(seedString);

        Transform[] arTF = tf.GetComponentsInChildren<Transform>();
        for (int i = 1; i < arTF.Length; i++)
        {
            Transform subtf = arTF[i];

            JSONClass subNode = new JSONClass();

            subNode.Add("type", "Normal");
            subNode.Add("posX", subtf.position.x + "");
            subNode.Add("posY", subtf.position.y + "");

            node["blocks"][-1] = subNode;
        }

        Debug.Log(node.ToString());
        writeStringToFile(node.ToString(), fileName);
    }
开发者ID:WonIkKim,项目名称:SexyJump,代码行数:28,代码来源:MakeBlockJsonData.cs


示例4: ConfirmConnectionOut

	private void ConfirmConnectionOut(string id){
		JSONNode data = new JSONClass();
		data["function"] = "Confirm";
		data["id"] = id;

		udpSend.Send(data);
	}
开发者ID:Urauth,项目名称:Finnish-Game-Jam-2016,代码行数:7,代码来源:ServerNetworker.cs


示例5: sendAction

	public void sendAction() {

		GetComponent<Animator>().Play("Click");

		if (buttonType == FLOOR_BUTTON_TYPE.YES || buttonType == FLOOR_BUTTON_TYPE.NO) {

			GameObject.Find("Debug Text").GetComponent<Text>().text += "Setting Position \n";

			HTTPRequest request = new HTTPRequest(new Uri("http://run-west.att.io/d9576f027ee8f/6e9234f387c9/9c7023eee2b3b23/in/flow/action"), HTTPMethods.Put, actionSentCallback);

			JSONClass data = new JSONClass();

			data["value"] = ((int)buttonType).ToString();

			request.AddHeader("Content-Type", "application/json");
			//request.AddHeader("X-M2X-KEY", "9fc7996ea7f03fccc6ef3978f2a4d012");
			request.RawData = Encoding.UTF8.GetBytes(data.ToString());
			request.Send();
		} else {

			HTTPRequest request = new HTTPRequest(new Uri("http://run-west.att.io/d9576f027ee8f/6e9234f387c9/9c7023eee2b3b23/in/flow/dlswitch"), HTTPMethods.Put, actionSentCallback);

			JSONClass data = new JSONClass();

			data["value"] = (dlSwitch).ToString();

			request.AddHeader("Content-Type", "application/json");
			//request.AddHeader("X-M2X-KEY", "9fc7996ea7f03fccc6ef3978f2a4d012");
			request.RawData = Encoding.UTF8.GetBytes(data.ToString());
			request.Send();
		}



	}
开发者ID:ubberkid,项目名称:PeerATT,代码行数:35,代码来源:FloorButton.cs


示例6: OnException

 public void OnException(Exception e)
 {
     ServiceAPI sp = AppConstant.GetServce();
     JSONClass json = new JSONClass();
     json.Add("userId",FB.UserId);
     json.Add("userName",AppConstant.GetUserName());
     AppConstant.GetStorageService(sp).InsertJSONDocument(AppConstant.DBName, AppConstant.CollectionName,json,this);
 }
开发者ID:sanyam5,项目名称:App42-Unity3d-Social-Leaderboard,代码行数:8,代码来源:SaveCallback.cs


示例7: GenerateLaunchConfiguration

    static JSONNode GenerateLaunchConfiguration(int port)
    {
        JSONNode N = new JSONClass();
        N["version"] = "0.1.0";
        N["configurations"][-1] = GenerateUnityConfiguration(port);

        return N;
    }
开发者ID:reapazor,项目名称:UniVSCode,代码行数:8,代码来源:UniVSCode.cs


示例8: ConnectToServerOut

	public void ConnectToServerOut(){
		JSONNode data = new JSONClass();

		data["function"] = "Connect";
		data["id"] = id;

		udpSend.Send(data);
	}
开发者ID:Urauth,项目名称:Finnish-Game-Jam-2016,代码行数:8,代码来源:ClientNetworker.cs


示例9: GetDictionary

 public Dictionary<string, string> GetDictionary(JSONClass N)
 {
     Dictionary<string, string> d = new Dictionary<string, string>();
     foreach (string key in N.GetKeys()) {
         d.Add(key, N[key]);
     }
     return d;
 }
开发者ID:kesumu,项目名称:dokidoki,代码行数:8,代码来源:BattleManager.cs


示例10: addGame

    public void addGame(string title, bool ispublic)
    {
        JSONClass json = new JSONClass ();
        json.Add ("title", new JSONData (title));
        json.Add ("public", new JSONData (ispublic));

        net.POST (url, System.Text.Encoding.UTF8.GetBytes (json.ToString ()), trackHeaders, new GameCreatorListener ());
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:8,代码来源:AddGameWindow.cs


示例11: login

    public void login(string user, string pass)
    {
        JSONClass json = new JSONClass ();
        json.Add ("username", new JSONData (this.user));
        json.Add ("password", new JSONData (this.pass));

        www = net.POST (baseurl + loginurl, System.Text.Encoding.UTF8.GetBytes (json.ToString ()), trackHeaders, new LoginListener ());
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:8,代码来源:RageWindow.cs


示例12: BuildBytes_NewMatch

    public static byte[] BuildBytes_NewMatch()
    {
        SimpleJSON.JSONClass obj = new SimpleJSON.JSONClass();
        obj.Add("sender", AppWarp.localusername);
        obj.Add("type", "new_match");

        byte[] retVal = System.Text.Encoding.UTF8.GetBytes(obj.ToString());
        return retVal;
    }
开发者ID:4ONSports,项目名称:Prototype_2,代码行数:9,代码来源:OnlineMessage.cs


示例13: BuildMessageBytes_Move

 public static byte[] BuildMessageBytes_Move( string piece, int gbi )
 {
     SimpleJSON.JSONClass moveObj = new SimpleJSON.JSONClass();
     moveObj.Add("gridBoxIndex", gbi);
     moveObj.Add("sender", AppWarp.localusername);
     moveObj.Add("piece", piece);
     moveObj.Add("type", "move");
     return System.Text.Encoding.UTF8.GetBytes(moveObj.ToString());
 }
开发者ID:4ONSports,项目名称:Prototype_2,代码行数:9,代码来源:OnlineMessage.cs


示例14: ToString

 public override string ToString()
 {
     JSONClass json = new JSONClass();
     json["uri"] = Uri;
     json["complete_uri"] = CompleteUri;
     json["ticket_id"] = TicketId;
     json["upload_link_secure"] = UploadLinkSecure;
     return json;
 }
开发者ID:uptredlabs,项目名称:Mobile,代码行数:9,代码来源:Ticket.cs


示例15: BuildMessageBytes_OppName

    public static byte[] BuildMessageBytes_OppName()
    {
        SimpleJSON.JSONClass obj = new SimpleJSON.JSONClass();
        obj.Add("sender", AppWarp.localusername);
        obj.Add("type", "oppName");

        byte[] retVal = System.Text.Encoding.UTF8.GetBytes(obj.ToString());
        return retVal;
    }
开发者ID:4ONSports,项目名称:Prototype_2,代码行数:9,代码来源:OnlineMessage.cs


示例16: GetDictionaryFloat

 public Dictionary<string, float> GetDictionaryFloat(JSONClass N)
 {
     Dictionary<string, string> d = this.GetDictionary(N);
     Dictionary<string, float> df = new Dictionary<string, float>();
     foreach(KeyValuePair<string, string> keyValuePair in d){
         df[keyValuePair.Key] = float.Parse(keyValuePair.Value);
     }
     return df;
 }
开发者ID:kesumu,项目名称:dokidoki,代码行数:9,代码来源:BattleManager.cs


示例17: ToJSON

 public override JSONNode ToJSON(Tile tile)
 {
     JSONNode node = new JSONClass ();
     node ["x"].AsInt = tile.position.x;
     node ["y"].AsInt = tile.position.y;
     node ["type"] = GetType ();
     node ["name"] = name;
     node ["description"] = description;
     return node;
 }
开发者ID:ChoiIngon,项目名称:Rpg1994,代码行数:10,代码来源:EnterPoint.cs


示例18: MoveOut

	public void MoveOut(float x, float y){
		JSONNode data = new JSONClass();

		data["function"] = "move";
		data["id"] = id;
		data["x"].AsFloat = x;
		data["y"].AsFloat = y;
	
		udpSend.Send(data);
	}
开发者ID:Urauth,项目名称:Finnish-Game-Jam-2016,代码行数:10,代码来源:ClientNetworker.cs


示例19: ToJSON

 public override JSONNode ToJSON(Tile tile)
 {
     JSONNode node = new JSONClass ();
     node ["x"].AsInt = tile.position.x;
     node ["y"].AsInt = tile.position.y;
     node ["type"] = GetType ();
     node ["text"] = tile.text;
     node ["color"] = Util.Color.ColorToHex(tile.color);
     return node;
 }
开发者ID:ChoiIngon,项目名称:Rpg1994,代码行数:10,代码来源:Tree.cs


示例20: DisableRating

        void DisableRating()
        {
            JSONNode data = new JSONClass();
            data = JSON.Parse(EditorPrefs.GetString(keyName));

            data["active"].AsBool = false;
            data["counter"].AsInt = 0;
            EditorPrefs.SetString(keyName, data.ToString());
            this.Close();
        }
开发者ID:mutatis,项目名称:sprawl-brawl,代码行数:10,代码来源:ReviewWindowEditor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SimpleJSON.JSONNode类代码示例发布时间:2022-05-26
下一篇:
C# SimpleJSON.JSONArray类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap