protected UvSerializer(Enum <Data.RendererCommonValues.UVType> uvType, Data.RendererCommonValues.UVFixedParamater @fixed, Data.RendererCommonValues.UVAnimationParamater animation, Data.RendererCommonValues.UVScrollParamater scroll, Data.RendererCommonValues.UVFCurveParamater fCurve) { UvType = uvType; Fixed = @fixed; Animation = animation; Scroll = scroll; FCurve = fCurve; }
public static byte[] GetUVBytes(TextureInformation _TexInfo, Data.Value.Enum <Data.RendererCommonValues.UVType> _UVType, Data.RendererCommonValues.UVFixedParamater _Fixed, Data.RendererCommonValues.UVAnimationParamater _Animation, Data.RendererCommonValues.UVScrollParamater _Scroll, Data.RendererCommonValues.UVFCurveParamater _FCurve) { List <byte[]> data = new List <byte[]>(); // sprcification change(1.5) float width = 128.0f; float height = 128.0f; if (_TexInfo.Width > width && _TexInfo.Height > height) { width = (float)_TexInfo.Width; height = (float)_TexInfo.Height; } data.Add(_UVType); if (_UVType == Data.RendererCommonValues.UVType.Default) { } else if (_UVType == Data.RendererCommonValues.UVType.Fixed) { var value_ = _Fixed; data.Add((value_.Start.X / width).GetBytes()); data.Add((value_.Start.Y / height).GetBytes()); data.Add((value_.Size.X / width).GetBytes()); data.Add((value_.Size.Y / height).GetBytes()); } else if (_UVType == Data.RendererCommonValues.UVType.Animation) { var value_ = _Animation; data.Add((value_.Start.X / width).GetBytes()); data.Add((value_.Start.Y / height).GetBytes()); data.Add((value_.Size.X / width).GetBytes()); data.Add((value_.Size.Y / height).GetBytes()); if (value_.FrameLength.Infinite) { var inf = int.MaxValue / 100; data.Add(inf.GetBytes()); } else { data.Add(value_.FrameLength.Value.Value.GetBytes()); } data.Add(value_.FrameCountX.Value.GetBytes()); data.Add(value_.FrameCountY.Value.GetBytes()); data.Add(value_.LoopType); data.Add(value_.StartSheet.Max.GetBytes()); data.Add(value_.StartSheet.Min.GetBytes()); } else if (_UVType == Data.RendererCommonValues.UVType.Scroll) { var value_ = _Scroll; data.Add((value_.Start.X.Max / width).GetBytes()); data.Add((value_.Start.Y.Max / height).GetBytes()); data.Add((value_.Start.X.Min / width).GetBytes()); data.Add((value_.Start.Y.Min / height).GetBytes()); data.Add((value_.Size.X.Max / width).GetBytes()); data.Add((value_.Size.Y.Max / height).GetBytes()); data.Add((value_.Size.X.Min / width).GetBytes()); data.Add((value_.Size.Y.Min / height).GetBytes()); data.Add((value_.Speed.X.Max / width).GetBytes()); data.Add((value_.Speed.Y.Max / height).GetBytes()); data.Add((value_.Speed.X.Min / width).GetBytes()); data.Add((value_.Speed.Y.Min / height).GetBytes()); } else if (_UVType == Data.RendererCommonValues.UVType.FCurve) { { var value_ = _FCurve.Start; var bytes1 = value_.GetBytes(1.0f / width); List <byte[]> _data = new List <byte[]>(); data.Add(bytes1); } { var value_ = _FCurve.Size; var bytes1 = value_.GetBytes(1.0f / height); List <byte[]> _data = new List <byte[]>(); data.Add(bytes1); } } return(data.ToArray().ToArray()); }