コード例 #1
0
        /*
         * @brief 初始化
         * @param serialId [in] 流水號
         * @param maxComponents [in] 組件數量上限, 不可超過32
         * @param componentsPools [in] 組件池
         * @param debugInfo [in] 除錯資訊
         * @note 新創時使用
         */
        public void Init(int serialId, int maxComponents, Stack <IComponent>[] componentsPools, DebugInfo debugInfo)
        {
            this.maxComponents   = maxComponents;
            components           = new IComponent[maxComponents];
            this.componentsPools = componentsPools;
            this.debugInfo       = debugInfo;
            refCounter           = new SafeRefCounter(this);

            Init(serialId);
        }
コード例 #2
0
ファイル: SoundCache.cs プロジェクト: yayuanget/CEngine
        public void AddCache(string key, AudioClip clip)
        {
            if (!base.Contains(key))
            {
                base.Add(key, new SoundRefCounter(clip));
            }

            IRefCounter counter = base.Get(key);

            counter.Retain();
        }
コード例 #3
0
        public void Initialize(int creationIndex, int totalComponents, Stack <IComponent>[] componentPools,
                               ContextInfo contextInfo = null, IRefCounter iarc = null)
        {
            Reactivate(creationIndex);

            mTotalComponents = totalComponents;
            mComponents      = new IComponent[totalComponents];
            mComponentPools  = componentPools;

            mContextInfo = contextInfo ?? createDefaultContextInfo();
            mAERC        = iarc ?? new SafeARC(this);
        }
コード例 #4
0
ファイル: TextureCache.cs プロジェクト: yayuanget/CEngine
        public void AddCache(string key, Texture2D texture2d)
        {
            if (!base.Contains(key))
            {
                base.Add(key, new TextureRefCounter(texture2d));
            }

            IRefCounter counter = base.Get(key);

            counter.Retain();
            //CDebug.LogError("TextureCache Retain key " + key + " ref " + counter.refCount);
        }
コード例 #5
0
ファイル: SpriteCache.cs プロジェクト: yayuanget/CEngine
        public void AddCache(string key, Sprite sprite)
        {
            if (!base.Contains(key))
            {
                base.Add(key, new SpriteRefCounter(sprite));
            }

            IRefCounter counter = base.Get(key);

            counter.Retain();
            //CDebug.LogError("SpriteCache Retain key " + key + " ref " + counter.refCount);
        }
コード例 #6
0
ファイル: AssetBundleCache.cs プロジェクト: yayuanget/CEngine
        public void AddCache(string key, AssetBundle bundle)
        {
            if (!base.Contains(key))
            {
                base.Add(key, new ABRefCounter(bundle));
            }

            IRefCounter counter = base.Get(key);

            counter.Retain();

            //CDebug.LogError("tex " + key + " add ref " + base.Get(key).refCnt);
        }
コード例 #7
0
ファイル: AssetBundleCache.cs プロジェクト: yayuanget/CEngine
        public void UnloadCache(string key)
        {
            if (!base.Contains(key))
            {
                return;
            }

            IRefCounter counter = base.Get(key);

            counter.Release();

            if (counter.refCount == 0)
            {
                base.Remove(key);
            }
        }
コード例 #8
0
ファイル: TextureCache.cs プロジェクト: yayuanget/CEngine
        public void UnloadCache(string key)
        {
            if (!base.Contains(key))
            {
                return;
            }

            IRefCounter counter = base.Get(key);

            counter.Release();
            //CDebug.LogError("TextureCache Release key " + key + " ref " + counter.refCount);

            if (counter.refCount == 0)
            {
                base.Remove(key);
            }
        }
コード例 #9
0
 public void ReleaseReference(IRefCounter obj)
 {
     _disposeQueue.Enqueue(obj);
 }
コード例 #10
0
 public RefCounter(Action handler, IRefCounter parent)
 {
     _handler = handler;
     _parent  = parent;
 }
コード例 #11
0
ファイル: ResItem.cs プロジェクト: zhoulk/ETBrainSecond
 public ResItem()
 {
     RefCount = new RefCounter(OnZeroRef);
 }