private void UpdateJointTransform(Lanotalium.Chart.LanotaHoldNote Note)
    {
        float aTime   = Note.Time;
        float aDegree = Note.Degree + Tuner.CameraManager.CurrentRotation;

        if (Note.Joints != null)
        {
            for (int i = 0; i < Note.Joints.Count - 1; ++i)
            {
                Lanotalium.Chart.LanotaJoints Joint = Note.Joints[i];
                aTime   += Joint.dTime;
                aDegree += Joint.dDegree;
                float Percent = CalculateMovePercent(aTime);
                Percent       = CalculateEasedPercent(Percent);
                Joint.Percent = Percent;
                if (Percent < 20)
                {
                    continue;
                }
                Joint.JointGameObject.transform.rotation   = Quaternion.Euler(new Vector3(90, aDegree, 0));
                Joint.JointGameObject.transform.position   = new Vector3(-Percent / 10 * Mathf.Sin(aDegree * Mathf.Deg2Rad), 0, -Percent / 10 * Mathf.Cos(aDegree * Mathf.Deg2Rad));
                Joint.JointGameObject.transform.localScale = new Vector3(Percent / 100, Percent / 100, 0);
                Joint.aTime   = aTime;
                Joint.aDegree = aDegree - Tuner.CameraManager.CurrentRotation;
            }
        }
    }
 public void Initialize(LimOperationManager OperationManager, Lanotalium.Chart.LanotaHoldNote HoldNoteData, Lanotalium.Chart.LanotaJoints JointNoteData, ComponentHoldNoteManager ComponentHoldNote)
 {
     this.OperationManager  = OperationManager;
     this.HoldNoteData      = HoldNoteData;
     this.JointNoteData     = JointNoteData;
     this.ComponentHoldNote = ComponentHoldNote;
     RefreshUiWidth();
 }
 private void UpdateAllJointActive()
 {
     foreach (Lanotalium.Chart.LanotaHoldNote Note in HoldNote)
     {
         if (!Note.shouldUpdate)
         {
             if (Note.Joints == null)
             {
                 continue;
             }
             for (int i = 0; i < Note.Joints.Count - 1; ++i)
             {
                 Lanotalium.Chart.LanotaJoints Joint = Note.Joints[i];
                 if (Joint.JointGameObject.activeInHierarchy)
                 {
                     Joint.JointGameObject.SetActive(false);
                 }
             }
             continue;
         }
         if (Note.Joints == null)
         {
             continue;
         }
         for (int i = 0; i < Note.Joints.Count - 1; ++i)
         {
             Lanotalium.Chart.LanotaJoints Joint = Note.Joints[i];
             if (Tuner.ChartTime > Joint.aTime && Joint.JointGameObject.activeInHierarchy)
             {
                 Joint.JointGameObject.SetActive(false);
             }
             else if (Tuner.ChartTime < Joint.aTime)
             {
                 if (Joint.Percent <= 20 || Joint.Percent >= 100)
                 {
                     if (Joint.JointGameObject.activeInHierarchy)
                     {
                         Joint.JointGameObject.SetActive(false);
                     }
                 }
                 else
                 {
                     if (!Joint.JointGameObject.activeInHierarchy)
                     {
                         Joint.JointGameObject.SetActive(true);
                     }
                 }
             }
         }
     }
 }
