예제 #1
0
 public HtmlEngine(RichTextField box, Graphics g, Rectangle bounds, Font font, Color color)
 {
     this.box    = box;
     this.g      = g;
     this.bounds = bounds;
     context     = new Context("", font, color, TextField.TextAlignmentType.Left);
 }
예제 #2
0
        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");
        }
예제 #3
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            if (comboBox == null)
            {
                return;
            }

            int width  = element.GetInt("width", 0);
            int height = element.GetInt("height", 0);

            if (width == 0)
            {
                width = comboBox.sourceWidth;
            }
            if (height == 0)
            {
                height = comboBox.sourceHeight;
            }

            comboBox.SetSize(width, height);
            comboBox.items  = (string[])element.Get("items");
            comboBox.values = (string[])element.Get("values");
            comboBox.value  = element.GetString("value");
        }
예제 #4
0
        public void Release()
        {
            _shape.RemoveEventListeners();

            _owner   = null;
            _element = null;
        }
예제 #5
0
파일: HtmlInput.cs 프로젝트: yinlei/Fishing
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner = owner;
            _element = element;

            string type = element.GetString("type");
            if (type != null)
                type = type.ToLower();

            _hidden = type == "hidden";
            if (!_hidden)
            {
                int width = element.GetInt("width", 0);
                int height = element.GetInt("height", 0);
                _borderSize = element.GetInt("border", defaultBorderSize);
                Color borderColor = element.GetColor("border-color", defaultBorderColor);

                if (width == 0)
                {
                    width = element.space - _borderSize * 2;
                    if (width > _owner.width / 2 || width < 100)
                        width = (int)_owner.width / 2;
                }
                if (height == 0)
                    height = element.format.size + 10 + _borderSize * 2;

                textInput.textFormat = element.format;
                textInput.displayAsPassword = type == "password";
                textInput.SetSize(width - _borderSize * 2, height - _borderSize * 2);
                textInput.maxLength = element.GetInt("maxlength", int.MaxValue);
                _border.size = new Vector2(width, height);
                _border.DrawRect(_borderSize, borderColor, new Color(0, 0, 0, 0));
            }
            textInput.text = element.GetString("value");
        }
예제 #6
0
        public void Release()
        {
            textInput.RemoveEventListeners();
            textInput.text = null;

            _owner   = null;
            _element = null;
        }
예제 #7
0
 public void Create(RichTextField owner, HtmlElement element)
 {
     _owner   = owner;
     _element = element;
     _shape.onClick.Add(_clickHandler);
     _shape.onRollOver.Add(_rolloverHandler);
     _shape.onRollOut.Add(_rolloutHandler);
     _shape.color = _owner.htmlParseOptions.linkBgColor;
 }
예제 #8
0
        public void Release()
        {
            if (button != null)
            {
                button.RemoveEventListeners();
            }

            _owner   = null;
            _element = null;
        }
예제 #9
0
        public void Release()
        {
            if (comboBox != null)
            {
                comboBox.RemoveEventListeners();
            }

            _owner   = null;
            _element = null;
        }
예제 #10
0
        public void Remove()
        {
            if (button != null && button.displayObject.parent != null)
            {
                _owner.RemoveChild(button.displayObject);
            }

            _owner   = null;
            _element = null;
        }
예제 #11
0
        public void Remove()
        {
            if (comboBox != null && comboBox.displayObject.parent != null)
            {
                _owner.RemoveChild(comboBox.displayObject);
            }

            _owner   = null;
            _element = null;
        }
예제 #12
0
        private static Control CreateRichTextFieldControl(SPField field, SPList list, SPListItem item, SPControlMode mode)
        {
            RichTextField rtf = new RichTextField();

            rtf.ListId      = list.ID;
            rtf.ItemId      = item.ID;
            rtf.FieldName   = field.Title;
            rtf.ID          = field.Title;
            rtf.ControlMode = mode;
            return(rtf);
        }
예제 #13
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;
        }
예제 #14
0
파일: HtmlLink.cs 프로젝트: mengtest/u1
        public void Remove()
        {
            if (shape.parent != null)
            {
                _owner.RemoveChild(shape);
            }
            shape.RemoveEventListeners();

            _owner   = null;
            _element = null;
        }
예제 #15
0
        public void Release()
        {
            loader.RemoveEventListeners();
            if (_externalTexture)
            {
                _owner.htmlPageContext.FreeImageTexture(this, loader.texture);
            }

            loader.url = null;
            _owner     = null;
            _element   = null;
        }
