void UpdateBpm()
        {
            if (CurrentBpm != context.TunerManager.BpmManager.CurrentBpm)
            {
                LanotaChangeBpm bpm = null;

                for (int i = 0; i < context.TunerManager.BpmManager.Bpm.Count - 1; ++i)
                {
                    if (context.TunerManager.ChartTime > context.TunerManager.BpmManager.Bpm[i].Time && context.TunerManager.ChartTime <= context.TunerManager.BpmManager.Bpm[i + 1].Time)
                    {
                        bpm = context.TunerManager.BpmManager.Bpm[i];
                        break;
                    }
                    else
                    {
                        bpm = context.TunerManager.BpmManager.Bpm[context.TunerManager.BpmManager.Bpm.Count - 1];
                    }
                }
                if (bpm != null)
                {
                    CurrentBpm = bpm.Bpm;
                    foreach (var e in EventBpm)
                    {
                        StartCoroutine(e.OnBpmChanged(context, bpm));
                    }
                }
                
            }
        }
예제 #2
0
        public void CreateBPMChange(float timing, float bpm)
        {
            var bpmchange = new LanotaChangeBpm()
            {
                Time = timing,
                Bpm  = bpm
            };

            _Operation.AddBpm(bpmchange);
        }
예제 #3
0
        private void AddBpm(float time, float bpm)
        {
            LanotaChangeBpm NewBpm = new LanotaChangeBpm
            {
                Time = time,
                Bpm  = bpm
            };

            context.OperationManager.AddBpm(NewBpm, false);
        }
예제 #4
0
 public IEnumerator OnBpmChanged(LanotaliumContext context, LanotaChangeBpm bpm)
 {
     context.MessageBox.ShowMessage(String.Format("BPM JUST CHANGED! {0}:{1}", bpm.Time, bpm.Bpm));
     yield return(null);
 }
예제 #5
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;
 }
예제 #6
0
        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);
                 *  }
                 * }
                 */
            }
        }