+ Item관련 Excel, Json, So 수정 + DropItemTable 로직 수정 + 아이템 프리팹에서 Enable Interaction 체크하면 직접 룻팅, 해제하면 자동 룻팅 + 체력회복 아이템 추가 + 개발자 메뉴 상호작용 "F1" 키를 통해 접근 가능 + 보스 맵은 마법진을 상호작용하면 보스전 시작 + 맵 안에서 교전 중일 때, 투명 벽 쉐이더 추가 + 맵 마다의 통로를 통해서 이동 가능 + 선형적인 맵 구조에 맞게 리소스 및 위치 수정 + 타이틀 화면으로 이동할 때 나타나는 오류 수정(CombatUiManager OnDisable 싱글톤 문제) Closes #25, #26
192 lines
6.3 KiB
C#
192 lines
6.3 KiB
C#
using System.Collections.Generic;
|
|
using BlueWater.Items;
|
|
using BlueWater.Maps;
|
|
using DG.Tweening;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BlueWater.Uis
|
|
{
|
|
public class CombatUiManager : Singleton<CombatUiManager>
|
|
{
|
|
[field: Title("UI")]
|
|
[field: SerializeField]
|
|
public Canvas MainCanvas { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public RectTransform MainCanvasRect { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CombatSkillUi CombatSkillUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public FieldBossHealthPointUi FieldBossHealthPointUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public PlayerHealthPointUi PlayerHealthPointUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public ItemLootUi ItemLootUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CombatItemInventoryUi CombatItemInventoryUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public GameOverPopupUi GameOverPopupUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public ClearPopupUi ClearPopupUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public MenuPopupUi CombatMenuPopupUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public CombatTutorialUi CombatTutorialUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public MenuPopupUi DevelopMenuPopupUi { get; private set; }
|
|
|
|
[SerializeField]
|
|
private Image _fadeImage;
|
|
|
|
public List<PopupUi> PopupUiList { get; private set; }
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
InitializeComponents();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent += RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent += UnregisterPopup;
|
|
|
|
Invoke(nameof(StartTutorial), 0.1f);
|
|
}
|
|
|
|
private void StartTutorial()
|
|
{
|
|
CombatTutorialUi.ShowFirstTutorialUi();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (Quitting) return;
|
|
|
|
PopupUi.OnPopupUiOpenEvent -= RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent -= UnregisterPopup;
|
|
}
|
|
|
|
[Button("셋팅 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
MainCanvas = GetComponent<Canvas>();
|
|
MainCanvasRect = MainCanvas.GetComponent<RectTransform>();
|
|
CombatSkillUi = MainCanvas.transform.Find("CombatSkillUi").GetComponent<CombatSkillUi>();
|
|
FieldBossHealthPointUi = MainCanvas.transform.Find("FieldBossHealthPointUi").GetComponent<FieldBossHealthPointUi>();
|
|
PlayerHealthPointUi = MainCanvas.transform.Find("PlayerHealthPointUi").GetComponent<PlayerHealthPointUi>();
|
|
ItemLootUi = MainCanvas.transform.Find("ItemLootUi").GetComponent<ItemLootUi>();
|
|
CombatItemInventoryUi = MainCanvas.transform.Find("CombatItemInventoryUi").GetComponent<CombatItemInventoryUi>();
|
|
GameOverPopupUi = MainCanvas.transform.Find("GameOverPopupUi").GetComponent<GameOverPopupUi>();
|
|
ClearPopupUi = MainCanvas.transform.Find("ClearPopupUi").GetComponent<ClearPopupUi>();
|
|
CombatMenuPopupUi = MainCanvas.transform.Find("CombatMenuPopupUi").GetComponent<MenuPopupUi>();
|
|
CombatTutorialUi = MainCanvas.transform.Find("CombatTutorialUi").GetComponent<CombatTutorialUi>();
|
|
DevelopMenuPopupUi = MainCanvas.transform.Find("DevelopMenuPopupUi").GetComponent<MenuPopupUi>();
|
|
_fadeImage = MainCanvas.transform.Find("FadeImage").GetComponent<Image>();
|
|
|
|
PopupUiList = new List<PopupUi>(8);
|
|
}
|
|
|
|
private void RegisterPopup(PopupUi popup)
|
|
{
|
|
if (!PopupUiList.Contains(popup))
|
|
{
|
|
PopupUiList.Add(popup);
|
|
}
|
|
}
|
|
|
|
private void UnregisterPopup(PopupUi popup)
|
|
{
|
|
if (PopupUiList.Contains(popup))
|
|
{
|
|
PopupUiList.Remove(popup);
|
|
}
|
|
}
|
|
|
|
public void CloseLastPopup()
|
|
{
|
|
if (PopupUiList.Count <= 0) return;
|
|
|
|
PopupUiList[^1].Close();
|
|
}
|
|
|
|
public void CloseAllPopup()
|
|
{
|
|
var tempList = new List<PopupUi>(PopupUiList);
|
|
|
|
foreach (var popup in tempList)
|
|
{
|
|
popup.Close();
|
|
}
|
|
|
|
PopupUiList.Clear();
|
|
}
|
|
|
|
public void FadeInOut(float fadeInTime, float fadeOutTime, Color? fadeColor = null, float delayAfterFadeIn = 0f)
|
|
{
|
|
var newColor = new Color(1f, 1f, 1f, 0f);
|
|
if (fadeColor != null)
|
|
{
|
|
newColor = (Color)fadeColor;
|
|
}
|
|
_fadeImage.color = newColor;
|
|
_fadeImage.enabled = true;
|
|
_fadeImage.DOFade(1f, fadeInTime).OnComplete(() =>
|
|
{
|
|
DOVirtual.DelayedCall(delayAfterFadeIn, () =>
|
|
{
|
|
_fadeImage.DOFade(0f, fadeOutTime).OnComplete(() =>
|
|
{
|
|
_fadeImage.enabled = false;
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
public void HardResetAllMaps()
|
|
{
|
|
MapManager.Instance.HardResetAllMaps();
|
|
CloseAllPopup();
|
|
}
|
|
|
|
public void RestartCurrentStage()
|
|
{
|
|
MapManager.Instance.CurrentMapRestart();
|
|
CloseAllPopup();
|
|
}
|
|
|
|
public void MoveSelectStage(int stage)
|
|
{
|
|
MapManager.Instance.MoveSelectStage(stage);
|
|
CloseAllPopup();
|
|
}
|
|
|
|
public void MoveTitleScene()
|
|
{
|
|
PostProcessingManager.Instance.ToggleRendererFeature(RendererFeatureName.GrayscaleRenderPassFeature, false);
|
|
VisualFeedbackManager.Instance.SetBaseTimeScale(1f);
|
|
SceneManager.LoadScene("00.CombatTitle");
|
|
}
|
|
|
|
public void QuitGame()
|
|
{
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorApplication.isPlaying = false;
|
|
#else
|
|
Application.Quit();
|
|
#endif
|
|
}
|
|
}
|
|
} |