protected override void __Initialize() { m_scrollable = true; m_maskTrans = GetChildComponent <RectTransform>("Image_mask"); //遮罩 GameObject contentGo = GameObjUtil.FuzzySearchChild(m_maskTrans.gameObject, "content"); m_contentTrans = contentGo.GetComponent <RectTransform>(); m_contentTrans.anchoredPosition = Vector2.zero; m_contentTrans.sizeDelta = new Vector2(m_maskTrans.rect.width, m_maskTrans.rect.height); m_scrollRect = ComponentUtil.EnsureComponent <ScrollRect>(this.gameObject); RefreshScrollRectSetting(); m_scrollRect.viewport = m_maskTrans; m_scrollRect.content = m_contentTrans; if (GetChild("Container_arrow") != null) { //有箭头 m_scrollArrow = AddChildComponent <KScrollViewArrow>("Container_arrow"); } m_scrollRect.onValueChanged.AddListener(OnInternalValueChanged); }
void Initialize() { base.onValueChanged.AddListener(OnValueChanged); m_checkmarkGo = GameObjUtil.FuzzySearchChild(this.gameObject, "checkmark"); m_backGo = GameObjUtil.FuzzySearchChild(this.gameObject, "back"); }
protected override void __Initialize() { m_contentGo = gameObject; m_itemTemp = GameObjUtil.FuzzySearchChild(m_contentGo, "item"); //只查找一层 m_itemTemp.SetActive(false); //隐藏掉模板 RectTransform rectTrans = m_itemTemp.GetComponent <RectTransform>(); m_layoutParam.itemSize = rectTrans.sizeDelta; m_layoutParam.pivot = rectTrans.pivot; }
//-------∽-★-∽------∽-★-∽--------∽-★-∽KList∽-★-∽--------∽-★-∽------∽-★-∽--------// override protected void __Initialize() { m_itemList = new List <KListItem>(); m_isSupportSingle = true; m_itemTemplate = GameObjUtil.FuzzySearchChild(gameObject, "item"); //只查找一层 m_itemTemplate.SetActive(false); //隐藏掉魔板 if (m_itemSize == Vector2.zero) { m_itemSize = m_itemTemplate.GetComponent <RectTransform>().sizeDelta; } }
static List <int> __delList = new List <int>(); //需要删除的序号 protected override void __Initialize() { m_scrollView = ComponentUtil.EnsureComponent <KScrollView>(this.gameObject); m_maskTrans = m_scrollView.maskTrans; m_contentTrans = m_scrollView.contentTrans; m_contentSizeDefault = m_contentTrans.sizeDelta; //content的默认尺寸(实际size不能比这个小) m_contentGo = m_contentTrans.gameObject; m_itemTemp = GameObjUtil.FuzzySearchChild(m_contentGo, "item"); //只查找一层 m_itemTemp.SetActive(false); //隐藏掉模板 //KListView a1 = gameObject.GetComponent<KListView>(); //Component a2 = gameObject.GetComponent("mg.org.KUI.KListView"); RectTransform rectTrans = m_itemTemp.GetComponent <RectTransform>(); m_layoutParam.itemSize = rectTrans.sizeDelta; m_layoutParam.pivot = rectTrans.pivot; }
override protected void __Initialize() { GameObject arrowGo = GameObjUtil.FuzzySearchChild(gameObject, "arrow"); if (arrowGo != null) { m_pageArrow = ComponentUtil.EnsureComponent <KScrollPageArrow> (arrowGo); } GameObject displayer = GameObjUtil.FuzzySearchChild(gameObject, "pager"); if (displayer != null) { m_pageDisplayer = ComponentUtil.EnsureComponent <KScrollPageDisplayer>(displayer); } m_pageTrans = GetChildComponent <RectTransform>("Image_mask"); GameObject contentGo = GameObjUtil.FuzzySearchChild(m_pageTrans.gameObject, "content"); m_contentTrans = contentGo.GetComponent <RectTransform>(); }