public void Edit(Lanotalium.Chart.LanotaCameraY Ver)
    {
        ResetGizmoMotionEditor();
        _Mode               = Lanotalium.Editor.GizmoMotionMode.Vertical;
        EditMode            = true;
        _VerReference       = Ver;
        UseType8            = false;
        UseType10           = true;
        UseType11           = false;
        UseType13           = false;
        UseMove             = false;
        UseRotate           = false;
        UseInput            = true;
        TimeStartInput.text = Ver.Time.ToString();
        _TimeToCreate       = Ver.Time;
        SetStartStatusToText();
        DurationInput.text = Ver.Duration.ToString();
        TimeEndInput.text  = (_TimeToCreate + Ver.Duration).ToString();
        EaseInput.text     = Ver.cfmi.ToString();
        float BeginHeight;

        if (!float.TryParse(BeginHeightText.text, out BeginHeight))
        {
            return;
        }
        HeightInput.text = (BeginHeight + Ver.ctp).ToString();
        gameObject.SetActive(true);
    }
Exemple #2
0
 public void CreateMotionVertical()
 {
     if (LimSystem.ChartContainer == null)
     {
         return;
     }
     Lanotalium.Chart.LanotaCameraY New = new Lanotalium.Chart.LanotaCameraY();
     New.Time     = TunerManager.ChartTime;
     New.Type     = 10;
     New.Duration = 0.00001f;
     OperationManager.AddVertical(New);
     OperationManager.InspectorManager.ArrangeComponentsUi();
 }
    public void CopySelectedMotion()
    {
        if (!OperationManager.TunerManager.isInitialized)
        {
            return;
        }
        if (!ValidateCopyInstruction())
        {
            return;
        }
        if (OperationManager.SelectedMotions.Count < 1)
        {
            return;
        }
        OperationManager.SelectedMotions.Sort((Lanotalium.Chart.LanotaCameraBase a, Lanotalium.Chart.LanotaCameraBase b) => { return(a.Time.CompareTo(b.Time)); });
        float FirstTime = OperationManager.SelectedMotions[0].Time;

        foreach (float Target in CopyTargets)
        {
            foreach (Lanotalium.Chart.LanotaCameraBase Base in OperationManager.SelectedMotions)
            {
                switch (Base.Type)
                {
                case 8:
                case 11:
                    Lanotalium.Chart.LanotaCameraXZ NewH = (Base as Lanotalium.Chart.LanotaCameraXZ).DeepCopy();
                    NewH.Time = Base.Time - FirstTime + Target;
                    OperationManager.AddHorizontal(NewH, false, true, false); break;

                case 10:
                    Lanotalium.Chart.LanotaCameraY NewV = (Base as Lanotalium.Chart.LanotaCameraY).DeepCopy();
                    NewV.Time = Base.Time - FirstTime + Target;
                    OperationManager.AddVertical(NewV, false, true, false); break;

                case 13:
                    Lanotalium.Chart.LanotaCameraRot NewR = (Base as Lanotalium.Chart.LanotaCameraRot).DeepCopy();
                    NewR.Time = Base.Time - FirstTime + Target;
                    OperationManager.AddRotation(NewR, false, true, false); break;
                }
            }
        }
        LimNotifyIcon.ShowMessage(LimLanguageManager.TextDict["Copier_Msg_Success"]);
    }
    public void Apply()
    {
        int   Ease;
        float Rad = 0, Deg = 0, Hei = 0, Rot = 0, Time = 0, Duration = 0;
        float StartT, StartR, StartH, StartRotation;

        if (!float.TryParse(BeginRadiusText.text, out StartR))
        {
            return;
        }
        if (!float.TryParse(BeginDegreeText.text, out StartT))
        {
            return;
        }
        if (!float.TryParse(BeginHeightText.text, out StartH))
        {
            return;
        }
        if (!float.TryParse(BeginRotationText.text, out StartRotation))
        {
            return;
        }
        if (UseType8 || UseType11)
        {
            if (!float.TryParse(RadiusInput.text, out Rad))
            {
                RadImg.color = InvalidColor; return;
            }
            else
            {
                RadImg.color = ValidColor;
            }
            if (!float.TryParse(DegreeInput.text, out Deg))
            {
                DegImg.color = InvalidColor; return;
            }
            else
            {
                DegImg.color = ValidColor;
            }
        }
        if (UseType10)
        {
            if (!float.TryParse(HeightInput.text, out Hei))
            {
                HeiImg.color = InvalidColor; return;
            }
            else
            {
                HeiImg.color = ValidColor;
            }
        }
        if (UseType13)
        {
            if (!float.TryParse(RotationInput.text, out Rot))
            {
                RotImg.color = InvalidColor; return;
            }
            else
            {
                RotImg.color = ValidColor;
            }
        }
        if (!float.TryParse(TimeStartInput.text, out Time))
        {
            TimeStartImg.color = InvalidColor; return;
        }
        else
        {
            TimeStartImg.color = ValidColor;
        }
        if (!float.TryParse(DurationInput.text, out Duration))
        {
            DurationImg.color = InvalidColor; return;
        }
        else
        {
            DurationImg.color = ValidColor;
        }
        if (Duration < 0.0001f)
        {
            DurationImg.color = InvalidColor; return;
        }
        else
        {
            DurationImg.color = ValidColor;
        }
        if (!int.TryParse(EaseInput.text, out Ease))
        {
            EaseImg.color = InvalidColor; return;
        }
        else
        {
            EaseImg.color = ValidColor;
        }
        if (Ease < 0 || Ease > 12)
        {
            EaseImg.color = InvalidColor; return;
        }
        else
        {
            EaseImg.color = ValidColor;
        }
        if (EditMode)
        {
            if (_Mode == Lanotalium.Editor.GizmoMotionMode.Horizontal)
            {
                if (!OperationManager.CheckHorizontalTimeValid(_HorReference, Time))
                {
                    TimeStartImg.color = InvalidColor; return;
                }
                else
                {
                    TimeStartImg.color = ValidColor;
                }
                OperationManager.SetHorizontalTime(_HorReference, Time);
                if (!OperationManager.CheckHorizontalDurationValid(_HorReference, Duration))
                {
                    DurationImg.color = InvalidColor; return;
                }
                else
                {
                    DurationImg.color = ValidColor;
                }
                OperationManager.SetHorizontalDuration(_HorReference, Duration);
                if (UseType8)
                {
                    OperationManager.SetHorizontalDegree(_HorReference, Deg - StartT);
                    OperationManager.SetHorizontalRadius(_HorReference, Rad - StartR);
                }
                else if (UseType11)
                {
                    OperationManager.SetHorizontalDegree(_HorReference, Deg);
                    OperationManager.SetHorizontalRadius(_HorReference, Rad);
                }
                OperationManager.SetHorizontalEase(_HorReference, Ease);
                if (UseType8)
                {
                    OperationManager.SetHorizontalType(_HorReference, 8);
                }
                else if (UseType11)
                {
                    OperationManager.SetHorizontalType(_HorReference, 11);
                }
            }
            else if (_Mode == Lanotalium.Editor.GizmoMotionMode.Vertical)
            {
                if (!OperationManager.CheckVerticalTimeValid(_VerReference, Time))
                {
                    TimeStartImg.color = InvalidColor; return;
                }
                else
                {
                    TimeStartImg.color = ValidColor;
                }
                OperationManager.SetVerticalTime(_VerReference, Time);
                if (!OperationManager.CheckVerticalDurationValid(_VerReference, Duration))
                {
                    DurationImg.color = InvalidColor; return;
                }
                else
                {
                    DurationImg.color = ValidColor;
                }
                OperationManager.SetVerticalDuration(_VerReference, Duration);
                OperationManager.SetVerticalHeight(_VerReference, Hei - StartH);
                OperationManager.SetVerticalEase(_VerReference, Ease);
            }
            else if (_Mode == Lanotalium.Editor.GizmoMotionMode.Rotation)
            {
                if (!OperationManager.CheckRotationTimeValid(_RotReference, Time))
                {
                    TimeStartImg.color = InvalidColor; return;
                }
                else
                {
                    TimeStartImg.color = ValidColor;
                }
                OperationManager.SetRotationTime(_RotReference, Time);
                if (!OperationManager.CheckRotationDurationValid(_RotReference, Duration))
                {
                    DurationImg.color = InvalidColor; return;
                }
                else
                {
                    DurationImg.color = ValidColor;
                }
                OperationManager.SetRotationDuration(_RotReference, Duration);
                OperationManager.SetRotationDegree(_RotReference, Rot - StartRotation);
                OperationManager.SetRotationEase(_RotReference, Ease);
            }
        }
        else if (!EditMode)
        {
            if (UseType8)
            {
                Lanotalium.Chart.LanotaCameraXZ New = new Lanotalium.Chart.LanotaCameraXZ();
                New.Time     = Time;
                New.Duration = Duration;
                New.ctp      = Deg - StartT;
                New.ctp1     = Rad - StartR;
                New.cfmi     = Ease;
                New.Type     = 8;
                if (!OperationManager.AddHorizontal(New, false))
                {
                    return;
                }
            }
            if (UseType10)
            {
                Lanotalium.Chart.LanotaCameraY New = new Lanotalium.Chart.LanotaCameraY();
                New.Time     = Time;
                New.Duration = Duration;
                New.ctp      = Hei - StartH;
                New.cfmi     = Ease;
                New.Type     = 10;
                if (!OperationManager.AddVertical(New, false))
                {
                    return;
                }
            }
            if (UseType11)
            {
                Lanotalium.Chart.LanotaCameraXZ New = new Lanotalium.Chart.LanotaCameraXZ();
                New.Time     = Time;
                New.Duration = Duration;
                New.ctp      = Deg;
                New.ctp1     = Rad;
                New.cfmi     = Ease;
                New.Type     = 11;
                if (!OperationManager.AddHorizontal(New, false))
                {
                    return;
                }
            }
            if (UseType13)
            {
                Lanotalium.Chart.LanotaCameraRot New = new Lanotalium.Chart.LanotaCameraRot();
                New.Time     = Time;
                New.Duration = Duration;
                New.ctp      = Rot - StartRotation;
                New.cfmi     = Ease;
                New.Type     = 13;
                if (!OperationManager.AddRotation(New, false))
                {
                    return;
                }
            }
        }
        gameObject.SetActive(false);
    }
    public void OnDurationChange()
    {
        if (!EnableValueChange)
        {
            return;
        }
        float DurationTmp;

        if (!float.TryParse(Duration.text, out DurationTmp))
        {
            DurationImg.color = InvalidColor;
            return;
        }
        if (Mode == Lanotalium.Editor.ComponentMotionMode.Horizontal)
        {
            if (!OperationManager.CheckHorizontalDurationValid(OperationManager.TunerManager.CameraManager.Horizontal[Index], DurationTmp))
            {
                DurationImg.color = InvalidColor;
                return;
            }
            OperationManager.SetHorizontalDuration(OperationManager.TunerManager.CameraManager.Horizontal[Index], DurationTmp);
        }
        else if (Mode == Lanotalium.Editor.ComponentMotionMode.Vertical)
        {
            if (!OperationManager.CheckVerticalDurationValid(OperationManager.TunerManager.CameraManager.Vertical[Index], DurationTmp))
            {
                DurationImg.color = InvalidColor;
                return;
            }
            OperationManager.SetVerticalDuration(OperationManager.TunerManager.CameraManager.Vertical[Index], DurationTmp);
        }
        else if (Mode == Lanotalium.Editor.ComponentMotionMode.Rotation)
        {
            if (!OperationManager.CheckRotationDurationValid(OperationManager.TunerManager.CameraManager.Rotation[Index], DurationTmp))
            {
                DurationImg.color = InvalidColor;
                return;
            }
            OperationManager.SetRotationDuration(OperationManager.TunerManager.CameraManager.Rotation[Index], DurationTmp);
        }
        else if (Mode == Lanotalium.Editor.ComponentMotionMode.Multiple)
        {
            foreach (Lanotalium.Chart.LanotaCameraBase Base in OperationManager.SelectedMotions)
            {
                switch (Base.Type)
                {
                case 8:
                case 11:
                    Lanotalium.Chart.LanotaCameraXZ XZ = Base as Lanotalium.Chart.LanotaCameraXZ;
                    if (!OperationManager.CheckHorizontalDurationValid(XZ, DurationTmp))
                    {
                        DurationImg.color = InvalidColor;
                        return;
                    }
                    OperationManager.SetHorizontalDuration(XZ, DurationTmp);
                    break;

                case 10:
                    Lanotalium.Chart.LanotaCameraY Y = Base as Lanotalium.Chart.LanotaCameraY;
                    if (!OperationManager.CheckVerticalDurationValid(Y, DurationTmp))
                    {
                        DurationImg.color = InvalidColor;
                        return;
                    }
                    OperationManager.SetVerticalDuration(Y, DurationTmp);
                    break;

                case 13:
                    Lanotalium.Chart.LanotaCameraRot Rot = Base as Lanotalium.Chart.LanotaCameraRot;
                    if (!OperationManager.CheckRotationDurationValid(Rot, DurationTmp))
                    {
                        DurationImg.color = InvalidColor;
                        return;
                    }
                    OperationManager.SetRotationDuration(Rot, DurationTmp);
                    break;
                }
            }
        }
        DurationImg.color = ValidColor;
    }