Ejemplo n.º 1
0
 public CDefaultItemRender()
 {
     SetGO(new GameObject());
     go.layer  = 5;
     uiw       = AddComponent <UIWidget>();
     uiw.pivot = UIWidget.Pivot.TopLeft;
     uiw.autoResizeBoxCollider = true;
     box   = AddComponent <BoxCollider>();
     Label = UICreater.CreateLabel(null, 0, 0, 158, 12, tran, new Color(1f, 229 / 255f, 178 / 255f), 12, FontStyle.Bold);
     Label.autoResizeBoxCollider = true;
     Label.alignment             = NGUIText.Alignment.Center;
     Label.pivot = UIWidget.Pivot.TopLeft;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置竖排label的内容
 /// </summary>
 /// <param name="msg"></param>
 public void SetText(string msg)
 {
     for (int i = 0; i < lbls.Count; i++)
     {
         GameObject.Destroy(lbls[i].gameObject, 0.1f);
     }
     lbls.Clear();
     msgItems = msg.Split('#');
     for (int i = 0; i < msgItems.Length; i++)
     {
         UILabel lbl = UICreater.CreateLabel(msgItems[i], 0, 0, 12, 22, this.transform, Color.grey);
         lbl.overflowMethod          = UILabel.Overflow.ResizeHeight;
         lbl.spacingY                = 2;
         lbl.transform.localPosition = (isLeftToRight ? Vector3.right * (lbl.fontSize + columeDistance) * i : Vector3.right * (msgItems.Length - i));
         lbls.Add(lbl);
     }
 }