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


C# SimpleJSON.JSONClass类代码示例

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


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


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