예제 #1
0
 public ChatEmojiItem GetChatEmojiItem()
 {
     if (mCacheStack.Count == 0)
     {
         ChatEmojiItem temp = new ChatEmojiItem();
         temp.SetAction(mUpdateContentAction);
         temp.InitItem(mOriginGo);
         return(temp);
     }
     return(mCacheStack.Pop());
 }
예제 #2
0
 public ChatEmojiCache(GameObject originGo, Action <ChatEmojiItem, ChatEmojiPos, Vector2, Transform> UpdateContentAction,
                       int initCount = 20)
 {
     mOriginGo = originGo;
     originGo.SetActive(false);
     this.mUpdateContentAction = UpdateContentAction;
     for (int i = 0; i < initCount; ++i)
     {
         ChatEmojiItem temp = new ChatEmojiItem();
         temp.SetAction(mUpdateContentAction);
         temp.InitItem(mOriginGo);
         mCacheStack.Push(temp);
     }
 }