208 lines
5.9 KiB
C#
208 lines
5.9 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
|
|
public class EquipGemSuitRoot : UIControllerBase<EquipGemSuitRoot>
|
|
{
|
|
void Awake()
|
|
{
|
|
SetInstance(this);
|
|
}
|
|
|
|
void OnDestory()
|
|
{
|
|
SetInstance(null);
|
|
}
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void CloseWindow()
|
|
{
|
|
UIManager.ShowUI(UIInfo.EquipEnhance);
|
|
UIManager.CloseUI(UIInfo.EquipGemSuit);
|
|
}
|
|
|
|
#region show
|
|
|
|
|
|
public static void Show(GameItem selectedItem)
|
|
{
|
|
var gemSuitInlay = TableManager.GetGemSuitInlayByID(selectedItem.DataID, 0);
|
|
var suitTabs = TableManager.GetGemSuit().Values;
|
|
List<Tab_GemSuit> gemSuits = new List<Tab_GemSuit>();
|
|
for (int i = 0; i < gemSuitInlay.getSuitIDCount(); ++i)
|
|
{
|
|
int suitID = (gemSuitInlay.GetSuitIDbyIndex(i));
|
|
if (suitID < 0)
|
|
continue;
|
|
|
|
foreach (var gemsuit in suitTabs)
|
|
{
|
|
if (gemsuit.SuitID == suitID && gemsuit.SuitLevel == _GemSuitMaxLevel)
|
|
gemSuits.Add(gemsuit);
|
|
}
|
|
}
|
|
if (gemSuits.Count == 0)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5389}"));
|
|
return;
|
|
}
|
|
|
|
Hashtable hash = new Hashtable();
|
|
hash.Add("SelectedItem", selectedItem);
|
|
hash.Add("GemSuits", gemSuits);
|
|
|
|
UIManager.ShowUI(UIInfo.EquipGemSuit, EquipGemSuitRoot.ShowUIOver, hash);
|
|
}
|
|
|
|
static void ShowUIOver(bool bSuccess, object param)
|
|
{
|
|
if (bSuccess)
|
|
{
|
|
Hashtable hash = param as Hashtable;
|
|
if (EquipGemSuitRoot.Instance() != null)
|
|
{
|
|
EquipGemSuitRoot.Instance().ShowInner((GameItem)hash["SelectedItem"], (List<Tab_GemSuit>)hash["GemSuits"]);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ShowInner(GameItem selectedItem, List<Tab_GemSuit> gemSuits)
|
|
{
|
|
ShowGemEquip(selectedItem, gemSuits);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region
|
|
|
|
private static List<string> _GemSuitLevelText;
|
|
private static int _GemSuitMaxLevel = 10;
|
|
|
|
public UIContainerSelect _GemSuits;
|
|
public GameObject _GemSuitLevelPanel;
|
|
public UISubScollMenu _GemSuitLevels;
|
|
public Text _SuitName;
|
|
public Text _SuitNeedLevel;
|
|
public Text _SuitGemLevel;
|
|
public Text _SuitAttrs;
|
|
public Text[] _SuitGems;
|
|
|
|
private GameItem _SelectEquip;
|
|
private Tab_GemSuit _SelectSuit;
|
|
|
|
private void ShowGemEquip(GameItem selectedItem, List<Tab_GemSuit> gemSuits)
|
|
{
|
|
_SelectEquip = selectedItem;
|
|
|
|
Hashtable hash = new Hashtable();
|
|
hash.Add("EquipItem", _SelectEquip);
|
|
_GemSuits.InitSelectContent(gemSuits, null, OnSelectGemSuit, null, hash);
|
|
|
|
}
|
|
|
|
private void OnSelectGemSuit(object gemTabObj)
|
|
{
|
|
Tab_GemSuit gemSuitTab = gemTabObj as Tab_GemSuit;
|
|
if (gemSuitTab == null)
|
|
return;
|
|
|
|
_GemSuitLevels.Clear();
|
|
_SelectSuit = gemSuitTab;
|
|
//if (_GemSuitLevelText == null)
|
|
//{
|
|
_GemSuitLevelText = new List<string>();
|
|
for (int i = 0; i < _GemSuitMaxLevel; ++i)
|
|
{
|
|
_GemSuitLevelText.Add(StrDictionary.GetClientDictionaryString("#{1166}", i + 1));
|
|
_GemSuitLevels.PushMenu(_GemSuitLevelText[i]);
|
|
}
|
|
//}
|
|
|
|
_GemSuitLevelPanel.SetActive(true);
|
|
_GemSuitLevels.ShowDefaultFirst();
|
|
}
|
|
|
|
public void OnHideSuitLevelPanel()
|
|
{
|
|
_GemSuitLevelPanel.SetActive(false);
|
|
}
|
|
|
|
public void OnGemSuitLevelMenu(object menuObj)
|
|
{
|
|
string menuStr = menuObj as string;
|
|
int level = _GemSuitLevelText.IndexOf(menuStr);
|
|
if (level < 0)
|
|
return;
|
|
|
|
var tabGemsuits = TableManager.GetGemSuit().Values;
|
|
Tab_GemSuit gemSuitTab = null;
|
|
++level;
|
|
foreach (var tabGemsuit in tabGemsuits)
|
|
{
|
|
if(tabGemsuit.SuitID == _SelectSuit.SuitID && tabGemsuit.SuitLevel == level)
|
|
{
|
|
gemSuitTab = tabGemsuit;
|
|
}
|
|
}
|
|
if (gemSuitTab == null)
|
|
return;
|
|
|
|
//_SuitGemLevel.text = StrDictionary.GetClientDictionaryString("#{1166}", level);
|
|
_SuitName.text = StrDictionary.GetClientDictionaryString("#{1166}", level) + gemSuitTab.Name;
|
|
int needLevel = TableManager.GetGemInlayLvlLimitByID(level, 0).MinLvl;
|
|
if (needLevel > GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Level)
|
|
{
|
|
_SuitNeedLevel.text = StrDictionary.GetClientDictionaryString("#{5526}") + StrDictionary.GetClientDictionaryString("#{1166}", needLevel) + "</color>";
|
|
}
|
|
else
|
|
{
|
|
_SuitNeedLevel.text = StrDictionary.GetClientDictionaryString("#{1166}", needLevel);
|
|
}
|
|
|
|
for (int i = 0; i < _SuitGems.Length; ++i)
|
|
{
|
|
//var gemData = TableManager.GetCommonItemByID(gemSuitTab.GetGemIDbyIndex(i), 0);
|
|
//if (gemData != null)
|
|
//{
|
|
// _SuitGems[i].text = Utils.GetQualityColorInTip(gemData.Quality) + gemSuitTab.SuitLevel + "级" + gemData.Name + "</color>";
|
|
// _SuitGems[i].gameObject.SetActive(true);
|
|
//}
|
|
//else
|
|
//{
|
|
// _SuitGems[i].gameObject.SetActive(false);
|
|
//}
|
|
|
|
}
|
|
|
|
string suitAttr = "";
|
|
for (int i = 0; i < gemSuitTab.getPropIDCount(); ++i)
|
|
{
|
|
var propID = gemSuitTab.GetPropIDbyIndex(i);
|
|
if (propID < 0)
|
|
continue;
|
|
|
|
suitAttr += PropID.GetAttrValue((PropID.PropertyID)propID, gemSuitTab.GetPropSubIDbyIndex(i), gemSuitTab.GetPropValuebyIndex(i)) + "\n";
|
|
}
|
|
suitAttr = suitAttr.Substring(0, suitAttr.Length - 1);
|
|
_SuitAttrs.text = suitAttr;
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|