/// <summary> /// Function to add a new sub text object. /// </summary> /// <param name="textComponent"></param> /// <param name="materialReference"></param> /// <returns></returns> public static TMP_SubMeshUI AddSubTextObject(TextMeshProUGUI textComponent, MaterialReference materialReference) { GameObject go = new GameObject("TMP UI SubObject [" + materialReference.material.name + "]", typeof(RectTransform)); go.transform.SetParent(textComponent.transform, false); go.layer = textComponent.gameObject.layer; RectTransform rectTransform = go.GetComponent <RectTransform>(); rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.sizeDelta = Vector2.zero; rectTransform.pivot = textComponent.rectTransform.pivot; TMP_SubMeshUI subMesh = go.AddComponent <TMP_SubMeshUI>(); subMesh.m_canvasRenderer = subMesh.canvasRenderer; subMesh.m_TextComponent = textComponent; subMesh.m_materialReferenceIndex = materialReference.index; subMesh.m_fontAsset = materialReference.fontAsset; subMesh.m_spriteAsset = materialReference.spriteAsset; subMesh.m_isDefaultMaterial = materialReference.isDefaultMaterial; subMesh.SetSharedMaterial(materialReference.material); return(subMesh); }
public static TMP_SubMeshUI AddSubTextObject(TextMeshProUGUI textComponent, MaterialReference materialReference) { GameObject gameObject = new GameObject("TMP UI SubObject [" + materialReference.material.name + "]", new Type[] { typeof(RectTransform) }); gameObject.transform.SetParent(textComponent.transform, false); gameObject.layer = textComponent.gameObject.layer; RectTransform component = gameObject.GetComponent <RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; component.pivot = textComponent.rectTransform.pivot; TMP_SubMeshUI tmp_SubMeshUI = gameObject.AddComponent <TMP_SubMeshUI>(); tmp_SubMeshUI.m_canvasRenderer = tmp_SubMeshUI.canvasRenderer; tmp_SubMeshUI.m_TextComponent = textComponent; tmp_SubMeshUI.m_materialReferenceIndex = materialReference.index; tmp_SubMeshUI.m_fontAsset = materialReference.fontAsset; tmp_SubMeshUI.m_spriteAsset = materialReference.spriteAsset; tmp_SubMeshUI.m_isDefaultMaterial = materialReference.isDefaultMaterial; tmp_SubMeshUI.SetSharedMaterial(materialReference.material); return(tmp_SubMeshUI); }
//alters alpha value of each component's material public void SetAlpha(float a) { border.color = new Color(border.color.r, border.color.g, border.color.b, a); innermessagepanel.color = new Color(innermessagepanel.color.r, innermessagepanel.color.g, innermessagepanel.color.b, a); TMPro.TMP_SubMeshUI submesh = messageContainer.GetComponentInChildren <TMPro.TMP_SubMeshUI>(); submesh.material.color = new Color(submesh.material.color.r, submesh.material.color.g, submesh.material.color.b, a); }
static int GetPaddingForMaterial(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); float o = obj.GetPaddingForMaterial(); LuaDLL.lua_pushnumber(L, o); return(1); } else if (count == 2) { TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject <UnityEngine.Material>(L, 2); float o = obj.GetPaddingForMaterial(arg0); LuaDLL.lua_pushnumber(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: TMPro.TMP_SubMeshUI.GetPaddingForMaterial")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int RecalculateMasking(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); obj.RecalculateMasking(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetPivotDirty(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); obj.SetPivotDirty(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Rebuild(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); UnityEngine.UI.CanvasUpdate arg0 = (UnityEngine.UI.CanvasUpdate)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.CanvasUpdate)); obj.Rebuild(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetModifiedMaterial(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject <UnityEngine.Material>(L, 2); UnityEngine.Material o = obj.GetModifiedMaterial(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int UpdateMeshPadding(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); obj.UpdateMeshPadding(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_padding(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; float ret = obj.padding; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index padding on a nil value")); } }
static int set_mesh(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); obj.mesh = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mesh on a nil value")); } }
static int set_padding(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.padding = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index padding on a nil value")); } }
static int set_isDefaultMaterial(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.isDefaultMaterial = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isDefaultMaterial on a nil value")); } }
static int set_fallbackSourceMaterial(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject <UnityEngine.Material>(L, 2); obj.fallbackSourceMaterial = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index fallbackSourceMaterial on a nil value")); } }
static int Cull(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)ToLua.CheckObject <TMPro.TMP_SubMeshUI>(L, 1); UnityEngine.Rect arg0 = StackTraits <UnityEngine.Rect> .Check(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); obj.Cull(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_isDefaultMaterial(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; bool ret = obj.isDefaultMaterial; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isDefaultMaterial on a nil value")); } }
static int get_materialForRendering(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; UnityEngine.Material ret = obj.materialForRendering; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index materialForRendering on a nil value")); } }
static int AddSubTextObject(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); TMPro.TextMeshProUGUI arg0 = (TMPro.TextMeshProUGUI)ToLua.CheckObject <TMPro.TextMeshProUGUI>(L, 1); TMPro.MaterialReference arg1 = StackTraits <TMPro.MaterialReference> .Check(L, 2); TMPro.TMP_SubMeshUI o = TMPro.TMP_SubMeshUI.AddSubTextObject(arg0, arg1); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_spriteAsset(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; TMPro.TMP_SpriteAsset ret = obj.spriteAsset; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index spriteAsset on a nil value")); } }
static int get_mesh(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; UnityEngine.Mesh ret = obj.mesh; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mesh on a nil value")); } }
static int set_spriteAsset(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); TMPro.TMP_SubMeshUI obj = (TMPro.TMP_SubMeshUI)o; TMPro.TMP_SpriteAsset arg0 = (TMPro.TMP_SpriteAsset)ToLua.CheckObject <TMPro.TMP_SpriteAsset>(L, 2); obj.spriteAsset = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index spriteAsset on a nil value")); } }
// Start is called before the first frame update void Awake() { image = panel.GetComponent <Image>(); sm = textmesh.GetComponent <TMPro.TMP_SubMeshUI>(); }