Project_WL/Assets/Script/UI/Center/Chapter/ChapterSelectCard.cs

86 lines
3.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChapterSelectCard : CardBase
{
public UISprite sprite_chapter;
public UILabel label_chapter, label_chaptername;
public GameObject[] gos; // 0 오픈여부, 1 선택된 챕터, 2 챕퀘노티, 3 new챕터
public UISprite[] sprites_clear;
ChapterTextTableData m_ChapterTextTableData;
bool isClick = false;
public override void Set<T>(T _base)
{
isClick = false;
base.Set(_base);
m_ChapterTextTableData = _base as ChapterTextTableData;
sprite_chapter.spriteName = DSUtil.Format("selectchapter_{0}", m_ChapterTextTableData.ID);
var sdata = ServerInfo.Ins.m_ServerData;
bool isNoOpen = true;// sdata.Get_Common(eCommon.MaxMapID) < m_ChapterTextTableData.ID;
// 오픈 되지 않았다.
// 1. 그림 흐리게
// 2. <챕터> 색깔 흐리게
// 3. 챕터 이름 흐리게
if (isNoOpen)
{
DSUtil.InActivateGameObjects(gos, 0);
label_chapter.text = DSUtil.Format("[0D2137]<챕터 {0}>", m_ChapterTextTableData.ID);
label_chaptername.text = DSUtil.Format("[0D2137]{0}", m_ChapterTextTableData.ChapterName);
for (int i = 0; i < sprites_clear.Length; i++)
sprites_clear[i].color = new Color32(13, 33, 55, 255);
}
else
{
//bool isClearChapter = sdata.Get_Common(eCommon.MaxMapID, true) > m_ChapterTextTableData.ID;
//int maxstage = 0;
//if (isClearChapter)
// maxstage = 10;
//else if (sdata.Get_Common(eCommon.MaxMapID) == m_ChapterTextTableData.ID)
// maxstage = sdata.Get_Common(eCommon.MaxStage);
//gos[0].SetActive(false);
//gos[1].SetActive(m_ChapterTextTableData.ID == sdata.Get_Common(eCommon.Chapter));
gos[2].SetActive(sdata.IsCanGetChapterClearReward(m_ChapterTextTableData.ID));
gos[3].SetActive(DataCheckMgr.Ins.NewChapter == m_ChapterTextTableData.ID);
gos[4].SetActive(m_ChapterTextTableData.ID > 1 && NewGameUI.Ins.m_GuideQuestUI.Get_Purpose() == ePurpose.ChapterChange && sdata.Get_Common(eCommon.GuideClear) == 0);
label_chapter.text = DSUtil.Format("<챕터 {0}>", m_ChapterTextTableData.ID);
label_chaptername.text = DSUtil.Format("[28FFAF]{0}", m_ChapterTextTableData.ChapterName);
for (int i = 0; i < sprites_clear.Length; i++)
{
//if (i < maxstage)
// sprites_clear[i].color = new Color32(41, 224, 156, 255);
//else
// sprites_clear[i].color = new Color32(13, 33, 55, 255);
}
}
}
public void OnClick_GoChapter()
{
if (!isClick)
{
isClick = true;
//ServerInfo.Ins.m_ServerData.Set_Common(eCommon.BeforeChapter, m_ChapterTextTableData.ID);
GameUI.Ins.LobbyUI.Get_MenuChapter().Go_SelectChapter(m_ChapterTextTableData.ID, false);
GameUI.Ins.LobbyUI.Get_ChapterSelect().OnClick_Back();
if (DataCheckMgr.Ins.NewChapter == m_ChapterTextTableData.ID)
{
DataCheckMgr.Ins.NewChapter = 0;
GameUI.Ins.LobbyUI.Set_Noti();
}
if (m_ChapterTextTableData.ID > 1)
NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.ChapterChange);
}
}
public void OnClick_ChapterDropInfo()
{
GameUI.Ins.LobbyUI.Get_MenuChapter().m_ChapterDropInfo.Set(m_ChapterTextTableData.ID);
}
}