Files
XRLib/Assets/Resources/UIToolkit/Sample/Input/UTKRectFieldSample.uxml
2026-01-21 20:43:54 +09:00

24 lines
2.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<UXML xmlns="UnityEngine.UIElements" xmlns:utk="UVC.UIToolkit">
<Style src="../UTKSampleCommon.uss" />
<Style src="UTKVectorFieldSample.uss" />
<VisualElement class="utk-sample-container">
<Label class="utk-sample-desc" text="Rect 입력 필드 (x, y, width, height)" />
<!-- Default -->
<VisualElement class="utk-sample-section">
<Label class="utk-sample-section__title" text="Default" />
<VisualElement class="utk-sample-row">
<utk:UTKRectField name="rect-area" label="Area" class="utk-sample-rect-field" />
</VisualElement>
</VisualElement>
<!-- Code Sample -->
<VisualElement class="utk-code-sample-container">
<utk:UTKCodeBlock title="C#" code="// 기본 Rect 필드 생성&#10;var rectField = new UTKRectField();&#10;rectField.label = &quot;UI 영역&quot;;&#10;rectField.Value = new Rect(0, 0, 100, 50);&#10;&#10;// 값 변경 이벤트&#10;rectField.OnValueChanged += (rect) =&gt; {&#10; Debug.Log($&quot;위치: ({rect.x}, {rect.y}), 크기: {rect.width} x {rect.height}&quot;);&#10;};&#10;&#10;// 라벨 생성자 사용&#10;var namedField = new UTKRectField(&quot;클리핑 영역&quot;);&#10;&#10;// 축 라벨 커스터마이징&#10;rectField.XLabel = &quot;Left&quot;;&#10;rectField.YLabel = &quot;Top&quot;;&#10;rectField.WLabel = &quot;Width&quot;;&#10;rectField.HLabel = &quot;Height&quot;;" />
<utk:UTKCodeBlock title="UXML" code="&lt;!-- 기본 Rect 필드 --&gt;&#10;&lt;utk:UTKRectField label=&quot;영역&quot; /&gt;&#10;&#10;&lt;!-- 커스텀 라벨 --&gt;&#10;&lt;utk:UTKRectField label=&quot;스프라이트 영역&quot;&#10; XLabel=&quot;Left&quot; YLabel=&quot;Top&quot;&#10; WLabel=&quot;W&quot; HLabel=&quot;H&quot; /&gt;&#10;&#10;&lt;!-- 비활성화 상태 --&gt;&#10;&lt;utk:UTKRectField label=&quot;읽기 전용&quot; IsEnabled=&quot;false&quot; /&gt;" />
</VisualElement>
</VisualElement>
</UXML>