Example #1
0
        static void Postfix(LanotaHoldNote HoldNoteData)
        {
            if (HoldNoteData.Joints == null)
            {
                return;
            }

            for (int i = 0; i < HoldNoteData.Joints.Count; i++)
            {
                var joint = HoldNoteData.Joints[i];

                if (joint.JointGameObject != null)
                {
                    var sort = joint.JointGameObject.GetComponent <SortingGroup>();
                    if (sort == null)
                    {
                        sort = joint.JointGameObject.AddComponent <SortingGroup>();
                        sort.sortingLayerName = "Note";
                    }

                    sort.sortingOrder = -(int)(joint.aTime * 10000.0f);
                    Debug.Log(sort.sortingOrder);
                }
            }
        }
        static void Postfix(LanotaHoldNote Note)
        {
            if (Note.Joints == null)
            {
                return;
            }

            for (int i = 0; i < Note.Joints.Count; i++)
            {
                var joint = Note.Joints[i];

                if (joint.JointGameObject != null)
                {
                    var sort = joint.JointGameObject.GetComponent <SortingGroup>();
                    if (sort == null)
                    {
                        sort = joint.JointGameObject.AddComponent <SortingGroup>();
                        sort.sortingLayerName = "Note";
                    }
                    //joint.dTime;

                    sort.sortingOrder = -(int)(joint.aTime * 10000.0f);
                }
            }
        }
        private static void Postfix(LimHoldNoteManager __instance, LanotaHoldNote Note)
        {
            var worker = Note.HoldNoteGameObject.AddComponent <HoldLineWorker>();

            worker.TouchMaterial   = __instance.HoldTouch;
            worker.UnTouchMaterial = __instance.HoldUntouch;
            worker.Note            = Note;
        }
 static void Postfix(LanotaHoldNote Note)
 {
     if (Note.HoldNoteGameObject != null)
     {
         var sort = Note.HoldNoteGameObject.AddComponent <SortingGroup>();
         sort.sortingLayerName = "Note";
         sort.sortingOrder     = -(int)(Note.Time * 10000.0f);
     }
 }
 static void Postfix(LanotaHoldNote HoldNoteData, float Time, bool SaveOperation)
 {
     if (HoldNoteData.HoldNoteGameObject != null)
     {
         var sort = HoldNoteData.HoldNoteGameObject.GetComponent <SortingGroup>();
         if (sort != null)
         {
             sort.sortingOrder = -(int)(HoldNoteData.Time * 10000.0f);
         }
     }
 }
Example #6
0
        int CalculateHoldNoteCount(LanotaHoldNote Hold, float Time)
        {
            int   NoteCount  = 0;
            float Duration   = (Hold.Time + Hold.Duration) < Time ? Hold.Duration : (Time - Hold.Time);
            float JudgeDelta = 30f / c.TunerManager.BpmManager.CalculateBpm(Hold.Time);

            while (NoteCount * JudgeDelta < Duration && !Approximately(NoteCount * JudgeDelta, Duration))
            {
                NoteCount++;
            }
            if (Time > Hold.Time + Hold.Duration)
            {
                NoteCount += 1;
            }
            return(NoteCount);
        }
Example #7
0
            public LanotaHoldNote ToHoldNote()
            {
                LanotaHoldNote HoldNote = new LanotaHoldNote();

                HoldNote.Bpm         = Bpm;
                HoldNote.Combination = Combination;
                HoldNote.Critical    = Critical;
                HoldNote.Degree      = Degree;
                HoldNote.Duration    = 1;
                HoldNote.Jcount      = 0;
                HoldNote.Joints      = null;
                HoldNote.OnSelect    = false;
                HoldNote.Size        = Size;
                HoldNote.Time        = Time;
                HoldNote.Type        = 5;
                return(HoldNote);
            }
Example #8
0
            public LanotaHoldNote DeepCopy()
            {
                LanotaHoldNote New = new LanotaHoldNote();

                New.Type     = Type;
                New.Time     = Time;
                New.Duration = Duration;
                New.Jcount   = Jcount;
                if (Joints != null)
                {
                    New.Joints = new List <LanotaJoints>();
                    foreach (LanotaJoints j in Joints)
                    {
                        New.Joints.Add(j.DeepCopy());
                    }
                }
                New.Degree      = Degree;
                New.Size        = Size;
                New.Critical    = Critical;
                New.Combination = Combination;
                New.Bpm         = Bpm;
                return(New);
            }
 void OnHoldNoteClicked(LanotaHoldNote note)
 {
 }
Example #10
0
 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);
                 *  }
                 * }
                 */
            }
        }