24 lines
1.9 KiB
XML
24 lines
1.9 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="Bounds 입력 필드 (center, extents)" />
|
|
|
|
<!-- Collision -->
|
|
<VisualElement class="utk-sample-section">
|
|
<Label class="utk-sample-section__title" text="Collision" />
|
|
<VisualElement class="utk-sample-row">
|
|
<utk:UTKBoundsField name="bounds-collision" label="Bounds" class="utk-sample-bounds-field" />
|
|
</VisualElement>
|
|
</VisualElement>
|
|
|
|
<!-- Code Sample -->
|
|
<VisualElement class="utk-code-sample-container">
|
|
<utk:UTKCodeBlock title="C#" code="// 기본 Bounds 필드 생성 var boundsField = new UTKBoundsField(); boundsField.label = "충돌 영역"; boundsField.Value = new Bounds( new Vector3(0, 1, 0), // 중심점 new Vector3(2, 2, 2) // 크기 ); // 값 변경 이벤트 boundsField.OnValueChanged += (bounds) => { Debug.Log($"Center: {bounds.center}, Size: {bounds.size}"); }; // 라벨 생성자 사용 var collisionField = new UTKBoundsField("Collision Bounds"); // BoxCollider와 연동 var collider = GetComponent<BoxCollider>(); boundsField.Value = collider.bounds; boundsField.OnValueChanged += (b) => { collider.center = b.center; collider.size = b.size; };" />
|
|
<utk:UTKCodeBlock title="UXML" code="<!-- 기본 Bounds 필드 --> <utk:UTKBoundsField label="충돌 영역" /> <!-- 비활성화 상태 --> <utk:UTKBoundsField label="읽기 전용" IsEnabled="false" />" />
|
|
</VisualElement>
|
|
</VisualElement>
|
|
</UXML>
|