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"); }
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"); }
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"); }
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; } }
static public int GetInt(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { FairyGUI.Utils.HtmlElement self = (FairyGUI.Utils.HtmlElement)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetInt(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { FairyGUI.Utils.HtmlElement self = (FairyGUI.Utils.HtmlElement)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); var ret = self.GetInt(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
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"); }
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; } }
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"); }
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"); }
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"); }