50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ShopCountPopup : BackKeyAdd
|
|
{
|
|
public UISprite[] sprites; // 0 박스, 1 종류, 2 재화, 3 박스 배경 색
|
|
public UILabel[] labels; // 0 필요 가격, 1 토탈 구매 개수
|
|
public ArrowUI m_ArrowUI;
|
|
|
|
eItem m_Price, m_BuyItem;
|
|
ObscuredInt m_PricePerAmount;
|
|
ObscuredDouble m_BuyItemPerAmount;
|
|
|
|
public void Set(string icon, eItem useitem, int useperamount, eItem buyitem, double peramount)
|
|
{
|
|
base.Set();
|
|
|
|
m_Price = useitem;
|
|
m_PricePerAmount = useperamount; m_PricePerAmount.RandomizeCryptoKey();
|
|
m_BuyItem = buyitem;
|
|
m_BuyItemPerAmount = peramount; m_BuyItemPerAmount.RandomizeCryptoKey();
|
|
|
|
sprites[0].spriteName = icon;
|
|
sprites[2].spriteName = DSUtil.Get_ItemSpriteInfo(useitem).Icon;
|
|
|
|
m_ArrowUI.Set(totalamount =>
|
|
{
|
|
labels[0].text = DSUtil.GetThousandCommaText(totalamount * useperamount);
|
|
labels[1].text = NumberFormatter.FormatNumber(totalamount * peramount);
|
|
}, (int)(ServerInfo.Ins.m_ServerData.Get_ItemAmount(useitem) / useperamount), false);
|
|
}
|
|
|
|
public void OnClick_Buy()
|
|
{
|
|
if (m_ArrowUI.Get_TotalCount() > 0)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (sdata.Check_ItemAmount(m_Price, m_ArrowUI.Get_TotalCount() * m_PricePerAmount))
|
|
{
|
|
OnClick_Back();
|
|
var useamount = m_ArrowUI.Get_TotalCount() * m_PricePerAmount;
|
|
sdata.Use_Item(m_Price, useamount, 0, "shop gold");
|
|
GetItemUI.Ins.Set(sdata.Add_Item(new ItemData(m_BuyItem, 0, m_BuyItemPerAmount * m_ArrowUI.Get_TotalCount(), "", eUICardType.GetItem)), true);
|
|
ServerInfo.Ins.Write(GetItemUI.Ins.Show_Items);
|
|
}
|
|
}
|
|
}
|
|
} |