예제 #16
0
        public void Remove()
        {
            if (!_hidden && textInput.displayObject.parent != null)
            {
                _owner.RemoveChild(_border);
                _owner.RemoveChild(textInput.displayObject);
            }
            textInput.text = null;

            _owner   = null;
            _element = null;
        }
예제 #17
0
파일: HtmlImage.cs 프로젝트: mengtest/u1
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            int width  = element.GetInt("width", 0);
            int height = element.GetInt("height", 0);

            NTexture texture = owner.htmlPageContext.GetImageTexture(this);

            if (texture != null)
            {
                if (width == 0)
                {
                    width = texture.width;
                }
                if (height == 0)
                {
                    height = texture.height;
                }

                loader.SetSize(width, height);
                loader.texture   = texture;
                _externalTexture = true;
            }
            else
            {
                string src = element.GetString("src");
                if (src != null && (width == 0 || height == 0))
                {
                    PackageItem pi = UIPackage.GetItemByURL(src);
                    if (pi != null)
                    {
                        width  = pi.width;
                        height = pi.height;
                    }
                }

                if (width == 0)
                {
                    width = 5;
                }
                if (height == 0)
                {
                    height = 10;
                }

                loader.SetSize(width, height);
                loader.url       = src;
                _externalTexture = false;
            }
        }
예제 #18
0
파일: HtmlImage.cs 프로젝트: zz0733/Fishing
        public void Remove()
        {
            if (loader.displayObject.parent != null)
            {
                _owner.RemoveChild(loader.displayObject);
            }
            if (_externalTexture)
            {
                _owner.htmlPageContext.FreeImageTexture(this, loader.texture);
            }
            loader.url = null;

            _owner   = null;
            _element = null;
        }
예제 #19
0
파일: HtmlLink.cs 프로젝트: mengtest/u1
 public void Create(RichTextField owner, HtmlElement element)
 {
     _owner   = owner;
     _element = element;
     shape.onClick.Add(_clickHandler);
     if (!Stage.touchScreen)
     {
         shape.onRollOver.Add(_rolloverHandler);
         shape.onRollOut.Add(_rolloutHandler);
     }
     else
     {
         shape.onTouchBegin.Add(_rolloverHandler);
         shape.onTouchEnd.Add(_rolloutHandler);
     }
 }
예제 #20
0
 public void Create(RichTextField owner, HtmlElement element)
 {
     _owner = owner;
     _element = element;
     shape.onClick.Add(_clickHandler);
     if (!Stage.touchScreen)
     {
         shape.onRollOver.Add(_rolloverHandler);
         shape.onRollOut.Add(_rolloutHandler);
     }
     else
     {
         shape.onTouchBegin.Add(_rolloverHandler);
         shape.onTouchEnd.Add(_rolloutHandler);
     }
 }
예제 #21
0
 public void Create(RichTextField owner, HtmlElement element)
 {
     _owner   = owner;
     _element = element;
     _shape.onClick.Add(_clickHandler);
     if (!Stage.touchScreen)
     {
         _shape.onRollOver.Add(_rolloverHandler);
         _shape.onRollOut.Add(_rolloutHandler);
     }
     else
     {
         _shape.onTouchBegin.Add(_rolloverHandler);
         _shape.onTouchEnd.Add(_rolloutHandler);
     }
     _shape.color = _owner.htmlParseOptions.linkBgColor;
 }
예제 #22
0
 public void Create(RichTextField owner, HtmlElement element)
 {
     _owner = owner;
     _element = element;
     _shape.onClick.Add(_clickHandler);
     if (!Stage.touchScreen)
     {
         _shape.onRollOver.Add(_rolloverHandler);
         _shape.onRollOut.Add(_rolloutHandler);
     }
     else
     {
         _shape.onTouchBegin.Add(_rolloverHandler);
         _shape.onTouchEnd.Add(_rolloutHandler);
     }
     _shape.color = _owner.htmlParseOptions.linkBgColor;
 }
예제 #23
0
파일: HtmlImage.cs 프로젝트: yinlei/Fishing
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner = owner;
            _element = element;

            int width = element.GetInt("width", 0);
            int height = element.GetInt("height", 0);

            NTexture texture = owner.htmlPageContext.GetImageTexture(this);
            if (texture != null)
            {
                if (width == 0)
                    width = texture.width;
                if (height == 0)
                    height = texture.height;

                loader.SetSize(width, height);
                loader.texture = texture;
                _externalTexture = true;

            }
            else
            {
                string src = element.GetString("src");
                if (src != null && (width == 0 || height == 0))
                {
                    PackageItem pi = UIPackage.GetItemByURL(src);
                    if (pi != null)
                    {
                        width = pi.width;
                        height = pi.height;
                    }
                }

                if (width == 0)
                    width = 5;
                if (height == 0)
                    height = 10;

                loader.SetSize(width, height);
                loader.url = src;
                _externalTexture = false;
            }
        }
