Ejemplo n.º 1
0
    public void OnTimingChange()
    {
        if (!EnableValueChange)
        {
            return;
        }
        float TimingTmp;

        if (!float.TryParse(Timing.text, out TimingTmp))
        {
            TimingImg.color = InvalidColor;
            return;
        }
        if (Mode == Lanotalium.Editor.ComponentMotionMode.Horizontal)
        {
            if (!OperationManager.CheckHorizontalTimeValid(OperationManager.TunerManager.CameraManager.Horizontal[Index], TimingTmp))
            {
                TimingImg.color = InvalidColor;
                return;
            }
            OperationManager.SetHorizontalTime(OperationManager.TunerManager.CameraManager.Horizontal[Index], TimingTmp);
        }
        else if (Mode == Lanotalium.Editor.ComponentMotionMode.Vertical)
        {
            if (!OperationManager.CheckVerticalTimeValid(OperationManager.TunerManager.CameraManager.Vertical[Index], TimingTmp))
            {
                TimingImg.color = InvalidColor;
                return;
            }
            OperationManager.SetVerticalTime(OperationManager.TunerManager.CameraManager.Vertical[Index], TimingTmp);
        }
        else if (Mode == Lanotalium.Editor.ComponentMotionMode.Rotation)
        {
            if (!OperationManager.CheckRotationTimeValid(OperationManager.TunerManager.CameraManager.Rotation[Index], TimingTmp))
            {
                TimingImg.color = InvalidColor;
                return;
            }
            OperationManager.SetRotationTime(OperationManager.TunerManager.CameraManager.Rotation[Index], TimingTmp);
        }
        TimingImg.color = ValidColor;
    }
Ejemplo n.º 2
0
    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);
    }