예제 #1
0
        static float GetFactorToDegree(Dimension.Unit unit)
        {
            switch (unit)
            {
            case Dimension.Unit.Gradian:
                return(360f / 400);

            case Dimension.Unit.Radian:
                return(Mathf.Rad2Deg);

            case Dimension.Unit.Turn:
                return(360f);

            default:
                return(1);
            }
        }
예제 #2
0
        public override string ToString()
        {
            string str = string.Empty;

            Dimension.Unit unit  = this.unit;
            Dimension.Unit unit2 = unit;
            if (unit2 != Dimension.Unit.Pixel)
            {
                if (unit2 == Dimension.Unit.Percent)
                {
                    str = "%";
                }
            }
            else
            {
                str = "px";
            }
            return(this.value.ToString(CultureInfo.InvariantCulture.NumberFormat) + str);
        }
예제 #3
0
 public BuilderTransformOrigin(float xValue, float yValue, Dimension.Unit unit = Dimension.Unit.Percent)
 {
     x = new Dimension(xValue, unit);
     y = new Dimension(yValue, unit);
 }
예제 #4
0
 public BuilderTransformOrigin(float xValue, Dimension.Unit xUnit, float yValue, Dimension.Unit yUnit)
 {
     x = new Dimension(xValue, xUnit);
     y = new Dimension(yValue, yUnit);
 }
예제 #5
0
 public static bool IsTimeUnit(this Dimension.Unit unit)
 {
     return(unit == Dimension.Unit.Millisecond || unit == Dimension.Unit.Second);
 }
예제 #6
0
 static float ConvertAngle(float angle, Dimension.Unit fromUnit, Dimension.Unit toUnit)
 {
     return(BuilderEditorUtility.FixRoundOff(angle * GetFactor(fromUnit, toUnit)));
 }
예제 #7
0
 static float GetFactor(Dimension.Unit unit1, Dimension.Unit unit2)
 {
     return(GetFactorToDegree(unit1) / GetFactorToDegree(unit2));
 }
예제 #8
0
 public BuilderRotate(float xValue, Dimension.Unit xUnit)
 {
     x = new Dimension(xValue, xUnit);
 }
예제 #9
0
 public Dimension(float value, Dimension.Unit unit)
 {
     this.unit  = unit;
     this.value = value;
 }