예제 #1
0
파일: UIUtil.cs 프로젝트: atom-chen/tianyu
    public static void AddFloatLabel(GameObject parent, string msg, UIFont mFont, string color)
    {
        int     nextDepth = NGUITools.CalculateNextDepth(parent);
        UILabel lbl       = NGUITools.AddWidget <UILabel>(parent);

        lbl.name                 = "FloatLabel";
        lbl.depth                = nextDepth;
        lbl.bitmapFont           = mFont;
        lbl.pivot                = UILabel.Pivot.TopLeft;
        lbl.transform.localScale = new Vector3(mFont.defaultSize, mFont.defaultSize, 1f);
        lbl.MakePixelPerfect();
        lbl.supportEncoding = true;
        lbl.symbolStyle     = NGUIText.SymbolStyle.Normal;

        if (color != null)
        {
            lbl.color = ColorManage.GetColor(color);
        }
        lbl.text = msg;
        TweenPosition pos = TweenPosition.Begin(lbl.gameObject, 0.4f, lbl.transform.localPosition + new Vector3(0f, 20f, 0f));

        EventDelegate.Add(pos.onFinished, () =>
        {
            Destroy(lbl.gameObject);
        }, true);
    }
예제 #2
0
파일: UIUtil.cs 프로젝트: atom-chen/tianyu
    private static UILabel CreateLabel(GameObject parent, string str, UIFont mFont, string color)
    {
        int     nextDepth = NGUITools.CalculateNextDepth(parent);
        UILabel lbl       = NGUITools.AddWidget <UILabel>(parent);

        lbl.name                 = "Label_text";
        lbl.depth                = nextDepth;
        lbl.bitmapFont           = mFont;
        lbl.pivot                = UILabel.Pivot.TopLeft;
        lbl.transform.localScale = new Vector3(mFont.defaultSize, mFont.defaultSize, 1f);
        lbl.MakePixelPerfect();
        lbl.supportEncoding = true;
        lbl.symbolStyle     = NGUIText.SymbolStyle.Normal;

        if (color != null)
        {
            lbl.color = ColorManage.GetColor(color);
        }
        lbl.text = str;
        return(lbl);
    }