2024-12-15 01:39:39 +00:00
|
|
|
using CodeStage.AntiCheat.ObscuredTypes;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class CollectionEssenceUI_Left : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public static CollectionEssenceUI_Left Ins;
|
|
|
|
|
private void Start() { Ins = this; }
|
|
|
|
|
|
2025-03-13 00:10:58 +00:00
|
|
|
public TextMeshProUGUI[] texts; // 0 마일리지 000 획득 시, 1 현재 마일리지
|
2024-12-15 01:39:39 +00:00
|
|
|
public Slider slider_mileage;
|
|
|
|
|
|
|
|
|
|
List<ObscuredInt> list_rewardstep = new List<ObscuredInt> { 200, 500, 700, 1000 };
|
|
|
|
|
List<ObscuredInt> list_rewardid = new List<ObscuredInt> { 2000001, 2000002, 2000003, 2000004, 2000005, 2000006 };
|
|
|
|
|
Dictionary<int, List<ObscuredFloat>> dic_rewardrate = new Dictionary<int, List<ObscuredFloat>>
|
|
|
|
|
{
|
|
|
|
|
{ 0, new List<ObscuredFloat> { 0.5f, 0.35f, 0.25f, 0f, 0f, 0f } },
|
|
|
|
|
{ 1, new List<ObscuredFloat> { 0f, 0.5f, 0.35f, 0.25f, 0f, 0f } },
|
|
|
|
|
{ 2, new List<ObscuredFloat> { 0f, 0f, 0.5f, 0.35f, 0.25f, 0f } },
|
|
|
|
|
{ 3, new List<ObscuredFloat> { 0f, 0f, 0f, 0.5f, 0.35f, 0.25f } },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public void Set()
|
|
|
|
|
{
|
|
|
|
|
RandomizeCryptoKey();
|
|
|
|
|
texts[0].text = DSUtil.Format(281, Get_NeedPoint());
|
2025-03-13 00:10:58 +00:00
|
|
|
texts[1].text = DSUtil.GetThousandCommaText(Get_CurMileage());
|
2024-12-15 01:39:39 +00:00
|
|
|
slider_mileage.value = DSUtil.Get_SliderValue(Get_CurMileage() / (float)list_rewardstep[list_rewardstep.Count - 1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Get_CurMileage()
|
|
|
|
|
{
|
|
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
|
var moneyid = table_GlobalValue.Ins.Get_Int("n_EssenceMileageID");
|
|
|
|
|
return (int)sdata.Get_ItemAmount(moneyid);
|
|
|
|
|
}
|
|
|
|
|
int Get_NeedPoint()
|
|
|
|
|
{
|
|
|
|
|
var curmoney = Get_CurMileage();
|
|
|
|
|
for (int i = 0; i < list_rewardstep.Count; i++)
|
|
|
|
|
if (curmoney < list_rewardstep[i])
|
|
|
|
|
return list_rewardstep[i] - curmoney;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
void RandomizeCryptoKey()
|
|
|
|
|
{
|
|
|
|
|
list_rewardstep.ForEach(f => f.RandomizeCryptoKey());
|
|
|
|
|
list_rewardid.ForEach(f => f.RandomizeCryptoKey());
|
|
|
|
|
foreach (var item in dic_rewardrate) item.Value.ForEach(f => f.RandomizeCryptoKey());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnClick_Get()
|
|
|
|
|
{
|
|
|
|
|
RandomizeCryptoKey();
|
|
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
|
var moneyid = table_GlobalValue.Ins.Get_Int("n_EssenceMileageID");
|
|
|
|
|
int index = -1;
|
|
|
|
|
for (int i = 3; i >= 0; --i)
|
|
|
|
|
{
|
|
|
|
|
if (sdata.Check_ItemAmount(moneyid, list_rewardstep[i], false))
|
|
|
|
|
{
|
|
|
|
|
index = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (index > -1)
|
|
|
|
|
{
|
|
|
|
|
Popup.Ins.Set(ePopupType.One, 283, () =>
|
|
|
|
|
{
|
2025-07-09 00:58:57 +00:00
|
|
|
ServerInfo.Ins.Save_Essence_Mileage(result =>
|
|
|
|
|
{
|
|
|
|
|
sdata.Use_Item(moneyid, result.mileage);
|
|
|
|
|
sdata.Add_Item(result.items[0].itemid, result.items[0].amount);
|
|
|
|
|
Set();
|
|
|
|
|
CollectionEssenceUI_Right.Ins.Set();
|
|
|
|
|
ObtainItemUI.Ins.Set(new ItemSimpleData { itemid = result.items[0].itemid, amount = 1 });
|
|
|
|
|
});
|
2024-12-15 01:39:39 +00:00
|
|
|
}, null, list_rewardstep[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|