Exemple #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="resID"></param>
    /// <param name="tsEvent"></param>
    /// <param name="param"></param>
    public void SpawnObjAsyn(uint resID, CMResEvent <Transform> tsEvent, object param1 = null, object param2 = null, object param3 = null)
    {
        table.UIResourceDataBase rsDb = GameTableManager.Instance.GetTableItem <table.UIResourceDataBase>(resID);
        if (null == rsDb)
        {
            if (null != tsEvent)
            {
                tsEvent.Invoke(null, param1, param2, param3);
            }
            return;
        }

        CMObjPool pool = null;

        if (m_pools.TryGetValue(rsDb.resRelativePath, out pool) && pool.State != CMObjPool.CMObjPoolState.Release)
        {
            if (null != tsEvent)
            {
                tsEvent.Invoke(pool.SpawnInstance(Vector3.zero, Quaternion.identity, true), param1, param2, param3);
            }
        }
        else
        {
            if (null != pool)
            {
                pool = null;
                RemovePool(rsDb.resRelativePath);
            }
            DataManager.Manager <CMResourceMgr>().GetGameObjAsyn(rsDb.assetbundlePath, rsDb.resRelativePath, (obj, passParam1, passParam2, passParam3) =>
            {
                CMObjPool newpool = CreatePool(
                    rsDb.resRelativePath
                    , obj.GetGameObj().transform
                    , rsDb.resKeepType != 2
                    , (int)rsDb.resPreloadNum
                    , (int)rsDb.resCloneNumLimit
                    , (rsDb.releaseCullAboveMask != 0)
                    , (int)rsDb.releaseCullAboveNum
                    , (int)rsDb.resIdleKeepNum
                    , rsDb.idle2releaseTime
                    , rsDb.active2idleTime
                    , (rsDb.cloneAddScriptState == 1) ? rsDb.resName : "");
                if (null != tsEvent)
                {
                    tsEvent.Invoke(newpool.SpawnInstance(Vector3.zero, Quaternion.identity), passParam1, passParam2, passParam3);
                }
            }, param1, param2, param3);
        }
    }
Exemple #2
0
    /// <summary>
    /// 异步
    /// </summary>
    /// <param name="abPath"></param>
    /// <param name="assetName"></param>
    /// <param name="atlas"></param>
    /// <param name="createDlg"></param>
    /// <param name="custParam"></param>
    public void GetCMResourceAsyn(ref CMResAsynSeedData <T> seedData, CMResEvent <T> createDlg, object param1 = null, object param2 = null, object param3 = null)
    {
        StructCMResAsynSeedData(ref seedData);
        AddRef();
        if (IsReady())
        {
            ChangeState(CMResState.CMRS_Active);
            if (null != createDlg)
            {
                createDlg.Invoke(GetThis(), param1, param2, param3);
            }
        }
        else
        {
            if (!m_dlgs.ContainsKey(seedData.Seed))
            {
                m_dlgs.Add(seedData.Seed, new CMEventBaseDelegate <T>()
                {
                    Dlg    = createDlg,
                    Param1 = param1,
                    Param2 = param2,
                    Param3 = param3,
                });
            }

            if (State != CMResState.CMRS_Loading)
            {
                ChangeState(CMResState.CMRS_Loading);
                DataManager.Manager <CMAssetBundleLoaderMgr>().CreateAssetAsyn(false, AbPath, AssetName, OnLoadAssetComplte, param1, param2, param3);
            }
        }
    }
Exemple #3
0
    //public static CMAtlas GetAtlas(AtlasID atlasID)
    //{
    //    return GetAtlas((uint)atlasID);
    //}
    #endregion

    #region Font
    /// <summary>
    ///  获取字图(异步)
    /// </summary>
    /// <param name="resID"></param>
    /// <param name="font"></param>
    /// <param name="fe"></param>
    /// <param name="param"></param>
    public static void GetFontAsyn(uint resID, ref CMResAsynSeedData <CMFont> seedData, CMResEvent <CMFont> fe, object param = null)
    {
        table.UIResourceDataBase rsDb = GameTableManager.Instance.GetTableItem <table.UIResourceDataBase>(resID);
        if (null == rsDb)
        {
            if (null != fe)
            {
                fe.Invoke(null, param, null, null);
            }
            return;
        }

        DataManager.Manager <CMResourceMgr>().GetFontAsyn(rsDb.assetbundlePath, rsDb.resRelativePath, ref seedData, fe, rsDb.idle2releaseTime, 10, param);
    }
Exemple #4
0
    /// <summary>
    /// 获取贴图(异步)
    /// </summary>
    /// <param name="resID"></param>
    /// <param name="tex"></param>
    /// <param name="te"></param>
    /// <param name="param"></param>
    private static void GetTextureAsyn(uint resID, ref CMResAsynSeedData <CMTexture> seedData, CMResEvent <CMTexture> te, object param1 = null, object param2 = null, object param3 = null)
    {
        table.UIResourceDataBase rsDb = GameTableManager.Instance.GetTableItem <table.UIResourceDataBase>(resID);
        if (null == rsDb)
        {
            if (null != te)
            {
                te.Invoke(null, param1, param2, param3);
            }
            return;
        }

        DataManager.Manager <CMResourceMgr>().GetTextureAsyn(rsDb.assetbundlePath, rsDb.resRelativePath,
                                                             ref seedData, te,
                                                             rsDb.idle2releaseTime, 10f,
                                                             param1, param2, param3);
    }
Exemple #5
0
 /// <summary>
 /// 获取图集(异步)
 /// </summary>
 /// <param name="resID"></param>
 /// <param name="atlas"></param>
 /// <param name="ae"></param>
 /// <param name="param"></param>
 public static void GetAtlasAsyn(uint resID, ref CMResAsynSeedData <CMAtlas> seedData, CMResEvent <CMAtlas> createDlg,
                                 object param1 = null, object param2 = null, object param3 = null)
 {
     table.UIResourceDataBase rsDb = GameTableManager.Instance.GetTableItem <table.UIResourceDataBase>(resID);
     if (null == rsDb)
     {
         if (null != createDlg)
         {
             createDlg.Invoke(null, param1, param2, param3);
         }
         return;
     }
     DataManager.Manager <CMResourceMgr>().GetAtlasAsyn(rsDb.assetbundlePath, rsDb.resRelativePath,
                                                        ref seedData, createDlg,
                                                        rsDb.idle2releaseTime, 10
                                                        , param1, param2, param3);
 }