112 lines
4.2 KiB
C#
112 lines
4.2 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EquipmentItemPopup : EquipmentPopupItemInfoBase
|
|
{
|
|
public RectTransform m_childrect;
|
|
public EquipItemEnchantOption m_EquipItemEnchantOption;
|
|
// 0 숙련 보너스%, 1 주능력치 이름, 2 주능력치값, 3 숙련도 레벨, 4 숙련도 능력치 이름, 5 숙련도 전, 6 비용, 7 숙련도 후
|
|
public TextMeshProUGUI[] texts;
|
|
public Image[] images; // 0 인챈트 스크롤
|
|
public GameObject[] gos_offwhenmoveleft;
|
|
|
|
EquipItemData m_EquipItemData = new EquipItemData();
|
|
Vector2 v3_childpos;
|
|
bool bRight = true;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
v3_childpos = m_childrect.anchoredPosition;
|
|
}
|
|
|
|
public override void Set(EquipmentListTableData data)
|
|
{
|
|
if (DSUtil.CheckNull(data)) return;
|
|
base.Set(data);
|
|
|
|
Set_Position(true);
|
|
Set_ItemInfo();
|
|
Set_UI();
|
|
|
|
bRight = true;
|
|
NewGameUI.Ins.m_EquipmentUI.Set_Scrollviews(false);
|
|
}
|
|
|
|
public override void Set_UI()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
m_EquipItemData.id = m_Data.n_EquipID;
|
|
m_EquipItemData.itemType = m_ItemData.e_ItemType;
|
|
m_Card.Set(m_EquipItemData);
|
|
m_Card.Set_CardType(eUICardType.UIEquip);
|
|
|
|
//texts[0].text = $"{m_SD_Slot.Lv * m_ESUTD.f_LevelPerValue}%";
|
|
//texts[1].text = texts[4].text = MyText.Get_StatName(m_ESUTD.e_OptionType);
|
|
var curmain = m_ESUTD.Get_MainStatValue(m_SD_Slot.Lv);
|
|
var nextmain = m_ESUTD.Get_MainStatValue(m_SD_Slot.Lv + 1);
|
|
var curmainText = MyText.Get_StatValueText(m_ESUTD.e_OptionType, curmain);
|
|
var nextmainText = MyText.Get_StatValueText(m_ESUTD.e_OptionType, nextmain - curmain);
|
|
//texts[2].text = $"{curmainText}<size=25>+{nextmainText}";
|
|
texts[3].text = DSUtil.Format(418, m_SD_Slot.Lv);
|
|
texts[5].text = $"{curmainText}";
|
|
texts[7].text = $"{MyText.Get_StatValueText(m_ESUTD.e_OptionType, curmain + nextmain - curmain)}";
|
|
texts[6].text = NumberFormatter.FormatNumber(Get_Price());
|
|
|
|
m_EquipItemEnchantOption.Set(m_SD_Slot);
|
|
}
|
|
|
|
int Get_Price() { var price = (int)m_ESUTD.Get_Price(m_SD_Slot.Lv); return price > 0 ? price : 1; }
|
|
public eItem Get_Parts() { return DSUtil.CheckNull(m_Data) ? eItem.None : m_Data.e_EquipParts; }
|
|
public int Get_ItemID() { return m_Data.n_EquipID; }
|
|
|
|
public void OnClick_Reinforce()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
var price = Get_Price();
|
|
if (sdata.Check_ItemAmount(m_ESUTD.n_ConsumeGoodsID, price))
|
|
{
|
|
ServerInfo.Ins.Save_EquipItem_SlotLvUp(m_Data.n_EquipID, () =>
|
|
{
|
|
sdata.Use_Item(m_ESUTD.n_ConsumeGoodsID, price);
|
|
sdata.Add_SlotLv(m_ESUTD.e_EquipParts, price);
|
|
Set_UI();
|
|
NewGameUI.Ins.m_EquipmentUI.m_equipItems.Set();
|
|
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
|
|
|
sdata.Add_MissionCount(ePurpose.EQUIP_SLOT_UPGRADE_ALL);
|
|
sdata.Add_MissionCount(ePurpose.EQUIP_SLOT_UPGRADE_ACC);
|
|
});
|
|
}
|
|
}
|
|
public void OnClick_ReinforceReset()
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (sdata.Get_SlotData(m_ESUTD.e_EquipParts).Lv > 0)
|
|
ServerInfo.Ins.Save_EquipItem_SlotLvUpInit(m_Data.n_EquipID, () =>
|
|
{
|
|
sdata.Init_SlotLv(m_ESUTD.e_EquipParts, m_ESUTD.n_ConsumeGoodsID);
|
|
Set_UI();
|
|
NewGameUI.Ins.m_EquipmentUI.m_equipItems.Set();
|
|
});
|
|
else
|
|
ToastUI.Ins.Set(999900021);
|
|
}
|
|
|
|
public override void OnClick_Back()
|
|
{
|
|
base.OnClick_Back();
|
|
NewGameUI.Ins.m_EquipmentUI.m_EquipmentUI_Enchant.Set_UI();
|
|
NewGameUI.Ins.m_EquipmentUI.Set_Scrollviews(true);
|
|
if (!bRight) DSUtil.ActivateGameObjects(gos_offwhenmoveleft);
|
|
}
|
|
|
|
public void Set_Position(bool right)
|
|
{ // 위치 조절 (좌우)
|
|
bRight = right;
|
|
m_childrect.anchoredPosition = right ? v3_childpos : new Vector2(v3_childpos.x - m_childrect.sizeDelta.x, v3_childpos.y);
|
|
if (!right) DSUtil.InActivateGameObjects(gos_offwhenmoveleft);
|
|
}
|
|
} |