- ToonPostProcess.shader: 횃불 고딕 스타일 후처리 쉐이더 (Built-in RP) - ToonCameraEffect.cs: 카메라 자동 부착 후처리 스크립트 - 중복 UI 스크립트 제거 (MenuIntroController, ToggleCustom) - 씬, 프리팹, 애니메이션 등 전체 업데이트 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
79 lines
1.9 KiB
C#
79 lines
1.9 KiB
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
|
|
public class GraphicsSettingsScroll : MonoBehaviour, IDragHandler, IScrollHandler
|
|
{
|
|
public RectTransform[] 내용목록; // ← 배열로 변경!
|
|
public float 드래그속도 = 2f;
|
|
public float 휠속도 = 50f;
|
|
|
|
private RectTransform 내영역;
|
|
private RectTransform 현재내용; // 현재 활성화된 내용
|
|
|
|
void Start()
|
|
{
|
|
내영역 = GetComponent<RectTransform>();
|
|
StartCoroutine(초기화());
|
|
}
|
|
|
|
IEnumerator 초기화()
|
|
{
|
|
yield return null;
|
|
yield return null;
|
|
현재내용찾기();
|
|
}
|
|
|
|
void 현재내용찾기()
|
|
{
|
|
foreach (RectTransform 내용 in 내용목록)
|
|
{
|
|
if (내용 != null && 내용.gameObject.activeInHierarchy)
|
|
{
|
|
현재내용 = 내용;
|
|
Debug.Log("현재내용: " + 내용.name);
|
|
return;
|
|
}
|
|
}
|
|
Debug.Log("현재내용 못찾음!");
|
|
}
|
|
|
|
float 최대스크롤()
|
|
{
|
|
if (현재내용 == null) return 0;
|
|
return Mathf.Max(0, 현재내용.rect.height - 내영역.rect.height);
|
|
}
|
|
|
|
public void OnDrag(PointerEventData 마우스)
|
|
{
|
|
현재내용찾기();
|
|
이동(-마우스.delta.y * 드래그속도);
|
|
}
|
|
|
|
public void OnScroll(PointerEventData 마우스)
|
|
{
|
|
현재내용찾기();
|
|
이동(-마우스.scrollDelta.y * 휠속도);
|
|
}
|
|
|
|
void 이동(float 양)
|
|
{
|
|
if (현재내용 == null) return;
|
|
float 새Y = 현재내용.anchoredPosition.y + 양;
|
|
새Y = Mathf.Clamp(새Y, 0, 최대스크롤());
|
|
현재내용.anchoredPosition = new Vector2(0, 새Y);
|
|
}
|
|
|
|
public void 스크롤초기화()
|
|
{
|
|
Canvas.ForceUpdateCanvases();
|
|
현재내용찾기();
|
|
if (현재내용 != null)
|
|
{
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(현재내용);
|
|
현재내용.anchoredPosition = new Vector2(0, 0);
|
|
}
|
|
}
|
|
}
|