1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-04 23:42:19 +08:00

UXAssist v1.2.20

This commit is contained in:
2025-04-21 14:05:52 +08:00
parent 78379165e8
commit 2a3fed7180
7 changed files with 232 additions and 144 deletions

View File

@@ -66,6 +66,7 @@ public class MyCheckBox : MonoBehaviour
cb.uiButton = go.GetComponent<UIButton>();
cb.boxImage = go.transform.GetComponent<Image>();
cb.checkImage = go.transform.Find("checked")?.GetComponent<Image>();
Util.NormalizeRectWithTopLeft(cb.checkImage, 0f, 0f);
var child = go.transform.Find("text");
if (child != null)
@@ -151,6 +152,16 @@ public class MyCheckBox : MonoBehaviour
return this;
}
public MyCheckBox WithSmallerBox(float boxSize = 20f)
{
var oldWidth = rectTrans.sizeDelta.x;
rectTrans.sizeDelta = new Vector2(boxSize, boxSize);
checkImage.rectTransform.sizeDelta = new Vector2(boxSize, boxSize);
labelText.rectTransform.sizeDelta = new Vector2(labelText.rectTransform.sizeDelta.x, boxSize);
labelText.rectTransform.localPosition = new Vector3(labelText.rectTransform.localPosition.x + boxSize - oldWidth, labelText.rectTransform.localPosition.y, labelText.rectTransform.localPosition.z);
return this;
}
public MyCheckBox WithEnable(bool on)
{
SetEnable(on);