private void updateNote(int instrValue, int noteValue) { if (!midiStarted) return; // Build up new note candidate NoteInfo newNote = new NoteInfo(); newNote.instr = instrValue; newNote.val = noteValue; // Keep track; should note be restarted after all channel commands? if (newNote.instr != curNote.instr) { // Change instrument patch (aka program) outDevice.Send(new ChannelMessage(ChannelCommand.ProgramChange, 0, newNote.instr, 0)); } // Restart the note based on what was updated... outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, curNote.val, 0)); outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, newNote.val, VELOCITY)); curNote = newNote; }
protected override void OnLoad(EventArgs e) { updateParamDisplay(); base.OnLoad(e); curNote = new NoteInfo(); }
protected override void OnLoad(EventArgs e) { //updateParamDisplay(); base.OnLoad(e); curNote = new NoteInfo(); binkBonkStatus = BinkBonkStatus_e.BONK; }
void OnNoteOn(MidiMessage midi) { int note = midi.data1; int velocity = midi.data2; foreach (var ni in noteInfoList) { if (ni.note == note) return; } int numElements = Mathf.Max (8 * velocity / 128, 1); var noteInfo = new NoteInfo (note); for (var i = 0; i < numElements; i++) { var element = Instantiate (prefab, transform.position, Random.rotation) as GameObject; noteInfo.elements.Add (element); element.GetComponent<Element> ().ApplyMidiMessage (midi); } noteInfoList.Add (noteInfo); }
public void Load(string filename) { Clear(); TextAsset textAsset = (TextAsset)Resources.Load("Stages/" + filename, typeof(TextAsset)); JsonData json = JsonMapper.ToObject(textAsset.text); JsonData jsonSoundName = json["soundname"]; soundName = jsonSoundName.ToString(); JsonData jsonNotes = json["notes"]; string strCount = jsonNotes.ToJson(); noteGroupCount = Convert.ToInt32(strCount); JsonData jsonHitTime = json["hittime"]; string strHitTime = jsonHitTime.ToString(); hitTime = (float)Convert.ToDouble(strHitTime); /* * JsonData jsonNoteGroups = json["notegroups"]; * for(int i=0; i<noteGroupCount; i++) * { * JsonData jsonNoteList = jsonNoteGroups[i]; * int count2 = jsonNoteList.Count; * * List<NoteInfo> noteGroup = new List<NoteInfo>(); * * for(int j=0; j<count2; j++) * { * string strTime = jsonNoteList[j]["time"].ToJson(); * float time = (float)Convert.ToDouble(strTime); * * string strCreateNumber = jsonNoteList[j]["createnumber"].ToJson(); * int createNumber = Convert.ToInt32(strCreateNumber); * * NoteInfo note = new NoteInfo(); * note.prePlayed = false; * note.playTime = time; * note.createNumber = createNumber; * * noteGroup.Add(note); * } * * noteGroupList.Add(noteGroup); * } */ JsonData jsonNoteGroups = json["notegroups"]; for (int i = 0; i < noteGroupCount; i++) { JsonData jsonNoteList = jsonNoteGroups[i]; int count2 = jsonNoteList.Count; for (int j = 0; j < count2; j++) { string strTime = jsonNoteList[j]["time"].ToJson(); float time = (float)Convert.ToDouble(strTime); string strGroupNumber = jsonNoteList[j]["groupnumber"].ToJson(); int groupNumber = Convert.ToInt32(strGroupNumber); string strCreateNumber = jsonNoteList[j]["createnumber"].ToJson(); int createNumber = Convert.ToInt32(strCreateNumber); string strLeftOrRight = jsonNoteList[j]["leftorright"].ToJson(); int leftOrRight = Convert.ToInt32(strLeftOrRight); NoteInfo note = new NoteInfo(); note.playTime = time; note.groupNumber = groupNumber; note.createNumber = createNumber; note.leftOrRight = leftOrRight; if (groupNumber != -1000) { if (noteDictionary.ContainsKey(groupNumber)) { List <NoteInfo> noteGroup = noteDictionary[groupNumber]; noteGroup.Add(note); noteGroup.Sort(CompareByTime); } else { List <NoteInfo> noteGroup = new List <NoteInfo>(); noteGroup.Add(note); noteGroup.Sort(CompareByTime); noteDictionary[groupNumber] = noteGroup; } } } } JsonData jsonNoteCounts = json["notecounts"]; string strNoteCount = jsonNoteCounts.ToJson(); noteCounts = Convert.ToInt32(strNoteCount); }
void Update() { NoteInfo test = this.info(); transform.Translate(Vector3.back * PlayManager.notespeed * Time.deltaTime); }
public NoteInfo Add(NoteInfo noteInfo) { uow.Repository <NoteInfo>().Add(noteInfo); return(noteInfo); }
public void CreateNote(int ID, int Size, Color32 Color, NoteInfo Mode, FlickMode Flick, float Time, float Speed, float Start, float End, List <int> Prev) { if (Mode.Equals(NoteInfo.SlideNoteStart)) { CreateNote(ID, Size, Color, NoteInfo.SystemNoteSlideDummy, Flick, Time, Speed, Start, End, new List <int>()); } GameObject newNote = null; Note noteComp = null; if (Game.Mode.Equals(GameMode.Starlight)) { if (Size <= 1) { newNote = Instantiate(Game.StarlightNote) as GameObject; } else { newNote = Instantiate(Game.StarlightXL) as GameObject; } noteComp = newNote.GetComponent <StarlightNote>(); } else if (Game.Mode.Equals(GameMode.Theater) || Game.Mode.Equals(GameMode.Theater4) || Game.Mode.Equals(GameMode.Theater2L) || Game.Mode.Equals(GameMode.Theater2P)) { if (Size.Equals(0)) { newNote = Instantiate(Game.TheaterSmall) as GameObject; } else if (Size.Equals(1)) { newNote = Instantiate(Game.TheaterLarge) as GameObject; } else if (Size > 1) { newNote = Instantiate(Game.TheaterXL) as GameObject; } noteComp = newNote.GetComponent <TheaterNote>(); } else if (Game.Mode.Equals(GameMode.Platinum)) { if (Size.Equals(0)) { newNote = Instantiate(Game.PlatinumSmall) as GameObject; } else if (Size.Equals(1)) { newNote = Instantiate(Game.PlatinumLarge) as GameObject; } else if (Size > 1) { newNote = Instantiate(Game.PlatinumXL) as GameObject; } noteComp = newNote.GetComponent <PlatinumNote>(); } newNote.GetComponent <RectTransform>().SetParent(Game.NoteParent, false); float resist = 0; if (!Flick.Equals(FlickMode.None)) { int flickVal; if (PlayerPrefs.HasKey("flickmode")) { flickVal = PlayerPrefs.GetInt("flickmode"); } else { flickVal = 1; } if (flickVal.Equals(0)) { resist = 20; } else if (flickVal.Equals(1)) { resist = 40; } else if (flickVal.Equals(2)) { resist = 60; } else if (flickVal.Equals(3)) { // TODO 하기 //if (!Game.Mode.Equals(GameMode.Starlight)) { resist = 35; } if (Game.Mode.Equals(GameMode.Starlight)) { bool applied = false; for (int i = 0; i < Prev.Count; i++) { if (!Notes[Prev[i]].Flick.Equals(FlickMode.None)) { float decVal; if (Time * (1 / Game.ScrollAmp) - Notes[Prev[i]].ReachFrame < 4) { decVal = 20; } else if (Time * (1 / Game.ScrollAmp) - Notes[Prev[i]].ReachFrame >= 20) { decVal = 60; } else { decVal = 20 + (2.5f * (Time * (1 / Game.ScrollAmp) - Notes[Prev[i]].ReachFrame - 4)); } Notes[Prev[i]].FlickThreshold = decVal; resist = decVal; applied = true; } } if (!applied) { resist = 40; } } else { resist = 50; } } } noteComp.SetNote(ID, Start, End, Time * (1 / Game.ScrollAmp), Speed, resist, Mode, Flick, Color, Prev, 0); if ((int)noteComp.Mode < 10) { if (!Game.Judger.NoteQueue.ContainsKey(noteComp.EndLine)) { Game.Judger.MakeNewKey(noteComp.EndLine); } Game.Judger.NoteQueue[noteComp.EndLine].Add(noteComp.ID); } if (!Mode.Equals(NoteInfo.SystemNoteSlideDummy)) { Notes.Add(ID, noteComp); NoteCount++; } else { Notes.Add(XLNoteID--, noteComp); } for (int i = 0; i < Prev.Count; i++) { Notes[Prev[i]].NextNoteID = ID; Notes[Prev[i]].CreateTailConnector(); if (Game.Mode.Equals(GameMode.Theater) || Game.Mode.Equals(GameMode.Theater4) || Game.Mode.Equals(GameMode.Theater2L) || Game.Mode.Equals(GameMode.Theater2P)) { if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Size.Equals(0)) { (Notes[Prev[i]] as TheaterNote).SizeInPixelNext = 70; } else if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Notes[Prev[i]].SizeInPixel.Equals(70)) { (Notes[ID] as TheaterNote).SizeInPixelPrev = 70; } } else if (Game.Mode.Equals(GameMode.Platinum)) { if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Size.Equals(0)) { (Notes[Prev[i]] as PlatinumNote).SizeInPixelNext = 70; } else if ((Notes[Prev[i]].Mode.Equals(NoteInfo.LongNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteStart) || Notes[Prev[i]].Mode.Equals(NoteInfo.SlideNoteCheckpoint)) && Notes[Prev[i]].SizeInPixel.Equals(70)) { (Notes[ID] as PlatinumNote).SizeInPixelPrev = 70; } } } if ((int)noteComp.Mode < 7) { VisibleNoteCount++; } if (Mode.Equals(NoteInfo.SystemNoteScroller)) // 스크롤러일 경우 배수 값을 저장합니다. { CurScrollVal = Speed; } if (Size >= 2) // 스페셜 노트가 나타났을 경우 { XLReachFrame = Time * (1 / Game.ScrollAmp); if (!XLAppeared) // 그중 처음일 경우 { GameObject xlStart = GetNoteInstance(); xlStart.GetComponent <RectTransform>().SetParent(Game.NoteParent, false); xlStart.GetComponent <Note>().Game = Game; xlStart.GetComponent <Note>().SetNote(XLNoteID, 0, 0, (Time * (1 / Game.ScrollAmp)) - (45 * CurScrollVal), Game.GlobalNoteSpeed, 0, NoteInfo.SystemNoteXLStarter, FlickMode.None, new Color32(0, 0, 0, 0), new List <int>(), 0); Notes.Add(XLNoteID--, xlStart.GetComponent <Note>()); XLAppeared = true; } } else if (Size < 2 && XLAppeared) // 스페셜 노트 이후 첫 다른 노트가 나타날 경우 { GameObject xlEnd = GetNoteInstance(); xlEnd.GetComponent <RectTransform>().SetParent(Game.NoteParent, false); xlEnd.GetComponent <Note>().Game = Game; xlEnd.GetComponent <Note>().SetNote(XLNoteID, 0, 0, (Time * (1 / Game.ScrollAmp)) - (90 * CurScrollVal) >= XLReachFrame + 15 ? (Time * (1 / Game.ScrollAmp)) - (90 * CurScrollVal) : XLReachFrame + 15, Game.GlobalNoteSpeed, 0, NoteInfo.SystemNoteXLEnder, FlickMode.None, new Color32(0, 0, 0, 0), new List <int>(), 0); Notes.Add(XLNoteID--, xlEnd.GetComponent <Note>()); XLAppeared = false; } }
public bool UpdateCompanyNoteInfo(NoteInfo data, List <NoteInfoDetail> noteInfoDetails) { return(this.NoteInfoLogic.UpdateCompanyNoteInfo(data, noteInfoDetails)); }
public void ReImportMIDI() { Debug.Log("MIDIReceiver: About to load " + MIDIResourcePath); MidiFile mid = new MidiFile(MIDIResourcePath, false); if (mid.Events == null) { Debug.Log("MIDIReceiver: Resource load failed- " + MIDIResourcePath); return; } _noteOns = new List<NoteInfo>(); foreach (MidiEvent ev in mid.Events[MIDITrackIdx]) { NoteOnEvent noteEvent = ev as NoteOnEvent; if (noteEvent != null) { try { NoteInfo newNote = new NoteInfo(); newNote.NoteNumber = noteEvent.NoteNumber; newNote.NoteOnBeat = MIDITimeMult*((float)noteEvent.AbsoluteTime / (float)mid.DeltaTicksPerQuarterNote); newNote.DurationBeats = MIDITimeMult*((float)noteEvent.NoteLength / (float)mid.DeltaTicksPerQuarterNote); newNote.Velocity = noteEvent.Velocity / 127.0f; _noteOns.Add(newNote); Debug.Log(" imported midi Note " + noteEvent.NoteNumber + " at beat " + newNote.NoteOnBeat + " duration " + newNote.DurationBeats); } catch (System.SystemException e) { Debug.Log("Error during midi import: " + e.Message); } } } }
internal static void Add(NoteInfo ni) { list.Add(ni); }
public bool InsertNoteInfo(NoteInfo data) { return(this.NoteInfoDAO.InsertNoteInfo(data)); }
/// <summary> /// 게임의 판정을 총괄하는 함수입니다. 판정 절차가 이루어졌으면 true, 그렇지 않으면 false를 반환합니다. /// </summary> /// <param name="gMode">게임의 모드입니다.</param> /// <param name="nMode">판정될 노트의 모드입니다.</param> /// <param name="fMode">판정될 노트의 플릭 여부입니다.</param> /// <param name="MyFrame">판정될 노트의 현재 프레임 값입니다.</param> /// <param name="RefFrame">판정될 노트의 기준 프레임 값입니다.</param> /// <param name="HasInput">사용자의 입력에 의한 판정인지의 여부입니다.</param> /// <returns>판정이 진행되었는지의 여부입니다.</returns> public bool HitJudge(GameMode gMode, NoteInfo nMode, FlickMode fMode, float MyFrame, float RefFrame, bool HasInput) { if (nMode.Equals(NoteInfo.DamageNote)) { if (HasInput) { if (MyFrame < RefFrame - BadBorder) { return(false); } else { DecisionProcess(0, fMode); } } else { DecisionProcess(5, fMode); } } else if (fMode.Equals(0) && (nMode.Equals(NoteInfo.NormalNote) || nMode.Equals(NoteInfo.HiddenNote))) { if (MyFrame < RefFrame - BadBorder) { return(false); } else if (MyFrame >= RefFrame - BadBorder && MyFrame < RefFrame - NiceBorder) { DecisionProcess(1, fMode); } else if (MyFrame >= RefFrame - NiceBorder && MyFrame < RefFrame - GreatBorder) { DecisionProcess(2, fMode); } else if (MyFrame >= RefFrame - GreatBorder && MyFrame < RefFrame - PerfectBorder) { DecisionProcess(3, fMode); } else if (MyFrame >= RefFrame - PerfectBorder && MyFrame < RefFrame - 0.5f) { DecisionProcess(4, fMode); } else if (MyFrame >= RefFrame - 0.5f && MyFrame <= RefFrame + 0.5f) { DecisionProcess(5, fMode); } else if (MyFrame > RefFrame + 0.5f && MyFrame <= RefFrame + PerfectBorder) { DecisionProcess(4, fMode); } else if (MyFrame > RefFrame + PerfectBorder && MyFrame <= RefFrame + GreatBorder) { if (nMode.Equals(NoteInfo.HiddenNote)) { return(false); } else { DecisionProcess(3, fMode); } } else if (MyFrame > RefFrame + GreatBorder && MyFrame <= RefFrame + NiceBorder) { if (nMode.Equals(NoteInfo.HiddenNote)) { return(false); } else { DecisionProcess(2, fMode); } } else if (MyFrame > RefFrame + NiceBorder && MyFrame <= RefFrame + BadBorder) { if (nMode.Equals(NoteInfo.HiddenNote)) { return(false); } else { DecisionProcess(1, fMode); } } else if (MyFrame > RefFrame + BadBorder) { if (nMode.Equals(NoteInfo.HiddenNote)) { return(false); } else { DecisionProcess(0, fMode); } } } else { if (MyFrame < RefFrame - BadBorderL) { if (nMode.Equals(NoteInfo.LongNoteEnd) || nMode.Equals(NoteInfo.SlideNoteEnd)) { DecisionProcess(0, fMode); } else { return(false); } } else if (MyFrame >= RefFrame - BadBorderL && MyFrame < RefFrame - NiceBorderL) { DecisionProcess(1, fMode); } else if (MyFrame >= RefFrame - NiceBorderL && MyFrame < RefFrame - GreatBorderL) { DecisionProcess(2, fMode); } else if (MyFrame >= RefFrame - GreatBorderL && MyFrame < RefFrame - PerfectBorderL) { DecisionProcess(3, fMode); } else if (MyFrame >= RefFrame - PerfectBorderL && MyFrame < RefFrame - 0.5f) { DecisionProcess(4, fMode); } else if (MyFrame >= RefFrame - 0.5f && MyFrame <= RefFrame + 0.5f) { DecisionProcess(5, fMode); } else if (MyFrame > RefFrame + 0.5f && MyFrame <= RefFrame + PerfectBorderL) { DecisionProcess(4, fMode); } else if (MyFrame > RefFrame + PerfectBorderL && MyFrame <= RefFrame + GreatBorderL) { DecisionProcess(3, fMode); } else if (MyFrame > RefFrame + GreatBorderL && MyFrame <= RefFrame + NiceBorderL) { DecisionProcess(2, fMode); } else if (MyFrame > RefFrame + NiceBorderL && MyFrame <= RefFrame + BadBorderL) { DecisionProcess(1, fMode); } else if (MyFrame > RefFrame + BadBorderL) { DecisionProcess(0, fMode); } } return(true); }
void Start() { for (int i = 0; i < 10; i++) { nodePlaying[i] = false; } //create right side spheres //for each string create nodes along z-axis for (int i = 1; i <= 5; i++) // x positions at 2,4,6,8,10 { for (int j = -25; j <= 25; j++) // z positions range from -5 to 5 { //initialize each sphere node = GameObject.CreatePrimitive(PrimitiveType.Sphere); node.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); node.GetComponent <Collider>().enabled = !node.GetComponent <Collider>().enabled; node.AddComponent <nodeOscillation>(); node.transform.position = new Vector3(i * 2.0f, 0.1f, j / 5.0f); node.name = "Node " + (6 - i) + " zPos " + j / 10.0f; } } //create right side spheres //for each string create nodes along z-axis for (int i = 1; i <= 5; i++) // x positions at 2,4,6,8,10 { for (int j = -25; j <= 25; j++) // z positions range from -5 to 5 { //initialize each sphere node = GameObject.CreatePrimitive(PrimitiveType.Sphere); node.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); node.GetComponent <Collider>().enabled = !node.GetComponent <Collider>().enabled; node.AddComponent <nodeOscillation>(); node.transform.position = new Vector3(-i * 2.0f, 0.1f, j / 5.0f); node.name = "Node " + (6 - i) + " zPos " + j / 10.0f + " Mirror"; } } //for (float i = 0; i < 105; i++) //{ // node = GameObject.CreatePrimitive(PrimitiveType.Sphere); // node.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); // node.GetComponent<Collider>().enabled = !node.GetComponent<Collider>().enabled; // node.AddComponent<nodeOscillation>(); // if (i < 21) // { // node.transform.position = new Vector3(10f, 0.05f, (10 - i) / 2); // node.name = "Node 1 " + i; // } // if (i >= 21 & i < 42) // { // node.transform.position = new Vector3(8f, 0.05f, (31 - i) / 2); // node.name = "Node 2 " + i; // } // if (i >= 42 & i < 63) // { // node.transform.position = new Vector3(6f, 0.05f, (52 - i) / 2); // node.name = "Node 3 " + i; // } // if (i >= 63 & i < 84) // { // node.transform.position = new Vector3(4f, 0.05f, (73 - i) / 2); // node.name = "Node 4 " + i; // } // if (i >= 84 & i < 105) // { // node.transform.position = new Vector3(2f, 0.05f, (94 - i) / 2); // node.name = "Node 5 " + i; // } //} //for (float i = 0; i < 105; i++) //{ // node = GameObject.CreatePrimitive(PrimitiveType.Sphere); // node.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); // node.GetComponent<Collider>().enabled = !node.GetComponent<Collider>().enabled; // node.AddComponent<nodeOscillation>(); // if (i < 21) // { // node.transform.position = new Vector3(-10f, 0.05f, (10 - i) / 2); // node.name = "Node 1 Mirror" + i; // } // if (i >= 21 & i < 42) // { // node.transform.position = new Vector3(-8f, 0.05f, (31 - i) / 2); // node.name = "Node 2 Mirror" + i; // } // if (i >= 42 & i < 63) // { // node.transform.position = new Vector3(-6f, 0.05f, (52 - i) / 2); // node.name = "Node 3 Mirror" + i; // } // if (i >= 63 & i < 84) // { // node.transform.position = new Vector3(-4f, 0.05f, (73 - i) / 2); // node.name = "Node 4 Mirror" + i; // } // if (i >= 84 & i < 105) // { // node.transform.position = new Vector3(-2f, 0.05f, (94 - i) / 2); // node.name = "Node 5 Mirror" + i; // } //} //populate frequency table for (double i = 1; i <= 127; i++) { double f = 8.1757989156f * Math.Pow(2.0f, (i / 12.0f)); freqs[(int)i] = (float)f; } //start audio source audioSource = gameObject.AddComponent <AudioSource>(); audioSource.playOnAwake = false; audioSource.spatialBlend = 0; //force 2D sound audioSource.Stop(); //avoids audiosource from starting to play automatically fs = AudioSettings.outputSampleRate; if (!audioSource.isPlaying) { //timeIndex = 0; //resets timer before playing sound audioSource.Play(); } //read in midi file var midiFile = MidiFile.Read("Assets/pink_panther.mid"); TempoMap tempoMap = midiFile.GetTempoMap(); ticksPerQuarterNote = tempoMap.TimeDivision.ToInt16() * 2.0f; // parse and extract melody track // melody track determines frequency of (monophonic) sound using (var notesManager = midiFile.GetTrackChunks().First().ManageNotes()) { var notes = notesManager.Notes; foreach (Note note in notes) { NoteInfo currentNoteRead = new NoteInfo { noteNum = note.NoteNumber, startTime = note.Time / ticksPerQuarterNote, duration = note.Length / ticksPerQuarterNote, velocity = note.Velocity, }; //add this object to the melody notes list MelodyList.Add(currentNoteRead); } } //parse and extract track of noteBars using (var notesManager = midiFile.GetTrackChunks().ElementAtOrDefault(1).ManageNotes()) { var notes = notesManager.Notes; //var numNoteBar = 1; foreach (Note note in notes) { NoteInfo currentNoteRead = new NoteInfo { noteNum = note.NoteNumber, startTime = note.Time / ticksPerQuarterNote, duration = note.Length / ticksPerQuarterNote, velocity = note.Velocity, }; //add this object to the melody notes list NoteBarList.Add(currentNoteRead); NoteBar.gameObject.name = "NoteBar " + (currentNoteRead.noteNum - 63) + " "; NoteBar.gameObject.transform.localScale = new Vector3(2, 0.1f, currentNoteRead.duration * 2.0f); NoteBar.gameObject.GetComponent <Collider>().isTrigger = true; Instantiate(NoteBar, new Vector3(currentNoteRead.noteNum - 63, 0.01f, (currentNoteRead.startTime + timeOffset) * 2.0f + currentNoteRead.duration), Quaternion.identity); Instantiate(NoteBar, new Vector3((-1) * (currentNoteRead.noteNum - 63), 0.01f, (currentNoteRead.startTime + timeOffset) * 2.0f + currentNoteRead.duration), Quaternion.identity); totalNotes++; //gets total number of notes for scoring later } } //parse and extract backing track using (var notesManager = midiFile.GetTrackChunks().ElementAtOrDefault(2).ManageNotes()) { var notes = notesManager.Notes; foreach (Note note in notes) { NoteInfo currentNoteRead = new NoteInfo { noteNum = note.NoteNumber, startTime = note.Time / ticksPerQuarterNote, duration = note.Length / ticksPerQuarterNote, velocity = note.Velocity, }; //add this object to the backing notes list BackingList.Add(currentNoteRead); } } ////parse and extract backing track //using (var notesManager = midiFile.GetTrackChunks().ElementAtOrDefault(1).ManageNotes()) //{ // var notes = notesManager.Notes; // foreach (Note note in notes) // { // NoteInfo currentNoteRead = new NoteInfo // { // noteNum = note.NoteNumber, // startTime = note.Time / ticksPerQuarterNote, // duration = note.Length / ticksPerQuarterNote, // velocity = note.Velocity, // }; // //add this object to the backing notes list // BackingList.Add(currentNoteRead); // } //} }
public void SpawnNote(NoteInfo note) { Instantiate(NoteBlueprints[note.Note]); }
void ReadNoteData() { TextAsset jsonPath = Resources.Load<TextAsset>(Setting.NOTE_DATA_PATH); string dataStr = jsonPath.text; JsonData _note = JsonMapper.ToObject(dataStr); //set speed _musicData.Speed = (float)(double)_note["speed"]; JsonData lanes = _note["lane"]; //set note data for (int i = 0; i < lanes.Count; ++i ) { JsonData noteInLane = lanes[i]; for (int j = 0; j < noteInLane.Count; ++j) { JsonData note = noteInLane[j]; NoteInfo n = new NoteInfo(); n.Endtime = float.Parse(note["endtime"].ToString()); n.Hold = bool.Parse(note["hold"].ToString()); n.Lane = int.Parse(note["lane"].ToString()); n.Longnote = bool.Parse(note["longnote"].ToString()); n.Starttime = float.Parse(note["starttime"].ToString()); n.Parallel = bool.Parse(note["parallel"].ToString()); _musicData.Lane[n.Lane].Enqueue(new Note(n)); } } State = GameState.WAIT; _buttonText.text = "Start"; _startButton.GetComponent<Button>().interactable = true; //排序 由小至大 /* foreach(List<Note> notes in _musicData.Lane) { // notes.Sort(); 貌似已经有序了 }*/ }
private static NoteInfo GetRandomInfo(Context context) { NoteInfo[] infos = new NoteInfo[] { GetRandomDate(context), GetRandomLocation() }; return((NoteInfo)GetRandomItem(infos)); }
public void SpawnNote(NoteInfo noteInfo, long hitMilliSeconds) { GameObject prefab = notePrefab; switch (noteInfo.NoteType) { case NoteInfo.ENoteType.BACKGROUND: { prefab = bgNotePrefab; } break; case NoteInfo.ENoteType.LONG: { prefab = longNotePrefab; } break; } GameObject instance = Instantiate(prefab, gameObject.transform); if (instance == null) { Debug.LogError("[SapwnNote] instance is null."); return; } Note note = instance.GetComponent <Note>(); if (note == null) { Debug.LogError("[SpawnNote] note is null."); return; } note.noteInfo = noteInfo; note.hitMiliSceconds = hitMilliSeconds; note.targetPosition = hitLine.position; switch (noteInfo.NoteType) { case NoteInfo.ENoteType.BACKGROUND: { backgrountNotes.Enqueue(note); note.SetVisible(GameManager.Instance.noteSpace.isVisibleBgNote); } break; case NoteInfo.ENoteType.LONG: { notes.Enqueue(note); if (currentLongNote == null) { // 롱노트 시작시 GameObject longNoteInstance = Instantiate(longNoteBodyPrefab, gameObject.transform); if (longNoteInstance == null) { Debug.LogError("[SapwnNote] longNoteInstance is null."); return; } Note longNote = longNoteInstance.GetComponent <Note>(); if (longNote == null) { Debug.LogError("[SpawnNote] longNote is null."); return; } longNote.noteInfo = new NoteInfo(); longNote.noteInfo.LineIndex = noteInfo.LineIndex; longNote.noteInfo.WaveIndex = 0; longNote.noteInfo.NoteType = NoteInfo.ENoteType.LONG_BODY; longNote.hitMiliSceconds = hitMilliSeconds; longNote.targetPosition = hitLine.position; currentLongNote = longNote; longNotes.Enqueue(longNote); } else { // 롱노트 종료시 note.linkedNote = currentLongNote; note.noteInfo.NoteType = NoteInfo.ENoteType.LONG_END; currentLongNote.rectTransform.offsetMax = new Vector2(currentLongNote.rectTransform.offsetMax.x, note.rectTransform.position.y - currentLongNote.rectTransform.position.y); currentLongNote = null; } } break; default: { notes.Enqueue(note); } break; } }
private void DrawNotesheetNotes(Difficulty difficulty, SerializedProperty notesArrayProp) { notesArrayProp.isExpanded = EditorGUILayout.Foldout(notesArrayProp.isExpanded, "Notes", true); if (!notesArrayProp.isExpanded) { return; } EditorGUI.indentLevel++; // Buttons GUILayout.BeginHorizontal(); if (GUILayout.Button("Import .txt")) { string path = EditorUtility.OpenFilePanel("Open note sheet .txt", "", "txt"); NoteGroup[] notes = null; if (NotesheetText.Import(path, ref notes) && notes != null) { AssignNoteArray(notesArrayProp, notes); } } if (GUILayout.Button("Export .txt")) { string path = EditorUtility.SaveFilePanel("Save note sheet as .txt", "", "notesheet.txt", "txt"); NotesheetText.Export(song, path, difficulty); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); string ext = NoteInfo.notesheetFileFormat; if (GUILayout.Button("Import ." + ext)) { string path = EditorUtility.OpenFilePanel("Open note sheet ." + ext, "", ext); if (!string.IsNullOrEmpty(path)) { AssignNoteArray(notesArrayProp, NoteInfo.LoadNoteSheetAsNoteGroups(path, song.BPM)); } } if (GUILayout.Button("Export ." + ext)) { string path = EditorUtility.SaveFilePanel("Save note sheet as ." + ext, "", "notesheet." + ext, ext); if (!string.IsNullOrEmpty(path)) { NoteInfo.SaveNotesheetFromNoteGroups(song.GetNotesheet(difficulty).GetNoteGroups, (byte)difficulty, song.BPM, path); } } GUILayout.EndHorizontal(); // Array int oldSize = notesArrayProp.arraySize; notesArrayProp.arraySize = Math.Max(EditorGUILayout.DelayedIntField("Size", oldSize), 0); if (oldSize <= 0) { for (int i = 0; i < notesArrayProp.arraySize; i++) { notesArrayProp.GetArrayElementAtIndex(i).FindPropertyRelative(relativeTimeName).intValue = Subdivision.substepDivision; } } string[] labels = new string[(int)difficulty]; Array.Copy(noteLabels, labels, labels.Length); for (int i = 0, lastStep = 0; i < notesArrayProp.arraySize; i++) { DrawNoteGroup(difficulty, notesArrayProp.GetArrayElementAtIndex(i), i, ref lastStep, labels); } EditorGUI.indentLevel--; }
// Word.Document myDoc = null; // private Word.ContentControl ccX = null; public EmrNote() { noteInfo = new NoteInfo(); }
public CutEffectEvent(int _pathIndex, int _masterPitch, int _customPitch, NoteInfo noteInfo) { SetEvent(_pathIndex, _masterPitch, _customPitch, noteInfo); }
public bool UpdateNoteInfo(NoteInfo data) { return(this.NoteInfoDAO.UpdateNoteInfo(data)); }
private void updateNote(bool forceRestart) { if (!midiStarted) return; if (!noteStarted) { killNote(); curNote = new NoteInfo(); // Reset note info return; } // Build up new note candidate NoteInfo newNote = new NoteInfo(); if(opt_modeMan.Checked) { // All settings manual, no accel control newNote.instr = (int)(instrumentSelect.Value); newNote.val = (int)(noteSelect.Value); newNote.vol = (int)(volumeSelect.Value); newNote.pitch = (int)(pitchBendSelect.Value); newNote.mod = (int)(modSelect.Value); } else if(opt_mode1.Checked) { // X accel controls note value, Y accel controls modulation newNote.instr = (int)(instrumentSelect.Value); // Use WHOLE TONE SCALE for creepy sounds, and rescale for mid-high range notes newNote.val = ((int)((xac_Scaled + 240) / 8)) * 2; newNote.vol = yac_Scaled; newNote.pitch = (int)(pitchBendSelect.Value); newNote.mod = (int)(modSelect.Value); } else if(opt_mode2.Checked) { // X accel controls pitch bend, Y accel controls modulation newNote.instr = (int)(instrumentSelect.Value); newNote.val = (int)(noteSelect.Value); newNote.vol = (int)(volumeSelect.Value); newNote.pitch = xac_Scaled; newNote.mod = yac_Scaled; } else if(opt_mode3.Checked) { // X accel controls pitch bend, Y accel controls volume newNote.instr = (int)(instrumentSelect.Value); newNote.val = (int)(noteSelect.Value); newNote.vol = yac_Scaled; newNote.pitch = xac_Scaled; newNote.mod = (int)(modSelect.Value); } else { // None of the option boxes are checked?! return; } // Keep track; should note be restarted after all channel commands bool restartNote = forceRestart; if (newNote.instr != curNote.instr || forceRestart) { // Change instrument patch (aka program) outDevice.Send(new ChannelMessage(ChannelCommand.ProgramChange, 0, newNote.instr, 0)); restartNote = true; } if (newNote.val != curNote.val) { // Restarting note will update note value restartNote = true; } if (newNote.vol != curNote.vol || forceRestart) { // Change master volume (controller # 0x07) outDevice.Send(new ChannelMessage(ChannelCommand.Controller, 0, 0x07, newNote.vol)); } if (newNote.pitch != curNote.pitch || forceRestart) { // Change pitch wheel setting outDevice.Send(new ChannelMessage(ChannelCommand.PitchWheel, 0, 0, newNote.pitch)); } if (newNote.mod != curNote.mod || forceRestart) { // Change Modulation controller (0x01) setting outDevice.Send(new ChannelMessage(ChannelCommand.Controller, 0, 0x01, newNote.mod)); } // Restart the note based on what was updated... if (restartNote) { outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, curNote.val, 0)); outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, newNote.val, VELOCITY)); } curNote = newNote; }
private void updateNote(bool forceRestart) { if (!midiStarted) { return; } if (!noteStarted) { killNote(); curNote = new NoteInfo(); // Reset note info return; } // Build up new note candidate NoteInfo newNote = new NoteInfo(); if (opt_modeMan.Checked) { // All settings manual, no accel control newNote.instr = (int)(instrumentSelect.Value); newNote.val = (int)(noteSelect.Value); newNote.vol = (int)(volumeSelect.Value); newNote.pitch = (int)(pitchBendSelect.Value); newNote.mod = (int)(modSelect.Value); } else if (opt_mode1.Checked) { // X accel controls note value, Y accel controls modulation newNote.instr = (int)(instrumentSelect.Value); // Use WHOLE TONE SCALE for creepy sounds, and rescale for mid-high range notes newNote.val = ((int)((xac_Scaled + 240) / 8)) * 2; newNote.vol = yac_Scaled; newNote.pitch = (int)(pitchBendSelect.Value); newNote.mod = (int)(modSelect.Value); } else if (opt_mode2.Checked) { // X accel controls pitch bend, Y accel controls modulation newNote.instr = (int)(instrumentSelect.Value); newNote.val = (int)(noteSelect.Value); newNote.vol = (int)(volumeSelect.Value); newNote.pitch = xac_Scaled; newNote.mod = yac_Scaled; } else if (opt_mode3.Checked) { // X accel controls pitch bend, Y accel controls volume newNote.instr = (int)(instrumentSelect.Value); newNote.val = (int)(noteSelect.Value); newNote.vol = yac_Scaled; newNote.pitch = xac_Scaled; newNote.mod = (int)(modSelect.Value); } else { // None of the option boxes are checked?! return; } // Keep track; should note be restarted after all channel commands bool restartNote = forceRestart; if (newNote.instr != curNote.instr || forceRestart) { // Change instrument patch (aka program) outDevice.Send(new ChannelMessage(ChannelCommand.ProgramChange, 0, newNote.instr, 0)); restartNote = true; } if (newNote.val != curNote.val) { // Restarting note will update note value restartNote = true; } if (newNote.vol != curNote.vol || forceRestart) { // Change master volume (controller # 0x07) outDevice.Send(new ChannelMessage(ChannelCommand.Controller, 0, 0x07, newNote.vol)); } if (newNote.pitch != curNote.pitch || forceRestart) { // Change pitch wheel setting outDevice.Send(new ChannelMessage(ChannelCommand.PitchWheel, 0, 0, newNote.pitch)); } if (newNote.mod != curNote.mod || forceRestart) { // Change Modulation controller (0x01) setting outDevice.Send(new ChannelMessage(ChannelCommand.Controller, 0, 0x01, newNote.mod)); } // Restart the note based on what was updated... if (restartNote) { outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, curNote.val, 0)); outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, newNote.val, VELOCITY)); } curNote = newNote; }
//public float barSpeed = 0; void Start() { audioSource = gameObject.AddComponent <AudioSource>(); audioSource.playOnAwake = false; audioSource.spatialBlend = 0; //force 2D sound audioSource.Stop(); //avoids audiosource from starting to play automatically fs = AudioSettings.outputSampleRate; f2 = 5.0f / 4.0f * f1; //maj 3rd f3 = 4.0f / 3.0f * f1; //perf 4th f4 = 3.0f / 2.0f * f1; //perf 5th f5 = 5.0f / 3.0f * f1; //maj 6th //populate frequency table for (double i = 1; i <= 127; i++) { double f = 8.1757989156f * Math.Pow(2.0f, (i / 12.0f)); freqs[(int)i] = (float)f; } if (!audioSource.isPlaying) { //timeIndex = 0; //resets timer before playing sound audioSource.Play(); } //read in midi file var midiFile = MidiFile.Read("Assets/sample_song.mid"); TempoMap tempoMap = midiFile.GetTempoMap(); print(tempoMap); //parse and extract track of noteBars //i.e. the strings that should be played //TODO: change name from melody track to noteBar track using (var notesManager = midiFile.GetTrackChunks().First().ManageNotes()) { var notes = notesManager.Notes; foreach (Note note in notes) { NoteInfo currentNoteRead = new NoteInfo { noteNum = note.NoteNumber, startTime = note.Time / 960.0f, duration = note.Length / 960.0f, velocity = note.Velocity, }; //add this object to the melody notes list MelodyList.Add(currentNoteRead); print(currentNoteRead.noteNum); //Rigidbody newNoteBar; //Instantiate(NoteBar, new Vector3(note.NoteNumber / 254.0f, 0, note.Time / 960.0f), Quaternion.identity); //TODO: MOVE INSTANTIATE TO NOTE BAR TRACK Instantiate(NoteBar, new Vector3(currentNoteRead.noteNum - 69, 0.05f, +currentNoteRead.startTime * 2.0f + 10.0f), Quaternion.identity); NoteBar.gameObject.name = "NoteBar " + currentNoteRead.noteNum + " "; } //var dump = ObjectDumper.Dump(notes); //print(dump); } //parse and extract melody track //i.e. the frequency of notes that should be played //parse and extract backing track using (var notesManager = midiFile.GetTrackChunks().ElementAtOrDefault(1).ManageNotes()) { var notes = notesManager.Notes; foreach (Note note in notes) { NoteInfo currentNoteRead = new NoteInfo { noteNum = note.NoteNumber, startTime = note.Time / 960.0f, duration = note.Length / 960.0f, velocity = note.Velocity, }; //add this object to the backing notes list BackingList.Add(currentNoteRead); } } }
/// <summary> /// This is method is used to find index of selected item /// </summary> /// <param name="notes">This parameter is list of notes</param> /// <param name="item">>This parameter is current item</param> /// <returns>This method return index</returns> private int IndexOfNote(List <NoteInfo> notes, NoteInfo item) { return(notes.FindIndex(0, notes.Count, note => note.DateOfCreation.Equals(item.DateOfCreation))); }
public static string ToNoteXml(NoteInfo noteInfo) { NoteData noteData = ToNoteData(noteInfo); return(NoteArchiver.WriteString(noteData)); }
public static NoteInfo ToNoteInfo(Note note) { NoteInfo noteInfo = new NoteInfo(); noteInfo.Guid = note.Id; noteInfo.Title = note.Title .Replace("&", "&") .Replace("<", "<") .Replace(">", ">") .Replace("\"", """) .Replace("\'", "'"); noteInfo.OpenOnStartup = note.IsOpenOnStartup; noteInfo.Pinned = note.IsPinned; noteInfo.CreateDate = note.CreateDate; noteInfo.LastChangeDate = note.ChangeDate; noteInfo.LastMetadataChangeDate = note.MetadataChangeDate; noteInfo.Tags = new List <string> (); foreach (Tag tag in note.Tags) { noteInfo.Tags.Add(tag.Name); } const string noteContentRegex = @"^<note-content([^>]+version=""(?<contentVersion>[^""]*)"")?[^>]*((/>)|(>(?<innerContent>.*)</note-content>))$"; Match m = Regex.Match(note.XmlContent, noteContentRegex, RegexOptions.Singleline); Group versionGroup = m.Groups ["contentVersion"]; Group contentGroup = m.Groups ["innerContent"]; double contentVersion; if (versionGroup.Success && double.TryParse(versionGroup.Value, out contentVersion)) { noteInfo.NoteContentVersion = contentVersion; } else { noteInfo.NoteContentVersion = 0.1; // TODO: Constants, transformations, etc, if this changes } if (contentGroup.Success) { string [] splits = contentGroup.Value.Split(new char [] { '\n' }, 2); if (splits.Length > 1 && splits [1].Length > 0) { StringBuilder builder = new StringBuilder(contentGroup.Value.Length); bool inTag = false; // Strip everything out of first line, except for XML tags // TODO: Handle 'note-title' element differently? // Ideally we would want to get rid of it completely. foreach (char c in splits[0]) { if (!inTag && c == '<') { inTag = true; } if (inTag) { builder.Append(c); if (c == '>') { inTag = false; } } } // Trim leading newline, if there is one if (splits [1][0] == '\n') { builder.Append(splits [1], 1, splits [1].Length - 1); } else { builder.Append(splits [1]); } noteInfo.NoteContent = builder.ToString(); } } if (noteInfo.NoteContent == null) { noteInfo.NoteContent = string.Empty; } return(noteInfo); }
public void Play(NoteInfo noteInfo) { PlayScheduled(noteInfo, 0); }
void keyEventCheck() { if (Input.GetKeyDown(KeyCode.Space)) { if (audioSource != null && audioSource.clip != null) { if (audioSource.pitch == 0f) { audioSource.pitch = 1f; } else { audioSource.pitch = 0f; GVContainer.ms = barList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } } } if (Input.GetKeyDown(KeyCode.LeftArrow)) { if (currentPos > 0) { if (currentPos != startLane + 1) { currentPos--; } else if (currentPos > 1) { currentPos -= 2; } } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } if (Input.GetKey(KeyCode.LeftArrow)) { inputTimer++; if (inputTimer > 30 && inputTimer % 2 == 0) { if (currentPos > 0) { if (currentPos != startLane + 1) { currentPos--; } else if (currentPos > 1) { currentPos -= 2; } } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } } if (Input.GetKeyUp(KeyCode.LeftArrow)) { inputTimer = 0; } if (Input.GetKeyDown(KeyCode.RightArrow)) { if (currentPos < 16) { if (currentPos != startLane - 1) { currentPos++; } else if (currentPos < 15) { currentPos += 2; } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } } if (Input.GetKey(KeyCode.RightArrow)) { inputTimer++; if (inputTimer > 30 && inputTimer % 2 == 0) { if (currentPos < 16) { if (currentPos != startLane - 1) { currentPos++; } else if (currentPos < 15) { currentPos += 2; } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } } } if (Input.GetKeyUp(KeyCode.RightArrow)) { inputTimer = 0; } if (editMode != 1) { if (Input.GetKeyDown(KeyCode.UpArrow)) { if (audioSource.pitch == 0) { if (GVContainer.ms >= offset - 1) { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { GVContainer.ms += (60000f / BPM); GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand)) { GVContainer.ms++; audioSource.time = GVContainer.ms / 1000f; } else { GVContainer.ms += (60000f / BPM) / quantize; GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } } } } if (Input.GetKey(KeyCode.UpArrow)) { inputTimer++; if (inputTimer > 30) { if (audioSource.pitch == 0) { if (GVContainer.ms >= offset - 1) { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { GVContainer.ms += (60000f / BPM); GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand)) { GVContainer.ms++; audioSource.time = GVContainer.ms / 1000f; } else { GVContainer.ms += (60000f / BPM) / quantize; GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } } } } } if (Input.GetKeyUp(KeyCode.UpArrow)) { inputTimer = 0; } if (Input.GetKeyDown(KeyCode.DownArrow)) { if (audioSource.pitch == 0) { if (GVContainer.ms < audioSource.clip.length * 1000f) { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { GVContainer.ms -= (60000f / BPM); GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand)) { GVContainer.ms--; audioSource.time = GVContainer.ms / 1000f; } else { GVContainer.ms -= (60000f / BPM) / quantize; GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } } } } if (Input.GetKey(KeyCode.DownArrow)) { inputTimer++; if (inputTimer > 30) { if (audioSource.pitch == 0) { if (GVContainer.ms < audioSource.clip.length * 1000f) { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { GVContainer.ms -= (60000f / BPM); GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand)) { GVContainer.ms--; audioSource.time = GVContainer.ms / 1000f; } else { GVContainer.ms -= (60000f / BPM) / quantize; GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } } } } } if (Input.GetKeyUp(KeyCode.DownArrow)) { inputTimer = 0; } float scroll = Input.GetAxis("Mouse ScrollWheel"); if (scroll != 0) { GVContainer.ms += ((60000f / BPM) / quantize) * (scroll * 10f); GVContainer.ms = qtList.Nearest(GVContainer.ms); audioSource.time = GVContainer.ms / 1000f; } } if (Input.GetKeyDown(KeyCode.X)) { switch (kind) { case 0: //tap if (editMode == 0) { editMode = 1; kindSelector.interactable = false; lane.Add(currentPos); startLane = currentPos; startLaneMarker.transform.position = new Vector3((float)(startLane - 8) / 4f, 0, -14.43f); if (currentPos != 16) { currentPos++; } else { currentPos--; } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } else if (editMode == 1) { editMode = 0; kindSelector.interactable = true; lane.Add(currentPos); lane.Sort(new Comparator()); startLane = -1; startLaneMarker.transform.position = new Vector3(0, 0, 0); currentEditing = new NoteInfo((int)GVContainer.ms, kind, lane.ToArray(), new float[0]); noteMap.Add(currentEditing); generateNote(currentEditing); lane.Clear(); } break; case 1: //hold if (editMode == 0) { editMode = 1; kindSelector.interactable = false; lane.Add(currentPos); startLane = currentPos; startLaneMarker.transform.position = new Vector3((float)(startLane - 8) / 4f, 0, -14.43f); if (currentPos != 16) { currentPos++; } else { currentPos--; } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } else if (editMode == 1) { editMode = 2; lane.Add(currentPos); lane.Sort(new Comparator()); startLane = -1; startLaneMarker.transform.position = new Vector3(0, 0, 0); currentEditing = new NoteInfo((int)GVContainer.ms, 0, lane.ToArray(), new float[0]); generatePreviewNote(currentEditing); } else if (editMode == 2) { if (GVContainer.ms > currentEditing.timing) { editMode = 0; kindSelector.interactable = true; currentEditing = new NoteInfo(currentEditing.timing, kind, lane.ToArray(), new float[1] { GVContainer.ms }); noteMap.Add(currentEditing); generateNote(currentEditing); lane.Clear(); args.Clear(); } } break; case 2: //slide if (editMode == 0) { editMode = 1; kindSelector.interactable = false; lane.Add(currentPos); startLane = currentPos; startLaneMarker.transform.position = new Vector3((float)(startLane - 8) / 4f, 0, -14.43f); currentEditing = new NoteInfo((int)GVContainer.ms, 0, lane.ToArray(), new float[0]); if (currentPos != 16) { currentPos++; } else { currentPos--; } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } else if (editMode == 1) { editMode = 2; lane.Add(currentPos); lane.Sort(lane.Count - 2, 2, new Comparator()); startLane = -1; startLaneMarker.transform.position = new Vector3(0, 0, 0); if (lane.Count > 2) { args.Add(GVContainer.ms); } currentEditing = new NoteInfo(currentEditing.timing, kind, lane.ToArray(), args.ToArray()); generatePreviewNote(currentEditing); } else if (editMode == 2) { if (GVContainer.ms > currentEditing.timing) { editMode = 1; lane.Add(currentPos); startLane = currentPos; startLaneMarker.transform.position = new Vector3((float)(startLane - 8) / 4f, 0, -14.43f); if (currentPos != 16) { currentPos++; } else { currentPos--; } currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } } break; case 3: //A-Hold if (editMode == 0) { editMode = 2; kindSelector.interactable = false; lane.Add(currentPos); currentEditing = new NoteInfo((int)GVContainer.ms, 0, lane.ToArray(), new float[0]); currentPositionMarker.transform.position = new Vector3((float)(currentPos - 8) / 4f, 0, -14.43f); } else if (editMode == 2) { lane.Add(currentPos); if (lane.Count > 1) { args.Add(GVContainer.ms); } currentEditing = new NoteInfo(currentEditing.timing, kind, lane.ToArray(), args.ToArray()); generatePreviewNote(currentEditing); } break; } } if (Input.GetKeyDown(KeyCode.Return)) { if (editMode == 2 && kind == 2) //slide { editMode = 0; kindSelector.interactable = true; startLane = -1; startLaneMarker.transform.position = new Vector3(0, 0, 0); currentEditing = new NoteInfo(currentEditing.timing, kind, lane.ToArray(), args.ToArray()); noteMap.Add(currentEditing); Debug.Log(string.Join(", ", lane.ToArray())); Debug.Log(string.Join(", ", args.ToArray())); generateNote(currentEditing); lane.Clear(); args.Clear(); } if (editMode == 2 && kind == 3) //A-hold { editMode = 0; kindSelector.interactable = true; startLane = -1; startLaneMarker.transform.position = new Vector3(0, 0, 0); currentEditing = new NoteInfo(currentEditing.timing, kind, lane.ToArray(), args.ToArray()); noteMap.Add(currentEditing); generateNote(currentEditing); lane.Clear(); args.Clear(); } } if (Input.GetKeyDown(KeyCode.Z)) { editMode = 0; kindSelector.interactable = true; lane.Clear(); args.Clear(); startLane = -1; startLaneMarker.transform.position = new Vector3(0, 0, 0); currentEditing = null; } if (Input.GetKeyDown(KeyCode.Backspace)) { noteMap.Sort((a, b) => a.timing - b.timing); if (noteMap.Count > 0) { int destroyIndex = BackKey(noteMap, GVContainer.ms - 5); if (destroyIndex >= 0) { Destroy(GameObject.Find("Note " + String.Format("{0:D4}", destroyIndex))); noteMap.RemoveAt(destroyIndex); reGenerateAllNote(noteMap); } } } if (Input.GetKeyDown(KeyCode.Delete)) { noteMap.Sort((a, b) => a.timing - b.timing); if (noteMap.Count > 0) { int destroyIndex = DeleteKey(noteMap, GVContainer.ms - 5); if (destroyIndex >= 0) { Destroy(GameObject.Find("Note " + String.Format("{0:D4}", destroyIndex))); noteMap.RemoveAt(destroyIndex); reGenerateAllNote(noteMap); } } } if ((Input.GetKey(KeyCode.S)) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand))) { onSaveAction(); } }
private SliderType_BeatSaber ConvTypeForNoteInfoToSlider(NoteInfo noteInfo) { return(ConvTypeCutDirectionToSliderIndex(noteInfo.cutDirection) + (int)noteInfo.type * ((int)SliderType_BeatSaber.RIGHT_BEGIN)); }
public NoteInfo Update(NoteInfo noteInfo) { uow.Repository <NoteInfo>().Update(noteInfo); return(noteInfo); }
void XML_LoadSelectedMusic(string fileName) { // temporary string string readingNode; string readingAttr; do { // Open XML TextAsset txt = Resources.Load("XML/" + fileName) as TextAsset; XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(txt.text); readingNode = "JamXML"; XmlNodeList tmpNodeList = xmldoc.SelectNodes(readingNode); if (tmpNodeList == null) { break; } readingNode = "O2Mode"; tmpNodeList = tmpNodeList[0].SelectNodes(readingNode); if (tmpNodeList == null) { break; } //XmlNode tmpNode = tmpNodeList[0].FirstChild; for (int i = 0; i < tmpNodeList.Count; ++i) { readingAttr = "nDifficuty"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } Difficulty tmpDiff = (Difficulty)XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); if (tmpDiff == Global.currentSelectDifficulty) { // Reading "O2Mode" ModeInfo tmpModeInfo = new ModeInfo(); tmpModeInfo.diff = tmpDiff; readingAttr = "nBPM"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpModeInfo.bpm = XmlConvert.ToSingle(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = "nNumTune"; if (tmpNodeList[i].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpModeInfo.totalMeasure = XmlConvert.ToInt32(tmpNodeList[i].Attributes[readingAttr].Value); readingAttr = ""; tmpModeInfo.noteInfo = new Dictionary <int, Dictionary <int, NoteInfo> >(); // Reading "O2Track" // readingNode = "O2Track"; XmlNodeList tmpTrackList = tmpNodeList[i].ChildNodes; // 노트 for (int j = 0; j < tmpTrackList.Count; ++j) { readingAttr = "nType"; if (XmlConvert.ToInt32(tmpTrackList[j].Attributes[readingAttr].Value) != 2) { continue; } Dictionary <int, NoteInfo> tmpTrackInfo = new Dictionary <int, NoteInfo>(); XmlNodeList tmpNoteList = tmpTrackList[j].ChildNodes; for (int k = 0; k < tmpNoteList.Count; ++k) { // Reading "O2NoteInfo" // readingNode = "O2NoteInfo"; NoteInfo tmpNoteInfo = new NoteInfo(); readingAttr = "nTune"; if (tmpNoteList[k].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpNoteInfo.measure = XmlConvert.ToInt32(tmpNoteList[k].Attributes[readingAttr].Value) - 1; readingAttr = "fGrid"; if (tmpNoteList[k].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpNoteInfo.grid = XmlConvert.ToSingle(tmpNoteList[k].Attributes[readingAttr].Value); readingAttr = "nType"; if (tmpNoteList[k].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpNoteInfo.type = (NoteType)XmlConvert.ToInt32(tmpNoteList[k].Attributes[readingAttr].Value); readingAttr = "fData"; if (tmpNoteList[k].Attributes[readingAttr] == null) { Debug.Log("Attribute not found : " + readingAttr); break; } tmpNoteInfo.drag = (DragType)XmlConvert.ToInt32(tmpNoteList[k].Attributes[readingAttr].Value); tmpTrackInfo[k] = tmpNoteInfo; } // end for k tmpModeInfo.noteInfo[j] = tmpTrackInfo; } // end for j Global.currentModeInfo = tmpModeInfo; } } // end for i readingNode = null; } while (false); if (readingNode != null) { Debug.Log("Failed to reading XML Node : " + readingNode); } }
public static OrderInfo ToOrderInfo(Order entityOrder, CFIEntities db) { OrderInfo order = new OrderInfo(); order.ID = entityOrder.OrderID; order.Customer = ConversionUtils.ToCustomerInfo(entityOrder.Customer); order.Market = entityOrder.Store.Market.MarketName; if (order.Market != null) { order.Market = order.Market.Trim(); } order.PONumber = entityOrder.PurchaseOrderNumber.Trim(); order.StoreNumber = entityOrder.Store.StoreNumber.Trim(); // division assignment requires another lookup order.Division = getDivision(entityOrder.MaterialTypeID, db); // Diagrams if (entityOrder.OrderDiagrams.Count > 0) { try { string installOrderNumber = entityOrder.CustomerOrderNumber.Trim(); string calcDateTimeStamp = entityOrder.OrderDiagrams.ElementAt <OrderDiagram>(0).DiagramDateTime.Value.ToString("MMddyyyyHHmm"); string diagramNumber = entityOrder.OrderDiagrams.ElementAt <OrderDiagram>(0).DiagramNumber; string fileName = string.Format("{0}-{1}-{2}-{3}-{4}-1-0.pdf", order.StoreNumber, order.PONumber, installOrderNumber, diagramNumber, calcDateTimeStamp); order.DiagramNumber = fileName; } catch (Exception ex) { LogAPI.WebServiceLog.DebugFormat("failed to generate order diagram file name. exception: {0}\r\n{1}", ex.Message, ex.StackTrace); order.DiagramNumber = ""; } } // if order is not scheduled then assign largest date value order.ScheduledDate = DateTime.MaxValue; if ((entityOrder.Scheduled == true) && (entityOrder.ScheduleStartDate != null)) { order.ScheduledDate = entityOrder.ScheduleStartDate.Value; } // assign notes List <NoteInfo> notes = new List <NoteInfo>(); foreach (PONote poNote in entityOrder.PONotes) { if (poNote.Deleted == false) { NoteInfo note = ConversionUtils.ToNoteInfo(poNote, db); notes.Add(note); } } order.Notes = notes.ToArray(); // assign photos List <PhotoInfo> photos = new List <PhotoInfo>(); foreach (POPhoto poPhoto in entityOrder.POPhotos) { if (poPhoto.Deleted == false) { PhotoInfo photo = ConversionUtils.ToPhotoInfo(poPhoto, db); photos.Add(photo); } } order.Photos = photos.ToArray(); return(order); }
public void ShowNote(NoteInfo noteInfo) { int index = ConvNoteInfoToSliderIndex(noteInfo); sliders[index].FlashBox((int)noteInfo.cutDirection); }