//--------------------------------------------------------------------------- public void Init(Rune rune, bool is_lock, OnRuneClickDelegate _del, int slot_index = 0) { gameObject.SetActive(true); //GetComponent<BoxCollider2D>().enabled = (_del != null && rune != null) || is_lock == true; if (rune == null) { GetComponent <UIButtonScale>().enabled = false; } System.Array.ForEach(gameObject.GetComponentsInChildren(typeof(UIWidget), true), o => o.GetComponent <UIWidget>().enabled = true); m_toggle.Set(is_lock || rune == null); slot_number = slot_number != 0 ? slot_number : slot_index; if (rune != null) { m_LabelGrade.text = rune.Info.Grade.ToString(); m_LabelLevel.text = Localization.Format("HeroLevel", rune.Level); m_SpriteIcon.spriteName = rune.Info.IconID; } m_lock_toggle.Set(is_lock); Rune = rune; OnRuneClick = _del; m_Tooltip.span_press_time = OnRuneClick != null ? 0.2f : 0f; gameObject.GetComponent <UIButtonScale>().enabled = OnRuneClick != null; m_Tooltip.SetDisableTooltip(false); }
public void InitDummy() { Rune = null; OnRuneClick = null; gameObject.SetActive(true); System.Array.ForEach(gameObject.GetComponentsInChildren(typeof(UIWidget), true), o => o.GetComponent <UIWidget>().enabled = false); GetComponent <BoxCollider2D>().enabled = true; m_Tooltip.SetDisableTooltip(true); gameObject.GetComponent <UIButtonScale>().enabled = false; }
public void Init(Rune rune, bool equipped, OnRuneClickDelegate del) { m_OnClickCallback = del; Rune = rune; if (m_RuneItem == null) { m_RuneItem = NGUITools.AddChild(m_RuneIndicator.gameObject, runeItemPrefab).GetComponent <RuneItem>(); } m_EquippedToggle.value = equipped; m_RuneItem.Init(Rune, false, null); m_title.text = Rune.GetName(); m_desc.text = Rune.GetDesc(); m_tween.ResetToBeginning(); m_tween.PlayForward(); m_EventRuneUnequip.SetActive(EventHottimeManager.Instance.IsRuneUnequipEvent); m_EventRuneEnchant.SetActive(EventHottimeManager.Instance.IsRuneEnchantEvent); }