[정영민] 카메라 위치 이동 코드 수정
26.02.09 - 카메라 위치 이동 코드 수정
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
using ChunilENG;
|
||||||
|
using ChunilENG.Management;
|
||||||
|
using ChunilENG.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
using UVC.UI.Commands;
|
||||||
|
|
||||||
|
namespace ChunilENG.UI.Command
|
||||||
|
{
|
||||||
|
public class ActiveMachineInfoItemCommand : ICommand
|
||||||
|
{
|
||||||
|
private bool isActive = true;
|
||||||
|
public void Execute(object? parameter = null)
|
||||||
|
{
|
||||||
|
var itemManager = ChunilENGSceneMain.Instance.GetManager<MachineInfoItemManager>();
|
||||||
|
isActive = !isActive;
|
||||||
|
itemManager.ActiveIcons(isActive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dc27e9cd507dea347ade0e5e30c38bde
|
||||||
@@ -125,8 +125,6 @@ namespace ChunilENG.Management
|
|||||||
return;
|
return;
|
||||||
var targetMachine = machines.Find(m => m.code == data.workcd);
|
var targetMachine = machines.Find(m => m.code == data.workcd);
|
||||||
|
|
||||||
Debug.Log(machines.Find(m => m.code == "IJ22"));
|
|
||||||
|
|
||||||
if (targetMachine == null) { continue; }
|
if (targetMachine == null) { continue; }
|
||||||
|
|
||||||
targetMachine.machineKPI.SetData(data, targetMachine.machineName);
|
targetMachine.machineKPI.SetData(data, targetMachine.machineName);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace ChunilENG.UI
|
|||||||
public class CameraControlItem : MonoBehaviour
|
public class CameraControlItem : MonoBehaviour
|
||||||
{
|
{
|
||||||
public CameraPoint point;
|
public CameraPoint point;
|
||||||
|
public int floorIndex;
|
||||||
private Button button;
|
private Button button;
|
||||||
public Image SelectImage; // 선택 상태를 표시할 이미지
|
public Image SelectImage; // 선택 상태를 표시할 이미지
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ namespace ChunilENG.UI
|
|||||||
public void SettingButton(int index, CameraPoint point)
|
public void SettingButton(int index, CameraPoint point)
|
||||||
{
|
{
|
||||||
this.point = point;
|
this.point = point;
|
||||||
|
floorIndex = point.floorIndex;
|
||||||
|
|
||||||
button = GetComponent<Button>();
|
button = GetComponent<Button>();
|
||||||
var buttonText = GetComponentInChildren<TMP_Text>();
|
var buttonText = GetComponentInChildren<TMP_Text>();
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ namespace ChunilENG.UI
|
|||||||
|
|
||||||
if (buttonText != null)
|
if (buttonText != null)
|
||||||
{
|
{
|
||||||
buttonText.SetText($"Camera {index}");
|
buttonText.SetText(point.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.onClick.AddListener(HandleClick);
|
button.onClick.AddListener(HandleClick);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using ChunilENG.Object;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OCTOPUS_TWIN.Constants;
|
using OCTOPUS_TWIN.Constants;
|
||||||
using ChunilENG.Management;
|
using ChunilENG.Management;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace ChunilENG.UI
|
namespace ChunilENG.UI
|
||||||
{
|
{
|
||||||
@@ -18,38 +19,44 @@ namespace ChunilENG.UI
|
|||||||
private readonly List<CameraControlItem> cameraButtons = new List<CameraControlItem>();
|
private readonly List<CameraControlItem> cameraButtons = new List<CameraControlItem>();
|
||||||
public CameraControlItem cameraControlItem;
|
public CameraControlItem cameraControlItem;
|
||||||
|
|
||||||
|
private CameraControlItem selectedCameraControlItem;
|
||||||
|
public bool isSceneReady;
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
IgnoreSingleOpenMode = true;
|
IgnoreSingleOpenMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async UniTask Init()
|
public override async UniTask Init()
|
||||||
{
|
{
|
||||||
cameraViewPoints = FindObjectsByType<CameraPoint>(FindObjectsSortMode.None).ToList();
|
|
||||||
cameraControlItem = Resources.Load<CameraControlItem>($"{ResourceURL.chunilENGUIPrefabFolderPath}CameraControlItem");
|
cameraControlItem = Resources.Load<CameraControlItem>($"{ResourceURL.chunilENGUIPrefabFolderPath}CameraControlItem");
|
||||||
SettingButtons();
|
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||||
|
|
||||||
//if (SceneManager.GetActiveScene().name == "Chunil")
|
|
||||||
//{
|
|
||||||
// floorControlPanel = FindFirstObjectByType<FloorControlPanel>(FindObjectsInactive.Include);
|
|
||||||
// if (floorControlPanel != null)
|
|
||||||
// {
|
|
||||||
// floorControlPanel.onValueChanged += FilterItemsByFloor;
|
|
||||||
// if (floorControlPanel.currentFloorItem != null)
|
|
||||||
// {
|
|
||||||
// FilterItemsByFloor(floorControlPanel.currentFloorItem.value);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// FilterItemsByFloor(-1);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
//이미 로드된 초기 씬 수동 처리
|
||||||
|
RefreshCameraPoints();
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
await UniTask.CompletedTask;
|
await UniTask.CompletedTask;
|
||||||
}
|
}
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||||
|
}
|
||||||
|
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||||
|
{
|
||||||
|
RefreshCameraPoints();
|
||||||
|
}
|
||||||
|
private void RefreshCameraPoints()
|
||||||
|
{
|
||||||
|
cameraViewPoints = FindObjectsByType<CameraPoint>(FindObjectsSortMode.None).OrderBy(cp => cp.transform.GetSiblingIndex()).ToList();
|
||||||
|
isSceneReady = cameraViewPoints == null || cameraViewPoints.Count == 0 ? false : true;
|
||||||
|
|
||||||
|
SettingButtons();
|
||||||
|
|
||||||
|
if (selectedCameraControlItem != null)
|
||||||
|
{
|
||||||
|
var point = cameraButtons.Find(x => x.name == selectedCameraControlItem.name).point;
|
||||||
|
CommandManager.Instance.Execute(new ChangedCameraCommand(point));
|
||||||
|
selectedCameraControlItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
public void SettingButtons()
|
public void SettingButtons()
|
||||||
{
|
{
|
||||||
if (cameraControlItem == null || cameraViewPoints.Count == 0) return;
|
if (cameraControlItem == null || cameraViewPoints.Count == 0) return;
|
||||||
@@ -73,25 +80,13 @@ namespace ChunilENG.UI
|
|||||||
private void HandleItemClicked(CameraControlItem item)
|
private void HandleItemClicked(CameraControlItem item)
|
||||||
{
|
{
|
||||||
var floorControl = ChunilENGSceneMain.Instance.GetManager<ChunilENGUIManager>().GetCanvas<PopupCanvas>().GetPanel<FloorControlPanel>();
|
var floorControl = ChunilENGSceneMain.Instance.GetManager<ChunilENGUIManager>().GetCanvas<PopupCanvas>().GetPanel<FloorControlPanel>();
|
||||||
floorControl.ChangedCurrentFloor(item.point.floorIndex);
|
floorControl.ChangedCurrentFloor(item.floorIndex);
|
||||||
|
|
||||||
//if (cameraControlItem != null && cameraControlItem != item)
|
if (!isSceneReady)
|
||||||
//{
|
|
||||||
// cameraControlItem.Deselect();
|
|
||||||
//}
|
|
||||||
//cameraControlItem = item;
|
|
||||||
//cameraControlItem.Select();
|
|
||||||
//TODO : Á¤¿µ¹Î
|
|
||||||
if(item.point==null)
|
|
||||||
{
|
{
|
||||||
cameraViewPoints = FindObjectsByType<CameraPoint>(FindObjectsSortMode.None).ToList();
|
selectedCameraControlItem = item;
|
||||||
int index = 0;
|
Debug.Log("Scene not ready. Camera change deferred.");
|
||||||
foreach (var test in cameraButtons)
|
return;
|
||||||
{
|
|
||||||
|
|
||||||
test.point = cameraViewPoints[index];
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CommandManager.Instance.Execute(new ChangedCameraCommand(item.point));
|
CommandManager.Instance.Execute(new ChangedCameraCommand(item.point));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace ChunilENG.UI
|
|||||||
"Prefabs/UI/Toolbar/images/IMG_WallControl_on",
|
"Prefabs/UI/Toolbar/images/IMG_WallControl_on",
|
||||||
"Prefabs/UI/Toolbar/images/IMG_WallControl_off",
|
"Prefabs/UI/Toolbar/images/IMG_WallControl_off",
|
||||||
(isSelected) => Debug.Log($"내/외벽 조절 UI 활성화 상태 : {(isSelected ? "활성화" : "비활성화")} (OnToggle 콜백)"),
|
(isSelected) => Debug.Log($"내/외벽 조절 UI 활성화 상태 : {(isSelected ? "활성화" : "비활성화")} (OnToggle 콜백)"),
|
||||||
new ActiveWallControlPanelCommand(),
|
new ActiveMachineInfoItemCommand(),
|
||||||
"내/외벽 조절 UI를 활성화/비활성화 합니다.");
|
"내/외벽 조절 UI를 활성화/비활성화 합니다.");
|
||||||
|
|
||||||
// 라이브러리
|
// 라이브러리
|
||||||
|
|||||||
Reference in New Issue
Block a user