You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
416 lines
15 KiB
416 lines
15 KiB
using DG.Tweening;
|
|
using IVDataFormat;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class DiaryMgr : MonoBehaviour
|
|
{
|
|
//#region Const
|
|
//private static DiaryMgr curMgr = null;
|
|
//#endregion Const
|
|
|
|
//#region UI
|
|
//[Header("UI")]
|
|
//[SerializeField]
|
|
//private TextMeshProUGUI txtMainT;
|
|
//[SerializeField]
|
|
//private Canvas canvasUI;
|
|
//private ButtonIV[] btnTabs; // trip , life 탭 버튼
|
|
//private ButtonIV[] tripChapterBtn, lifeChapterBtn; // trip 1~n장 life 1~n장 버튼
|
|
//private ButtonIV[] btnTripLock, btnLifeLock;
|
|
//private TextMeshProUGUI[] btnTabsTxt;
|
|
//private TextMeshProUGUI diaText;
|
|
//private TextMeshProUGUI[] tripText, lifeText;
|
|
//private GameObject[] tripObjects, lifeObjects; // tripobject[0] = tripchapter버튼 부모 오브젝트 tripobject[1] = tripdecoration
|
|
//private GameObject[] tripcheckObjects, lifecheckObjects; //tripcheckObjects[i].transform.getchild(0) = 버튼, (1) = txt ,(2) = lock
|
|
//private GameObject[] groupTabs; // trip, life scroller ON/OFF
|
|
|
|
//[SerializeField]
|
|
//private Image allCircle, tripCircle, lifeCircle;
|
|
//#endregion UI
|
|
|
|
//#region EScr
|
|
//[SerializeField]
|
|
//private EScrController escrTrip, escrLife;
|
|
//#endregion
|
|
|
|
//#region Variables
|
|
//private int iLoading = 1;
|
|
//private int iSelectedTab = -1;
|
|
//private int iTripCurChapter = 0;
|
|
//private int iLifeCurChapter = 0;
|
|
//private float btnSaveY, txtSaveY;
|
|
//#endregion Variables
|
|
|
|
|
|
|
|
|
|
//#region Base
|
|
//public static void SLocalize(bool bmain)
|
|
//{
|
|
// if (curMgr != null)
|
|
// curMgr.Localize(bmain);
|
|
//}
|
|
|
|
//// 번역, 할당
|
|
//private void Localize(bool bmain)
|
|
//{
|
|
// if (bmain)
|
|
// {
|
|
// txtMainT.text = LocalizationText.GetText("diary_title");
|
|
// }
|
|
// else
|
|
// {
|
|
// canvasUI.transform.Find("txtT").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("diary_title");
|
|
// btnTabs = canvasUI.transform.Find("tabWrapLeft").GetComponentsInChildren<ButtonIV>(true);
|
|
// btnTabsTxt = new TextMeshProUGUI[2];
|
|
// btnTabsTxt[0] = btnTabs[0].transform.Find("txt").GetComponent<TextMeshProUGUI>(); //.text = LocalizationText.GetText("diary_trip")
|
|
// btnTabsTxt[1] = btnTabs[1].transform.Find("txt").GetComponent<TextMeshProUGUI>(); //.text = LocalizationText.GetText("diary_life")
|
|
// btnTabsTxt[0].text = LocalizationText.GetText("diary_trip");
|
|
// btnTabsTxt[1].text = LocalizationText.GetText("diary_life");
|
|
// tripCircle = btnTabs[0].transform.Find("circle").GetComponent<Image>();
|
|
// lifeCircle = btnTabs[1].transform.Find("circle").GetComponent<Image>();
|
|
|
|
// groupTabs = new GameObject[btnTabs.Length];
|
|
// groupTabs[0] = canvasUI.transform.Find("trip").gameObject;
|
|
// groupTabs[1] = canvasUI.transform.Find("life").gameObject;
|
|
|
|
// tripObjects = new GameObject[btnTabs.Length];
|
|
// lifeObjects = new GameObject[btnTabs.Length];
|
|
// tripObjects[0] = canvasUI.transform.Find("TripChapter").gameObject;
|
|
// tripObjects[1] = canvasUI.transform.Find("TripDecoration").gameObject;
|
|
// lifeObjects[0] = canvasUI.transform.Find("LifeChapter").gameObject;
|
|
// lifeObjects[1] = canvasUI.transform.Find("LifeDecoration").gameObject;
|
|
|
|
// tripChapterBtn = new ButtonIV[DataHandler.Const.TripChapterMaxsize];
|
|
// lifeChapterBtn = new ButtonIV[DataHandler.Const.LifeChapterMaxsize];
|
|
// tripText = new TextMeshProUGUI[DataHandler.Const.TripChapterMaxsize];
|
|
// lifeText = new TextMeshProUGUI[DataHandler.Const.LifeChapterMaxsize];
|
|
// btnTripLock = new ButtonIV[DataHandler.Const.TripChapterMaxsize];
|
|
// btnLifeLock = new ButtonIV[DataHandler.Const.LifeChapterMaxsize];
|
|
// tripcheckObjects = new GameObject[tripObjects[0].transform.childCount];
|
|
// lifecheckObjects = new GameObject[lifeObjects[0].transform.childCount];
|
|
|
|
// // UI 순서 때문에 역순으로 할당
|
|
// for (int i = 0; i < tripObjects[0].transform.childCount; i++)
|
|
// {
|
|
// tripObjects[0].transform.GetChild(i).Find("txt").GetComponent<TextMeshProUGUI>().text = (tripObjects[0].transform.childCount - i) + LocalizationText.GetText("diary_chapter");
|
|
// tripcheckObjects[i] = tripObjects[0].transform.GetChild((DataHandler.Const.TripChapterMaxsize - 1) - i).gameObject;
|
|
// tripChapterBtn[i] = tripcheckObjects[i].transform.GetChild(0).GetComponent<ButtonIV>();
|
|
// tripText[i] = tripcheckObjects[i].transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
|
// btnTripLock[i] = tripcheckObjects[i].transform.GetChild(2).GetComponent<ButtonIV>();
|
|
// }
|
|
// for (int i = 0; i < lifeObjects[0].transform.childCount; i++)
|
|
// {
|
|
// lifeObjects[0].transform.GetChild(i).Find("txt").GetComponent<TextMeshProUGUI>().text = (lifeObjects[0].transform.childCount - i) + LocalizationText.GetText("diary_chapter");
|
|
// lifecheckObjects[i] = lifeObjects[0].transform.GetChild((DataHandler.Const.LifeChapterMaxsize - 1) - i).gameObject;
|
|
// lifeChapterBtn[i] = lifecheckObjects[i].transform.GetChild(0).GetComponent<ButtonIV>();
|
|
// lifeText[i] = lifecheckObjects[i].transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
|
// btnLifeLock[i] = lifecheckObjects[i].transform.GetChild(2).GetComponent<ButtonIV>();
|
|
// }
|
|
|
|
|
|
// diaText = canvasUI.transform.Find("diaPanel").gameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>();
|
|
// diaText.text = DataHandler.Goods.Dia.ToString();
|
|
// btnSaveY = tripChapterBtn[0].transform.position.y;
|
|
// txtSaveY = tripcheckObjects[0].transform.GetChild(1).transform.position.y;
|
|
// DataHandler.initTrip();
|
|
// }
|
|
//}
|
|
|
|
//private void Awake()
|
|
//{
|
|
// curMgr = this;
|
|
//}
|
|
|
|
//void Start()
|
|
//{
|
|
// iLoading--;
|
|
//}
|
|
//#endregion Base
|
|
|
|
|
|
//#region UI
|
|
//// 다이어리창 열기.
|
|
//public void OpenDiary()
|
|
//{
|
|
// GameUIMgr.AllOffDownMenu();
|
|
// if (iLoading > 0)
|
|
// return;
|
|
// iLoading++;
|
|
|
|
// Localize(false);
|
|
// diaText.text = DataHandler.Goods.Dia.ToString();
|
|
// setTrip();
|
|
// setLife();
|
|
// groupTabs[0].SetActive(false);
|
|
// groupTabs[1].SetActive(false);
|
|
// initDiary();
|
|
// if (iSelectedTab < 0)
|
|
// {
|
|
// canvasUI.enabled = true;
|
|
// TabTrip();
|
|
// BtnsetChapter(0);
|
|
// }
|
|
// else
|
|
// {
|
|
// canvasUI.enabled = true;
|
|
// TabLife();
|
|
// BtnsetChapter(0);
|
|
// }
|
|
//GameUIMgr.SSetMainUiOn(false);
|
|
//BattleMgr.SSetBattleUiOn(false);
|
|
//BattleMgr.SSetClearFailUiOn(false);
|
|
//BattleMgr.SSetCameraOn(false);
|
|
// iLoading--;
|
|
//}
|
|
|
|
//// 다이어리창 닫기.
|
|
//public void CloseDiary()
|
|
//{
|
|
// if (iLoading > 0)
|
|
// return;
|
|
// iLoading++;
|
|
// iSelectedTab = -1;
|
|
// canvasUI.enabled = false;
|
|
//GameUIMgr.SSetMainUiOn(true);
|
|
//BattleMgr.SSetBattleUiOn(true);
|
|
//BattleMgr.SSetClearFailUiOn(true);
|
|
//BattleMgr.SSetCameraOn(true);
|
|
// initDiary();
|
|
// iLoading--;
|
|
//}
|
|
|
|
//public void BtnsetChapter(int inum)
|
|
//{
|
|
// if (iSelectedTab > 0 && inum <= DataHandler.Const.LifeChapterMaxsize)
|
|
// {
|
|
// initDiary();
|
|
// iLifeCurChapter = inum;
|
|
// setLife();
|
|
// chapterSelectEffect(inum);
|
|
// }
|
|
// else if (iSelectedTab <= 0 && inum <= DataHandler.Const.TripChapterMaxsize)
|
|
// {
|
|
// initDiary();
|
|
// iTripCurChapter = inum;
|
|
// setTrip();
|
|
// chapterSelectEffect(inum);
|
|
// }
|
|
// else
|
|
// return;
|
|
//}
|
|
|
|
//public void BtnLock(int inum)
|
|
//{
|
|
|
|
// //업데이트 판별 유무는 나중에...
|
|
// if(inum > 0)
|
|
// {
|
|
// GameUIMgr.SOpenPopup1Button(LocalizationText.GetText("diary_not_updated"));
|
|
// //;
|
|
// }
|
|
// //else
|
|
// //(inum+1)+ LocalizationText.GetText("diary_chapter") + LocalizationText.GetText("diary_updated");
|
|
//}
|
|
|
|
//private void setActivetripObject(bool bvalue)
|
|
//{
|
|
// tripObjects[0].SetActive(bvalue);
|
|
// tripObjects[1].SetActive(bvalue);
|
|
//}
|
|
//private void setActiveLifeObject(bool bvalue)
|
|
//{
|
|
// lifeObjects[0].SetActive(bvalue);
|
|
// lifeObjects[1].SetActive(bvalue);
|
|
//}
|
|
|
|
//// 1~n 장 버튼 연출
|
|
//private void chapterSelectEffect(int inum)
|
|
//{
|
|
// if (iSelectedTab == 0)
|
|
// {
|
|
// for(int i = 0; i<DataHandler.Const.TripChapterMaxsize; i++)
|
|
// {
|
|
// if(i == inum)
|
|
// {
|
|
// tripChapterBtn[i].transform.position = new Vector3(tripChapterBtn[i].transform.position.x, btnSaveY + 0.3f, tripChapterBtn[i].transform.position.z);
|
|
// tripChapterBtn[i].transform.localScale = new Vector3(1.0f, 1.3f, 1.0f);
|
|
// tripText[i].transform.position = new Vector3(tripText[i].transform.position.x, txtSaveY+0.3f, tripText[i].transform.position.z);
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (iSelectedTab == 1)
|
|
// {
|
|
// for(int i = 0; i<DataHandler.Const.LifeChapterMaxsize; i++)
|
|
// {
|
|
// if(i == inum)
|
|
// {
|
|
// lifeChapterBtn[i].transform.position = new Vector3(lifeChapterBtn[i].transform.position.x, btnSaveY + 0.3f, lifeChapterBtn[i].transform.position.z);
|
|
// lifeChapterBtn[i].transform.localScale = new Vector3(1.0f, 1.3f, 1.0f);
|
|
// lifeText[i].transform.position = new Vector3(lifeText[i].transform.position.x, txtSaveY + 0.3f, lifeText[i].transform.position.z);
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
// else
|
|
// return;
|
|
//}
|
|
|
|
//private void initDiary()
|
|
//{
|
|
// for(int i = 0; i<DataHandler.Const.TripChapterMaxsize; i++)
|
|
// {
|
|
// tripChapterBtn[i].transform.position = new Vector3(tripChapterBtn[i].transform.position.x, btnSaveY, tripChapterBtn[i].transform.position.z);
|
|
// tripChapterBtn[i].transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
|
|
// tripText[i].transform.position = new Vector3(tripText[i].transform.position.x, txtSaveY, tripText[i].transform.position.z);
|
|
// }
|
|
// for(int i = 0; i < DataHandler.Const.LifeChapterMaxsize; i++)
|
|
// {
|
|
// lifeChapterBtn[i].transform.position = new Vector3(lifeChapterBtn[i].transform.position.x, btnSaveY, lifeChapterBtn[i].transform.position.z);
|
|
// lifeChapterBtn[i].transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
|
|
// lifeText[i].transform.position = new Vector3(lifeText[i].transform.position.x, txtSaveY, lifeText[i].transform.position.z);
|
|
// }
|
|
// CheckTripCircle();
|
|
// //checkLifeCircle();
|
|
|
|
//}
|
|
//#endregion UI
|
|
//public static void SunlockTrip(int idx, int itemid)
|
|
//{
|
|
// DataHandler.tripPieceUnlock(idx, itemid);
|
|
//}
|
|
//public static void SunlockLife(int idx, int itemid)
|
|
//{
|
|
// DataHandler.LifePieceUnlock(idx, itemid);
|
|
//}
|
|
//public void CheckTripCircle()
|
|
//{
|
|
// if(DataHandler.PlayData.tripPiece > 0)
|
|
// {
|
|
// curMgr.tripCircle.gameObject.SetActive(true);
|
|
// }
|
|
// else
|
|
// curMgr.tripCircle.gameObject.SetActive(false);
|
|
//}
|
|
//public static void AllCheckCircle()
|
|
//{
|
|
// if(DataHandler.PlayData.tripPiece > 0)
|
|
// curMgr.allCircle.gameObject.SetActive(true);
|
|
// else
|
|
// {
|
|
// curMgr.allCircle.gameObject.SetActive(false);
|
|
// curMgr.tripCircle.gameObject.SetActive(false);
|
|
// }
|
|
//}
|
|
|
|
//public void setTrip()
|
|
//{
|
|
// EnhancedUI.SmallList<int> DiaryChapterTrip = new EnhancedUI.SmallList<int>();
|
|
// int iTripscount = DataHandler.Const.TripMaxsize;
|
|
// bool[] islock = DataHandler.tripChapterIslock();
|
|
// for (int i = 0; i < islock.Length; i++)
|
|
// {
|
|
// int inum = i + 1;
|
|
// tripChapterBtn[inum].interactable = islock[i];
|
|
// tripcheckObjects[inum].transform.GetChild(2).gameObject.SetActive(true);
|
|
// }
|
|
// for (int j = 0; j < iTripscount; j++)
|
|
// {
|
|
// DiaryChapterTrip.Add(j);
|
|
// }
|
|
|
|
// escrTrip.SetType(iTripCurChapter);
|
|
// escrTrip.LoadDatas(DiaryChapterTrip);
|
|
//}
|
|
//public void setLife()
|
|
//{
|
|
// EnhancedUI.SmallList<int> DiaryChapterLife = new EnhancedUI.SmallList<int>();
|
|
// int iTripscount = DataHandler.Const.LifeMaxsize;
|
|
// bool[] islock = DataHandler.lifeChapterIslock();
|
|
// for (int i = 0; i < islock.Length; i++)
|
|
// {
|
|
// int inum = i + 1;
|
|
// lifeChapterBtn[inum].interactable = islock[i];
|
|
// lifecheckObjects[inum].transform.GetChild(2).gameObject.SetActive(true);
|
|
// }
|
|
// for (int j = 0; j < iTripscount; j++)
|
|
// {
|
|
// DiaryChapterLife.Add(j);
|
|
// }
|
|
// escrLife.SetType(iLifeCurChapter);
|
|
// escrLife.LoadDatas(DiaryChapterLife);
|
|
//}
|
|
//private void checkLifeCircle()
|
|
//{
|
|
// if (DataHandler.PlayData.tripPiece > 0)
|
|
// lifeCircle.gameObject.SetActive(true);
|
|
// else
|
|
// lifeCircle.gameObject.SetActive(false);
|
|
//}
|
|
//private void btnTabInit()
|
|
//{
|
|
// if(iSelectedTab >= 0 || iSelectedTab == -1)
|
|
// {
|
|
// //btnTabsTxt[0].color
|
|
// //btnTabsTxt[1].color = new Vector4(255, 255, 255, 100);
|
|
// btnTabs[iSelectedTab].interactable = false;
|
|
// }
|
|
// else if(iSelectedTab >= 0)
|
|
// {
|
|
// //btnTabsTxt[1].color = Global.CLR_White;
|
|
// //btnTabsTxt[0].color = new Vector4(255, 255, 255, 100);
|
|
// btnTabs[iSelectedTab].interactable = false;
|
|
// }
|
|
//}
|
|
|
|
//#region Tab
|
|
//public void TabTrip()
|
|
//{
|
|
// if (iSelectedTab == 0)
|
|
// return;
|
|
|
|
|
|
// if (iSelectedTab >= 0 || iSelectedTab == -1)
|
|
// {
|
|
// iSelectedTab = 1;
|
|
// btnTabs[iSelectedTab].interactable = true;
|
|
// groupTabs[iSelectedTab].SetActive(false);
|
|
// setActiveLifeObject(false);
|
|
// }
|
|
// iSelectedTab = 0;
|
|
// btnTabInit();
|
|
// groupTabs[iSelectedTab].SetActive(true);
|
|
// setActivetripObject(true);
|
|
// chapterSelectEffect(iTripCurChapter);
|
|
// DataHandler.initTrip();
|
|
//}
|
|
|
|
//public void TabLife()
|
|
//{
|
|
// if (iSelectedTab == 1)
|
|
// return;
|
|
|
|
|
|
// if (iSelectedTab >= 0)
|
|
// {
|
|
// iSelectedTab = 0;
|
|
// btnTabs[iSelectedTab].interactable = true;
|
|
// groupTabs[iSelectedTab].SetActive(false);
|
|
// setActivetripObject(false);
|
|
// }
|
|
// iSelectedTab = 1;
|
|
// btnTabInit();
|
|
// groupTabs[iSelectedTab].SetActive(true);
|
|
// setActiveLifeObject(true);
|
|
// chapterSelectEffect(iLifeCurChapter);
|
|
//}
|
|
|
|
//#endregion Tab
|
|
|
|
}
|