예제 #24
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            string type = element.GetString("type");

            if (type != null)
            {
                type = type.ToLower();
            }

            _hidden = type == "hidden";
            if (!_hidden)
            {
                int width  = element.GetInt("width", 0);
                int height = element.GetInt("height", 0);
                _borderSize = element.GetInt("border", defaultBorderSize);
                Color borderColor = element.GetColor("border-color", defaultBorderColor);

                if (width == 0)
                {
                    width = element.space;
                    if (width > _owner.width / 2 || width < 100)
                    {
                        width = (int)_owner.width / 2;
                    }
                }
                if (height == 0)
                {
                    height = element.format.size + 10 + _borderSize * 2;
                }

                textInput.textFormat        = element.format;
                textInput.displayAsPassword = type == "password";
                textInput.SetSize(width - _borderSize * 2, height - _borderSize * 2);
                textInput.maxLength = element.GetInt("maxlength", int.MaxValue);

                _border.SetXY(-_borderSize, -_borderSize);
                _border.SetSize(width, height);
                _border.DrawRect(_borderSize, borderColor, new Color(0, 0, 0, 0));
            }
            textInput.text = element.GetString("value");
        }
예제 #25
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner = owner;
            _element = element;

            if (button == null)
                return;

            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");
        }
예제 #26
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner   = owner;
            _element = element;

            if (comboBox == null)
            {
                return;
            }

            comboBox.onChanged.Add(_changeHandler);

            int width  = element.GetInt("width", comboBox.sourceWidth);
            int height = element.GetInt("height", comboBox.sourceHeight);

            comboBox.SetSize(width, height);
            comboBox.items  = (string[])element.Get("items");
            comboBox.values = (string[])element.Get("values");
            comboBox.value  = element.GetString("value");
        }
예제 #27
0
        public void Create(RichTextField owner, HtmlElement element)
        {
            _owner = owner;
            _element = element;

            if (comboBox == null)
                return;

            int width = element.GetInt("width", 0);
            int height = element.GetInt("height", 0);

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

            comboBox.SetSize(width, height);
            comboBox.items = (string[])element.Get("items");
            comboBox.values = (string[])element.Get("values");
            comboBox.value = element.GetString("value");
        }
예제 #28
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);
        }
예제 #29
0
        public void Release()
        {
            if (button != null)
                button.RemoveEventListeners();

            _owner = null;
            _element = null;
        }
예제 #30
0
        public void Remove()
        {
            if (button != null && button.displayObject.parent != null)
                _owner.RemoveChild(button.displayObject);

            _owner = null;
            _element = null;
        }
예제 #31
0
        public void Release()
        {
            loader.RemoveEventListeners();
            if (_externalTexture)
                _owner.htmlPageContext.FreeImageTexture(this, loader.texture);

            loader.url = null;
            _owner = null;
            _element = null;
        }
예제 #32
0
파일: HtmlInput.cs 프로젝트: yinlei/Fishing
        public void Remove()
        {
            if (!_hidden && textInput.displayObject.parent != null)
            {
                _owner.RemoveChild(_border);
                _owner.RemoveChild(textInput.displayObject);
            }
            textInput.text = null;

            _owner = null;
            _element = null;
        }
예제 #33
0
파일: HtmlImage.cs 프로젝트: yinlei/Fishing
        public void Remove()
        {
            if (loader.displayObject.parent != null)
                _owner.RemoveChild(loader.displayObject);
            if (_externalTexture)
                _owner.htmlPageContext.FreeImageTexture(this, loader.texture);
            loader.url = null;

            _owner = null;
            _element = null;
        }
예제 #34
0
        public void Release()
        {
            if (comboBox != null)
                comboBox.RemoveEventListeners();

            _owner = null;
            _element = null;
        }
예제 #35
0
        public void Release()
        {
            _shape.RemoveEventListeners();

            _owner = null;
            _element = null;
        }
예제 #36
0
        public void Release()
        {
            textInput.RemoveEventListeners();
            textInput.text = null;

            _owner = null;
            _element = null;
        }
예제 #37
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);
        }
예제 #38
0
        public void Remove()
        {
            if (comboBox != null && comboBox.displayObject.parent != null)
                _owner.RemoveChild(comboBox.displayObject);

            _owner = null;
            _element = null;
        }
예제 #39
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);
                if (ret.displayObject != null)
                {
                    ret.displayObject.home = owner.cachedTransform;
                }
            }

            return(ret);
        }