101 lines
3.4 KiB
C#
101 lines
3.4 KiB
C#
using Continentis.MainGame.Card;
|
|
using Continentis.MainGame.Character;
|
|
using Continentis.MainGame.Combat;
|
|
using Continentis.MainGame.UI;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
namespace Continentis.MainGame
|
|
{
|
|
public partial class CombatUIManager : UIManagerBase
|
|
{
|
|
public new static CombatUIManager Instance => instance as CombatUIManager;
|
|
|
|
public Camera combatCamera;
|
|
public Camera uiCamera;
|
|
public CombatMainPage combatMainPage;
|
|
public InformationPage informationPage;
|
|
public HUDPage hudPage;
|
|
public ArrowsPage arrowsPage;
|
|
}
|
|
|
|
public partial class CombatUIManager
|
|
{
|
|
public CardViewBase hoveringCardView;
|
|
public CardViewBase selectingCardView;
|
|
public CombatCharacterViewBase hoveringCharacterView;
|
|
public CombatCharacterViewBase selectingCharacterView;
|
|
}
|
|
|
|
public partial class CombatUIManager
|
|
{
|
|
private void Update()
|
|
{
|
|
ManageCharacterViews();
|
|
}
|
|
|
|
public bool IsNoOtherUIPageOpen()
|
|
{
|
|
return uiPageList.Count == 1 && uiPageList.Contains(combatMainPage);
|
|
}
|
|
|
|
public void UpdateAll()
|
|
{
|
|
combatMainPage.teamSwitchButton.UpdateTeamPileText(CombatMainManager.Instance.characterController.playerTeam);
|
|
}
|
|
}
|
|
|
|
public partial class CombatUIManager
|
|
{
|
|
private void ManageCharacterViews()
|
|
{
|
|
if (!IsNoOtherUIPageOpen())
|
|
{
|
|
return;
|
|
}
|
|
|
|
Ray ray = combatCamera.ScreenPointToRay(Mouse.current.position.ReadValue());
|
|
|
|
if (Physics.Raycast(ray, out RaycastHit hit, 2048, LayerMask.GetMask("Combat")))
|
|
{
|
|
if (hit.collider.gameObject.CompareTag("Character"))
|
|
{
|
|
hoveringCharacterView ??= hit.collider.GetComponent<CombatCharacterViewBase>();
|
|
|
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
{
|
|
if (hoveringCharacterView == selectingCharacterView)
|
|
{
|
|
informationPage.characterInformationPanel.Show();
|
|
informationPage.characterInformationPanel.Initialize(hoveringCharacterView.character);
|
|
}
|
|
else
|
|
{
|
|
selectingCharacterView?.hudContainer.DisableHUD("SelectingDot");
|
|
selectingCharacterView = hoveringCharacterView;
|
|
selectingCharacterView.hudContainer.EnableHUD("SelectingDot");
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
{
|
|
selectingCharacterView?.hudContainer.DisableHUD("SelectingDot");
|
|
selectingCharacterView = null;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
hoveringCharacterView = null;
|
|
|
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
{
|
|
selectingCharacterView?.hudContainer.DisableHUD("SelectingDot");
|
|
selectingCharacterView = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |