Files
JJBB/Assets/Project/Script/GUI/Equip/EquipQianghuaSuitTips.cs

136 lines
4.3 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using GCGame.Table;
using Games.Item;
using Games.GlobeDefine;
using GCGame;
using System.Collections.Generic;
using Module.Log;
using Games.UserCommonData;
public class EquipQianghuaSuitTips : UIControllerBase<EquipQianghuaSuitTips>
{
void OnEnable()
{
SetInstance(this);
}
void OnDisable()
{
SetInstance(null);
}
#region static
// isJustShowCur - 是否只显示当前等级套装
public static void Show(int suitLevel, int nextEquipCnt, bool isJustShowCur = false)
{
Hashtable hash = new Hashtable();
hash.Add("SuitLevel", suitLevel);
hash.Add("NextSuitCnt", nextEquipCnt);
hash.Add("IsJustShowCur", isJustShowCur);
UIManager.ShowUI(UIInfo.EquipQianghuaSuitTips, EquipQianghuaSuitTips.ShowUIOver, hash);
}
static void ShowUIOver(bool bSuccess, object param)
{
if (bSuccess)
{
Hashtable hash = param as Hashtable;
if (EquipQianghuaSuitTips.Instance() != null)
{
EquipQianghuaSuitTips.Instance().ShowInner((int)hash["SuitLevel"], (int)hash["NextSuitCnt"], (bool)hash["IsJustShowCur"]);
}
}
}
void ShowInner(int suitLevel, int nextSuitCnt, bool isJustShowCur)
{
ShowQianghuaLevel(suitLevel, nextSuitCnt, isJustShowCur);
}
#endregion
public GameObject _CurSuitPanel;
public GameObject _NextSuitPanel;
public Text _CurName;
public Text[] _Attrs;
public Text _CombatValue;
public Text _LevelReq;
public EquipStarProcess _PerfectReq;
public Text _NextName;
public Text[] _NextAttrs;
public Text _NextCombatValue;
public Text _NextLevelReq;
public EquipStarProcess _NextPerfectReq;
// 注意!!! Level是提升等级而不是ID
private void ShowQianghuaLevel(int level, int nextSuitCnt, bool isJustShowCur)
{
var temp = TableManager.GetEquipEnchanceSuit().Values;
Tab_EquipEnchanceSuit tabCurLevel = null;
foreach (var v in temp)
{
if (v.EnchanceLevel == level)
{
tabCurLevel = v;
break;
}
}
if (tabCurLevel == null)
_CurSuitPanel.SetActive(false);
else
{
_CurName.text = StrDictionary.GetClientDictionaryString("#{5311}", tabCurLevel.EnchanceLevel);
for (int i = 0; i < _Attrs.Length; ++i)
{
_Attrs[i].text = PropID.GetAttrValue((PropID.PropertyID)tabCurLevel.GetPropIDbyIndex(i), tabCurLevel.GetPropSubIDbyIndex(i), tabCurLevel.GetPropValuebyIndex(i));
}
_CombatValue.text = StrDictionary.GetClientDictionaryString("#{5314}", 1770);
_LevelReq.text = StrDictionary.GetClientDictionaryString("#{5312}", tabCurLevel.EquipNum, tabCurLevel.EnchanceLevel);
_PerfectReq.Value = tabCurLevel.PerfectID;
_CurSuitPanel.SetActive(true);
}
if(isJustShowCur == true)
{
_NextSuitPanel.SetActive(false);
return;
}
Tab_EquipEnchanceSuit tabNextLevel;
if (level == 0)
{
tabNextLevel = TableManager.GetEquipEnchanceSuitByID(1, 0);
}
else
{
tabNextLevel = TableManager.GetEquipEnchanceSuitByID(tabCurLevel.Id +1, 0);
}
if (tabNextLevel == null)
_NextSuitPanel.SetActive(false);
else
{
_NextName.text = StrDictionary.GetClientDictionaryString("#{5313}", tabNextLevel.EnchanceLevel, nextSuitCnt, tabNextLevel.EquipNum);
for (int i = 0; i < _Attrs.Length; ++i)
{
_NextAttrs[i].text = PropID.GetAttrValue((PropID.PropertyID)tabNextLevel.GetPropIDbyIndex(i), tabNextLevel.GetPropSubIDbyIndex(i), tabNextLevel.GetPropValuebyIndex(i));
}
_NextCombatValue.text = StrDictionary.GetClientDictionaryString("#{5314}", 1770);
_NextLevelReq.text = StrDictionary.GetClientDictionaryString("#{5312}", tabNextLevel.EquipNum, tabNextLevel.EnchanceLevel);
_NextPerfectReq.Value = tabNextLevel.PerfectID;
_NextSuitPanel.SetActive(true);
}
}
public void CloseWindow()
{
UIManager.CloseUI(UIInfo.EquipQianghuaSuitTips);
}
}