From 766cdff5ffa72b65d7f106658d1603f47739b2ba Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 27 Oct 2023 11:05:14 +0800 Subject: + init --- GameCode/FreeModifier.cs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 GameCode/FreeModifier.cs (limited to 'GameCode/FreeModifier.cs') diff --git a/GameCode/FreeModifier.cs b/GameCode/FreeModifier.cs new file mode 100644 index 0000000..4f8badf --- /dev/null +++ b/GameCode/FreeModifier.cs @@ -0,0 +1,35 @@ +using UnityEngine; +using UnityEngine.UI.ProceduralImage; + +[ModifierID("Free")] +public class FreeModifier : ProceduralImageModifier +{ + [SerializeField] + private Vector4 radius; + + public Vector4 Radius + { + get + { + return radius; + } + set + { + radius = value; + base._Graphic.SetVerticesDirty(); + } + } + + public override Vector4 CalculateRadius(Rect imageRect) + { + return radius; + } + + protected void OnValidate() + { + radius.x = Mathf.Max(0f, radius.x); + radius.y = Mathf.Max(0f, radius.y); + radius.z = Mathf.Max(0f, radius.z); + radius.w = Mathf.Max(0f, radius.w); + } +} -- cgit v1.1-26-g67d0