59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class BookTabCard : CardBase
|
||
|
|
{
|
||
|
|
public UISprite sprite_icon;
|
||
|
|
public UILabel[] labels; // 0 이름1, 1 이름2, 2 진행, 3 완료 효과
|
||
|
|
public UISlider slider;
|
||
|
|
public GameObject[] gos; // 0 미완성, 1 완성버튼노출, 2 완성 애님, 3 완성, 4 노티
|
||
|
|
|
||
|
|
BookTableData m_BookTableData;
|
||
|
|
|
||
|
|
public override void Set<T>(T _base)
|
||
|
|
{
|
||
|
|
base.Set(_base);
|
||
|
|
m_BookTableData = _base as BookTableData;
|
||
|
|
sprite_icon.spriteName = m_BookTableData.IconBook;
|
||
|
|
labels[0].text = labels[1].text = m_BookTableData.Name;
|
||
|
|
Set_UI();
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Set_UI()
|
||
|
|
{
|
||
|
|
base.Set_UI();
|
||
|
|
|
||
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
||
|
|
var sum = sdata.Get_BookSumPage(Get_ID());
|
||
|
|
slider.value = (float)sum / m_BookTableData.TotalPage;
|
||
|
|
labels[2].text = DSUtil.Format("({0}/{1}) {2:0.##}%", sum, m_BookTableData.TotalPage, slider.value * 100f);
|
||
|
|
|
||
|
|
if (sdata.IsComplete_Book(Get_ID()))
|
||
|
|
{
|
||
|
|
DSUtil.InActivateGameObjects(gos, 3);
|
||
|
|
labels[3].text = DSUtil.Format("{0} {1}", MyText.Get_StatName(m_BookTableData.Stat), MyText.Get_StatValueText(m_BookTableData.Stat, m_BookTableData.Complete));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
if (slider.value >= 1f)
|
||
|
|
DSUtil.InActivateGameObjects(gos, 1);
|
||
|
|
else
|
||
|
|
DSUtil.InActivateGameObjects(gos, 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
gos[4].SetActive(Menu_Book.dic_newBookPage.ContainsKey(Get_ID()) && Menu_Book.dic_newBookPage[Get_ID()].Count > 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnClick_Complete()
|
||
|
|
{
|
||
|
|
SoundInfo.Ins.Play_OneShot(eSound.s004_GetBook);
|
||
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
||
|
|
sdata.Set_BookComplete(Get_ID());
|
||
|
|
NetWait.Ins.Set(true);
|
||
|
|
DSUtil.InActivateGameObjects(gos, 2);
|
||
|
|
Set_Coroutine(() => { Set_UI(); NetWait.Ins.Set(false); }, 1f);
|
||
|
|
}
|
||
|
|
|
||
|
|
public int Get_ID() { return m_BookTableData.ID; }
|
||
|
|
}
|