Exemplo n.º 1
0
	public void CreateNotes(){
		nowmusic = AudioManager.Instance.getNowBGMName();
		AutoNotes = new AutoNotes();
		outjson = AutoNotes.getDataJson(nowmusic);
		//BPM
		BPM = outjson.getBPM();
		//Note数を取り込む
		NotesSum = outjson.getNotesSum();
		newnotes = AutoNotes.getNotesJson(nowmusic);
		//Debug.Log("Sumnotes:"+NotesSum);
		//Note数を元に配列を初期化
		notes = new List<Note>(NotesSum);
		noteobjects = new List<GameObject>(NotesSum);
		Timetable = new List<float>(NotesSum);
		//ファイルからノーツ情報を読み込む処理
		for(int j=0; j<NotesSum; j++){
			//Debug.Log("readNotes:"+ j);
			noteobject = GameObject.Instantiate(Resources.Load("Prefabs/Sphere", typeof(GameObject))) as GameObject;
			rotation = noteobject.GetComponent<Note_Rotation>();
			note = noteobject.GetComponent<Note>();
			note.posx = newnotes[j].posx;
			note.posy = newnotes[j].posy;
			note.posz = newnotes[j].posz;
			note.angle = newnotes[j].angle;
			note.scale = newnotes[j].scale;
			note.radiusBefore = newnotes[j].radiusBefore;
			note.DecisionTime = newnotes[j].DecisionTime;
			note.EmitTime = newnotes[j].EmitTime;
			note.RadiusIncrement = newnotes[j].RadiusIncrement;
			note.TargetName = newnotes[j].TargetName;
			//Debug.Log(note.EmitTime);
			note.Init(noteobject);
			note.Hidden();
			Timetable.Add(note.EmitTime);
			notes.Add(note);
			noteobjects.Add(noteobject);
			//Debug.Log(notes.Count);
		}
		//Debug.Log(notes.Count);
		//this.NoteDestroy(noteobject);
	}
Exemplo n.º 2
0
    public void outNotes(){
        Debug.Log("Start outnotes");
        nowBGMName = AudioManager.Instance.getNowBGMName();
        JsonMapper JsonMapper = new JsonMapper();
        path = Application.persistentDataPath + "/Notes/" ;
		Debug.Log ("save path: "+path);
        // フォルダーがない場合は作成する
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        //Notesのデータ
        jsontext = JsonMapper.ToJson(notes);
        File.WriteAllText(path + nowBGMName + ".json", jsontext);
        //Notesのjsonのデータ
        outjson = new OutJson();
        outjson.set(nowBGMName,notes.Count);
        jsontext = JsonMapper.ToJson(outjson);
        File.WriteAllText(path + "Data-" +nowBGMName + ".json", jsontext);
        notes.Clear();
        Debug.Log("Done outnotes");
    }
Exemplo n.º 3
0
    public List<newNote> getNotesJson(string MusicName){
        JsonMapper JsonMapper = new JsonMapper();
        path = Application.persistentDataPath + "/Notes/" ;
        outjson = new OutJson();
        fi = new FileInfo(path +MusicName + ".json");
        try {
			using (StreamReader sr = new StreamReader(fi.OpenRead(), Encoding.UTF8)){
				jsontext = sr.ReadToEnd();
			}
		} catch (Exception e){
			Debug.Log("NotFound Notes-Json File");
            Debug.Log("Error:"+e);
		}
        notes = JsonMapper.ToObject<List<newNote>>(jsontext);
        return notes; 
    }