using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class DemonDungeonBehaviour : MonoBehaviour { [SerializeField] Image m_NormalBottom; [SerializeField] Image m_TreasureBottom; [SerializeField] Text m_BossName; [SerializeField] Image m_Icon; [SerializeField] RectTransform m_ContainerSelect; [SerializeField] UIEffect m_Line; TreasureModel model { get { return ModelCenter.Instance.GetModel(); } } public UIEffect line { get { return m_Line; } } public void Display(int treasureId, int level) { TreasureDungeon treasureDungeon; if (model.TryGetTreasureDungeon(treasureId, out treasureDungeon)) { var count = treasureDungeon.dungeonInfos.Count; var maxlevel = treasureDungeon.dungeonInfos[count - 1].level; var active = level <= treasureDungeon.currentLevel; var select = level == treasureDungeon.currentLevel + 1; var dungeonInfo = treasureDungeon.Get(level); m_NormalBottom.gameObject.SetActive(level != maxlevel); m_TreasureBottom.gameObject.SetActive(level == maxlevel); if (!dungeonInfo.Equals(default(TreasureDungeonInfo))) { var config = TreasureDungeonConfig.Get(dungeonInfo.key); m_BossName.text = config.bossName; m_Icon.SetSprite(config.icon); m_Icon.SetNativeSize(); } if (active) { m_BossName.text = Language.Get("PassedTreasureDungeon"); m_BossName.color = UIHelper.GetUIColor(TextColType.Green, true); } else if (select) { m_BossName.color = UIHelper.GetUIColor(TextColType.Red); } else { m_BossName.color = UIHelper.GetUIColor(TextColType.Gray); } transform.localScale = select ? Vector3.one * DemonTreasureWin.expand : Vector3.one; m_ContainerSelect.gameObject.SetActive(select); m_Icon.material = active || select ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); if (level == maxlevel) { m_TreasureBottom.material = active || select ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); } else { m_NormalBottom.material = active || select ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); } } } } }