177 lines
5.3 KiB
C#
177 lines
5.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Equipment_Right : ScrollViewMgr
|
|
{
|
|
eItem m_type;
|
|
public bool IsInit { get; private set; }
|
|
|
|
public void Set(eItem _type)
|
|
{
|
|
m_type = _type;
|
|
Set_UI(true);
|
|
Check_GuideQuest();
|
|
IsInit = true;
|
|
}
|
|
public void Set_UI(bool _movescroll)
|
|
{
|
|
var sdata = ServerInfo.Ins.m_ServerData;
|
|
|
|
var curPreset = Content_Equipment.Ins.m_Equipment_Left.m_DeckTabUI.Get_Tab();
|
|
List<ItemData> list = null;
|
|
switch (m_type)
|
|
{
|
|
//case eItem.Weapon: list = table_weapon.Ins.Get_ItemDatas(curPreset, eUICardType.UI); break;
|
|
case eItem.Fairy: list = table_fairy.Ins.Get_ItemDatas(curPreset, eUICardType.UI); break;
|
|
//case eItem.Skill: list = table_skilllist.Ins.Get_ItemDatas(curPreset, eUICardType.UI); break;
|
|
}
|
|
//if (_movescroll)
|
|
//{
|
|
// if (m_type == eItem.Magic)
|
|
// {
|
|
// int magicequipid = sdata.Equip.Get_Preset_byPrest(curPreset).MagicEquip.Find(f => f > 0);
|
|
// MoveScroll(magicequipid);
|
|
// }
|
|
// else
|
|
// MoveScroll(sdata.Equip.Get_Preset_byPrest(curPreset).EquipMentEquip[m_type - eItem.PC]);
|
|
//}
|
|
Set_ScrollView(list);
|
|
}
|
|
|
|
void Check_GuideQuest()
|
|
{
|
|
switch (NewGameUI.Ins.m_GuideQuestUI.Get_Purpose())
|
|
{
|
|
// 제일 앞 카드
|
|
case ePurpose.MixRing:
|
|
if (m_type == eItem.Ring && ServerInfo.Ins.m_ServerData.Get_Common(eCommon.GuideClear) == 0)
|
|
(list_CardBase[0] as UIItemCard).Set_GuideArrow(true);
|
|
break;
|
|
case ePurpose.EnchantMagic:
|
|
if (m_type == eItem.Skill && ServerInfo.Ins.m_ServerData.Get_Common(eCommon.GuideClear) == 0)
|
|
(list_CardBase[0] as UIItemCard).Set_GuideArrow(true);
|
|
break;
|
|
|
|
// 제일 좋은 카드
|
|
case ePurpose.EqiupWeapon:
|
|
Check_GuideItem(eItem.Weapon, true);
|
|
break;
|
|
case ePurpose.EqiupFairy:
|
|
Check_GuideItem(eItem.Fairy, true);
|
|
break;
|
|
|
|
// 제일 앞 카드 말고 안 좋은 카드
|
|
case ePurpose.EquipMagic:
|
|
Check_GuideItem(eItem.Skill, false);
|
|
break;
|
|
}
|
|
}
|
|
void Check_GuideItem(eItem item, bool findhigh)
|
|
{
|
|
if (m_type == item && ServerInfo.Ins.m_ServerData.Get_Common(eCommon.GuideClear) == 0)
|
|
{
|
|
var card = findhigh ? Get_HighIDCard() : Get_LowIDCard_Not1();
|
|
card.Set_GuideArrow(true);
|
|
MoveScroll(card.Get_ItemData().Get_ID());
|
|
}
|
|
}
|
|
UIItemCard Get_HighIDCard()
|
|
{
|
|
UIItemCard HighItem = null;
|
|
for (int i = 0; i < list_CardBase.Count; i++)
|
|
{
|
|
var data = list_CardBase[i] as UIItemCard;
|
|
if (HighItem == null)
|
|
{
|
|
if (data.Get_ItemData().Lv > 0)
|
|
HighItem = data;
|
|
}
|
|
else
|
|
{
|
|
if (data.Get_ItemData().Lv > 0 && HighItem.Get_ItemData().Get_ID() < data.Get_ItemData().Get_ID())
|
|
HighItem = data;
|
|
}
|
|
}
|
|
return HighItem;
|
|
}
|
|
UIItemCard Get_LowIDCard_Not1()
|
|
{
|
|
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)
|
|
return data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public UIItemCard Get_Card_orNull(ItemData _id)
|
|
{
|
|
for (int i = 0; i < list_CardBase.Count; i++)
|
|
{
|
|
var card = list_CardBase[i] as UIItemCard;
|
|
if (card.Get_ItemData().Get_ID() == _id.Get_ID() && card.Get_ItemData().ItemType == _id.ItemType)
|
|
return card;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public UIItemCard Get_PreNextCard_orNull(bool _ismix, bool _pre, int _id)
|
|
{
|
|
UIItemCard findcard = null;
|
|
int id;
|
|
if (_pre)
|
|
{
|
|
id = _id - 1;
|
|
if (_ismix)
|
|
{
|
|
if (id < 1) id = 24;
|
|
}
|
|
else
|
|
{
|
|
if (id < 1) id = 28;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
id = _id + 1;
|
|
if (_ismix)
|
|
{
|
|
if (id > 24) id = 1;
|
|
}
|
|
else
|
|
{
|
|
if (id > 28) id = 1;
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < list_CardBase.Count; i++)
|
|
{
|
|
var card = list_CardBase[i] as UIItemCard;
|
|
if (card.IsID(id))
|
|
{
|
|
findcard = card;
|
|
break;
|
|
}
|
|
}
|
|
if (findcard != null)
|
|
{
|
|
findcard.Get_ItemData().Deck = Content_Equipment.Ins.m_Equipment_Left.m_DeckTabUI.Get_Tab();
|
|
MoveScroll(id);
|
|
}
|
|
return findcard;
|
|
}
|
|
|
|
void MoveScroll(int id)
|
|
{
|
|
// 스크롤뷰 이동
|
|
Set_Coroutine(() =>
|
|
{
|
|
var grade = MyValue.Get_GradebyID(id);
|
|
if (grade < eItemGrade.Unique) m_scrollview.SetDragAmount(0f, 0f, false);
|
|
else m_scrollview.SetDragAmount(0f, (int)grade / 7f, false);
|
|
}, Time.deltaTime);
|
|
}
|
|
} |