public WeaponRaiseUI_ExchangeMatItemUI GetInstance() { WeaponRaiseUI_ExchangeMatItemUI instance = null; if (mCachedInstances != null) { while ((instance == null || instance.Equals(null)) && mCachedInstances.Count > 0) { instance = mCachedInstances.Dequeue(); } } if (instance == null || instance.Equals(null)) { instance = Instantiate <WeaponRaiseUI_ExchangeMatItemUI>(m_ExchangeMatItemUI); } Transform t0 = m_ExchangeMatItemUI.transform; Transform t1 = instance.transform; t1.SetParent(t0.parent); t1.localPosition = t0.localPosition; t1.localRotation = t0.localRotation; t1.localScale = t0.localScale; t1.SetSiblingIndex(t0.GetSiblingIndex() + 1); return(instance); }
public override void Init <T>(string name, UIInfo info, T arg) { m_ItemUI = arg as WeaponRaiseUI_ExchangeMatItemUI; base.Init(name, info, arg); InitNode(); base.ChangeLanguage(); }
//刷新ShowScrollItem private void ShowScrollItem() { ClearShowList(); m_WeaponRaiseUi.ExchangeMatItemUI.gameObject.SetActive(false); CampShopItem[] shopItems = Global.gApp.gGameData.CampShopConfig.items; foreach (CampShopItem shopItem in shopItems) { WeaponRaiseUI_ExchangeMatItemUI itemUI = m_WeaponRaiseUi.ExchangeMatItemUI.GetInstance(); itemUI.transform.SetSiblingIndex(shopItem.heartNum); itemUI.Init(shopItem, this); m_ShowItemList.Add(itemUI); } }
public bool CacheInstance(WeaponRaiseUI_ExchangeMatItemUI instance) { if (instance == null || instance.Equals(null)) { return(false); } if (mCachedInstances == null) { mCachedInstances = new Queue <WeaponRaiseUI_ExchangeMatItemUI>(); } if (mCachedInstances.Contains(instance)) { return(false); } instance.gameObject.SetActive(false); mCachedInstances.Enqueue(instance); return(true); }