private void OnEntryClicked(Object p_sender, EventArgs p_args) { UnlockContentEntry unlockContentEntry = p_sender as UnlockContentEntry; if (unlockContentEntry != m_selectedEntry) { SelectEntry(unlockContentEntry); } }
public void Open() { NGUITools.SetActiveSelf(this.gameObject, true); m_isVisible = true; if (!m_initialised) { IEnumerable <UnlockableContentStaticData> iterator = StaticDataHandler.GetIterator <UnlockableContentStaticData>(EDataType.UNLOCKABLE_CONTENT); foreach (UnlockableContentStaticData p_data in iterator) { GameObject gameObject = NGUITools.AddChild(m_grid.gameObject, m_entryPrefab); UnlockContentEntry component = gameObject.GetComponent <UnlockContentEntry>(); component.Init(p_data); component.OnClicked += OnEntryClicked; m_entries.Add(component); } m_initialised = true; } SelectEntry(m_entries[0]); }
private void SelectEntry(UnlockContentEntry p_entry) { if (m_selectedEntry != null) { m_selectedEntry.SetSelected(false); } m_selectedEntry = p_entry; m_selectedEntry.SetSelected(true); m_contentTitle.text = LocaManager.GetText(m_selectedEntry.StaticData.NameKey); m_contentInfo.text = LocaManager.GetText(m_selectedEntry.StaticData.InfoTextKey); Boolean flag = m_selectedEntry.StaticData.IsBuyable && !LegacyLogic.Instance.ServiceWrapper.IsPrivilegeAvailable(m_selectedEntry.StaticData.PrivilegeId); Texture texture = Helper.ResourcesLoad <Texture>("UnlockContent/" + m_selectedEntry.StaticData.Image); if (m_contentImage.mainTexture != texture) { Texture mainTexture = m_contentImage.mainTexture; m_contentImage.mainTexture = texture; if (mainTexture != null) { mainTexture.UnloadAsset(); } } m_dragPanel.UpdateScrollbars(true); }