protected IRuneDetailObj GetOrCreateRuneDetailObj(RuneDetailObjType type, Transform parent) { if (mObjPool != null && mObjPool.Count > 0) { for (int i = 0; i < mObjPool.Count; i++) { if (mObjPool[i].isInUse) { continue; } if (mObjPool[i].objType != type) { continue; } mObjPool[i].isInUse = true; return(mObjPool[i].obj); } } IRuneDetailObj detailObj = RuneFactory.Create(type, parent); RuneDetailCommonObjData objData = new RuneDetailCommonObjData(); objData.isInUse = true; objData.obj = detailObj; objData.objType = type; mObjPool.Add(objData); return(detailObj); }
public RuneDetailCommon(Transform parent, X_GUID runeId, float scrollRectHeight = -1f, int strenLvAdder = 0) { mParent = parent; mRuneGUID = runeId; mStrenLvAdder = strenLvAdder; GameEventDispatcher.Inst.addEventListener(GameEventID.Net_RefreshItem, OnItemRefresh); RuneDetailScrollRect scrollRect = RuneFactory.Create(RuneDetailObjType.ScrollRect, parent) as RuneDetailScrollRect; layoutTrans = scrollRect.GetLayoutObj().transform; if (scrollRectHeight > 0f) { scrollRect.SetScrollRectWidth(scrollRectHeight); } UpdateData(RuneAttriShowType.All); }
public RuneDetailCommon(Transform parent, int runeTableId, float scrollRectHeight = -1f) { mParent = parent; mRuneTableId = runeTableId; ItemTemplate itemT = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(runeTableId); SetRuneTemplateDate(itemT); RuneDetailScrollRect scrollRect = RuneFactory.Create(RuneDetailObjType.ScrollRect, parent) as RuneDetailScrollRect; layoutTrans = scrollRect.GetLayoutObj().transform; if (scrollRectHeight > 0f) { scrollRect.SetScrollRectWidth(scrollRectHeight); } bool isSpec = RuneModule.IsSpecialRune(runeTableId); UpdateData(isSpec ? RuneAttriShowType.BaseContent : RuneAttriShowType.BaseAttriOnly); }