2025-09-12 05:23:34 +00:00
|
|
|
using System.Collections.Generic;
|
2025-09-12 05:45:25 +00:00
|
|
|
using TMPro;
|
2025-09-12 04:10:11 +00:00
|
|
|
using UnityEngine;
|
2025-09-12 05:23:34 +00:00
|
|
|
using UnityEngine.UI;
|
2025-09-12 04:10:11 +00:00
|
|
|
|
2025-09-12 05:23:34 +00:00
|
|
|
public class GachaUI : uScrollViewMgr
|
2025-09-12 04:10:11 +00:00
|
|
|
{
|
2025-09-12 05:23:34 +00:00
|
|
|
public GameObject[] gos_grade;
|
2025-09-12 05:45:25 +00:00
|
|
|
public Slider slider_lucky, slider_lucky2;
|
2025-09-18 05:28:09 +00:00
|
|
|
public TextMeshProUGUI[] texts_money; // 0 앨범 오픈 재화, 1 챗 코인, 2 가챠 코인
|
2025-09-12 05:45:25 +00:00
|
|
|
public TextMeshProUGUI[] texts; // 0 럭키 %
|
2025-09-13 02:54:32 +00:00
|
|
|
public GameObject go_CanEnterLuckyGame;
|
2025-09-12 05:23:34 +00:00
|
|
|
|
|
|
|
|
List<(eMoney, int)> list_log = new List<(eMoney, int)>();
|
|
|
|
|
|
2025-09-12 04:10:11 +00:00
|
|
|
public void Set()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
2025-09-12 05:23:34 +00:00
|
|
|
DSUtil.InActivateGameObjects(gos_grade);
|
2025-09-12 05:39:25 +00:00
|
|
|
Set_UI();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Set_UI()
|
|
|
|
|
{
|
2025-09-12 05:45:25 +00:00
|
|
|
var cal = SaveMgr.Ins.Get_Money(eMoney.Lucky) / table_GlobalValue.Ins.Get_Float("LuckyPoint");
|
|
|
|
|
slider_lucky.value = DSUtil.Get_SliderValue(cal);
|
|
|
|
|
slider_lucky2.value = DSUtil.Get_SliderValue(cal - 1f);
|
|
|
|
|
texts[0].text = MyText.Get_PercentValueText_100(cal);
|
2025-09-13 02:54:32 +00:00
|
|
|
|
|
|
|
|
go_CanEnterLuckyGame.SetActive(SaveMgr.Ins.Get_Money(eMoney.Lucky) >= table_GlobalValue.Ins.Get_Float("LuckyPoint"));
|
2025-09-18 05:28:09 +00:00
|
|
|
|
|
|
|
|
Set_Money();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Set_Money()
|
|
|
|
|
{
|
|
|
|
|
texts_money[0].text = SaveMgr.Ins.Get_Money(eMoney.AlbumOpen).ToString();
|
|
|
|
|
texts_money[1].text = SaveMgr.Ins.Get_Money(eMoney.Chat).ToString();
|
|
|
|
|
texts_money[2].text = SaveMgr.Ins.Get_Money(eMoney.Gacha).ToString();
|
2025-09-12 05:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnClick_Lucky()
|
|
|
|
|
{
|
2025-09-18 20:21:29 +00:00
|
|
|
if (SaveMgr.Ins.Check_Money(eMoney.Lucky, table_GlobalValue.Ins.Get_Int("LuckyPoint")))
|
2025-09-13 02:42:04 +00:00
|
|
|
{
|
2025-09-18 20:21:29 +00:00
|
|
|
SaveMgr.Ins.Add_Money(eMoney.Lucky, -table_GlobalValue.Ins.Get_Int("LuckyPoint"));
|
2025-09-13 02:42:04 +00:00
|
|
|
SaveMgr.Ins.Save();
|
|
|
|
|
LobbyUI.Ins.m_Game_Lucky.Set();
|
|
|
|
|
Set_UI();
|
|
|
|
|
}
|
2025-09-12 04:10:11 +00:00
|
|
|
}
|
2025-09-12 04:54:04 +00:00
|
|
|
|
2025-09-13 21:57:57 +00:00
|
|
|
public void OnClick_AD()
|
|
|
|
|
{
|
|
|
|
|
if (SaveMgr.Ins.CanShowGachaAD())
|
|
|
|
|
{
|
2025-09-15 21:41:59 +00:00
|
|
|
ADInfo.Ins.Show_AD(false, () =>
|
|
|
|
|
{
|
|
|
|
|
SaveMgr.Ins.Add_Money(eMoney.Gacha, table_GlobalValue.Ins.Get_Int("GachaAD_Reward"));
|
|
|
|
|
SaveMgr.Ins.Add_GachaADTime(table_GlobalValue.Ins.Get_Int("ADSec_Gacha"));
|
|
|
|
|
LobbyUI.Ins.m_ToastUI.Set($"가챠 코인 {table_GlobalValue.Ins.Get_Int("GachaAD_Reward")}개를 획득했습니다.");
|
|
|
|
|
});
|
2025-09-13 21:57:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-12 04:54:04 +00:00
|
|
|
public void OnClick_Gacha()
|
|
|
|
|
{
|
2025-09-13 21:57:57 +00:00
|
|
|
if (SaveMgr.Ins.Check_Money(eMoney.Gacha, table_GlobalValue.Ins.Get_Int("GachaAmount")))
|
|
|
|
|
{
|
|
|
|
|
SaveMgr.Ins.Add_Money(eMoney.Gacha, -table_GlobalValue.Ins.Get_Int("GachaAmount"));
|
|
|
|
|
var gradedata = table_gacharateconfig.Ins.Get_RadomData();
|
|
|
|
|
DSUtil.InActivateGameObjects(gos_grade, gradedata.n_GachaGrade - 1);
|
|
|
|
|
var reward = table_gachareward.Ins.Get_Reward(gradedata.n_GachaGrade);
|
|
|
|
|
SaveMgr.Ins.Add_Money(reward.Item1, reward.Item2);
|
|
|
|
|
SaveMgr.Ins.Add_Money(eMoney.Lucky, reward.Item3);
|
|
|
|
|
SaveMgr.Ins.Save();
|
|
|
|
|
list_log.Add((reward.Item1, reward.Item2));
|
|
|
|
|
list_log.Add((eMoney.Lucky, reward.Item3));
|
|
|
|
|
Set_ScrollView(list_log);
|
|
|
|
|
Set_Vertical_ScrollEnd(0);
|
|
|
|
|
Set_UI();
|
|
|
|
|
}
|
2025-09-12 04:54:04 +00:00
|
|
|
}
|
2025-09-12 04:10:11 +00:00
|
|
|
}
|