FairyGUI.Utils.HtmlElement.GetElement C# (CSharp) Method

GetElement() public static method

public static GetElement ( HtmlElementType type ) : HtmlElement
type HtmlElementType
return HtmlElement
        public static HtmlElement GetElement(HtmlElementType type)
        {
            HtmlElement ret;
            if (elementPool.Count > 0)
                ret = elementPool.Pop();
            else
                ret = new HtmlElement();
            ret.type = type;

            if (type != HtmlElementType.Text && ret.attributes == null)
                ret.attributes = new Hashtable();

            return ret;
        }

Usage Example

Exemplo n.º 1
0
        protected void AppendText(string text)
        {
            HtmlElement element;

            if (_elements.Count > 0)
            {
                element = _elements[_elements.Count - 1];
                if (element.type == HtmlElementType.Text && element.format.EqualStyle(_format))
                {
                    element.text += text;
                    return;
                }
            }

            element      = HtmlElement.GetElement(HtmlElementType.Text);
            element.text = text;
            element.format.CopyFrom(_format);
            _elements.Add(element);
        }
All Usage Examples Of FairyGUI.Utils.HtmlElement::GetElement