示例#1
0
    void Init()
    {
        string     strPrefab = "Common/Prefab/Comment/UIComment";
        GameObject obj       = PrefabCache.main.Load(strPrefab);

        uiPrefab = obj.GetComponent <UIComment>();
    }
示例#2
0
 public void CreateUI()
 {
     ui = (UIComment)GameObject.Instantiate(uiPrefab);
     ui.SetController(this);
     ViewControllerManager.ClonePrefabRectTransform(uiPrefab.gameObject, ui.gameObject);
     ui.callBackClick = OnUICommentDidClick;
 }
示例#3
0
        public static UIComment Comment(Comment cm, List <Comment> replys, List <UMC.Data.Entities.Picture> pics, UMC.Data.WebResource webr, string model)
        {
            var btnStyle = new UIStyle().Size(12).Name("icon", new UIStyle().Font("wdk").Size(18)).Color(0x666);
            var cell     = new UIComment(webr.ResolveUrl(cm.user_id.Value, 1, "0") + "!50");

            cell.Id = cm.Id.ToString();
            // cell.Tag(new UIEventText("d"));
            var image = new List <UIComment.Image>();

            cell.ImageClick(UIClick.Pager(model, "Account", new WebMeta().Put("Id", cm.user_id), true));

            UMC.Data.Utility.Each(pics, g =>
            {
                if (g.group_id == cm.Id)
                {
                    image.Add(new UIComment.Image
                    {
                        src = webr.ResolveUrl(cm.Id.Value, g.Seq, "0") + "!m200?_ts=" + UMC.Data.Utility.TimeSpan(g.UploadDate.Value),
                        max = webr.ResolveUrl(cm.Id.Value, g.Seq, "0")
                    });
                }
            });
            var nick = cm.Poster;

            if (String.IsNullOrEmpty(nick))
            {
                nick = "游客";
            }
            if (Data.Utility.IsPhone(nick))
            {
                nick = "手机客户";
            }
            cell.Name("name", nick)//.Name("tag", "x").Name("desc", "dd")
            .Content(cm.Content).Name("time", String.Format("{0:yyyy.MM.dd HH:mm}", cm.CommentDate));
            cell.Button(new UIEventText('\uf087', cm.Effective > 0 ? String.Format("( {0} )", cm.Effective) : "赞").Format("{icon} {text}").Style(btnStyle)
                        .Click(Web.UIClick.Click(new UIClick("Refer", cm.Id.ToString())
            {
                Model = model, Command = "Effective"
            }))
                        , new UIEventText('\uF0E5', "回复").Format("{icon} {text}").Style(btnStyle)
                        .Click(Web.UIClick.Click(new UIClick("Refer", cm.Id.ToString())
            {
                Model = model, Command = "Comment"
            })));

            var rs = new List <UIComment.Reply>();

            foreach (var re in replys)
            {
                var ts = new UIComment.Reply {
                    content = "{desc}", title = "{nick} 在 {time} 回复说:"
                };
                ts.data = new UMC.Web.WebMeta().Put("desc", re.Content).Put("time", String.Format("{0:yyyy.MM.dd HH:mm}", re.CommentDate))
                          .Put("nick", re.Poster);

                //ts.style.
                rs.Add(ts);
            }
            cell.Replys(rs.ToArray());
            cell.Images(image.ToArray());
            return(cell);
        }