//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Saturday, August 18, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using TableConfig;
|
|
namespace Snxxz.UI
|
{
|
|
public class DogzDungeonBreifInfoBehaviour : FindPreciousBossBriefInfoBehaviour
|
{
|
|
[SerializeField] Text m_RefreshTimesDescription;
|
[SerializeField] Image m_Attention;
|
|
protected override int selectedBossId {
|
get {
|
return model.selectedBoss;
|
}
|
set {
|
model.selectedBoss = value;
|
}
|
}
|
|
protected override InteractorableState interactorableState {
|
get {
|
var selected = selectedBossId == bossId;
|
var dieOrLocked = !model.IsBossUnLocked(bossId) || !findPreciousModel.IsBossAlive(bossId);
|
|
if (!dieOrLocked)
|
{
|
return selected ? InteractorableState.NormalSelected : InteractorableState.NormalUnSelected;
|
}
|
else
|
{
|
return selected ? InteractorableState.DieOrLockedSelected : InteractorableState.DieOrLockedUnSelected;
|
}
|
}
|
set {
|
base.interactorableState = value;
|
}
|
}
|
|
protected override bool isUnLocked {
|
get {
|
return model.IsBossUnLocked(bossId);
|
}
|
}
|
|
DogzDungeonModel model { get { return ModelCenter.Instance.GetModel<DogzDungeonModel>(); } }
|
|
protected override void DrawBossBaseInfo(string _icon, string _name, int _level, int _realm)
|
{
|
var config = ConfigManager.Instance.GetTemplate<DogzDungeonConfig>(bossId);
|
m_Portrait.SetSprite(_icon);
|
m_Portrait.SetNativeSize();
|
m_BossName.text = _name;
|
|
m_BossLevel.text = config.MonsterType == 3 ? "(随机boss)" : Language.Get("Z1024", _level);
|
|
if (m_Realm != null)
|
{
|
if (_realm > 0)
|
{
|
m_Realm.gameObject.SetActive(true);
|
var realmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(_realm);
|
if (realmConfig != null)
|
{
|
m_Realm.SetSprite(realmConfig.Img);
|
}
|
}
|
else
|
{
|
m_Realm.gameObject.SetActive(false);
|
}
|
}
|
}
|
|
private void DisplayRefreshTimesDescription()
|
{
|
var config = ConfigManager.Instance.GetTemplate<DogzDungeonConfig>(bossId);
|
|
var timeStrings = new string[config.RefreshTime.Length];
|
for (int i = 0; i < config.RefreshTime.Length; i++)
|
{
|
timeStrings[i] = config.RefreshTime[i].ToString();
|
}
|
|
m_RefreshTimesDescription.text = string.Join("、", timeStrings);
|
|
}
|
|
|
public override void Display(object _data)
|
{
|
base.Display(_data);
|
|
m_Attention.gameObject.SetActive(findPreciousModel.IsBossSubscribed(bossId));
|
var config = ConfigManager.Instance.GetTemplate<WorldBossConfig>(bossId);
|
var npcConfig = ConfigManager.Instance.GetTemplate<NPCConfig>(bossId);
|
|
DrawBossBaseInfo(config.PortraitID, npcConfig.charName, npcConfig.NPCLV, npcConfig.Realm);
|
UpdateBossRebornCoolDown(isUnLocked);
|
UpdateBossPortrait(interactorableState);
|
OnSelected(bossId);
|
|
model.bossSelectedEvent -= OnSelected;
|
model.bossSelectedEvent += OnSelected;
|
}
|
|
public override void Dispose()
|
{
|
base.Dispose();
|
model.bossSelectedEvent -= OnSelected;
|
}
|
|
private void OnSelected(int _bossId)
|
{
|
UpdateBossNameLevelFont(interactorableState);
|
}
|
|
protected override void OnSubscribe(int _bossId)
|
{
|
base.OnSubscribe(_bossId);
|
if (bossId != _bossId)
|
{
|
return;
|
}
|
|
m_Attention.gameObject.SetActive(findPreciousModel.IsBossSubscribed(bossId));
|
}
|
|
}
|
|
}
|