public void ALLDELETE() { // encryption ec = scriptbox.GetComponent<encryption>(); #if UNITY_EDITOR json = File.ReadAllText(Application.streamingAssetsPath + "/data_model.json");//読み取ってるよ #elif UNITY_ANDROID WWW reader = new WWW(Application.streamingAssetsPath + "/data_model.json"); while (!reader.isDone) { } json = reader.text; #endif Debug.Log("データ全削除"); // JsonUtility.FromJsonOverwrite(json, sv);//読み取ったのを変換してるよ // json = Json.Serialize(sv); json = encryption.EncryptString(json); jiki_setter js = scriptbox.GetComponent <jiki_setter>(); //スコアを取得 File.WriteAllText(Application.persistentDataPath + "/data.json", json); //最初のデータを代入 deleteflag = false; deletemenu2.SetActive(false); menu.SetActive(true); darkmask.SetActive(false); title_importaantvalue iv = scriptbox.GetComponent <title_importaantvalue>(); //スコアを取得 iv.Start(); scenemover sm = scriptbox.GetComponent <scenemover>(); //スコアを取得 sm.homeButtonpushed(); }
public void checkPlayerRename() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("ScoreRanking"); string playerName = renamefield.text; query.WhereEqualTo("playername", playerName); query.CountAsync((int count, NCMBException e) => { // 1つ上のコードで絞られたデータが何個あるかかぞえる if (e == null) { if (count == 0 && playerName != "") { // 0個なら名前は登録されていないので登録 json = File.ReadAllText(Application.persistentDataPath + "/data.json"); json = encryption.DecryptString(json); JsonUtility.FromJsonOverwrite(json, sv); renamePlayerName(sv._name, playerName, "ScoreRanking"); //改名したデータを送信 renamePlayerName(sv._name, playerName, "LevelRanking"); //改名したデータを送信 sv._name = playerName; Debug.Log("あなたの新しい名前は" + sv._name); json = JsonUtility.ToJson(sv); json = encryption.EncryptString(json); File.WriteAllText(Application.persistentDataPath + "/data.json", json);//結局これでよかった Debug.Log("改名しました!!"); rename.SetActive(false); setting.SetActive(true); // CheckScore(); title_importaantvalue iv = scriptbox.GetComponent <title_importaantvalue>();//右上の名前を変更 iv.Start(); } else { // 0個じゃなかったらすでに名前が登録されている Debug.Log("登録できません"); duplicated_re.SetActive(true); } } }); }