/* * @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); }
public void AddCache(string key, AudioClip clip) { if (!base.Contains(key)) { base.Add(key, new SoundRefCounter(clip)); } IRefCounter counter = base.Get(key); counter.Retain(); }
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); }
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); }
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); }
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); }
public void UnloadCache(string key) { if (!base.Contains(key)) { return; } IRefCounter counter = base.Get(key); counter.Release(); if (counter.refCount == 0) { base.Remove(key); } }
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); } }
public void ReleaseReference(IRefCounter obj) { _disposeQueue.Enqueue(obj); }
public RefCounter(Action handler, IRefCounter parent) { _handler = handler; _parent = parent; }
public ResItem() { RefCount = new RefCounter(OnZeroRef); }