public IEnumerator FileDownloadTest() { byte[] data = System.Text.Encoding.UTF8.GetBytes("hello"); NCMBFile file = new NCMBFile("test.txt", data); file.SaveAsync((NCMBException error) => { Assert.Null(error); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); NCMBTestSettings.CallbackFlag = false; NCMBFile getFile = new NCMBFile("test.txt"); getFile.FetchAsync((byte[] fileData, NCMBException error) => { Assert.Null(error); Assert.AreEqual("hello", Encoding.UTF8.GetString(fileData)); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); Assert.NotNull(getFile.FileData); Assert.AreEqual("hello", Encoding.UTF8.GetString(getFile.FileData)); Assert.True(NCMBTestSettings.CallbackFlag); }
public IEnumerator FileResponseSignatureTest() { NCMBSettings.EnableResponseValidation(true); byte[] data = System.Text.Encoding.UTF8.GetBytes("hello"); NCMBFile file = new NCMBFile("test.txt", data); file.SaveAsync((NCMBException error) => { Assert.Null(error); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); NCMBTestSettings.CallbackFlag = false; NCMBFile getFile = new NCMBFile("test.txt"); getFile.FetchAsync((byte[] fileData, NCMBException error) => { Assert.Null(error); NCMBTestSettings.CallbackFlag = true; }); yield return(NCMBTestSettings.AwaitAsync()); Assert.NotNull(file.CreateDate); Assert.True(NCMBTestSettings.CallbackFlag); }
void loadOneImageTo(string name, int index) { NCMBFile file = new NCMBFile(name); file.FetchAsync((byte[] fileData, NCMBException error) => { if (error != null) { // 失敗 } else { SaveBytesTo(fileData, index); } }); }
public void GetFile() { if (lastedFileName != null) { NCMBFile file = new NCMBFile(lastedFileName); file.FetchAsync((byte[] fileData, NCMBException error) => { if (error != null) { // 失敗 Debug.LogError(error); } else { // 成功 Debug.Log("Get file success: " + System.Text.Encoding.Default.GetString(fileData)); } }); } }
void Start() { string ID = Transition_to_play.getId(); string Title = Transition_to_play.getTitle(); // Debug.Log(ID+" "+Title); Title_text.GetComponent <Text>().text = Title; NCMBFile file = new NCMBFile(ID); file.FetchAsync((byte[] fileData, NCMBException error) => { if (error != null) { UnityEngine.Debug.Log("file検索失敗時の処理"); } else { LoadMSF(fileData); ModificationEventTimes(); Debug.Log(noteList.Count); // Debug.Log(tempoList.Count); // Debug.Log("EventTime"); KeyCode = new bool[130, Enumerable.Last(noteList).eventTime *2]; for (int i = 0; i < noteList.Count; i++) { // Debug.Log(noteList[i].laneIndex+" , "+noteList[i].eventTime/100); if (noteList[i].type != NoteType.LongEnd) { KeyCode[noteList[i].laneIndex - 21, noteList[i].eventTime / 100] = true; } } Endtime = noteList[noteList.Count - 1].eventTime / 100; EventCount = noteList.Count; KeyPrint.PrintStart(); } }); // NCMBQuery<NCMBObject> query = new NCMBQuery<NCMBObject> ("MusicData"); // query.Limit = 1; // query.FindAsync ((List<NCMBObject> objList ,NCMBException e) => { // if (e != null) { // Debug.Log("検索失敗時の処理"); // //検索失敗時の処理 // } else { // NCMBObject Data=objList[0]; // Debug.Log(Data["Title"]); // Debug.Log(Data["Comment"]); // // NCMBFile file=new NCMBFile(Data["ID"].ToString()); // NCMBFile file=new NCMBFile("83is6C0qeCRD1Rfa"); // file.FetchAsync ((byte[] fileData, NCMBException error) => { // if (error != null) { // UnityEngine.Debug.Log("file検索失敗時の処理"); // } else { // LoadMSF(fileData); // ModificationEventTimes(); // Debug.Log(noteList.Count); // // Debug.Log(tempoList.Count); // // Debug.Log("EventTime"); // KeyCode=new bool[130,Enumerable.Last(noteList).eventTime*2]; // for(int i=0;i<noteList.Count;i++){ // Debug.Log(noteList[i].laneIndex+" , "+noteList[i].eventTime/100); // if(noteList[i].type != NoteType.LongEnd) KeyCode[noteList[i].laneIndex-21 , noteList[i].eventTime/100] = true; // } // } // }); // } // }); // // var fileName = @"C:\\Users\\famil\\OneDrive\\ドキュメント\\GitHub\\music_game\\test 3D\\Assets\\Scenes\\doremi.mid"; // // var fileName = @"C:\\Users\\famil\\OneDrive\\ドキュメント\\GitHub\\music_game\\test 3D\\doremi.mid"; // var fileName=@"C:\\Users\\famil\\OneDrive\\ドキュメント\\Alice_in_冷凍庫\\Alice in 冷凍庫.mid"; // // var fileName=@"C:\Users\famil\Downloads\toruko.mid"; // LoadMSF(fileName); // ModificationEventTimes(); // // Debug.Log(noteList.Count); // // Debug.Log(tempoList.Count); // // Debug.Log("EventTime"); // KeyCode=new bool[130,Enumerable.Last(noteList).eventTime*2]; // for(int i=0;i<noteList.Count;i++){ // // Debug.Log(noteList[i].laneIndex+" , "+noteList[i].eventTime/100); // if(noteList[i].type != NoteType.LongEnd) KeyCode[noteList[i].laneIndex , noteList[i].eventTime/100] = true; // } // Ready=true; }