Inheritance: IHtmlObject
Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 static public int Dispose(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlImage self = (FairyGUI.Utils.HtmlImage)checkSelf(l);
         self.Dispose();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 3
0
 static public int get_height(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlImage self = (FairyGUI.Utils.HtmlImage)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.height);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 4
0
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlImage o;
         o = new FairyGUI.Utils.HtmlImage();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 5
0
 static public int SetPosition(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlImage self = (FairyGUI.Utils.HtmlImage)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));
     }
 }
Ejemplo n.º 6
0
 static public int Create(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlImage self = (FairyGUI.Utils.HtmlImage)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));
     }
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 virtual public void FreeImageTexture(HtmlImage image, NTexture texture)
 {
 }
Ejemplo n.º 9
0
 virtual public NTexture GetImageTexture(HtmlImage image)
 {
     return(null);
 }
Ejemplo n.º 10
0
 public virtual void FreeImageTexture(HtmlImage image, NTexture texture)
 {
 }
Ejemplo n.º 11
0
 public virtual NTexture GetImageTexture(HtmlImage image)
 {
     return null;
 }
Ejemplo n.º 12
0
        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);
            }

            return(ret);
        }