public void RemoveSpriteAnimInfos(InlineText inlineText) { if (inlineText == null) { return; } int id = inlineText.GetInstanceID(); if (!mTextSpriteAnimKeysDic.ContainsKey(id)) { return; } int count = mTotalSpriteAnimDic.Count; List <string> spriteAnimKeys = mTextSpriteAnimKeysDic[id]; for (int i = 0; i < spriteAnimKeys.Count; ++i) { if (mTotalSpriteAnimDic.ContainsKey(spriteAnimKeys[i])) { mTotalSpriteAnimDic.Remove(spriteAnimKeys[i]); } } mTextSpriteAnimKeysDic.Remove(id); if (count != mTotalSpriteAnimDic.Count) { //Debug.Log("mInlineSpriteAnimInfoDic Count:" + mTotalSpriteAnimDic.Count); UpdateMeshCapacity(); } }
public void Register(InlineText inlineText) { if (null == inlineText) { return; } int id = inlineText.GetInstanceID(); if (mActicveTextDic.ContainsKey(id)) { return; } // Debug.Log("___________________________Register Name:" + inlineText.name); mActicveTextDic[id] = inlineText; }
public void UnRegister(InlineText inlineText) { if (null == inlineText) { return; } RemoveSpriteAnimInfos(inlineText); int id = inlineText.GetInstanceID(); if (mActicveTextDic.ContainsKey(id)) { mActicveTextDic.Remove(id); } // Debug.Log("___________________________UnRegister Name:" + inlineText.name); }
public void UpdateSpriteAnimInfos(InlineText inlineText, List <SpriteAnimInfo> inputSpriteAnimInfos) { UnityEngine.Profiling.Profiler.BeginSample("inlineSpriteManager UpdateSpriteAnimInfos "); if (inlineText == null) { return; } bool isUpdateMeshData = false; int id = inlineText.GetInstanceID(); List <string> oldSpriteKeys = null; if (mTextSpriteAnimKeysDic.ContainsKey(id)) { oldSpriteKeys = mTextSpriteAnimKeysDic[id]; } //input is null if (inputSpriteAnimInfos == null) { if (oldSpriteKeys != null) { for (int i = 0; i < oldSpriteKeys.Count; ++i) { mTotalSpriteAnimDic.Remove(oldSpriteKeys[i]); } mTextSpriteAnimKeysDic.Remove(id); isUpdateMeshData = true; } } else { int oldCount = mTotalSpriteAnimDic.Count; if (oldSpriteKeys != null) { for (int i = 0; i < oldSpriteKeys.Count; ++i) { mTotalSpriteAnimDic.Remove(oldSpriteKeys[i]); } } List <string> keys = new List <string>(); for (int i = 0; i < inputSpriteAnimInfos.Count; ++i) { SpriteAnimInfo temp = inputSpriteAnimInfos[i]; if (temp != null && temp.IsValid()) { mTotalSpriteAnimDic[temp.Key] = temp; keys.Add(temp.Key); } } if (keys.Count > 0) { mTextSpriteAnimKeysDic[id] = keys; } else { if (oldSpriteKeys != null) { mTextSpriteAnimKeysDic.Remove(id); } } if (oldCount != mTotalSpriteAnimDic.Count) { isUpdateMeshData = true; } } if (isUpdateMeshData) { //Debug.LogWarning("mInlineSpriteAnimInfoDic Count:" + mSpriteAnimInfoDic.Count); UpdateMeshCapacity(); } UnityEngine.Profiling.Profiler.EndSample(); }