IEnumerator sendScore(JsonData obj) { WWWForm dataParameters = new WWWForm(); dataParameters.AddField("scores", obj.ToString()); // stuur altijd als string. dataParameters.AddField("UserId" , LoginScript.userID); WWW www = new WWW(Url,dataParameters); yield return www; }
// Use this for initialization void Start() { // Pass JsonMapper.ToJson method the player object (character instance). This converts the data to JSON format playerJson = JsonMapper.ToJson(player); // Now write the restulting data to our StreamingAssets folder File.WriteAllText(Application.streamingAssetsPath + "/Player.json", playerJson.ToString()); }
public void CreateSavaData() { createUserDataObejct(); setData = LitJson.JsonMapper.ToJson(userData); Debug.Log(setData); File.WriteAllText(Application.dataPath + "/Resources/userData.json", setData.ToString()); }
public void writeFile() { //Lo que hacemos ahora es almacenar en una lista los niveles definidos segun la clase anteriores foreach (int key in m_dictionaryScore.Keys) { m_leveldef.Add(new levelsDef(key, m_dictionaryScore[key])); } //Serializamos esa lista y la escribimos en la ruta indicada. fileJson = JsonMapper.ToJson(m_leveldef); File.WriteAllText(Application.persistentDataPath + "/scoreLevels.json", fileJson.ToString()); }
static int ToString(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LitJson.JsonData obj = (LitJson.JsonData)ToLua.CheckObject(L, 1, typeof(LitJson.JsonData)); string o = obj.ToString(); LuaDLL.lua_pushstring(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void DefaultSettingOK() { mapConfig.stage_id = int.Parse(stageidText.text); mapConfig.author = authorText.text; mapConfig.difficulty = difficultyText.text; //pattenList.Add(createSubObject("0", new int[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 })); //pattenList.Add(createSubObject("1", new int[] { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 })); //mainObject.pattern = pattenList.ToArray(); createMainObejct(int.Parse(stageidText.text), authorText.text, difficultyText.text, 1); //Debug.Log(CustomJSON(0, new int[] { 1,0,1,0,1,1})); setData = LitJson.JsonMapper.ToJson(mainObject); Debug.Log(setData); //setData = LitJson.JsonMapper.ToJson(mapConfig) + CustomJSON(0, new int[] { 1, 0, 1, 0, 1, 1 }); //Debug.Log(setData); File.WriteAllText(Application.dataPath + "/customSetting.json", setData.ToString());//CustomJSON(mapConfig.stage_id, mapConfig.author, mapConfig.difficulty, mapConfig.level, 0, new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 })); Debug.Log(mapConfig.stage_id + " " + mapConfig.author + " " + mapConfig.difficulty); defaultSettingUI.gameObject.SetActive(false); editorUI.gameObject.SetActive(true); }
private static void SendMessageToMobile(LitJson.JsonData data) { Utility.LogPrint(data.ToString()); switch (Application.platform) { case RuntimePlatform.Android: AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject> ("currentActivity"); if (data.ToJson() != "") { jo.Call("UnityCallBack", data.ToJson()); } break; case RuntimePlatform.IPhonePlayer: #if UNITY_IPHONE InteractInterface.UnityCallBack(data.ToJson()); #endif break; default: break; } }
public void SaveUserDataJSON() { setData = LitJson.JsonMapper.ToJson(userData); Debug.Log(setData); File.WriteAllText(Application.dataPath + "/Resources/userData.json", setData.ToString()); }
public void SaveJSON() { //pattenList.Add(createSubObject(0, new int[]{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 })); //pattenList.Add(createSubObject(0, new int[]{ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 })); mainObject.pattern = pattenList.ToArray(); //createMainObejct(101, "Jaehyuk", "Normal", 1); setData = LitJson.JsonMapper.ToJson(mainObject); Debug.Log(setData); File.WriteAllText(Application.dataPath + "/Resources/" + mainObject.stage_id + ".json", setData.ToString()); }
protected override void OnFinish(LitJson.JsonData backJsonData) { base.OnFinish(backJsonData); Debug.logger.Log(backJsonData.ToString()); }
//have to be implemented by the developers public void AppSettingsDidLoad(JsonData data) { Debug.Log(data.ToString()); }
private static float floatParse(LitJson.JsonData data) { return(float.Parse(data.ToString())); }
private static object get_value(JsonData v) { if(v.IsString) return v.ToString(); else if(v.IsInt) return Convert.ToInt32(v.ToString()); else if(v.IsLong) return Convert.ToInt64(v.ToString()); else if(v.IsDouble) return Convert.ToDouble(v.ToString()); else if(v.IsBoolean) return Convert.ToBoolean(v.ToString()); else return v.ToString(); }