/// <summary> /// ノートをどのlineに入れるか、そして同時押しの判断 /// </summary> void Note_allocation(Note_data note_Data) { int list1_index = (temp_note_data_list_line1.Count - 1); int list2_index = (temp_note_data_list_line2.Count - 1); if (list1_index < 0) { list1_index = 0; } if (list2_index < 0) { list2_index = 0; } if (temp_note_data_list_line1.Count == 0 && temp_note_data_list_line2.Count == 0) //最初のノート { temp_note_data_list_line1.Add(note_Data); } else if (temp_note_data_list_line1[list1_index].parfectTime == note_Data.parfectTime) { note_Data.sync = true; temp_note_data_list_line1[list1_index].sync = true; temp_note_data_list_line2.Add(note_Data); } //else if (temp_note_data_list_line1[list1_index].parfectTime + poorTime <=) //{ //} }
void Debug_note_data_show(int line, Note_data note_Data) { Debug.Log("insert line " + line); Debug.Log("startTime " + note_Data.startTime); Debug.Log("steamTime " + note_Data.steamTime); Debug.Log("parfectTime " + note_Data.parfectTime); Debug.Log("note_end_pos.x " + note_Data.note_end_pos.x); Debug.Log("note_end_pos.y " + note_Data.note_end_pos.y); Debug.Log("note_pos1.x " + note_Data.note_pos1.x); Debug.Log("note_pos1.y " + note_Data.note_pos1.y); Debug.Log("note_pos2.x " + note_Data.note_pos2.x); Debug.Log("note_pos2.y " + note_Data.note_pos2.y); Debug.Log("note_pos3.x " + note_Data.note_pos3.x); Debug.Log("note_pos3.y " + note_Data.note_pos3.y); Debug.Log("note_pos4.x " + note_Data.note_pos4.x); Debug.Log("note_pos4.y " + note_Data.note_pos4.y); Debug.Log("hold_end_time " + note_Data.hold_end_time); Debug.Log("rotation " + note_Data.rotation); Debug.Log("flick_pos " + note_Data.flick_pos); Debug.Log("startTime " + note_Data.startTime); Debug.Log("sync " + note_Data.sync); Debug.Log("alive " + note_Data.judged); Debug.Log("made " + note_Data.made); Debug.Log("-------------------------------------"); }
public void Hold_judge(Touch_Manager.My_touch my_Touch, float hold_end_time) { Note_data note_Data = Dc.Get_any_note_data(my_Touch.Hold_note_line, my_Touch.Hold_note_data_index); float lag = Mathf.Abs((float)note_Data.hold_end_time - hold_end_time); int judgetype = -1; if (lag <= perfectTime) { //Debug.Log("Hold_Judge PERFECT!!! "); //debug_Disp_Info.disp_judge(raw_lag); judgetype = 1; } else if (lag <= greatTime) { //Debug.Log("Hold_Judge GREAT!! "); //debug_Disp_Info.disp_judge(raw_lag); judgetype = 2; } else if (lag <= goodTime) { //Debug.Log("Hold_Judge GREAT!! "); //debug_Disp_Info.disp_judge(raw_lag); judgetype = 3; } else if (lag <= poorTime) { //Debug.Log("Hold_Judge BAD… "); judgetype = 4; } else { judgetype = 4; } Hold_end(judgetype, my_Touch.Hold_note_line, my_Touch.Hold_note_data_index); }
//エディタ用デバッグメソッド #if UNITY_EDITOR || UNITY_STANDALONE //キーボードで無理やり判定を通す public void Main_judge(int line, float touchTime) { note_Data_line1 = Dc.Get_Judge_note_data(1); if (Dc.Note_data_list_line2.Length != 0) { note_Data_line2 = Dc.Get_Judge_note_data(2); } //Time_judge(line , touchTime , 0); }
/// <summary> /// デバッグ用ノート情報表示 /// </summary> void Debug_Note_info(int line) { Note_data note_data = Dc.Get_Create_note_data(line); //デバッグする時なおして //Debug.Log("/*-------------------*/"); Debug.Log("line " + line); Debug.Log("startTime " + note_data.startTime); Debug.Log("steamTime " + note_data.steamTime); Debug.Log("parfectTime " + note_data.parfectTime); Debug.Log("time " + Time.Get_time()); Debug.Log("生成 "); Debug.Log("/*-------------------*/"); }
public bool Is_hold_within_range(Vector2 touchpos, Touch_Manager.My_touch my_Touch) { Note_data note_Data = Dc.Get_any_note_data(my_Touch.Hold_note_line, my_Touch.Hold_note_data_index); if (touchpos.x <= note_Data.note_end_pos.x + touchwidth && touchpos.x >= note_Data.note_end_pos.x - touchwidth) { if (touchpos.y <= note_Data.note_end_pos.y + touchwidth && touchpos.y >= note_Data.note_end_pos.y - touchwidth) { return(true); } } return(false); }
/// <summary> /// 時間の判定 /// </summary> void Time_judge(Note_data note_Data, int line, int hold_note_data_index, float touchtime, int fingerID) { float lag = Mathf.Abs(note_Data.parfectTime - touchtime); //raw_lag = note_Data_line1.parfectTime - touchtime; float hold_time = 0; /* * ホールドすべき秒数とは * ホールドノートのホールド終了時刻-タッチした絶対時刻 */ if (note_Data.noteType == 2) //ホールドなら { hold_time = (float)note_Data.hold_end_time - touchtime; } //Debug.Log("note_Data.parfectTime " + note_Data.parfectTime + " touchtime " + touchtime); if (lag <= perfectTime) { //Debug.Log("Time_Judge PERFECT!!! " + line); //debug_Disp_Info.disp_judge(raw_lag); After_judge(1, line, fingerID, hold_note_data_index, hold_time, note_Data); } else if (lag <= greatTime) { //Debug.Log("Time_Judge GREAT!! " + line); //debug_Disp_Info.disp_judge(raw_lag); After_judge(2, line, fingerID, hold_note_data_index, hold_time, note_Data); } else if (lag <= goodTime) { //Debug.Log("Time_Judge GREAT!! " + line); //debug_Disp_Info.disp_judge(raw_lag); After_judge(3, line, fingerID, hold_note_data_index, hold_time, note_Data); } else if (lag <= poorTime) { //Debug.Log("Time_Judge BAD… " + line); After_judge(4, line, fingerID, hold_note_data_index, hold_time, note_Data); } else //判定時間外 { return; //Debug.Log("None…"); //debug_Disp_Info.disp_judge(0); } }
// Use this for initialization void Start() { factor = 1.3f; isFactor = false; beatsOfCountdown = 2; l = GameObject.Find("HUD").GetComponent <myUGUI>(); pt = Time.time; pn = 0; pg = 0; bn = 4; beatCount = 0; sceneName = SceneManager.GetActiveScene().name; if (sceneName == "Versus") { lv = GameObject.Find("HUD").GetComponent <VersusUI>(); } avatar = GameObject.Find("t2").GetComponent <Animator>(); isChanging = false; isSelected = false; // #if UNITY_EDITOR // string filepath = Application.dataPath +"/StreamingAssets"; // // #elif UNITY_IPHONE // string filepath = Application.dataPath +"/Raw"; // // #elif UNITY_ANDROID // string filepath = "jar:file://" + Application.dataPath + "!/assets/"; // // #endif // path=filepath; gens = new ArrayList(); for (int i = 0; i < GEN_COUNT; i++) { NoteGen s = GameObject.Find("Stream" + i).GetComponentInChildren <NoteGen>(); s.speed = this.speed; gens.Add(s); } // foreach(NoteGen g in gens) // { // g.hello(); // } bool isStart = true; //TODO:xiugai ArrayList info = LoadFile("gei"); gei = new ArrayList(); Gei_data t_gei = new Gei_data(); foreach (string str in info) { //Debug.Log(str); if (str.Length > 0 && str[0] == '/') { } else if (isStart) { if (str.Length > 0) { //Debug.Log(str); t_gei = new Gei_data(); isStart = false; t_gei.name = str; } } else { if (str.Length < 1) { gei.Add(t_gei); isStart = true; } else { string t = str; string[] temp = t.Split(new char[] { ' ' }); if (temp.Length == 4) { Note_data nd = new Note_data(); nd.flag = int.Parse(temp[0]); nd.type = int.Parse(temp[1]); nd.pos = int.Parse(temp[2]); nd.len = int.Parse(temp[3]); t_gei.note.Add(nd); } else if (temp.Length == 3) { Note_data nd = new Note_data(); nd.flag = int.Parse(temp[0]); nd.type = int.Parse(temp[1]); nd.pos = int.Parse(temp[2]); t_gei.note.Add(nd); } else if (temp.Length == 2) { t_gei.len = int.Parse(temp[0]); t_gei.type = int.Parse(temp[1]); } } } } CatGeis(); // foreach(Gei_data g in gei) // { // Debug.Log(g.name); // Debug.Log(g.len); // Debug.Log(g.note.Count); // foreach(Note_data n in g.note) // { // Debug.Log(n.flag); // Debug.Log(n.type); // Debug.Log(n.pos); // if(n.type==1) // Debug.Log(n.len); // Debug.Log('\n'); // } // Debug.Log('\n'); // Debug.Log('\n'); // } // //map loading //TODO:xiugai info = LoadFile("map"); bool isFirst = true; map = new ArrayList(); foreach (string str in info) { // Debug.Log(str); if (str.Length > 0 && str[0] == '/') { } else { if (isFirst) { bpm = int.Parse(str); isFirst = false; } else { map.Add(int.Parse(str)); } } } // Debug.Log(bpm); // foreach(int num in map) // { // Debug.Log(num); // } dt = 60f / bpm; tmp = (Gei_data)(gei[(int)(map[pg])]); InvokeRepeating("UpdateNote", 0, dt); }
private void Note_data_add() { Note_data note_Data = new Note_data(); int noteType = 0; //タッチ if (Sd.note_List[note_list_index].flickAngle != 0) { noteType = 1; //フリック } else if (Sd.note_List[note_list_index].endCnt != 0) { noteType = 2; //ホールド } note_Data.noteType = noteType; note_Data.startTime = temp_start_time + Sd.total_offset + startOffset; //temp_start_time + Sd.offset note_Data.steamTime = (float)note_steam_time; note_Data.parfectTime = (float)(temp_note_time + Sd.total_offset + perfectOffset); note_Data.note_end_pos.x = (float)temp_note_pos[0]; note_Data.note_end_pos.y = (float)temp_note_pos[1]; note_Data.note_pos1.x = (float)temp_note_pos[2]; note_Data.note_pos1.y = (float)temp_note_pos[3]; note_Data.note_pos2.x = (float)temp_note_pos[4]; note_Data.note_pos2.y = (float)temp_note_pos[5]; if (noteType == 2) { note_Data.note_pos3.x = (float)temp_note_pos[6]; note_Data.note_pos3.y = (float)temp_note_pos[7]; note_Data.note_pos4.x = (float)temp_note_pos[8]; note_Data.note_pos4.y = (float)temp_note_pos[9]; } //note ノートパターンに関わらず値を入れる。 //フリックノートでない場合確実に反応しない値を入れる必要があるため note_Data.flick_pos.x = (float)temp_note_pos[10]; note_Data.flick_pos.y = (float)temp_note_pos[11]; //Debug.Log("note_list_index " + note_list_index); //Debug.Log("load flick_x " + note_Data.flick_pos.x); //Debug.Log(" flick_y " + note_Data.flick_pos.y); if (temp_holdend_time < 0) //temp_idと揃えるためにマイナスの値が入っている場合 { note_Data.hold_end_time = temp_holdend_time; } else { note_Data.hold_end_time = temp_holdend_time + Sd.total_offset + startOffset; } note_Data.rotation = (-1) * (float)Sd.note_List[note_list_index].rotation; note_Data.sync = false; note_Data.judged = false; note_Data.made = false; Note_allocation(note_Data); switch (1) //同時押しによって挿入先を変える { case 0: temp_note_data_list_line1.Add(note_Data); //Debug_note_data_show(1 , note_Data); break; case 1: temp_note_data_list_line2.Add(note_Data); //Debug_note_data_show(2 , note_Data); break; case 3: break; default: break; } }
void get_Note_data(int line) { note_data = Dc.Get_Create_note_data(line); //Debug.Log("flick_x " + note_data.flick_pos.x); //Debug.Log("flick_y " + note_data.flick_pos.y); }
/// <summary> /// 判定時に最初に呼ばれる処理 /// </summary> /// <param name="touchType">0がタッチorホールドの最初、1がフリック</param> /// <param name="my_Touch"></param> public void Main_judge(int touchType, Touch_Manager.My_touch my_Touch) { //Debug.Log("judege "); note_Data_line1 = Dc.Get_Judge_note_data(1); if (Dc.Note_data_list_line2.Length != 0) { note_Data_line2 = Dc.Get_Judge_note_data(2); } if (touchType == 0) //タッチorホールド始点のとき { if (Is_touch_within_range(my_Touch.touchPos)) { int hold_note_data_index = 0; Note_data note_Data = new Note_data(); switch (within_range_line) { case 1: hold_note_data_index = Dc.judge_Index.get_note_data_line1; note_Data = note_Data_line1; break; case 2: hold_note_data_index = Dc.judge_Index.get_note_data_line2; note_Data = note_Data_line2; break; default: break; } if (note_Data.judged == false) //まだ未判定 { if (note_Data.noteType == 0 || note_Data.noteType == 2) { Time_judge(note_Data, within_range_line, hold_note_data_index, my_Touch.touchTime, my_Touch.fingerID); } } else { return; } } } else if (touchType == 1) //フリックのとき { if (Is_Swipe_within_range(my_Touch.touchPos)) { Note_data note_Data = new Note_data(); switch (within_range_line) { case 1: //hold_note_data_index = Dc.judge_Index.get_note_data_line1;//note_data.made note_Data = note_Data_line1; break; case 2: //hold_note_data_index = Dc.judge_Index.get_note_data_line2; note_Data = note_Data_line2; break; default: break; } if (note_Data.judged == false) //まだ未判定 { Time_judge(note_Data, within_range_line, -1, my_Touch.touchTime, my_Touch.fingerID); } else { return; } } } }
/// <summary> /// 判定した後の共通処理 /// </summary> void After_judge(int judgetype, int line, int fingerID, int hold_note_data_index, float hold_time, Note_data note_Data) { SE_Player.Play_touch_sound(judgetype); Dc.Set_judge_note_data_judged(line); effect_Manager.Play_Particle(judgetype, note_Data.note_end_pos); if (note_Data.noteType == 2 && judgetype != 4) //ホールドかつpoorでないなら { touch_Manager.Set_Hold(fingerID, hold_note_data_index, within_range_line); Hold_process(line, hold_note_data_index, hold_time); ops.DestroyNote(line, note_Data.made_note_list_index, true, false); Debug.Log("line " + line); Debug.Log("hold_end_time " + note_Data.hold_end_time); } else if (note_Data.noteType == 0 || note_Data.noteType == 1) { ops.DestroyNote(line, note_Data.made_note_list_index, false, false); //Debug.Log("破壊 " + note_Data.made_note_list_index); } }