Inheritance: IHtmlObject
        public virtual IHtmlObject CreateObject(RichTextField owner, HtmlElement element)
        {
            IHtmlObject ret = null;
            if (element.type == HtmlElementType.Image)
            {
                if (_imagePool.Count > 0 && Application.isPlaying)
                    ret = _imagePool.Pop();
                else
                    ret = new HtmlImage();
            }
            else if (element.type == HtmlElementType.Link)
            {
                if (_linkPool.Count > 0 && Application.isPlaying)
                    ret = _linkPool.Pop();
                else
                    ret = new HtmlLink();
            }
            else if (element.type == HtmlElementType.Input)
            {
                string type = element.GetString("type");
                if (type != null)
                    type = type.ToLower();
                if (type == "button" || type == "submit")
                {
                    if (_buttonPool.Count > 0 && Application.isPlaying)
                        ret = _buttonPool.Pop();
                    else
                        ret = new HtmlButton();
                }
                else
                {
                    if (_inputPool.Count > 0 && Application.isPlaying)
                        ret = _inputPool.Pop();
                    else
                        ret = new HtmlInput();
                }
            }
            else if (element.type == HtmlElementType.Select)
            {
                if (_selectPool.Count > 0 && Application.isPlaying)
                    ret = _selectPool.Pop();
                else
                    ret = new HtmlSelect();
            }

            if (ret != null)
            {
                ret.Create(owner, element);
                if (ret.displayObject != null)
                    ret.displayObject.home = owner.cachedTransform;
            }

            return ret;
        }
Example #2
0
 static public int Dispose(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlInput self = (FairyGUI.Utils.HtmlInput)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
 static public int get_height(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlInput self = (FairyGUI.Utils.HtmlInput)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.height);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlInput o;
         o = new FairyGUI.Utils.HtmlInput();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #5
0
 static public int SetPosition(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlInput self = (FairyGUI.Utils.HtmlInput)checkSelf(l);
         System.Single            a1;
         checkType(l, 2, out a1);
         System.Single a2;
         checkType(l, 3, out a2);
         self.SetPosition(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #6
0
 static public int Create(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlInput self = (FairyGUI.Utils.HtmlInput)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));
     }
 }
Example #7
0
        virtual public IHtmlObject CreateObject(RichTextField owner, HtmlElement element)
        {
            IHtmlObject ret = null;

            if (element.type == HtmlElementType.Image)
            {
                if (_imagePool.Count > 0 && Application.isPlaying)
                {
                    ret = _imagePool.Pop();
                }
                else
                {
                    ret = new HtmlImage();
                }
            }
            else if (element.type == HtmlElementType.Input)
            {
                string type = element.GetString("type");
                if (type != null)
                {
                    type = type.ToLower();
                }
                if (type == "button" || type == "submit")
                {
                    if (_buttonPool.Count > 0 && Application.isPlaying)
                    {
                        ret = _buttonPool.Pop();
                    }
                    else
                    {
                        ret = new HtmlButton();
                    }
                }
                else
                {
                    if (_inputPool.Count > 0 && Application.isPlaying)
                    {
                        ret = _inputPool.Pop();
                    }
                    else
                    {
                        ret = new HtmlInput();
                    }
                }
            }
            else if (element.type == HtmlElementType.Select)
            {
                if (_selectPool.Count > 0 && Application.isPlaying)
                {
                    ret = _selectPool.Pop();
                }
                else
                {
                    ret = new HtmlSelect();
                }
            }

            if (ret != null)
            {
                ret.Create(owner, element);
            }

            return(ret);
        }
        virtual public IHtmlObject CreateObject(RichTextField owner, HtmlElement element)
        {
            IHtmlObject ret = null;

            if (element.type == HtmlElementType.Image)
            {
                if (_imagePool.Count > 0)
                {
                    ret = _imagePool.Pop();
                }
                else
                {
                    ret = new HtmlImage();
                }
            }
            else if (element.type == HtmlElementType.Link)
            {
                if (_linkPool.Count > 0)
                {
                    ret = _linkPool.Pop();
                }
                else
                {
                    ret = new HtmlLink();
                }
            }
            else if (element.type == HtmlElementType.Input)
            {
                string type = element.GetString("type");
                if (type != null)
                {
                    type = type.ToLower();
                }
                if (type == "button" || type == "submit")
                {
                    if (_buttonPool.Count > 0)
                    {
                        ret = _buttonPool.Pop();
                    }
                    else
                    {
                        ret = new HtmlButton();
                    }
                }
                else
                {
                    if (_inputPool.Count > 0)
                    {
                        ret = _inputPool.Pop();
                    }
                    else
                    {
                        ret = new HtmlInput();
                    }
                }
            }
            else if (element.type == HtmlElementType.Select)
            {
                if (_selectPool.Count > 0)
                {
                    ret = _selectPool.Pop();
                }
                else
                {
                    ret = new HtmlSelect();
                }
            }

            if (ret != null)
            {
                ret.Create(owner, element);
                if (ret.displayObject != null)
                {
                    ret.displayObject.home = owner.cachedTransform;
                }
            }

            return(ret);
        }
        virtual public IHtmlObject CreateObject(RichTextField owner, HtmlElement element)
        {
            IHtmlObject ret      = null;
            bool        fromPool = false;

            if (element.type == HtmlElementType.Image)
            {
                if (_imagePool.Count > 0 && _poolManager != null)
                {
                    ret      = _imagePool.Pop();
                    fromPool = true;
                }
                else
                {
                    ret = new HtmlImage();
                }
            }
            else if (element.type == HtmlElementType.Link)
            {
                if (_linkPool.Count > 0 && _poolManager != null)
                {
                    ret      = _linkPool.Pop();
                    fromPool = true;
                }
                else
                {
                    ret = new HtmlLink();
                }
            }
            else if (element.type == HtmlElementType.Input)
            {
                string type = element.GetString("type");
                if (type != null)
                {
                    type = type.ToLower();
                }
                if (type == "button" || type == "submit")
                {
                    if (_buttonPool.Count > 0 && _poolManager != null)
                    {
                        ret      = _buttonPool.Pop();
                        fromPool = true;
                    }
                    else
                    {
                        ret = new HtmlButton();
                    }
                }
                else
                {
                    if (_inputPool.Count > 0 && _poolManager != null)
                    {
                        ret      = _inputPool.Pop();
                        fromPool = true;
                    }
                    else
                    {
                        ret = new HtmlInput();
                    }
                }
            }
            else if (element.type == HtmlElementType.Select)
            {
                if (_selectPool.Count > 0 && _poolManager != null)
                {
                    ret      = _selectPool.Pop();
                    fromPool = true;
                }
                else
                {
                    ret = new HtmlSelect();
                }
            }

            //Debug.Log("from=" + fromPool);
            if (ret != null)
            {
                //可能已经被GameObject tree deleted了,不再使用
                if (fromPool && ret.displayObject != null && ret.displayObject.isDisposed)
                {
                    ret.Dispose();
                    return(CreateObject(owner, element));
                }
                ret.Create(owner, element);
                if (ret.displayObject != null)
                {
                    ret.displayObject.home = owner.cachedTransform;
                }
            }

            return(ret);
        }