public void CreateLabel() { //GameObject mObj = LuaHelper.CreateInstance("Assets/GameModules/Chat/Prefabs/GameObject.prefab"); //mObj.transform.parent = scrollViewRoot;// LuaHelper.GetActiveCanvasParent(); //MixedLabel mixedLabel = mObj.GetComponent<MixedLabel>(); MixedLabel mixedLabel = MixedLabelGlobal.CreateMixedLabel(); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); mixedLabel.Init( displayStrings[currentDisplayStringIndex % displayStrings.Length], contentWidth, new TextSettings() { textColor = Color.black, hyperDefaultColor = Color.blue, hyperHoverColor = Color.red, hyperPressColor = Color.green }, (x) => { Debug.LogFormat("Number {0} hyper link is clicked", x); }, (x) => { Debug.LogFormat("Number {0} hyper link is clicked", x); }); mixedLabel.transform.parent = scrollViewRoot; mixedLabel.GetComponent <RectTransform>().anchoredPosition = new Vector3(20, currentYPos, 0); //20 is the horizontal padding mMixedLabels.Add(mixedLabel); currentYPos -= mixedLabel.totalHeight + 20; //20 is vertical padding currentDisplayStringIndex++; scrollViewRoot.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, -currentYPos); sw.Stop(); Debug.LogFormat("request time = {0}", sw.Elapsed.TotalMilliseconds); }
public static MixedLabel CreateMixedLabel() { GameObject obj = emojiFactory.CreateObj(ChatCreationType.Label); MixedLabel mixedLabel = obj.GetComponent <MixedLabel>(); if (mixedLabel == null) { Debug.LogError("The factory cannot create a right mixedlabel"); } return(mixedLabel); }
static int Dispose(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); MixedLabel obj = (MixedLabel)ToLua.CheckObject <MixedLabel>(L, 1); obj.Dispose(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_totalHeight(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); MixedLabel obj = (MixedLabel)o; int ret = obj.totalHeight; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index totalHeight on a nil value")); } }
static int set_totalHeight(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); MixedLabel obj = (MixedLabel)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.totalHeight = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index totalHeight on a nil value")); } }
static int Init(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); MixedLabel obj = (MixedLabel)ToLua.CheckObject <MixedLabel>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); TextSettings arg2 = (TextSettings)ToLua.CheckObject <TextSettings>(L, 4); System.Action <int>[] arg3 = ToLua.CheckParamsObject <System.Action <int> >(L, 5, count - 4); obj.Init(arg0, arg1, arg2, arg3); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }