176 lines
5.6 KiB
C#
176 lines
5.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class WishGodPageManager : MonoBehaviour
|
|
{
|
|
public WishGodPageUI[] wishGodPages;
|
|
|
|
private int wishGodPageIndex = 0;
|
|
|
|
public GameObject mainCamera;
|
|
public GameObject wishCanvas;
|
|
[SerializeField]
|
|
private PuzzleDrawTarotItem m_puzzleDrawTarotItemPrefab;
|
|
[SerializeField]
|
|
private Transform m_puzzleDrawTarotItemParent;
|
|
[SerializeField]
|
|
private Transform m_tarotSelectTypeUI;
|
|
[SerializeField]
|
|
private Transform m_tarotTypeDetailUI;
|
|
[SerializeField]
|
|
private PuzzleExplainUI m_tarotExplainUI;
|
|
[SerializeField]
|
|
private Transform m_wishPet;
|
|
[SerializeField]
|
|
private Transform m_wishRing;
|
|
[SerializeField]
|
|
private Text m_tarotTypeNameText;
|
|
[SerializeField]
|
|
private Text m_tarotTypeDesText;
|
|
[SerializeField]
|
|
private Button m_confirmSelectText;
|
|
[SerializeField]
|
|
private Button m_backBtn;
|
|
[SerializeField]
|
|
private Button m_backSelectBtn;
|
|
[SerializeField]
|
|
private Button m_backExplainBtn;
|
|
[SerializeField]
|
|
private Button m_clearDateBtn;
|
|
[SerializeField]
|
|
private Button m_drawLotsBtn;
|
|
[SerializeField]
|
|
private CardUIManager m_cardUI;
|
|
private List<PuzzleDrawTarotItem> drawTarotItemList;
|
|
|
|
[Header("Attack")]
|
|
public GameObject attackCamera;
|
|
public GameObject attackPage;
|
|
public GameObject attackAnimationGroup;
|
|
public GameObject attackCanvasGroup;
|
|
public Button attackReturnButton;
|
|
|
|
|
|
private void Start()
|
|
{
|
|
wishGodPages = GetComponentsInChildren<WishGodPageUI>(true);
|
|
|
|
for(int index = 0; index < wishGodPages.Length; ++index)
|
|
{
|
|
if (index != wishGodPageIndex) wishGodPages[index].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
void ChangeIndex(int index)
|
|
{
|
|
//if (index < 0 || index > wishGodPages.Length - 1) return;
|
|
////if (wishGodPages[wishGodPageIndex].wishRing) wishGodPages[wishGodPageIndex].wishRing.SetActive(false);
|
|
//wishGodPages[wishGodPageIndex].gameObject.SetActive(false);
|
|
//wishGodPageIndex = index;
|
|
//wishGodPages[wishGodPageIndex].gameObject.SetActive(true);
|
|
////if (wishGodPages[wishGodPageIndex].wishRing) wishGodPages[wishGodPageIndex].wishRing.SetActive(true);
|
|
}
|
|
|
|
public void MoveLeft()
|
|
{
|
|
//ChangeIndex(wishGodPageIndex - 1);
|
|
}
|
|
|
|
public void MoveRight()
|
|
{
|
|
ChangeIndex(wishGodPageIndex + 1);
|
|
}
|
|
|
|
public void Attack()
|
|
{
|
|
attackReturnButton.onClick.AddListener(AttackReturnUI);
|
|
Transition.PlayFade(1.0f, Color.white, delegate {
|
|
//mainCamera.SetActive(false);
|
|
attackCanvasGroup.SetActive(true);
|
|
wishCanvas.SetActive(false);
|
|
//attackCamera.SetActive(true);
|
|
//attackAnimationGroup.SetActive(true);
|
|
});
|
|
|
|
}
|
|
|
|
public void AttackReturnUI()
|
|
{
|
|
Transition.PlayFade(1.0f, Color.white, delegate {
|
|
//mainCamera.SetActive(true);
|
|
attackCanvasGroup.SetActive(false);
|
|
wishCanvas.SetActive(true);
|
|
//attackCamera.SetActive(false);
|
|
//attackAnimationGroup.SetActive(false);
|
|
});
|
|
}
|
|
|
|
public void ShowAllSelectType(List<PuzzleDrawTarot> puzzleDrawTarotList)
|
|
{
|
|
m_backBtn.onClick.RemoveAllListeners();
|
|
m_backBtn.onClick.AddListener(BackBtnClick);
|
|
m_backSelectBtn.onClick.RemoveAllListeners();
|
|
m_backSelectBtn.onClick.AddListener(BackSelectBtnClick);
|
|
m_backExplainBtn.onClick.RemoveAllListeners();
|
|
m_backExplainBtn.onClick.AddListener(ExitExplainUI);
|
|
m_tarotSelectTypeUI.gameObject.SetActive(true);
|
|
// m_wishPet.gameObject.SetActive(false);
|
|
// m_wishRing.gameObject.SetActive(false);
|
|
if(drawTarotItemList==null)
|
|
{
|
|
drawTarotItemList= new List<PuzzleDrawTarotItem>();
|
|
}
|
|
for(int j=0;j<drawTarotItemList.Count;j++)
|
|
{
|
|
Destroy(drawTarotItemList[j].gameObject);
|
|
}
|
|
drawTarotItemList.Clear();
|
|
for(int j=0;j<puzzleDrawTarotList.Count;j++)
|
|
{
|
|
GameObject go = Instantiate(m_puzzleDrawTarotItemPrefab.gameObject,m_puzzleDrawTarotItemParent);
|
|
PuzzleDrawTarotItem currItem = go.GetComponent<PuzzleDrawTarotItem>();
|
|
currItem.Init(puzzleDrawTarotList[j],ShowSelectTypeDetail);
|
|
drawTarotItemList.Add(currItem);
|
|
}
|
|
}
|
|
|
|
void BackBtnClick()
|
|
{
|
|
m_tarotSelectTypeUI.gameObject.SetActive(false);
|
|
m_tarotTypeDetailUI.gameObject.SetActive(false);
|
|
m_clearDateBtn.gameObject.SetActive(true);
|
|
m_drawLotsBtn.gameObject.SetActive(true);
|
|
}
|
|
|
|
void ExitExplainUI()
|
|
{
|
|
m_tarotExplainUI.Exit();
|
|
m_clearDateBtn.gameObject.SetActive(true);
|
|
m_drawLotsBtn.gameObject.SetActive(true);
|
|
}
|
|
|
|
void BackSelectBtnClick()
|
|
{
|
|
m_tarotSelectTypeUI.gameObject.SetActive(true);
|
|
m_tarotTypeDetailUI.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void ShowSelectTypeDetail(PuzzleDrawTarot PuzzleDrawTarot)
|
|
{
|
|
m_tarotSelectTypeUI.gameObject.SetActive(false);
|
|
m_tarotTypeDetailUI.gameObject.SetActive(true);
|
|
m_tarotTypeNameText.text = PuzzleDrawTarot.DisplayName;
|
|
m_tarotTypeDesText.text = PuzzleDrawTarot.Description;
|
|
m_confirmSelectText.onClick.RemoveAllListeners();
|
|
m_confirmSelectText.onClick.AddListener(()=>{ConfirmSelectBtnClick(PuzzleDrawTarot);} );
|
|
}
|
|
|
|
public void ConfirmSelectBtnClick(PuzzleDrawTarot PuzzleDrawTarot)
|
|
{
|
|
m_tarotTypeDetailUI.gameObject.SetActive(false);
|
|
m_cardUI.Init(PuzzleDrawTarot);
|
|
}
|
|
}
|