示例#1
0
    public GameObject GetRes(Transform parent, Vector3 pos, Vector3 scale, object param, CallBackGameObject callback)
    {
        GameObject preObject = null;

        if (goList.Count > 0)
        {
            preObject = goList[0];
            goList.Remove(preObject);
            preObject.SetActive(true);
            preObject.transform.parent        = parent;
            preObject.transform.localPosition = pos;
            preObject.transform.localScale    = scale;
            preObject.transform.localRotation = new Quaternion(0, 0, 0, 0);
            if (callback != null)
            {
                callback(preObject, param);
            }
        }
        else
        {
            if (bundle == null)
            {
                UnityEngine.Object initObj = Resources.Load(url);
                bundle = initObj;
            }
            if (bundle == null)
            {
                Debug.LogError(url + " no url res");
            }
            preObject = Tools.CreateGameObjectByObject(bundle, parent, pos, scale);
            if (callback != null)
            {
                callback(preObject, param);
            }
        }
        return(preObject);
    }
示例#2
0
    public GameObject GetRes(string url, Transform parent, Vector3 pos, Vector3 scale, object param, CallBackGameObject callback)
    {
        BasePool pool;

        if (dicArray.Contains(url))
        {
            pool = dicArray[url] as BasePool;
        }
        else
        {
            pool = new BasePool(url);
            dicArray.Add(url, pool);
        }
        GameObject preObject = pool.GetRes(parent, pos, scale, param, callback);

        return(preObject);
    }