首页 > 代码库 > Unity3d使用json与javaserver通信

Unity3d使用json与javaserver通信

Unity3d使用json能够借助LitJson

下载LitJson,复制到Unity3d工作文件夹下

于是能够在代码中实现了

以下发送请求到server并解析


System.Collections.Hashtable headers = new System.Collections.Hashtable ();
		
		headers.Add ("Content-Type","application/x-www-form-urlencoded");
	
		string data = http://www.mamicode.com/"token="+User.token;>
</pre><pre code_snippet_id="503706" snippet_file_name="blog_20141031_3_1427346" name="code" class="csharp">以下是server数据
</pre><pre code_snippet_id="503706" snippet_file_name="blog_20141031_5_2276003" name="code" class="java">	Map<String,Object> map=new HashMap<String,Object>();
		
		map.put("r","1212121212d12");
		map.put("e","1212121212a12");
		map.put("a","1212121212d12");
		map.put("f","1212121212c12");
		map.put("d","12121212121g2");
		map.put("s","sdfdsfds");





Unity3d使用json与javaserver通信