2024-12-15 01:39:39 +00:00
|
|
|
using CodeStage.AntiCheat.ObscuredTypes;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class MixPopup : MenuBase
|
|
|
|
|
{
|
|
|
|
|
public ArrowUI m_ArrowUI;
|
|
|
|
|
public UISprite[] sprites; // 0 왼쪽 등급, 1 왼쪽 아이콘, 2 오른쪽 등급, 3 오른쪽 아이콘
|
|
|
|
|
public UILabel[] labels; // 0 왼쪽, 1 오른쪽
|
|
|
|
|
|
|
|
|
|
UIItemCard m_UIItemCard;
|
|
|
|
|
ItemData m_ItemData;
|
|
|
|
|
ObscuredInt m_MixNeedAmount;
|
|
|
|
|
|
|
|
|
|
public void Set(UIItemCard mixItemData, int mixneedamount = -1) // - 1 이면 기존값 사용
|
|
|
|
|
{
|
|
|
|
|
if (mixItemData.Get_ItemData().Grade >= eItemGrade.Myth)
|
|
|
|
|
{
|
|
|
|
|
//ToastUI.Ins.Set("합성할 수 없는 등급입니다.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Set_On();
|
|
|
|
|
m_UIItemCard = mixItemData;
|
|
|
|
|
m_ItemData = m_UIItemCard.Get_ItemData();
|
|
|
|
|
if (mixneedamount > 0)
|
|
|
|
|
{
|
|
|
|
|
m_MixNeedAmount = mixneedamount;
|
|
|
|
|
m_MixNeedAmount.RandomizeCryptoKey();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprites[0].spriteName = DSUtil.Get_GradeSpriteName(m_ItemData.Grade);
|
|
|
|
|
sprites[1].spriteName = m_ItemData.IconInfo.Icon;
|
|
|
|
|
sprites[2].spriteName = DSUtil.Get_GradeSpriteName(m_ItemData.Grade + 1);
|
|
|
|
|
sprites[3].spriteName = DSUtil.Get_ItemSpriteInfo(eItem.IdontKnow).Icon;
|
|
|
|
|
|
|
|
|
|
Refresh_UI();
|
|
|
|
|
}
|
|
|
|
|
void Refresh_UI()
|
|
|
|
|
{
|
|
|
|
|
m_ArrowUI.Set(count =>
|
|
|
|
|
{
|
|
|
|
|
labels[0].text = DSUtil.Format("{0:N0}([ff0000]-{1}[-])", m_ItemData.Amount, m_MixNeedAmount * count);
|
|
|
|
|
labels[1].text = DSUtil.Format("[00ff00]+{0}", count);
|
|
|
|
|
}, (int)(m_ItemData.Amount / m_MixNeedAmount));
|
|
|
|
|
}
|
|
|
|
|
public void OnClick_Mix()
|
|
|
|
|
{
|
|
|
|
|
var count = m_ArrowUI.Get_TotalCount();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
|
List<ItemData> itemlst = new List<ItemData>();
|
|
|
|
|
if (m_ItemData != null)
|
|
|
|
|
{
|
|
|
|
|
ObscuredInt needMixAmount = MyValue.arr_NeedMixCount[(int)m_ItemData.Grade];
|
|
|
|
|
needMixAmount.RandomizeCryptoKey();
|
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (m_ItemData.Lv > 0 && sdata.Check_ItemAmount(m_ItemData.ItemType, needMixAmount, m_ItemData.Get_ID()))
|
|
|
|
|
{
|
|
|
|
|
int id = MyValue.Get_NextGradeID(m_ItemData.Grade);
|
|
|
|
|
if (id > 0)
|
|
|
|
|
{
|
|
|
|
|
sdata.Use_Item(m_ItemData.ItemType, needMixAmount, m_ItemData.Get_ID());
|
|
|
|
|
m_ItemData.Amount -= needMixAmount;
|
|
|
|
|
itemlst.AddRange(sdata.Add_Item(new ItemData(m_ItemData.ItemType, id, 1, "", eUICardType.GetItem)));
|
2025-03-17 07:34:17 +00:00
|
|
|
//if (Get_RepeatMissionID_Mix() > 0) sdata.Add_MissionCount(MyValue.arr_Mission[1], Get_RepeatMissionID_Mix());
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-17 00:08:46 +00:00
|
|
|
//switch (m_ItemData.ItemType)
|
|
|
|
|
//{
|
|
|
|
|
// case eItem.Ring: NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.MixRing); break;
|
|
|
|
|
//}
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
GetItemUI.Ins.Set(itemlst);
|
|
|
|
|
ServerInfo.Ins.Write(() =>
|
|
|
|
|
{
|
|
|
|
|
if (m_ItemData.ItemType == eItem.Pet)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
GetItemUI.Ins.Show_Items();
|
|
|
|
|
Refresh_UI();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void MixAll()
|
|
|
|
|
{
|
|
|
|
|
m_ArrowUI.OnClick_RightMax();
|
|
|
|
|
OnClick_Mix();
|
|
|
|
|
Set_Off();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Get_RepeatMissionID_Mix()
|
|
|
|
|
{
|
|
|
|
|
if (m_ItemData.ItemType == eItem.Pet) return 21;
|
|
|
|
|
else if (m_ItemData.ItemType == eItem.Skill) return 22;
|
|
|
|
|
return m_ItemData.ItemType - eItem.Weapon + 16;
|
|
|
|
|
}
|
|
|
|
|
}
|