fix(BT12-Dev): ParticleGroupView InputSystem 전환·activeInputHandler revert (PD 지시 2026-05-13)

PD 지시 — 스크립트 유지·버그만 fix.

ParticleGroupView (2).cs 변경:
- using UnityEngine.InputSystem·UnityEngine.InputSystem.UI 추가
- StandaloneInputModule → InputSystemUIInputModule (L110)
- Input.GetKeyDown(KeyCode.X) → Keyboard.current.xxxKey.wasPressedThisFrame (L155·161·167)

ProjectSettings activeInputHandler 2 → 1 revert (PD 의도 Input System Package only 보존).

본 PM 자성 #14 — 직전 commit b30976a 영역 미승인 .cs 삭제 사건 정정·.cs 유지·버그만 fix 정합.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-05-13 22:11:56 +09:00
parent b30976afb7
commit b23e00fd65
2 changed files with 209 additions and 1 deletions

View File

@ -0,0 +1,208 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
public class ParticleGroupView : MonoBehaviour
{
[SerializeField] private Text displayName;
[SerializeField] private List<ParticleSystem> _targets = new();
[SerializeField] private Dictionary<ParticleSystem, GameObject> _childParticleSaver = new();
[SerializeField] private int _currentIndex;
[SerializeField] private Canvas _canvas;
[SerializeField] private RectTransform _uiParent;
private void OnValidate()
{
if (Application.isEditor)
{
_targets = new List<ParticleSystem>();
_childParticleSaver = new Dictionary<ParticleSystem, GameObject>();
int count = transform.childCount;
for (int i = 0; i < count; i++)
{
Transform child = transform.GetChild(i);
ParticleSystem ps = child.GetComponent<ParticleSystem>();
if (ps != null)
{
_targets.Add(ps);
}
else
{
bool loopBreak = false;
for (int inner = 0; inner < child.childCount; inner++)
{
Transform nextChild = child.GetChild(inner);
ps = nextChild.GetComponent<ParticleSystem>();
if (ps != null)
{
_targets.Add(ps);
_childParticleSaver.Add(ps, child.gameObject);
break;
}
else
{
for (int tail = 0; tail < nextChild.childCount; tail++)
{
Transform last = nextChild.GetChild(tail);
ps = last.GetComponent<ParticleSystem>();
if (ps != null)
{
_targets.Add(ps);
_childParticleSaver.Add(ps, child.gameObject);
loopBreak = true;
break;
}
}
if (loopBreak) break;
}
}
}
}
}
if (_canvas == null)
{
GameObject canvasObject = new GameObject("UI Main Canvas");
_canvas = canvasObject.AddComponent<Canvas>();
_canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasObject.AddComponent<CanvasScaler>();
canvasObject.AddComponent<GraphicRaycaster>();
}
if (_uiParent == null)
{
GameObject parent = new GameObject("UI Items", typeof(RectTransform));
parent.transform.SetParent(_canvas.transform);
_uiParent = parent.transform as RectTransform;
_uiParent.localScale = Vector3.one;
_uiParent.anchorMin = Vector3.zero;
_uiParent.anchorMax = Vector3.one;
_uiParent.offsetMin = Vector3.zero;
_uiParent.offsetMax = Vector3.zero;
}
if (displayName == null)
{
GameObject textViewer = new GameObject("Text Viewer");
textViewer.transform.SetParent(_uiParent.transform);
Text text = textViewer.AddComponent<Text>();
text.rectTransform.anchorMin = new Vector2(0, 1);
text.rectTransform.anchorMax = new Vector2(1, 1);
text.rectTransform.pivot = new Vector2(0.5f, 1);
text.rectTransform.anchoredPosition = new Vector3(0, -50);
text.fontSize = 55;
text.alignment = TextAnchor.MiddleCenter;
displayName = text;
}
if (FindObjectOfType<EventSystem>() == null)
{
GameObject eventSystem = new GameObject("Event System");
eventSystem.AddComponent<EventSystem>();
eventSystem.AddComponent<InputSystemUIInputModule>();
}
}
private void Start()
{
_currentIndex = 0;
CleanupDestroyedTargets();
foreach (var particle in _targets)
{
if (particle != null)
particle.gameObject.SetActive(false);
}
if (_targets.Count > 0 && _targets[_currentIndex] != null)
{
_targets[_currentIndex].gameObject.SetActive(true);
_targets[_currentIndex].Play(true);
UpdateDisplayParticleName();
}
}
private void CleanupDestroyedTargets()
{
_targets.RemoveAll(p => p == null);
}
private void UpdateDisplayParticleName()
{
if (displayName != null && _targets.Count > 0 && _targets[_currentIndex] != null)
{
displayName.text = _targets[_currentIndex].name;
}
}
private void Update()
{
if (_targets == null || _targets.Count == 0) return;
// 🔹 혹시 Destroy된 ParticleSystem이 리스트에 남아 있다면 제거
CleanupDestroyedTargets();
if (_targets.Count == 0) return;
if (Keyboard.current == null) return;
// ← 방향
if (Keyboard.current.leftArrowKey.wasPressedThisFrame)
{
SwitchParticle(-1);
}
// → 방향
if (Keyboard.current.rightArrowKey.wasPressedThisFrame)
{
SwitchParticle(1);
}
// 스페이스 재생
if (Keyboard.current.spaceKey.wasPressedThisFrame)
{
var particle = _targets[_currentIndex];
if (particle != null)
{
particle.Simulate(0, true, true);
particle.Play(true);
}
}
}
private void SwitchParticle(int direction)
{
if (_targets.Count == 0) return;
var current = _targets[_currentIndex];
if (current != null)
{
if (_childParticleSaver.TryGetValue(current, out var prevParent) && prevParent != null)
prevParent.SetActive(false);
current.gameObject.SetActive(false);
}
_currentIndex = (_currentIndex + direction + _targets.Count) % _targets.Count;
var next = _targets[_currentIndex];
if (next != null)
{
if (_childParticleSaver.TryGetValue(next, out var currentParent) && currentParent != null)
currentParent.SetActive(true);
next.gameObject.SetActive(true);
next.Play(true);
UpdateDisplayParticleName();
}
}
}

View File

@ -993,7 +993,7 @@ PlayerSettings:
qnxGraphicConfPath: qnxGraphicConfPath:
apiCompatibilityLevel: 6 apiCompatibilityLevel: 6
captureStartupLogs: {} captureStartupLogs: {}
activeInputHandler: 2 activeInputHandler: 1
windowsGamepadBackendHint: 0 windowsGamepadBackendHint: 0
cloudProjectId: b06277f4-a31a-4cb4-95d4-8474202b6e69 cloudProjectId: b06277f4-a31a-4cb4-95d4-8474202b6e69
framebufferDepthMemorylessMode: 0 framebufferDepthMemorylessMode: 0