void Start() { Application.targetFrameRate = 60; GRoot.inst.SetContentScaleFactor(1136, 640); Stage.inst.onKeyDown.Add(OnKeyDown); UIPackage.AddPackage("UI/Emoji"); UIConfig.verticalScrollBar = UIPackage.GetItemURL("Emoji", "ScrollBar_VT"); UIConfig.defaultScrollBarDisplay = ScrollBarDisplayType.Auto; _mainView = UIPackage.CreateObject("Emoji", "Main").asCom; _mainView.fairyBatching = true; _mainView.SetSize(GRoot.inst.width, GRoot.inst.height); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); _list = _mainView.GetChild("list").asList; _list.RemoveChildrenToPool(); _input = _mainView.GetChild("input").asTextInput; _input.onKeyDown.Add(__inputKeyDown); _itemURL1 = UIPackage.GetItemURL("Emoji", "chatLeft"); _itemURL2 = UIPackage.GetItemURL("Emoji", "chatRight"); _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn); _mainView.GetChild("btnEmoji").onClick.Add(__clickEmojiBtn); _emojiSelectUI = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom; _emojiSelectUI.fairyBatching = true; _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji); }
override public void Setup_AfterAdd(XML cxml) { base.Setup_AfterAdd(cxml); XML xml = cxml.GetNode("Label"); if (xml == null) { return; } string str; str = xml.GetAttribute("title"); if (str != null) { this.title = str; } str = xml.GetAttribute("icon"); if (str != null) { this.icon = str; } str = xml.GetAttribute("titleColor"); if (str != null) { this.titleColor = ToolSet.ConvertFromHtmlColor(str); } str = xml.GetAttribute("titleFontSize"); if (str != null) { this.titleFontSize = int.Parse(str); } if (_titleObject is GTextInput) { GTextInput input = ((GTextInput)_titleObject); str = xml.GetAttribute("prompt"); if (str != null) { input.promptText = str; } str = xml.GetAttribute("restrict"); if (str != null) { input.restrict = str; } input.maxLength = xml.GetAttributeInt("maxLength", input.maxLength); input.keyboardType = xml.GetAttributeInt("keyboardType", input.keyboardType); input.displayAsPassword = xml.GetAttributeBool("password", input.displayAsPassword); } }
static int set_keyboardType(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.keyboardType = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index keyboardType on a nil value" : e.Message)); } }
static int get_caretPosition(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; int ret = obj.caretPosition; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index caretPosition on a nil value")); } }
static int set_displayAsPassword(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.displayAsPassword = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index displayAsPassword on a nil value" : e.Message)); } }
static int get_emojies(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; System.Collections.Generic.Dictionary <uint, FairyGUI.Emoji> ret = obj.emojies; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index emojies on a nil value" : e.Message)); } }
static int get_keyboardType(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; int ret = obj.keyboardType; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index keyboardType on a nil value" : e.Message)); } }
static int get_promptText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; string ret = obj.promptText; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index promptText on a nil value" : e.Message)); } }
static int get_displayAsPassword(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; bool ret = obj.displayAsPassword; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index displayAsPassword on a nil value" : e.Message)); } }
static int get_onFocusIn(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; FairyGUI.EventListener ret = obj.onFocusIn; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onFocusIn on a nil value")); } }
static int set_keyboardInput(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.keyboardInput = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index keyboardInput on a nil value")); } }
static int set_caretPosition(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.caretPosition = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index caretPosition on a nil value")); } }
static int get_keyboardInput(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; bool ret = obj.keyboardInput; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index keyboardInput on a nil value")); } }
static int set_emojies(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; System.Collections.Generic.Dictionary <uint, FairyGUI.Emoji> arg0 = (System.Collections.Generic.Dictionary <uint, FairyGUI.Emoji>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Dictionary <uint, FairyGUI.Emoji>)); obj.emojies = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index emojies on a nil value" : e.Message)); } }
static int set_promptText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; string arg0 = ToLua.CheckString(L, 2); obj.promptText = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index promptText on a nil value" : e.Message)); } }
static int get_restrict(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; string ret = obj.restrict; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index restrict on a nil value")); } }
static int get_inputTextField(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; FairyGUI.InputTextField ret = obj.inputTextField; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index inputTextField on a nil value" : e.Message)); } }
static int get_onChanged(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GTextInput obj = (FairyGUI.GTextInput)o; FairyGUI.EventListener ret = obj.onChanged; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onChanged on a nil value" : e.Message)); } }
private GObject ConstructChild(XML xml) { string pkgId = xml.GetAttribute("pkg"); UIPackage thisPkg = _packageItem.owner; UIPackage pkg; if (pkgId != null && pkgId != thisPkg.id) { pkg = UIPackage.GetById(pkgId); if (pkg == null) { return(null); } } else { pkg = thisPkg; } string src = xml.GetAttribute("src"); if (src != null) { PackageItem pi = pkg.GetItem(src); if (pi == null) { return(null); } GObject g = pkg.CreateObject(pi, null); return(g); } else { GObject g; if (xml.name == "text" && xml.GetAttributeBool("input", false)) { g = new GTextInput(); } else { g = UIObjectFactory.NewObject(xml.name); } return(g); } }
static int _CreateFairyGUI_GTextInput(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { FairyGUI.GTextInput obj = new FairyGUI.GTextInput(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.GTextInput.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void Start() { Application.targetFrameRate = 60; Stage.inst.onKeyDown.Add(OnKeyDown); _mainView = this.GetComponent<UIPanel>().ui; _list = _mainView.GetChild("list").asList; _list.RemoveChildrenToPool(); _input = _mainView.GetChild("input").asTextInput; _input.onKeyDown.Add(__inputKeyDown); _itemURL1 = UIPackage.GetItemURL("Emoji", "chatLeft"); _itemURL2 = UIPackage.GetItemURL("Emoji", "chatRight"); _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn); _mainView.GetChild("btnEmoji").onClick.Add(__clickEmojiBtn); _emojiSelectUI = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom; _emojiSelectUI.fairyBatching = true; _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji); }
void Start() { Application.targetFrameRate = 60; DontDestroyOnLoad(this.gameObject); Stage.Instantiate(5); Stage.inst.AddChild(new GRoot().displayObject); Stage.inst.camera.clearFlags = CameraClearFlags.Depth; Stage.inst.onKeyDown.Add(OnKeyDown); GRoot.inst.SetContentScaleFactor(1136, 640); UIPackage.AddPackage("UI/EmojiDemo"); UIConfig.verticalScrollBar = UIPackage.GetItemURL("Demo", "ScrollBar_VT"); UIConfig.defaultScrollBarDisplay = ScrollBarDisplayType.Auto; _mainView = UIPackage.CreateObject("Demo", "Main").asCom; _mainView.SetSize(GRoot.inst.width, GRoot.inst.height); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); _list = _mainView.GetChild("list").asList; _list.RemoveChildrenToPool(); _input = _mainView.GetChild("input").asTextInput; _input.onKeyDown.Add(__inputKeyDown); _itemURL1 = UIPackage.GetItemURL("Demo", "chatLeft"); _itemURL2 = UIPackage.GetItemURL("Demo", "chatRight"); _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn); _mainView.GetChild("btnEmoji").onClick.Add(__clickEmojiBtn); _emojiSelectUI = UIPackage.CreateObject("Demo", "EmojiSelectUI").asCom; _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji); }
private GObject ConstructChild(XML xml) { string pkgId = xml.GetAttribute("pkg"); UIPackage thisPkg = _packageItem.owner; UIPackage pkg; if (pkgId != null && pkgId != thisPkg.id) { pkg = UIPackage.GetById(pkgId); if (pkg == null) return null; } else pkg = thisPkg; string src = xml.GetAttribute("src"); if (src != null) { PackageItem pi = pkg.GetItem(src); if (pi == null) return null; GObject g = pkg.CreateObject(pi, null); return g; } else { GObject g; if (xml.name == "text" && xml.GetAttributeBool("input", false)) g = new GTextInput(); else g = UIObjectFactory.NewObject(xml.name); return g; } }
override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos) { base.Setup_AfterAdd(buffer, beginPos); if (!buffer.Seek(beginPos, 6)) { return; } if ((ObjectType)buffer.ReadByte() != packageItem.objectType) { return; } string str; str = buffer.ReadS(); if (str != null) { this.title = str; } str = buffer.ReadS(); if (str != null) { this.icon = str; } if (buffer.ReadBool()) { this.titleColor = buffer.ReadColor(); } int iv = buffer.ReadInt(); if (iv != 0) { this.titleFontSize = iv; } if (buffer.ReadBool()) { GTextInput input = GetTextField() as GTextInput; if (input != null) { str = buffer.ReadS(); if (str != null) { input.promptText = str; } str = buffer.ReadS(); if (str != null) { input.restrict = str; } iv = buffer.ReadInt(); if (iv != 0) { input.maxLength = iv; } iv = buffer.ReadInt(); if (iv != 0) { input.keyboardType = iv; } if (buffer.ReadBool()) { input.displayAsPassword = true; } } else { buffer.Skip(13); } } if (buffer.version >= 5) { string sound = buffer.ReadS(); if (!string.IsNullOrEmpty(sound)) { float volumeScale = buffer.ReadFloat(); displayObject.onClick.Add(() => { NAudioClip audioClip = UIPackage.GetItemAssetByURL(sound) as NAudioClip; if (audioClip != null && audioClip.nativeClip != null) { Stage.inst.PlayOneShotSound(audioClip.nativeClip, volumeScale); } }); } else { buffer.Skip(4); } } }
override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos) { base.Setup_AfterAdd(buffer, beginPos); if (!buffer.Seek(beginPos, 6)) { return; } if ((ObjectType)buffer.ReadByte() != packageItem.objectType) { return; } string str; str = buffer.ReadS(); if (str != null) { this.title = str; } str = buffer.ReadS(); if (str != null) { this.icon = str; } if (buffer.ReadBool()) { this.titleColor = buffer.ReadColor(); } int iv = buffer.ReadInt(); if (iv != 0) { this.titleFontSize = iv; } if (buffer.ReadBool()) { GTextInput input = GetTextField() as GTextInput; if (input != null) { str = buffer.ReadS(); if (str != null) { input.promptText = str; } str = buffer.ReadS(); if (str != null) { input.restrict = str; } iv = buffer.ReadInt(); if (iv != 0) { input.maxLength = iv; } iv = buffer.ReadInt(); if (iv != 0) { input.keyboardType = iv; } if (buffer.ReadBool()) { input.displayAsPassword = true; } } else { buffer.Skip(13); } } }
/// <summary> /// FGUI url转换 /// </summary> /// <param name="url"></param> /// <returns></returns> public static void InputIcon(FairyGUI.GTextInput input, string icon) { string content = string.Format("[img]{0}[/img]", icon); input.ReplaceSelection(content); }
void Start() { Application.targetFrameRate = 60; Stage.inst.onKeyDown.Add(OnKeyDown); _itemURL1 = UIPackage.GetItemURL("EmojiPro", "chatLeft"); _itemURL2 = UIPackage.GetItemURL("EmojiPro", "chatRight"); _messages = new List<Message>(); _mainView = this.GetComponent<UIPanel>().ui; _list = _mainView.GetChild("list").asList; _list.defaultItem = _itemURL1; _list.SetVirtual(); _list.itemProvider = GetListItemResource; _list.itemRenderer = RenderListItem; _input = _mainView.GetChild("input").asTextInput; _input.onKeyDown.Add(__inputKeyDown); //作为demo,这里只添加了部分表情素材 _emojies = new Dictionary<uint, Emoji>(); for (uint i = 0x1f600; i < 0x1f637; i++) { string url = UIPackage.GetItemURL("EmojiPro", Convert.ToString(i, 16)); if (url != null) _emojies.Add(i, new Emoji(url)); } _input.emojies = _emojies; _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn); }