using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
public class RealmHeartMagicBehaviour : MonoBehaviour
|
{
|
[SerializeField] Text m_BossName;
|
[SerializeField] Text m_FightPower;
|
[SerializeField] RawImage m_RawBoss;
|
[SerializeField] Button m_Goto;
|
[SerializeField] UIEffect m_OpenEffect;
|
|
const string State_EnterHash = "Show";
|
const string State_IdleHash = "Idle";
|
|
int realmLevel = 0;
|
|
DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
|
private void Awake()
|
{
|
m_Goto.AddListener(GotoBoss);
|
}
|
|
public void Display(int realmLevel)
|
{
|
this.realmLevel = realmLevel;
|
|
DisplayBase();
|
|
m_RawBoss.SetActive(false);
|
m_OpenEffect.Play();
|
|
StartCoroutine(Co_DisplayBoss());
|
}
|
|
void DisplayBase()
|
{
|
var config = RealmConfig.Get(realmLevel);
|
var fightPower = PlayerDatas.Instance.baseData.FightPoint;
|
var satisfy = fightPower >= (ulong)config.FightPower;
|
var label = UIHelper.AppendColor(satisfy ? TextColType.LightGreen : TextColType.Red, fightPower.ToString());
|
m_FightPower.text = StringUtility.Contact(UIHelper.AppendColor(TextColType.LightGreen,
|
Language.Get("RolePromoteBetterFight")), label, "/", config.FightPower);
|
var npcConfig = NPCConfig.Get(config.BossID);
|
m_BossName.text = npcConfig.charName;
|
}
|
|
IEnumerator Co_DisplayBoss()
|
{
|
yield return WaitingForSecondConst.WaitMS1800;
|
DisplayBoss();
|
}
|
|
void DisplayBoss()
|
{
|
var config = RealmConfig.Get(realmLevel);
|
m_RawBoss.SetActive(true);
|
UI3DModelExhibition.Instance.ShowNPC(m_RawBoss, new UI3DNPCExhibitionData()
|
{
|
gray = false,
|
isDialogue = false,
|
npcId = config.BossID,
|
});
|
|
var npcConfig = NPCConfig.Get(config.BossID);
|
|
var npcModel = UI3DModelExhibition.Instance.NpcModelPet;
|
if (npcModel != null)
|
{
|
var animator = npcModel.GetComponentInChildren<Animator>();
|
if (animator != null)
|
{
|
var runtimeController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerRealmSuffix, npcConfig.MODE);
|
animator.runtimeAnimatorController = runtimeController;
|
animator.Play(State_EnterHash, 0);
|
}
|
}
|
}
|
|
public void Dispose()
|
{
|
UI3DModelExhibition.Instance.StopShow();
|
StopAllCoroutines();
|
}
|
|
private void GotoBoss()
|
{
|
if (CrossServerUtility.IsCrossServer())
|
{
|
SysNotifyMgr.Instance.ShowTip("CrossMap10");
|
return;
|
}
|
dungeonModel.SingleChallenge(RealmModel.REALM_DUNGEON_ID, 0);
|
}
|
}
|
}
|
|