Example #4
0
    public void ConvertSelectedToHoldNote()
    {
        if (LimSystem.ChartContainer == null)
        {
            return;
        }
        OperationManager.SelectedTapNote.Sort((Lanotalium.Chart.LanotaTapNote a, Lanotalium.Chart.LanotaTapNote b) => { return(a.Time.CompareTo(b.Time)); });
        int Quantity = OperationManager.SelectedTapNote.Count;

        if (Quantity == 0)
        {
            return;
        }
        else if (Quantity == 1)
        {
            OperationManager.ConvertTapNoteToHoldNote(OperationManager.SelectedTapNote[0]); return;
        }
        else
        {
            Lanotalium.Chart.LanotaHoldNote New = new Lanotalium.Chart.LanotaHoldNote
            {
                Duration = OperationManager.SelectedTapNote[Quantity - 1].Time - OperationManager.SelectedTapNote[0].Time,
                Time     = OperationManager.SelectedTapNote[0].Time,
                Degree   = OperationManager.SelectedTapNote[0].Degree,
                Type     = 5,
                Size     = 1,
                Jcount   = Quantity - 1,
                Joints   = new List <Lanotalium.Chart.LanotaJoints>()
            };
            float DegreeCount = New.Degree;
            float TimeCount   = New.Time;
            for (int i = 1; i < Quantity; ++i)
            {
                Lanotalium.Chart.LanotaJoints NewJ = new Lanotalium.Chart.LanotaJoints();
                NewJ.Cfmi    = 0;
                NewJ.dTime   = Mathf.Max(0.0001f, OperationManager.SelectedTapNote[i].Time - TimeCount);
                NewJ.dDegree = OperationManager.SelectedTapNote[i].Degree - DegreeCount;
                New.Joints.Add(NewJ);
                TimeCount   += NewJ.dTime;
                DegreeCount += NewJ.dDegree;
            }
            foreach (Lanotalium.Chart.LanotaTapNote Tap in OperationManager.SelectedTapNote)
            {
                OperationManager.DeleteTapNote(Tap);
            }
            OperationManager.SelectedTapNote.Clear();
            OperationManager.AddHoldNote(New, true, true, true);
        }
    }
 public void InstantiateJointNote(Lanotalium.Chart.LanotaJoints Joint)
 {
     Joint.JointGameObject = Instantiate(oTJoint, transform);
     Joint.InstanceId      = Joint.JointGameObject.GetInstanceID();
     Joint.JointGameObject.SetActive(false);
 }
    private void UpdateAllLineRenderers()
    {
        foreach (Lanotalium.Chart.LanotaHoldNote Note in HoldNote)
        {
            if (!Note.shouldUpdate)
            {
                continue;
            }
            if (Note.Percent < 20)
            {
                continue;
            }
            if (Note.Jcount == 0)
            {
                float Rotation   = Note.Degree + Tuner.CameraManager.CurrentRotation;
                float EndPercent = CalculateMovePercent(Note.Time + Note.Duration);
                Note.LineRenderer.positionCount = 10;
                Note.LineRenderer.startWidth    = Note.Percent / 100 + (Note.OnTouch ? OnTouchWidthAdd : 0);
                Note.LineRenderer.endWidth      = CalculateEasedPercent(EndPercent) / 100 + (Note.OnTouch ? OnTouchWidthAdd : 0);
                Vector3 Start = CalculateLineRendererPoint(Note.Percent, Rotation);
                Vector3 End   = CalculateLineRendererPoint(CalculateEasedPercent(EndPercent), Rotation);
                Vector3 Delta = (End - Start) / 9;
                for (int i = 0; i < 10; ++i)
                {
                    Note.LineRenderer.SetPosition(i, Start + i * Delta);
                }
            }
            else
            {
                float lastPercent = 0;
                int   positionIndex = 0;
                float currentaTime = Note.Time, currentaDegree = Note.Degree;
                bool  headPointAdded = false;

                for (int i = 0; i < Note.Joints.Count; ++i)
                {
                    Lanotalium.Chart.LanotaJoints Joint = Note.Joints[i];
                    if (Joint.aTime < Tuner.ChartTime)
                    {
                        currentaTime   = Joint.aTime;
                        currentaDegree = Joint.aDegree;
                        continue;
                    }

                    if (!headPointAdded)
                    {
                        if (Note.Time < Tuner.ChartTime)
                        {
                            float startDegreePercent = (Tuner.ChartTime - currentaTime) / Joint.dTime;
                            AddLineRendererPosition(positionIndex, Note.LineRenderer, CalculateLineRendererPoint(100, currentaDegree + Joint.dDegree * CalculateEasedCurve(startDegreePercent, Joint.Cfmi) + Tuner.CameraManager.CurrentRotation));
                            positionIndex++;
                        }
                        headPointAdded = true;
                    }

                    int jCount = Mathf.Max(Mathf.FloorToInt(Mathf.Abs(Joint.dDegree)), 50);
                    for (int j = 0; j < jCount; ++j)
                    {
                        float degreePercent = 1f * j / (jCount - 1);
                        float degree        = currentaDegree + Joint.dDegree * degreePercent;
                        float timingPercent = CalculateReverseEasedCurve(degreePercent, Joint.Cfmi);
                        float timing        = currentaTime + Joint.dTime * timingPercent;
                        float percent       = CalculateEasedPercent(CalculateMovePercent(timing));
                        lastPercent = percent;
                        if (percent == 100 && timing <= Tuner.ChartTime)
                        {
                            continue;
                        }
                        AddLineRendererPosition(positionIndex, Note.LineRenderer, CalculateLineRendererPoint(percent, degree + Tuner.CameraManager.CurrentRotation));
                        positionIndex++;
                        if (percent <= 15)
                        {
                            goto end;
                        }
                    }

                    currentaTime   = Joint.aTime;
                    currentaDegree = Joint.aDegree;
                }
end:

                Note.LineRenderer.startWidth    = Note.Percent / 100;
                Note.LineRenderer.endWidth      = lastPercent / 100;
                Note.LineRenderer.positionCount = positionIndex;
            }
        }
    }