public static LabelData GetLabelData(JSONNode json) { json.TryGetAsOrDefault("text", out string text, "Text key not found"); UnityEngine.Color color = UnityEngine.Color.black; UnityEngine.TextAnchor alignement = UnityEngine.TextAnchor.MiddleLeft; if (json.HasChild("color")) { color = GetColor(json.GetAs <string>("color")); } if (json.TryGetAs("alignement", out string alignementStr)) { Enum.TryParse(alignementStr, true, out alignement); } json.TryGetAsOrDefault("fontsize", out int fontSize, 18); LabelData.ELocalizationType localizationType = LabelData.ELocalizationType.Sentence; if (json.TryGetAs("localizationType", out string localizationString) && Enum.TryParse(localizationString, true, out LabelData.ELocalizationType newLocalization)) { localizationType = newLocalization; } return(new LabelData(text, color, alignement, fontSize, localizationType)); }
/// <summary> /// Convert a Unity text anchor to a kRPC text anchor. /// </summary> public static TextAnchor ToTextAnchor(this UnityEngine.TextAnchor style) { switch (style) { case UnityEngine.TextAnchor.LowerCenter: return(TextAnchor.LowerCenter); case UnityEngine.TextAnchor.LowerLeft: return(TextAnchor.LowerLeft); case UnityEngine.TextAnchor.LowerRight: return(TextAnchor.LowerRight); case UnityEngine.TextAnchor.MiddleCenter: return(TextAnchor.MiddleCenter); case UnityEngine.TextAnchor.MiddleLeft: return(TextAnchor.MiddleLeft); case UnityEngine.TextAnchor.MiddleRight: return(TextAnchor.MiddleRight); case UnityEngine.TextAnchor.UpperCenter: return(TextAnchor.UpperCenter); case UnityEngine.TextAnchor.UpperLeft: return(TextAnchor.UpperLeft); case UnityEngine.TextAnchor.UpperRight: return(TextAnchor.UpperRight); default: throw new ArgumentOutOfRangeException(nameof(style)); } }
public void PushUnityEngineTextAnchor(RealStatePtr L, UnityEngine.TextAnchor val) { if (UnityEngineTextAnchor_TypeID == -1) { bool is_first; UnityEngineTextAnchor_TypeID = getTypeId(L, typeof(UnityEngine.TextAnchor), out is_first); if (UnityEngineTextAnchor_EnumRef == -1) { Utils.LoadCSTable(L, typeof(UnityEngine.TextAnchor)); UnityEngineTextAnchor_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX); } } if (LuaAPI.xlua_tryget_cachedud(L, (int)val, UnityEngineTextAnchor_EnumRef) == 1) { return; } IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, UnityEngineTextAnchor_TypeID); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail fail for UnityEngine.TextAnchor ,value=" + val); } LuaAPI.lua_getref(L, UnityEngineTextAnchor_EnumRef); LuaAPI.lua_pushvalue(L, -2); LuaAPI.xlua_rawseti(L, -2, (int)val); LuaAPI.lua_pop(L, 1); }
public static UnityEngine.GUIStyle Aligned(UnityEngine.TextAnchor alignment, UnityEngine.GUIStyle style) { var aligned_style = new UnityEngine.GUIStyle(style); aligned_style.alignment = alignment; return(aligned_style); }
static int IntToEnum(IntPtr L) { int arg0 = (int)LuaDLL.lua_tonumber(L, 1); UnityEngine.TextAnchor o = (UnityEngine.TextAnchor)arg0; ToLua.Push(L, o); return(1); }
static int QPYX_GetTextAnchorPivot_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 1); UnityEngine.TextAnchor QPYX_arg0_YXQP = (UnityEngine.TextAnchor)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.TextAnchor)); UnityEngine.Vector2 QPYX_o_YXQP = UnityEngine.UI.Text.GetTextAnchorPivot(QPYX_arg0_YXQP); ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static StackObject *GetTextAnchorPivot_32(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.TextAnchor anchor = (UnityEngine.TextAnchor) typeof(UnityEngine.TextAnchor).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = UnityEngine.UI.Text.GetTextAnchorPivot(anchor); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
// Rates are in units of |value| per real-time second. public DifferentialSlider(string label, string unit, double log10_lower_rate, double log10_upper_rate, ValueFormatter formatter, UnityEngine.TextAnchor alignment = UnityEngine.TextAnchor.MiddleRight, ValueParser parser = null, double zero_value = 0, double min_value = double.NegativeInfinity, double max_value = double.PositiveInfinity, UnityEngine.Color?text_colour = null, int label_width = 3, int field_width = 5) { label_ = label; label_width_ = label_width; field_width_ = field_width; unit_ = unit; alignment_ = alignment; formatter_ = formatter; if (parser == null) { // As a special exemption we allow a comma as the decimal separator and // the hyphen-minus instead of the minus sign. // We also turn figure spaces back into leading 0s, and remove grouping // marks, since .NET does not like those in the fractional part. parser_ = (string s, out double value) => double.TryParse( s.Replace(',', '.').Replace('-', '−') .Replace(figure_space, '0').Replace("'", ""), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowThousands | NumberStyles.AllowTrailingWhite, Culture.culture.NumberFormat, out value); } else { parser_ = parser; } log10_lower_rate_ = log10_lower_rate; log10_upper_rate_ = log10_upper_rate; zero_value_ = zero_value; min_value_ = min_value; max_value_ = max_value; text_colour_ = text_colour; }
static int QPYX_set_childAlignment_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); UnityEngine.UI.LayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.LayoutGroup)QPYX_o_YXQP; UnityEngine.TextAnchor QPYX_arg0_YXQP = (UnityEngine.TextAnchor)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.TextAnchor)); QPYX_obj_YXQP.childAlignment = QPYX_arg0_YXQP; return(0); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index childAlignment on a nil value")); } }
static int GetTextAnchorPivot(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 1, typeof(UnityEngine.TextAnchor)); UnityEngine.Vector2 o = UnityEngine.UI.Text.GetTextAnchorPivot(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int QPYX_get_childAlignment_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); UnityEngine.UI.LayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.LayoutGroup)QPYX_o_YXQP; UnityEngine.TextAnchor QPYX_ret_YXQP = QPYX_obj_YXQP.childAlignment; ToLua.Push(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index childAlignment on a nil value")); } }
static int GetTextAnchorPivot(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)LuaDLL.luaL_checknumber(L, 1); var o = UnityEngine.UI.Text.GetTextAnchorPivot(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_alignment(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor)); obj.alignment = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index alignment on a nil value" : e.Message)); } }
static int get_alignment(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; UnityEngine.TextAnchor ret = obj.alignment; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index alignment on a nil value" : e.Message)); } }
static int set_alignment(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)LuaDLL.luaL_checknumber(L, 2); obj.alignment = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index alignment on a nil value")); } }
static int get_alignment(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; UnityEngine.TextAnchor ret = obj.alignment; LuaDLL.lua_pushinteger(L, (int)ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index alignment on a nil value")); } }
static int set_childAlignment(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o; UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor)); obj.childAlignment = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index childAlignment on a nil value")); } }
static int get_textAnchor(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.TextGenerationSettings obj = (UnityEngine.TextGenerationSettings)o; UnityEngine.TextAnchor ret = obj.textAnchor; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index textAnchor on a nil value" : e.Message)); } }
static int set_anchor(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.TextMesh obj = (UnityEngine.TextMesh)o; UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor)); obj.anchor = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index anchor on a nil value")); } }
static int get_anchor(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.TextMesh obj = (UnityEngine.TextMesh)o; UnityEngine.TextAnchor ret = obj.anchor; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index anchor on a nil value")); } }
static int get_childAlignment(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.LayoutGroup obj = (UnityEngine.UI.LayoutGroup)o; UnityEngine.TextAnchor ret = obj.childAlignment; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index childAlignment on a nil value")); } }
static int GetTextAnchorPivot(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.UI.Text.GetTextAnchorPivot"); #endif try { ToLua.CheckArgsCount(L, 1); UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 1, typeof(UnityEngine.TextAnchor)); UnityEngine.Vector2 o = UnityEngine.UI.Text.GetTextAnchorPivot(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_textAnchor(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.TextGenerationSettings obj = (UnityEngine.TextGenerationSettings)o; UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor)); obj.textAnchor = arg0; ToLua.SetBack(L, 1, obj); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index textAnchor on a nil value" : e.Message)); } }
static StackObject *set_alignment_17(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.TextAnchor value = (UnityEngine.TextAnchor) typeof(UnityEngine.TextAnchor).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.Text instance_of_this_method; instance_of_this_method = (UnityEngine.UI.Text) typeof(UnityEngine.UI.Text).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.alignment = value; return(__ret); }
static int set_alignment(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.UI.Text.alignment"); #endif object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor)); obj.alignment = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index alignment on a nil value")); } }
static int get_alignment(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.UI.Text.alignment"); #endif object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; UnityEngine.TextAnchor ret = obj.alignment; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index alignment on a nil value")); } }
public void UpdateUnityEngineTextAnchor(RealStatePtr L, int index, UnityEngine.TextAnchor val) { if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineTextAnchor_TypeID) { throw new Exception("invalid userdata for UnityEngine.TextAnchor"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail for UnityEngine.TextAnchor ,value=" + val); } } else { throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index)); } }
public void Get(RealStatePtr L, int index, out UnityEngine.TextAnchor val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineTextAnchor_TypeID) { throw new Exception("invalid userdata for UnityEngine.TextAnchor"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); int e; if (!CopyByValue.UnPack(buff, 0, out e)) { throw new Exception("unpack fail for UnityEngine.TextAnchor"); } val = (UnityEngine.TextAnchor)e; } else { val = (UnityEngine.TextAnchor)objectCasters.GetCaster(typeof(UnityEngine.TextAnchor))(L, index, null); } }
static int QPYX_IntToEnum_YXQP(IntPtr L_YXQP) { int QPYX_arg0_YXQP = (int)LuaDLL.lua_tonumber(L_YXQP, 1); UnityEngine.TextAnchor QPYX_o_YXQP = (UnityEngine.TextAnchor)QPYX_arg0_YXQP; ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); }
static void Push(IntPtr L, UnityEngine.TextAnchor arg) { ToLua.Push(L, arg); }