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 EmoticonSticker Create(string name, Transform parent) { GameObject gobj = GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/EmoticonSticker")) as GameObject; gobj.transform.parent = parent; gobj.transform.localScale = Vector3.one; gobj.transform.localPosition = new Vector3(0f, 50f, 0f); gobj.GetComponent <UISprite> ().spriteName = name; gobj.GetComponent <UISprite> ().MakePixelPerfect(); EmoticonSticker sticker = gobj.GetComponent <EmoticonSticker> (); sticker.killMeAfter(2.0f); return(sticker); }