DI 추가
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using RTGLite;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UVC.Core;
|
||||
using UVC.UI.Buttons;
|
||||
using UVC.UI.Window.PropertyWindow;
|
||||
|
||||
namespace UVC.Studio.UI.Buttons
|
||||
{
|
||||
public class PropertyWindowToggleButton : MonoBehaviour
|
||||
{
|
||||
|
||||
private ImageToggle toggleButton;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
toggleButton = GetComponent<ImageToggle>();
|
||||
toggleButton.OnValueChanged.AddListener(OnToggleValueChanged);
|
||||
|
||||
StudioSceneMain.Instance.Initialized += OnSceneInitialized;
|
||||
}
|
||||
|
||||
private void OnSceneInitialized()
|
||||
{
|
||||
PropertyWindow propertyWindow = InjectorAppContext.Instance.Get<PropertyWindow>();
|
||||
if (propertyWindow != null)
|
||||
{
|
||||
propertyWindow.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToggleValueChanged(bool visible)
|
||||
{
|
||||
PropertyWindow propertyWindow = InjectorAppContext.Instance.Get<PropertyWindow>();
|
||||
if (propertyWindow != null)
|
||||
{
|
||||
propertyWindow.SetVisibility(visible);
|
||||
|
||||
// View Gizmo의 Screen Padding 값 수정
|
||||
// RTGizmos.get.skin.viewGizmoStyle.screenPadding 으로 접근
|
||||
if (RTGizmos.get != null && RTGizmos.get.skin != null)
|
||||
{
|
||||
// PropertyWindow가 보이면 padding을 늘리고, 숨겨지면 원래대로
|
||||
if (visible)
|
||||
{
|
||||
// X: 오른쪽 여백, Y: 위쪽 여백 (TopRight alignment 기준)
|
||||
RTGizmos.get.skin.viewGizmoStyle.screenPadding = new Vector2(300f, 40f);
|
||||
}
|
||||
else
|
||||
{
|
||||
RTGizmos.get.skin.viewGizmoStyle.screenPadding = new Vector2(0f, 40f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
if (toggleButton != null)
|
||||
{
|
||||
toggleButton.OnValueChanged.RemoveListener(OnToggleValueChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fa85141ca6765c40a59d9224631e2b9
|
||||
Reference in New Issue
Block a user