122 lines
4.6 KiB
C#
122 lines
4.6 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
|
using System;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class EquipmentPopup_Obtain : EquipmentPopupBase
|
|
{
|
|
public EquipmentSimpleCard m_SmeltingMaterialCard;
|
|
public TextMeshProUGUI[] texts; // 0 제련 레벨, 1 제련 효과, 2 제련 확률
|
|
public Image[] images; // 0 분해 시 획득 아이템
|
|
public TextMeshProUGUI[] texts_decomp; // 0 분해 시 획득량, 1 분해량
|
|
public Slider slider_decomp;
|
|
|
|
Action act_RefreshUI;
|
|
EquipmentSmeltingTableData m_SmeltingData, m_NextSmeltingData;
|
|
ObscuredInt m_DecompAmount;
|
|
|
|
private void Start()
|
|
{
|
|
m_SmeltingMaterialCard.Set_CardType(eUICardType.MakeMaterial);
|
|
}
|
|
|
|
public override void Set(EquipmentListTableData data, Action refresh = null)
|
|
{
|
|
base.Set(data, refresh);
|
|
act_RefreshUI = refresh;
|
|
Set_SmeltingUI();
|
|
Set_Decompostion(0);
|
|
}
|
|
|
|
void Set_SmeltingUI()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
var lv = sdata.Get_SmeltingLv(m_Data.n_EquipID);
|
|
texts[0].text = lv.ToString();
|
|
m_SmeltingData = table_equipsmelting.Ins.Get_Data(lv);
|
|
m_NextSmeltingData = table_equipsmelting.Ins.Get_Data(lv + 1);
|
|
m_SmeltingMaterialCard.Set(table_itemlist.Ins.Get_Data(m_Data.n_EquipID));
|
|
m_SmeltingMaterialCard.Set_NeedAmount(m_SmeltingData.n_UpgradePrice);
|
|
if (!DSUtil.CheckNull(m_NextSmeltingData))
|
|
{
|
|
texts[1].text = $"{NumberFormatter.FormatNumber(m_SmeltingData.f_IncreaseValueRate)}% >> {NumberFormatter.FormatNumber(m_NextSmeltingData.f_IncreaseValueRate)}%";
|
|
texts[2].text = $"{NumberFormatter.FormatNumber(m_SmeltingData.f_NextStepRate)}%";
|
|
}
|
|
else
|
|
{
|
|
texts[1].text = $"{NumberFormatter.FormatNumber(m_SmeltingData.f_IncreaseValueRate)}%";
|
|
texts[2].text = "0%";
|
|
}
|
|
}
|
|
void Set_Decompostion(int amount)
|
|
{
|
|
var max = (int)ServerInfo.Ins.m_ServerData.Get_ItemAmount(m_Data.n_EquipID);
|
|
|
|
if (amount == 0) m_DecompAmount = amount;
|
|
else m_DecompAmount += amount;
|
|
if (m_DecompAmount < 0) m_DecompAmount = 0;
|
|
else if (m_DecompAmount > max) m_DecompAmount = max;
|
|
m_DecompAmount.RandomizeCryptoKey();
|
|
|
|
images[0].sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_DecompositionReward);
|
|
|
|
texts_decomp[0].text = NumberFormatter.FormatNumber(m_Data.n_DecompositionCount * m_DecompAmount);
|
|
texts_decomp[1].text = m_DecompAmount.ToString();
|
|
|
|
var sliderval = m_DecompAmount / (float)max;
|
|
slider_decomp.value = DSUtil.Get_SliderValue(sliderval);
|
|
}
|
|
|
|
public void OnClick_Equip()
|
|
{
|
|
// 장비 착용 처리
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (sdata.IsObtainItem(m_Data.n_EquipID))
|
|
{
|
|
if (!sdata.IsEquip(m_Data.e_EquipParts, m_Data.n_EquipID))
|
|
{
|
|
sdata.Equip.Set_Equip(m_Data.e_EquipParts, m_Data.n_EquipID);
|
|
act_RefreshUI();
|
|
NewGameUI.Ins.m_EquipmentUI.m_equipItems.Set();
|
|
NewGameUI.Ins.m_EquipmentUI.m_EquipmentUI_Items.Set_UI();
|
|
if (m_Data.e_EquipParts == eItem.Weapon)
|
|
MyValue.MyPC.Change_Weapon(false);
|
|
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnClick_Smelting()
|
|
{
|
|
// 장비 제련 처리
|
|
if (!DSUtil.CheckNull(m_NextSmeltingData))
|
|
{
|
|
ServerInfo.Ins.m_ServerData.Try_SmeltingLvUp(m_SmeltingData, m_Data.n_EquipID, success =>
|
|
{
|
|
Set_SmeltingUI();
|
|
NewGameUI.Ins.m_EquipmentUI.m_equipItems.Set();
|
|
NewGameUI.Ins.m_EquipmentUI.m_EquipmentUI_Items.Set_UI();
|
|
PopupMgr.Ins.m_EquipmentPopup.Set_UI();
|
|
ToastUI.Ins.Set(174, success ? "제련 성공!!" : "제련 실패...");
|
|
});
|
|
}
|
|
}
|
|
|
|
public void OnClick_Decomposition()
|
|
{
|
|
// 장비 분해 처리
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (m_DecompAmount > 0 && sdata.Check_ItemAmount(m_Data.n_EquipID, m_DecompAmount))
|
|
{
|
|
sdata.Use_Item(m_Data.n_EquipID, m_DecompAmount);
|
|
sdata.Add_Item(m_Data.n_DecompositionReward, m_Data.n_DecompositionCount * m_DecompAmount);
|
|
ToastUI.Ins.Set(174, $"분해해서 {m_Data.n_DecompositionReward} 아이템 {m_Data.n_DecompositionCount * m_DecompAmount} 개 획득");
|
|
Set_Decompostion(0);
|
|
Set_SmeltingUI();
|
|
}
|
|
}
|
|
public void OnClick_Slider(int add)
|
|
{
|
|
Set_Decompostion(add);
|
|
}
|
|
} |