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;
        }
Exemple #2
0
 static public int get_height(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.height);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
 static public int Dispose(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #4
0
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlLink o;
         o = new FairyGUI.Utils.HtmlLink();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #5
0
 static public int SetPosition(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)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));
     }
 }
Exemple #6
0
 static public int Create(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)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));
     }
 }
Exemple #7
0
 static public int SetArea(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)checkSelf(l);
             UnityEngine.Rect        a1;
             checkValueType(l, 2, out a1);
             self.SetArea(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)checkSelf(l);
             UnityEngine.Rect        a1;
             checkValueType(l, 2, out a1);
             UnityEngine.Rect a2;
             checkValueType(l, 3, out a2);
             self.SetArea(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             FairyGUI.Utils.HtmlLink self = (FairyGUI.Utils.HtmlLink)checkSelf(l);
             UnityEngine.Rect        a1;
             checkValueType(l, 2, out a1);
             UnityEngine.Rect a2;
             checkValueType(l, 3, out a2);
             UnityEngine.Rect a3;
             checkValueType(l, 4, out a3);
             self.SetArea(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #8
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.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);
            }

            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);
        }