68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using Doozy.Runtime.Reactor.Animators;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class UiManager : Singleton<UiManager>
|
|
{
|
|
[Title("Card")]
|
|
private Transform cardLayoutGroup;
|
|
public UIAnimator CardLayoutGroupAnimator { get; set; }
|
|
|
|
[Title("TakeAim")]
|
|
private GameObject takeAim;
|
|
private Texture2D cursorTexture;
|
|
private bool isTakeAim;
|
|
|
|
private void Init()
|
|
{
|
|
cardLayoutGroup = transform.Find("CardLayoutGroup");
|
|
CardLayoutGroupAnimator = cardLayoutGroup.GetComponent<UIAnimator>();
|
|
takeAim = transform.Find("Aim").gameObject;
|
|
}
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
Init();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
CursorTextureChange();
|
|
AssaultCardInit();
|
|
}
|
|
|
|
public void AddCard() //TODO Test button and function, delete later
|
|
{
|
|
Instantiate(DataManager.Inst.assaultCard, cardLayoutGroup);
|
|
}
|
|
|
|
public void AimOnOff(bool isOn)
|
|
{
|
|
takeAim.SetActive(isOn);
|
|
isTakeAim = isOn;
|
|
}
|
|
|
|
private void CursorTextureChange()
|
|
{
|
|
cursorTexture = DataManager.Inst.cursorTexture;
|
|
//var hotSpot = new Vector2(cursorTexture.width / 2f, cursorTexture.height / 2f);
|
|
var hotSpot = Vector2.zero;
|
|
Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.Auto);
|
|
}
|
|
|
|
private void AssaultCardInit()
|
|
{
|
|
for (int i = 0; i < DataManager.Inst.CardList.Count; i++)
|
|
{
|
|
var obj = Instantiate(DataManager.Inst.assaultCard, cardLayoutGroup);
|
|
var draggableCard = obj.GetComponent<DraggableCard>();
|
|
draggableCard.card = DataManager.Inst.GetCardDictionaryFromKey(DataManager.Inst.CardList[i]);
|
|
draggableCard.CardInit();
|
|
}
|
|
}
|
|
}
|
|
}
|