void InitUI() { for (int i = 0; i < m_emotionAtlas.spriteList.Count; i++) { string strName = m_emotionAtlas.spriteList[i].name; if (strName.Contains("-01")) { EmotionItem.CreateEmotion(m_grid.gameObject, strName, SelEmotionCallback); } } SetShow(true); }
public static EmotionItem CreateEmotion(GameObject parent, string strText, SelEmotionCallback callback) { Object prefab = PrefabLoader.loadFromPack("ZQ/EmotionItem"); if (prefab != null) { GameObject obj = Instantiate(prefab) as GameObject; RED.AddChild(obj, parent); EmotionItem emotion = obj.GetComponent <EmotionItem>(); emotion.m_txtEmotion = strText; emotion.m_onClick = callback; return(emotion); } return(null); }
public void SetSpriteData(BMSymbol symbol, Vector3 position, int index) { if (!Application.isPlaying) { return; } //bool isNew; //EmotionItem item = UIService.CheckOut<EmotionItem>(mEmationPrefab, transform, out isNew); EmotionItem item = onCheckOutEvts(mEmationPrefab, transform); if (item != null) { item.SetEmotion(symbol.spriteName); item.emotion.depth = mLbl.depth + 2; item.transform.localPosition = position; item.gameObject.SetActive(true); mItems.Add(item); } }