178 lines
7.6 KiB
C#
178 lines
7.6 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Content_Equipment : MonoBehaviourSingletonTemplate<Content_Equipment>
|
|
{
|
|
public Equipment_Left m_Equipment_Left;
|
|
public Equipment_Right m_Equipment_Right;
|
|
public EquipmentInfoPopup m_EquipmentInfoPopup;
|
|
public EquipmentReinforceInitPopup m_EquipmentReinforceInitPopup;
|
|
public UILabel[] labels; // 0 일괄합성
|
|
|
|
eItem m_type;
|
|
Action<int> act_setTab;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
m_EquipmentInfoPopup.Check();
|
|
m_EquipmentReinforceInitPopup.Check();
|
|
}
|
|
|
|
public void Set(eItem _type, bool _init, Action<int> _settab)
|
|
{
|
|
gameObject.SetActive(true);
|
|
m_type = _type;
|
|
act_setTab = _settab;
|
|
m_Equipment_Left.Set(_init);
|
|
Refresh_RightCards();
|
|
//labels[0].text = MyText.Get_ItemName(_type);
|
|
GameUI.Ins.Clear_newItem(_type);
|
|
}
|
|
public void Refresh_RightCards() { m_Equipment_Right.Set(m_type); }
|
|
public void Select_Card(ItemData _id)
|
|
{
|
|
if (m_type != _id.ItemType)
|
|
{
|
|
m_type = _id.ItemType;
|
|
act_setTab(m_type - eItem.Weapon);
|
|
Refresh_RightCards();
|
|
}
|
|
var card = m_Equipment_Right.Get_Card_orNull(_id);
|
|
if (card != null) Select_ItemData(card);
|
|
}
|
|
public void Select_ItemData(UIItemCard _card)
|
|
{
|
|
_card.Get_ItemData().Deck = m_Equipment_Left.m_DeckTabUI.Get_Tab();
|
|
m_EquipmentInfoPopup.Set(_card);
|
|
}
|
|
|
|
void FindSelectCard(bool reselect)
|
|
{
|
|
//if (reselect || SelectCard == null)
|
|
//{
|
|
// var sdata = ServerInfo.Ins.m_ServerData;
|
|
// if (m_type == eItem.Magic)
|
|
// {
|
|
// // 스킬 선택
|
|
// switch (GameUI.Ins.CommonUI.m_GuideQuestUI.Get_Purpose())
|
|
// {
|
|
// case eGuideQuestPurpose.EquipMagic:
|
|
// if (sdata.Get_Common(eCommon.GuideClear) == 0)
|
|
// for (int ii = 0; ii < list_CardBase.Count; ii++)
|
|
// {
|
|
// var data = list_CardBase[ii] as UIItemCard;
|
|
// if (data.Get_SkillTableData().ID != 1 && data.Get_ItemData().Lv > 0)
|
|
// {
|
|
// SelectCard = data;
|
|
// SelectCard.Set_GuideArrow(true);
|
|
// break;
|
|
// }
|
|
// }
|
|
// break;
|
|
// case eGuideQuestPurpose.EnchantMagic:
|
|
// SelectCard = list_CardBase[0] as UIItemCard;
|
|
// break;
|
|
// default:
|
|
// if (SelectCard == null) SelectCard = list_CardBase[0] as UIItemCard;
|
|
// break;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// SelectCard = list_CardBase[0] as UIItemCard;
|
|
// //int id = sdata.Equip.Get_Preset_byPrest(m_DeckTabUI.Get_Tab()).EquipMentEquip[m_type - eItem.PC];
|
|
// //if (id > 0) SelectCard = list_CardBase.Find(f => (f as UIItemCard).IsID(id)) as UIItemCard;
|
|
// }
|
|
//}
|
|
}
|
|
|
|
public void OnClick_AllMix()
|
|
{
|
|
//Popup.Ins.Set(ePopupType.Two, "일괄합성을 하시겠습니까?", () =>
|
|
Popup.Ins.Set(ePopupType.Two, 0, () =>
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
if (m_type == eItem.Skill)
|
|
{
|
|
List<ItemData> datas = new List<ItemData>();
|
|
// ID, 갯수, 레벨, 특성1, 특성2
|
|
for (int i = 0; i < sdata.Skill.Count; i++)
|
|
{
|
|
//var tdata = table_skilllist.Ins.Get_Data(sdata.Skill[i][0], sdata);
|
|
//if (tdata.e_Grade < eItemGrade.Myth && sdata.Skill[i][1] >= MyValue.arr_NeedMixCount[(int)tdata.e_Grade])
|
|
//{
|
|
// int mixcount = sdata.Skill[i][1] / MyValue.arr_NeedMixCount[(int)tdata.e_Grade];
|
|
// sdata.Use_Item(eItem.Magic, MyValue.arr_NeedMixCount[(int)tdata.e_Grade] * mixcount, tdata.ID, "mix");
|
|
// for (int j = 0; j < mixcount; j++)
|
|
// {
|
|
// int id = MyValue.Get_NextGradeID(tdata.e_Grade);
|
|
// if (id > 0)
|
|
// datas.AddRange(sdata.Add_Item(new ItemData(eItem.Magic, id, 1, "", eUICardType.GetItem)));
|
|
// }
|
|
//}
|
|
}
|
|
if (datas.Count > 0)
|
|
{
|
|
GetItemUI.Ins.Set(datas);
|
|
ServerInfo.Ins.Write(() =>
|
|
{
|
|
GetItemUI.Ins.Show_Items();
|
|
Refresh_RightCards();
|
|
});
|
|
}
|
|
//else
|
|
// ToastUI.Ins.Set("합성할 수 있는 마법이 없습니다.");
|
|
}
|
|
else
|
|
{
|
|
List<List<ObscuredInt>> list = null;
|
|
table_itemdatabase itemtable = null;
|
|
switch (m_type)
|
|
{
|
|
//case eItem.Weapon: list = sdata.Equipment[MyValue.str_EquipMent[0]]; itemtable = table_weapon.Ins; break;
|
|
//case eItem.Ring: list = sdata.Equipment[MyValue.str_EquipMent[2]]; itemtable = table_ring.Ins; NewGameUI.Ins.m_GuideQuestUI.Add_GuideQuest(ePurpose.MixRing); break;
|
|
//case eItem.Neck: list = sdata.Equipment[MyValue.str_EquipMent[3]]; itemtable = table_neck.Ins; break;
|
|
//case eItem.Boots: list = sdata.Equipment[MyValue.str_EquipMent[4]]; itemtable = table_boots.Ins; break;
|
|
//case eItem.Fairy: list = sdata.Equipment[MyValue.str_EquipMent[5]]; itemtable = table_fairy.Ins; break;
|
|
}
|
|
if (list != null && itemtable != null)
|
|
{
|
|
List<ItemData> datas = new List<ItemData>();
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (list[i][1] > 0)
|
|
{
|
|
var tabledata = itemtable.Get_Data(list[i][0]);
|
|
if (tabledata.Grade < eItemGrade.Myth)
|
|
{
|
|
int mixcount = list[i][3] / MyValue.arr_NeedMixCount[(int)tabledata.Grade];
|
|
sdata.Use_Item(m_type, mixcount * MyValue.arr_NeedMixCount[(int)tabledata.Grade], tabledata.ID, "mix");
|
|
for (int j = 0; j < mixcount; j++)
|
|
{
|
|
int id = MyValue.Get_NextGradeID(tabledata.Grade);
|
|
if (id > 0)
|
|
datas.AddRange(sdata.Add_Item(new ItemData(m_type, id, 1, "", eUICardType.GetItem)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (datas.Count > 0)
|
|
{
|
|
GetItemUI.Ins.Set(datas);
|
|
ServerInfo.Ins.Write(() =>
|
|
{
|
|
GetItemUI.Ins.Show_Items();
|
|
Refresh_RightCards();
|
|
});
|
|
}
|
|
//else
|
|
// ToastUI.Ins.Set("합성할 수 있는 아이템이 없습니다.");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
} |