Files
JJBB/Assets/Project/Script/GUI/WorldBoss/BossUIItems/CrossServerBossItem.cs
2024-08-23 15:49:34 +08:00

81 lines
2.4 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using Games.Item;
using GCGame.Table;
using GCGame;
using Games.Fellow;
using Games.GlobeDefine;
public class CrossServerBossItem : UIItemBase
{
public Text LabelText;
public Slider Blood;
public GameObject BeKilled;
public GameObject Detial;
public TimeDownText TimeDown;
public GameObject State;
public GameObject WorldBoss;
public GameObject CrossServerBOSS;
private WorldBossData.SceneBossInfo m_bossInfo;
public override void Show(Hashtable hash)
{
m_bossInfo = (WorldBossData.SceneBossInfo)hash["InitObj"];
if (m_bossInfo == null)
return;
base.Show();
Refresh();
}
public void Click_BossItem()
{
Tab_WorldBoss worldBoss = TableManager.GetWorldBossByID(m_bossInfo.BossID, 0);
if (worldBoss != null)
{
AutoSearchPoint point = new AutoSearchPoint(worldBoss.SceneID, worldBoss.PosX, worldBoss.PosZ, -1, AutoSearchPoint.ChangeMap_Type.WORLDMAP);
if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
{
GameManager.gameManager.AutoSearch.BuildPath(point);
GameManager.gameManager.AutoSearch.Path.autoSearchRadius = 1.5f;
GameManager.gameManager.AutoSearch.Path.AutoSearchTargetName = m_bossInfo.BossName;
}
}
}
private void OnEnable()
{
Refresh();
}
public override void Refresh()
{
base.Refresh();
if (m_bossInfo == null)
return;
WorldBoss.SetActive(m_bossInfo.BossType == 1 || m_bossInfo.BossType == 2);
CrossServerBOSS.SetActive(m_bossInfo.BossType == 3);
LabelText.text = m_bossInfo.NameDesc;
Blood.value = m_bossInfo.LeaveBlood / 100.0f;
Detial.SetActive(m_bossInfo.BeKilled == false);
BeKilled.SetActive(m_bossInfo.BeKilled);
if(m_bossInfo.OverTime <= Time.realtimeSinceStartup || m_bossInfo.BeKilled == false)
{
State.SetActive(true);
TimeDown.Init("", 0);
}
else
{
State.SetActive(false);
TimeDown.Init("", m_bossInfo.OverTime, 0, -1, delegate (Hashtable table)
{
State.SetActive(true);
TimeDown.Init("", 0);
}, TimeDownText.TimeFormat.english,1);
}
}
}