/** * JSONデータ読み込みボタン. */ public void OnClickJsonLoadButton() { InputField fileNameInputField = GameObject.Find("FileNameInputField").GetComponent <InputField>(); NKTextMan textMan = gameObject.GetComponent <NKTextMan> (); string strStream = textMan.readText("/Resources/Save/" + fileNameInputField.text); }
static public void SaveAllJson() { foreach (JsonBuffer b in DataBuffer) { #if true PlayerPrefs.SetString(b.path + b.file, b.json); #else DirectoryUtils.SafeCreateDirectory(b.path); NKTextMan.saveText(b.path + b.file, b.json); #endif } }
/** * JSONデータ保存ボタン. */ public void OnClickJsonSaveButton() { InputField fileNameInputField = GameObject.Find("FileNameInputField").GetComponent <InputField>(); InputField jsonInput = GameObject.Find("jsonInput").GetComponent <InputField>(); NKTextMan textMan = gameObject.GetComponent <NKTextMan> (); //保存 if (textMan.saveText("/Resources/Save/" + fileNameInputField.text, jsonInput.text)) { //保存成功 } else { //保存失敗 } }
static public string LoadJson(string path, string file) { string json = ""; if (TitleDataLoad.instance.LoadData) { foreach (JsonBuffer b in DataBuffer) { if (b.path == path && b.file == file) { return(b.json); } } #if true json = PlayerPrefs.GetString(path + file, ""); #else string json = NKTextMan.readText(path + file); #endif } DataBuffer.Add(new JsonBuffer(path, file, json)); return(json); }