Example #1
0
    void _itpAddItemToShow(object oitemDatas, string loadPrefabKey = "", Callback overMethod = null)
    {
        if (string.IsNullOrEmpty(loadPrefabKey))
        {
            Debug.LogError("Miss load prefab key.");
            //	yield return 0;
        }
        if (!string.IsNullOrEmpty(curPrefabPath) && curPrefabPath != loadPrefabKey)
        {
            return;
        }
        curPrefabPath = loadPrefabKey;
        int   curExistChildCount = mTrans_.childCount;
        IList refreshItems       = ( IList )oitemDatas;

        WUIManager.GetSignleAsset(WUIManager.hlpGetUIPath(loadPrefabKey), delegate(Object prefabObj) {
            ObjectCache itemObj     = null;
            itemObj                 = ObjectCachePool.instance.ocpNew <ObjectCache>(prefabObj.name, prefabObj as GameObject, mTrans_, Vector3.zero);
            itemObj.gameObject.name = string.Format("{0}{1}", itemSlotName, curExistChildCount++);
            itemList.Add(itemObj);
            ((IPanelItem)itemObj).itemRefresh(refreshItems[refreshItems.Count - 1]);
            StartCoroutine(_itpWaitFinished(delegate {
                if (overMethod != null)
                {
                    overMethod();
                }
            }));
        });
    }
Example #2
0
 void _itpLoadRes(string loadPrefabKey, Callback <Object> cb)
 {
     if (preloadItemObj != null && curPrefabPath == loadPrefabKey)
     {
         cb(preloadItemObj);
     }
     else
     {
         preloadItemObj = null;
         WUIManager.GetSignleAsset(WUIManager.hlpGetUIPath(loadPrefabKey), delegate(Object prefabObj){
             preloadItemObj = prefabObj as GameObject;
             cb(prefabObj);
         });
     }
 }
Example #3
0
    void _itpAddItemsToShow(object oitemDatas, string loadPrefabKey = "", Callback overMethod = null)
    {
        if (string.IsNullOrEmpty(loadPrefabKey))
        {
            Debug.LogError("Miss load prefab key.");
        }
        if (!string.IsNullOrEmpty(curPrefabPath) && curPrefabPath != loadPrefabKey)
        {
            return;
        }
        int   curExistChildCount = mTrans_.childCount;
        IList refreshItems       = ( IList )oitemDatas;
        int   idx = curExistChildCount;

        WUIManager.GetSignleAsset(WUIManager.hlpGetUIPath(loadPrefabKey), delegate(Object prefabObj) {
            ObjectCache itemObj = null;
            for (int i = 0; i < refreshItems.Count; ++i)
            {
                itemObj = ObjectCachePool.instance.ocpNew <ObjectCache>(prefabObj.name, prefabObj as GameObject, mTrans_, Vector3.zero);
                itemObj.gameObject.name = string.Format("{0}{1}", itemSlotName, curExistChildCount++);
                if (autoLayout)
                {
                    if (pivot == Pivot.Horizontal)
                    {
                        itemObj.mTrans.localPosition = new Vector3(cellWidth * idx, 0, 1);
                    }
                    else
                    {
                        itemObj.mTrans.localPosition = new Vector3(0, -cellHeight * idx, 1);
                    }
                }
                itemList.Add(itemObj);
                ((IPanelItem)itemObj).itemRefresh(refreshItems[i]);
                idx++;
            }
            if (overMethod != null)
            {
                overMethod();
            }
        });
    }