FairyGUI.Utils.HtmlButton.Create C# (CSharp) Method

Create() public method

public Create ( RichTextField owner, HtmlElement element ) : void
owner RichTextField
element HtmlElement
return void
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner = owner;
            _element = element;

            if (button == null)
                return;

            button.onClick.Add(_clickHandler);
            int width = element.GetInt("width", 0);
            int height = element.GetInt("height", 0);

            if (width == 0)
                width = button.sourceWidth;
            if (height == 0)
                height = button.sourceHeight;

            button.SetSize(width, height);
            button.text = element.GetString("value");
        }

Usage Example

Example #1
0
 static public int Create(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlButton self = (FairyGUI.Utils.HtmlButton)checkSelf(l);
         FairyGUI.RichTextField    a1;
         checkType(l, 2, out a1);
         FairyGUI.Utils.HtmlElement a2;
         checkType(l, 3, out a2);
         self.Create(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }