public CampMatBag_MatItemUI GetInstance() { CampMatBag_MatItemUI 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 <CampMatBag_MatItemUI>(m_MatItemUI); } Transform t0 = m_MatItemUI.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); }
private void CreateMatItem() { CampRecycleItem[] campRecycleItems = Global.gApp.gGameData.CampRecycleConfig.items; foreach (CampRecycleItem recycleItem in campRecycleItems) { double count = GameItemFactory.GetInstance().GetItem(recycleItem.id); if (count > 0) { ItemItem itemItem = Global.gApp.gGameData.ItemData.Get(recycleItem.id); CampMatBag_MatItemUI matItem = MatItemUI.GetInstance(); matItem.Init(recycleItem, itemItem, this); m_AllCampRecycleItem.Add(matItem); } } FreshTipsState(); }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); m_MatItemUI = arg as CampMatBag_MatItemUI; m_CampRecycleItem = m_MatItemUI.GetRecycleItem();; Gold_paramsItem gpiCfg = Global.gApp.gGameData.GoldParamsConfig.Get(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel()); m_GoldParam = gpiCfg.coinParams; double count = GameItemFactory.GetInstance().GetItem(m_CampRecycleItem.id); m_RealMaxCount = count; m_MaxCount = (double)((int)(m_RealMaxCount + 0.5d)); m_CurSellCount = m_MaxCount; InitNode(); base.ChangeLanguage(); }
public bool CacheInstance(CampMatBag_MatItemUI instance) { if (instance == null || instance.Equals(null)) { return(false); } if (mCachedInstances == null) { mCachedInstances = new Queue <CampMatBag_MatItemUI>(); } if (mCachedInstances.Contains(instance)) { return(false); } instance.gameObject.SetActive(false); mCachedInstances.Enqueue(instance); return(true); }
public void RemoveItem(CampMatBag_MatItemUI item) { MatItemUI.CacheInstance(item); m_AllCampRecycleItem.Remove(item); FreshTipsState(); }