private void ShowMessage(DataChat message) { if (message.GetChatType() == DataChat.ChatType.Public) { if (message.Sender.userName == UserName) { if (message.Content.IndexOf(DialogGameplayChatView.EMOTICON_CODE) != 0) { PokerGameplayPlayerChat.Create(message.Content, this); } else { if (message.Content.Contains(DialogGameplayChatView.EMOTICON_STICKER_CODE)) { string name = "S_" + message.Content.Split('_')[1]; EmoticonSticker.Create(name, gameObject.transform); } else if (message.Content.Contains(DialogGameplayChatView.EMOTICON_ANIMATION_CODE)) { string name = message.Content.Split('-')[1]; EmoticonAnimation.Create(name, gameObject.transform); } } } } }
public static EmoticonAnimation Create(string name, Transform parent) { GameObject gobj = GameObject.Instantiate(Resources.Load("Prefabs/Emoticon/" + name)) as GameObject; gobj.transform.parent = parent; gobj.transform.localScale = Vector3.one; gobj.transform.localPosition = new Vector3(0f, 50f, 0f); EmoticonAnimation item = gobj.GetComponent <EmoticonAnimation>(); if (item == null) { item = gobj.AddComponent <EmoticonAnimation>(); } ; item.killMeAfter(2.0f); return(item); }