Files
JJBB/Assets/Project/Script/GUI/MeridiaSoul/BossBookSuitItem.cs

113 lines
2.9 KiB
C#
Raw Normal View History

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

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using GCGame.Table;
using Games.Mission;
using Games.Events;
using Games.Item;
using GCGame;
using Games.GlobeDefine;
public class BossBookSuitItem : UIItemBase
{
public Text _Name;
public Text _BossNames;
public List<Image> _BossIcons;
public List<Text> _Attrs;
public GameObject _BtnAct;
public GameObject _ActtedGO;
#region
Tab_BossHandBookCombine _ShowBossSuit;
public override void Show(Hashtable hash)
{
base.Show(hash);
var bossInfo = (Tab_BossHandBookCombine)hash["InitObj"];
ShowLevelItem(bossInfo);
}
public void ShowLevelItem(Tab_BossHandBookCombine bossSuitTable)
{
_ShowBossSuit = bossSuitTable;
List<Tab_BossHandBook> bossTabs = new List<Tab_BossHandBook>();
_Name.text = bossSuitTable.Name;
var bossNames = "(";
for (int i = 0; i < bossSuitTable.BossId.Length; ++i)
{
if (bossSuitTable.BossId[i] > 0)
{
var bossTab = BossBookPanel.GetBossBookTab(bossSuitTable.BossId[i], bossSuitTable.Level[i]);
bossNames += bossTab.Name + "-" + StrDictionary.GetClientDictionaryString("#{8113}", bossSuitTable.Level[i]);
bossTabs.Add(bossTab);
LoadAssetBundle.Instance.SetImageSprite(_BossIcons[i], bossTab.Icon);
if (i != bossSuitTable.BossId.Length - 1)
{
bossNames += " ";
}
}
}
bossNames += ")";
_BossNames.text = bossNames;
for (int i = 0; i < _Attrs.Count; ++i)
{
if (bossSuitTable.PropId[i] > 0)
{
string propName = PropID.GetAttrName((PropID.PropertyID)bossSuitTable.PropId[i]);
_Attrs[i].text = propName + "+" + bossSuitTable.PropVal[i];
}
else
{
_Attrs[i].text = "";
}
}
if (BossBookPanel.ActedSuidIDs.Contains(_ShowBossSuit.Id))
{
_BtnAct.SetActive(false);
_ActtedGO.SetActive(true);
}
else
{
_ActtedGO.SetActive(false);
var bossCanAct = true;
foreach (var bossTab in bossTabs)
{
if (!BossBookPanel.IsBoosLevel(bossTab.BossId, bossTab.Level))
{
bossCanAct = false;
break;
}
}
if (bossCanAct)
{
_BtnAct.SetActive(true);
}
else
{
_BtnAct.SetActive(false);
}
}
}
public void OnBtnAct()
{
ReqHandbookBossCombineActive packet = new ReqHandbookBossCombineActive();
packet.CombineId = _ShowBossSuit.Id;
packet.SendMsg();
}
#endregion
}