Exemple #1
0
 public void SetUp(Message msg)
 {
     owner = msg.owner;
     if (avatar)
     {
         avatar.sprite = Sprite.Create(msg.owner.avatar, avatar.sprite.rect, new Vector2(.5f, .5f));
     }
     headWidget.SetUp(msg);
 }
Exemple #2
0
    public void AddMessage(Message msg)
    {
        if (msg.owner != owner)
        {
            return;
        }

        MessageWidget newWidget = Instantiate(common.gameObject, content).GetComponent <MessageWidget>();

        newWidget.SetUp(headWidget.msg);
        newWidget.onDestroy.AddListener(() =>
        {
            commonWidgets.Remove(newWidget);
            newWidget.Destroy();
        });
        commonWidgets.AddLast(newWidget);
        headWidget.SetUp(msg);
        headWidget.Resize((transform.parent as RectTransform).rect.width - widthOffset);
        headWidget.transform.SetAsLastSibling();
    }