ToolBar 알람 기능 추가

This commit is contained in:
정영민
2025-04-22 15:29:46 +09:00
parent 06d2697453
commit 4d1bc3e5f5
33 changed files with 2085 additions and 987 deletions

View File

@@ -37,6 +37,7 @@ public class Panel_ToolBar : PanelBase
public Action<int> onClickCustomView;
public Action onClickMiniMap;
public Action onClickFloorControl;
public Action<Vector3, string, bool> onAlarm;
public override void AfterAwake()
{
@@ -149,6 +150,14 @@ public class Panel_ToolBar : PanelBase
var floorIndex = FindSingle<Building>().currentFloor.floorIndex;
onClickCustomView?.Invoke(floorIndex);
SetToolBarAlarm();
}
private void SetToolBarAlarm()
{
var viewButtonName = currentViewButton.gameObject.name;
var viewMode = viewButtonName.Substring(viewButtonName.IndexOf("_") + 1);
onAlarm?.Invoke(Button_CustomView.transform.position, $"{viewMode} 시점의 위치를 저장하였습니다.", true);
}
private void OnClickDashBoard()
@@ -162,6 +171,12 @@ public class Panel_ToolBar : PanelBase
private void OnClickShoulderView()
{
onClickCameraView?.Invoke(ViewMode.FirstPersonView);
var floorIndex = FindSingle<Building>().currentFloor.floorIndex;
if (floorIndex == 5)
{
onAlarm?.Invoke(Button_SholuderView.transform.position, "시점을 Shoulder View 로 전환할 수 없습니다.", false);
}
}
private void OnClickQuaterView()

View File

@@ -0,0 +1,44 @@
using UnityEngine;
using WI;
using TMPro;
using System.Collections;
using UnityEngine.UI;
public class Panel_ToolBarAlarm : PanelBase
{
private TextMeshProUGUI Content;
private Image Image_Icon;
public float fadeTime;
public Vector3 offset;
public override void AfterAwake()
{
gameObject.SetActive(false);
}
public void ActiveAlarm(Vector3 pos, string value, bool isSuccess)
{
transform.position = new Vector3(pos.x + offset.x, pos.y + offset.y, 0);
gameObject.SetActive(true);
Image_Icon.color = isSuccess ? Color.green : Color.red;
Content.SetText(value);
StartCoroutine(ScaleDown());
}
private IEnumerator ScaleDown()
{
float timer = 0f;
float percent = 0f;
while (percent < 1)
{
timer += Time.deltaTime;
percent = timer / fadeTime;
transform.localScale = Vector3.Lerp(transform.localScale, Vector3.one, percent);
yield return null;
}
gameObject.SetActive(false);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1a1452abeb06e9c478c203b50e503c22