static void Postfix(LanotaTapNote Note) { if (Note.TapNoteGameObject != null) { var sort = Note.TapNoteGameObject.AddComponent <SortingGroup>(); sort.sortingLayerName = "Note"; sort.sortingOrder = -(int)(Note.Time * 10000.0f); } }
static void Postfix(LanotaTapNote TapNoteData, float Time, bool SaveOperation) { if (TapNoteData.TapNoteGameObject != null) { var sort = TapNoteData.TapNoteGameObject.GetComponent <SortingGroup>(); if (sort != null) { sort.sortingOrder = -(int)(TapNoteData.Time * 10000.0f); } } }
public LanotaTapNote DeepCopy() { LanotaTapNote New = new LanotaTapNote(); New.Type = Type; New.Time = Time; New.Duration = Duration; New.Degree = Degree; New.Size = Size; New.Critical = Critical; New.Combination = Combination; New.Bpm = Bpm; return(New); }
public LanotaTapNote ToTapNote(int Type) { LanotaTapNote TapNote = new LanotaTapNote(); TapNote.Bpm = Bpm; TapNote.Combination = Combination; TapNote.Critical = Critical; TapNote.Degree = Degree; TapNote.Duration = Duration; TapNote.OnSelect = false; TapNote.Size = Size; TapNote.Time = Time; TapNote.Type = Type; return(TapNote); }
void EmitTapNoteEffect(LanotaTapNote note) { //harmony particle Instantiate(r.Prefab_harmonyeffect, note.TapNoteGameObject.transform.position, note.TapNoteGameObject.transform.rotation, Tuner.transform).AddComponent <AnimationAutoDestroy>(); if (note.Type != 4) { Instantiate(r.Prefab_ShockwaveClick, note.TapNoteGameObject.transform.position, note.TapNoteGameObject.transform.rotation, Tuner.transform); } if (note.Type == 2) { Instantiate(r.Prefab_SparkleFlickIn, note.TapNoteGameObject.transform.position, note.TapNoteGameObject.transform.rotation, Tuner.transform); } else if (note.Type == 3) { Instantiate(r.Prefab_SparkleFlickOut, note.TapNoteGameObject.transform.position, note.TapNoteGameObject.transform.rotation, Tuner.transform); } }
public IEnumerator Process(LanotaliumContext context) { if (!context.IsProjectLoaded) { yield break; } if (context.OperationManager.SelectedTapNote.Count != 2) { if (context.OperationManager.SelectedTapNote.Count > 2) { context.MessageBox.ShowMessage("More then 2 Tap note selected"); } else { context.MessageBox.ShowMessage("Please Select 2 Click / Catch note"); } yield break; } Request <AskCatchRail> r = new Request <AskCatchRail>(); yield return(context.UserRequest.Request(r, "Create Catch Rail (Advanced)")); if (r.Succeed) { var p = r.Object; var o = context.OperationManager; var rand = new System.Random(); LanotaTapNote first = null, last = null; if (o.SelectedTapNote.First().Time < o.SelectedTapNote.Last().Time) { first = o.SelectedTapNote.First(); last = o.SelectedTapNote.Last(); } else { last = o.SelectedTapNote.First(); first = o.SelectedTapNote.Last(); } var count = p.Count; if (count == 0) { var bpms = o.InspectorManager.ComponentBpm; bpms.EnableBeatline = true; var firstIdx = o.FindNearestBeatlineIndexByTime(first.Time); var lastIdx = o.FindNearestBeatlineIndexByTime(last.Time); count = lastIdx - firstIdx - 1; if (count > 99999) { context.MessageBox.ShowMessage("Infinite Loop Detected!\nTry again"); yield break; } /* * var beat = first.Time; * while (beat < last.Time) * { * if(count > 99999) * { * context.MessageBox.ShowMessage("Infinite Loop Detected!\nTry again"); * yield break; * } * * beat = o.InspectorManager.ComponentBpm.FindPrevOrNextBeatline(beat, true); * count++; * } * count--; */ } if (count <= 0) { context.MessageBox.ShowMessage("There is no Beatline Between Two Selected note"); yield break; } var deltaTime = (last.Time - first.Time) / (count + 1); var firstDegMod = first.Degree % 360.0f; var lastDegMod = last.Degree % 360.0f; var firstDegAbs = firstDegMod > 0.0f ? firstDegMod : 360 - (-firstDegMod); var lastDegAbs = lastDegMod > 0.0f ? lastDegMod : 360 - (-lastDegMod); var deltaDegree = (lastDegAbs) - (firstDegAbs); //Clockwise but delta is Anti-clockwise if (p.Clockwise && deltaDegree > 0.0f) { deltaDegree = 360.0f - deltaDegree; } //Anti-clockwise but delta is Clockwise else if (!p.Clockwise && deltaDegree < 0.0f) { deltaDegree = 360.0f + deltaDegree; } if (p.Revolution > 0) { if (p.Clockwise) { deltaDegree -= p.Revolution * 360.0f; } else { deltaDegree += p.Revolution * 360.0f; } } var sizePattern = new IntPattern(ValidSizeAndTypePattern); var typePattern = new IntPattern(ValidSizeAndTypePattern); if (sizePattern.ReadPattern(p.SizePattern) && typePattern.ReadPattern(p.TypePattern)) { for (int i = 0; i < count; i++) { var percent = (float)(i + 1) / (float)(count + 1); var note = new LanotaTapNote() { Time = first.Time + (deltaTime * (i + 1)), Degree = first.Degree + deltaDegree * Ease.CalculateEase(percent, p.Ease), @Type = ConvertNoteType(typePattern.GetValue(i)), Size = sizePattern.GetValue(i), }; if (p.Random != 0.0f) { var randDegree = ((float)rand.NextDouble() - 0.5f) * 2.0f * p.Random; note.Degree += randDegree; } o.AddTapNote(note); } } else { context.MessageBox.ShowMessage("Error in Pattern String!"); } } }
void OnTapNoteClicked(LanotaTapNote note) { }
public ChartData(string Text) { Json.LnmReadJson MidJson; MidJson = JsonConvert.DeserializeObject <Json.LnmReadJson>(Text); if (MidJson == null) { MidJson = JsonConvert.DeserializeObject <Json.LnmReadJson>("{\"events\":null,\"eos\":0,\"bpm\":null,\"scroll\":null}"); } LanotaCameraRot = new List <LanotaCameraRot>(); LanotaCameraXZ = new List <LanotaCameraXZ>(); LanotaCameraY = new List <LanotaCameraY>(); LanotaChangeBpm = new List <LanotaChangeBpm>(); LanotaDefault = new LanotaDefault(); LanotaHoldNote = new List <LanotaHoldNote>(); LanotaScroll = new List <LanotaScroll>(); LanotaTapNote = new List <LanotaTapNote>(); //Events if (MidJson.events != null) { for (int i = 0; i < MidJson.events.Count; ++i) { int Type = MidJson.events[i].Type; if (Type == 0 || Type == 2 || Type == 3 || Type == 4) { LanotaTapNote TmpTap = new LanotaTapNote(); TmpTap.Type = Type; TmpTap.Time = MidJson.events[i].Timing; TmpTap.Duration = MidJson.events[i].Duration; TmpTap.Degree = MidJson.events[i].Degree; TmpTap.Size = MidJson.events[i].Size; TmpTap.Critical = MidJson.events[i].Critical; TmpTap.Combination = MidJson.events[i].Combination; TmpTap.Bpm = MidJson.events[i].Bpm; TmpTap.Sizef = MidJson.events[i].Sizef; LanotaTapNote.Add(TmpTap); } else if (Type == 5) { LanotaHoldNote TmpHold = new LanotaHoldNote(); TmpHold.Type = Type; TmpHold.Time = MidJson.events[i].Timing; TmpHold.Duration = MidJson.events[i].Duration; TmpHold.Jcount = MidJson.events[i].joints.j_count; TmpHold.Degree = MidJson.events[i].Degree; TmpHold.Combination = MidJson.events[i].Combination; TmpHold.Sizef = MidJson.events[i].Sizef; if (TmpHold.Jcount != 0) { TmpHold.Joints = new List <LanotaJoints>(); for (int j = 0; j < MidJson.events[i].joints.j.Count; ++j) { LanotaJoints JTmpHold = new LanotaJoints(); JTmpHold.dDegree = MidJson.events[i].joints.j[j].d_deg; JTmpHold.dTime = MidJson.events[i].joints.j[j].d_time; float TmpDegree = TmpHold.Degree + JTmpHold.dDegree; float TmpTime = TmpHold.Time + JTmpHold.dTime; for (int k = 0; k < j; ++k) { TmpDegree += TmpHold.Joints[k].dDegree; TmpTime += TmpHold.Joints[k].dTime; } JTmpHold.aDegree = TmpDegree; JTmpHold.aTime = TmpTime; JTmpHold.Cfmi = MidJson.events[i].joints.j[j].d_e; TmpHold.Joints.Add(JTmpHold); } } TmpHold.Size = MidJson.events[i].Size; TmpHold.Critical = MidJson.events[i].Critical; TmpHold.Bpm = MidJson.events[i].Bpm; LanotaHoldNote.Add(TmpHold); } else if (Type == 8 || Type == 11) { LanotaCameraXZ TmpCam = new LanotaCameraXZ(); TmpCam.Type = Type; TmpCam.Time = MidJson.events[i].Timing; TmpCam.Duration = MidJson.events[i].Duration; TmpCam.ctp = MidJson.events[i].ctp; TmpCam.ctp1 = MidJson.events[i].ctp1; TmpCam.ctp2 = MidJson.events[i].ctp2; TmpCam.cfmi = MidJson.events[i].cfmi; TmpCam.cflg = MidJson.events[i].cflg; LanotaCameraXZ.Add(TmpCam); } else if (Type == 10) { LanotaCameraY TmpCam = new LanotaCameraY(); TmpCam.Type = Type; TmpCam.Time = MidJson.events[i].Timing; TmpCam.Duration = MidJson.events[i].Duration; TmpCam.ctp = MidJson.events[i].ctp; TmpCam.ctp1 = MidJson.events[i].ctp1; TmpCam.ctp2 = MidJson.events[i].ctp2; TmpCam.cfmi = MidJson.events[i].cfmi; TmpCam.cflg = MidJson.events[i].cflg; LanotaCameraY.Add(TmpCam); } else if (Type == 12) { LanotaDefault.CamRou = MidJson.events[i].ctp; LanotaDefault.CamTheta = MidJson.events[i].ctp1; LanotaDefault.CamHeight = MidJson.events[i].ctp2; LanotaDefault.Degree = MidJson.events[i].Degree; } else if (Type == 13) { LanotaCameraRot TmpCam = new LanotaCameraRot(); TmpCam.Type = Type; TmpCam.Time = MidJson.events[i].Timing; TmpCam.Duration = MidJson.events[i].Duration; TmpCam.ctp = MidJson.events[i].ctp * -1; TmpCam.ctp1 = MidJson.events[i].ctp1; TmpCam.ctp2 = MidJson.events[i].ctp2; TmpCam.cfmi = MidJson.events[i].cfmi; TmpCam.cflg = MidJson.events[i].cflg; LanotaCameraRot.Add(TmpCam); } } } //Bpm if (MidJson.bpm != null) { if (MidJson.bpm.Count != 0) { LanotaChangeBpm FirstTmpBpm = new LanotaChangeBpm(); FirstTmpBpm.Type = MidJson.bpm[0].Type; FirstTmpBpm.Time = -3; FirstTmpBpm.Duration = MidJson.bpm[0].Duration; FirstTmpBpm.Degree = MidJson.bpm[0].Degree; FirstTmpBpm.Size = MidJson.bpm[0].Size; FirstTmpBpm.Critical = MidJson.bpm[0].Critical; FirstTmpBpm.Combination = MidJson.bpm[0].Combination; FirstTmpBpm.Bpm = MidJson.bpm[0].Bpm; LanotaChangeBpm.Add(FirstTmpBpm); for (int i = 1; i < MidJson.bpm.Count; ++i) { LanotaChangeBpm TmpBpm = new LanotaChangeBpm(); TmpBpm.Type = MidJson.bpm[i].Type; TmpBpm.Time = MidJson.bpm[i].Timing; TmpBpm.Duration = MidJson.bpm[i].Duration; TmpBpm.Degree = MidJson.bpm[i].Degree; TmpBpm.Size = MidJson.bpm[i].Size; TmpBpm.Critical = MidJson.bpm[i].Critical; TmpBpm.Combination = MidJson.bpm[i].Combination; TmpBpm.Bpm = MidJson.bpm[i].Bpm; LanotaChangeBpm.Add(TmpBpm); } } else { LanotaChangeBpm FirstTmpBpm = new LanotaChangeBpm(); FirstTmpBpm.Type = 6; FirstTmpBpm.Time = -3; FirstTmpBpm.Bpm = 100; LanotaChangeBpm.Add(FirstTmpBpm); } } else { LanotaChangeBpm FirstTmpBpm = new LanotaChangeBpm(); FirstTmpBpm.Type = 6; FirstTmpBpm.Time = -3; FirstTmpBpm.Bpm = 100; LanotaChangeBpm.Add(FirstTmpBpm); } //Scroll if (MidJson.scroll != null) { if (MidJson.scroll.Count != 0) { LanotaScroll TmpScrollFirst = new LanotaScroll(); TmpScrollFirst.Speed = MidJson.scroll[0].speed; TmpScrollFirst.Time = -10; LanotaScroll.Add(TmpScrollFirst); for (int i = 1; i < MidJson.scroll.Count; ++i) { LanotaScroll TmpScroll = new LanotaScroll(); TmpScroll.Speed = MidJson.scroll[i].speed; TmpScroll.Time = MidJson.scroll[i].timing; LanotaScroll.Add(TmpScroll); } } else { LanotaScroll TmpScrollFirst = new LanotaScroll(); TmpScrollFirst.Speed = 1; TmpScrollFirst.Time = -10; LanotaScroll.Add(TmpScrollFirst); } } else { LanotaScroll TmpScrollFirst = new LanotaScroll(); TmpScrollFirst.Speed = 1; TmpScrollFirst.Time = -10; LanotaScroll.Add(TmpScrollFirst); } SongLength = MidJson.eos; }
IEnumerator UpdateHotKey() { while (true) { //Create Tap if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.T)) { LanotaTapNote NewNote = new LanotaTapNote { Time = context.TunerManager.ChartTime, Degree = 0, Size = 1 }; context.OperationManager.AddTapNote(NewNote, false); yield return(new WaitForSeconds(0.3f)); } //Create Hold else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.H)) { LanotaHoldNote NewNote = new LanotaHoldNote { Time = context.TunerManager.ChartTime, Degree = 0, Duration = 1.0f, Size = 1 }; context.OperationManager.AddHoldNote(NewNote, false); yield return(new WaitForSecondsRealtime(0.3f)); } //Create Bpm else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.B)) { LanotaChangeBpm NewBpm = new LanotaChangeBpm { Time = context.TunerManager.ChartTime, Bpm = 100.0f }; context.OperationManager.AddBpm(NewBpm, false); yield return(new WaitForSecondsRealtime(0.3f)); } //Create Scroll Speed else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.F)) { LanotaScroll NewSpeed = new LanotaScroll { Time = context.TunerManager.ChartTime, Speed = 1.0f }; context.OperationManager.AddScrollSpeed(NewSpeed, false); yield return(new WaitForSecondsRealtime(0.3f)); } //Enable Click to Create else if (Input.GetKey(KeyCode.F2)) { context.EditorManager.CreatorWindow.ClickToCreateManager.Enable = !context.EditorManager.CreatorWindow.ClickToCreateManager.Enable; yield return(new WaitForSecondsRealtime(0.4f)); } yield return(null); //Click to Create snap hotkey /* //I'm note sure * if(context.EditorManager.CreatorWindow.ClickToCreateManager.Enable) * { * if (Input.GetKey(KeyCode.LeftControl)) * { * context.EditorManager.CreatorWindow.ClickToCreateManager.AttachToAngleline = !context.EditorManager.CreatorWindow.ClickToCreateManager.AttachToAngleline; * yield return new WaitForSecondsRealtime(0.4f); * } * if (Input.GetKey(KeyCode.LeftAlt)) * { * context.EditorManager.CreatorWindow.ClickToCreateManager.AttachToBeatline = !context.EditorManager.CreatorWindow.ClickToCreateManager.AttachToBeatline; * yield return new WaitForSecondsRealtime(0.4f); * } * } */ } }