12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using CommonLang.Xml;
- using CommonUnity3D.UGUI;
- using System;
- using System.Xml;
- using UnityEngine;
- using CommonUI.Data;
- using TextAnchor = CommonUI.Data.TextAnchor;
- using FontStyle = CommonUI.Data.FontStyle;
- using CommonUI.Cell;
- namespace CommonUnity3D.UGUIEditor.UI
- {
- public class UELabel : UETextComponent
- {
- public UELabel() : this(UIEditor.GlobalUseBitmapText)
- {
- }
- public UELabel(bool use_bitmap) : base(use_bitmap)
- {
- this.Enable = false;
- this.EnableChildren = false;
- }
- public UELabel(string text, UILayout layout = null, CPJAtlas imageFont = null, bool use_bitmap = false) : base(use_bitmap)
- {
- this.Enable = false;
- this.EnableChildren = false;
- if (layout != null)
- {
- if (imageFont != null)
- {
- var vt = new ImageFontSprite("image_font");
- vt.SetAtlas(imageFont);
- this.mTextSprite = vt;
- }
- else if (base.mUseBitmapFont)
- {
- mTextSprite = new BitmapTextSprite("bitmap_text");
- }
- else
- {
- mTextSprite = new TextSprite("text");
- }
- this.AddChild(mTextSprite);
- }
- else
- {
- if (imageFont != null)
- {
- var vt = mGameObject.AddComponent<ImageFontGraphics>();
- this.mTextGraphics = vt;
- vt.Atlas = imageFont;
- }
- else if (base.mUseBitmapFont)
- {
- this.mTextGraphics = mGameObject.AddComponent<BitmapTextGraphics>();
- }
- else
- {
- this.mTextGraphics = mGameObject.AddComponent<TextGraphics>();
- }
- }
- this.Text = text;
- }
- }
- }
|