using CodeJay.Classes; using System.Collections.Generic; using UnityEngine; public class HuntingPanel : uScrollViewMgr { [SerializeField] private TMPro.TextMeshProUGUI TitleTMP; [SerializeField] private GameObject[] Buttons; public ShowPanel m_ShowPanel; private List _lstSlots; private int CurAlbumType = 1; private void Awake() { //// HuntingData하나에 2개의 데이터 필요함. //// 100개라면 50개만 생성해야함 (왼쪽 오른쪽 있기때문) //_lstSlots = new List(DB_HuntingListData.CountEntities); //// 소수점이 나오면 데이터가 홀수로 끝난다는것이기 때문에 //// 오른쪽에 슬롯이 생성되지 않는것을 방지하기위해 올림을 한다. ////int length = Mathf.CeilToInt(GameManager.DB.GetHuntingDataLength() / 2f); //// 헌팅 도전 슬롯 생성 //HuntingSlot slot = null; //for (int i = 0; i < DB_HuntingListData.CountEntities; i++) //{ // slot = Instantiate(SlotPrefab, Content).GetComponent(); // _lstSlots.Add(slot); //} if (GameManager.Instance != null) { // 이벤트 매니저에 구독 GameManager.Event.RegistEvent(EEventType.OnSynchronizeAIChllengeModeAIData, this.Set_UI); GameManager.Event.RegistEvent(EEventType.OnClickFullView, this.OnClickFullView); GameManager.Event.RegistEvent(EEventType.OnReturnFullView, this.OnReturnFullView); } } public void ShowPanel(HuntingData data) { m_ShowPanel.Set(data); } private void OnDestroy() { if (GameManager.Instance != null) { // 구독한 이벤트 해제 GameManager.Event.RemoveEvent(EEventType.OnSynchronizeAIChllengeModeAIData, this.Set_UI); GameManager.Event.RemoveEvent(EEventType.OnClickFullView, this.OnClickFullView); GameManager.Event.RemoveEvent(EEventType.OnReturnFullView, this.OnReturnFullView); GameManager.BGDatabase.ReleaseHuntingUnlockImage(); } } private void OnEnable() { GameManager.DB.CheckDayReset(); Set_UI(); } public void Set_UI() { //GameManager.DB.GetHuntingDataLength() var curtargetindex = GameManager.DB.GetUnlockTargetIndex(true); DB_HuntingListData huntingListData = DB_HuntingListData.GetEntity(curtargetindex); TitleTMP.text = huntingListData.DBF_Title; Set_ScrollView(GameManager.DB.Get_AlbumDatas()); } private void OnClickFullView(object huntingDataID, object huntingListDataID) { for (int i = 0; i < Buttons.Length; i++) Buttons[i].SetActive(false); } private void OnReturnFullView() { for (int i = 0; i < Buttons.Length; i++) Buttons[i].SetActive(true); } public void ClickUnlockNowButton() { //GameManager.Sound.PlaySFX(ESFXType.Button_Hit); //if (GameManager.DB.IsAllUnlocked() == false) //{ // if (GameManager.DB.Key > 0) // { // GameManager.DB.SubKey(1, this.name); // GameManager.DB.UnlockLastAIImage(); // GameManager.DB.SaveDatas(); // GameManager.Event.InvokeEvent(EEventType.OnSynchronizeAIChllengeModeAIData); // BGId huntingDataID = GameManager.BGDatabase.GetLastUnolockHuntingDataID(); // BGId huntingListDataID = GameManager.BGDatabase.GetLastUnolockHuntingListDataID(); // if (huntingDataID != BGId.Empty && huntingListDataID != BGId.Empty) // { // GameManager.Event.InvokeEvent(EEventType.OnClickFullView, huntingDataID, huntingListDataID); // } // } // else // { // GameManager.UI.ShowNStackPopup(EPopupType.KeyChargePopup); // } //} } public void ClickChallenge() { //GameManager.Sound.PlaySFX(ESFXType.Button_Hit); //if (GameManager.DB.IsAllUnlocked() == false) //{ // if (GameManager.DB.Heart > 0) // { // if (GameManager.DB.Gold > 0) // { // GameManager.DB.SubHeart(1, this.name); // GameManager.Event.InvokeEvent(EEventType.OnChallengeStart); // } // else // { // GameManager.UI.ShowNStackPopup(EPopupType.GoldChargePopup); // } // } // else // GameManager.UI.ShowNStackPopup(EPopupType.HeartChargePopup); //} } public void OnClick_Arrow(int add) { CurAlbumType += add; if (CurAlbumType < 1) CurAlbumType = 10; else if (CurAlbumType > 10) CurAlbumType = 1; Set_UI(); } public void OnClick_Collection() { CanvasControl.Ins.Go_Collection(); } }