/// <summary>Tweens an LayoutElement's preferredWidth/Height to the given value. /// Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> /// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param> public static Tweener DOPreferredSize(this UnityEngine.UI.LayoutElement target, Vector2 endValue, float duration, bool snapping = false) { return(DOTween.To(() => new Vector2(target.preferredWidth, target.preferredHeight), x => { target.preferredWidth = x.x; target.preferredHeight = x.y; }, endValue, duration) .SetOptions(snapping).SetTarget(target)); }
protected override void OnInit() { base.OnInit(); label = GetComponent <UnityEngine.UI.Text>(); layout = GetComponent <UnityEngine.UI.LayoutElement>(); if (label != null) { initialColor = label.color; } }
static int _s_set_preferredWidth(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.LayoutElement gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); gen_to_be_invoked.preferredWidth = (float)LuaAPI.lua_tonumber(L, 2); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _s_set_layoutPriority(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.LayoutElement gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); gen_to_be_invoked.layoutPriority = LuaAPI.xlua_tointeger(L, 2); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _g_get_layoutPriority(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { UnityEngine.UI.LayoutElement __cl_gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, __cl_gen_to_be_invoked.layoutPriority); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(1); }
static int _s_set_flexibleHeight(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { UnityEngine.UI.LayoutElement __cl_gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); __cl_gen_to_be_invoked.flexibleHeight = (float)LuaAPI.lua_tonumber(L, 2); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
static int _g_get_flexibleHeight(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.LayoutElement gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.flexibleHeight); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static StackObject *CalculateLayoutInputVertical_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.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.UI.LayoutElement instance_of_this_method = (UnityEngine.UI.LayoutElement) typeof(UnityEngine.UI.LayoutElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.CalculateLayoutInputVertical(); return(__ret); }
static StackObject *get_flexibleHeight_14(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.UI.LayoutElement instance_of_this_method = (UnityEngine.UI.LayoutElement) typeof(UnityEngine.UI.LayoutElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.flexibleHeight; __ret->ObjectType = ObjectTypes.Float; *(float *)&__ret->Value = result_of_this_method; return(__ret + 1); }
public override void ReadFrom(object obj) { base.ReadFrom(obj); if (obj == null) { return; } UnityEngine.UI.LayoutElement o = (UnityEngine.UI.LayoutElement)obj; ignoreLayout = o.ignoreLayout; minWidth = o.minWidth; minHeight = o.minHeight; preferredWidth = o.preferredWidth; preferredHeight = o.preferredHeight; flexibleWidth = o.flexibleWidth; flexibleHeight = o.flexibleHeight; }
protected override void Init() { if (null == m_target) { return; } // end if m_LayoutElement = m_target.GetComponent <UnityEngine.UI.LayoutElement>(); if (null == m_LayoutElement) { return; } // end if m_beginWidth = m_LayoutElement.flexibleWidth; m_beginHeight = m_LayoutElement.flexibleHeight; }
static StackObject *get_ignoreLayout_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.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.UI.LayoutElement instance_of_this_method = (UnityEngine.UI.LayoutElement) typeof(UnityEngine.UI.LayoutElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.ignoreLayout; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }
public override object WriteTo(object obj, System.Collections.Generic.Dictionary <long, UnityEngine.Object> objects) { obj = base.WriteTo(obj, objects); if (obj == null) { return(null); } UnityEngine.UI.LayoutElement o = (UnityEngine.UI.LayoutElement)obj; o.ignoreLayout = ignoreLayout; o.minWidth = minWidth; o.minHeight = minHeight; o.preferredWidth = preferredWidth; o.preferredHeight = preferredHeight; o.flexibleWidth = flexibleWidth; o.flexibleHeight = flexibleHeight; return(o); }
public override void OnEnter() { GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject); if (_go != null) { _layoutElement = _go.GetComponent <UnityEngine.UI.LayoutElement>(); } DoSetValues(); if (!everyFrame) { Finish(); } }
static StackObject *set_layoutPriority_17(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.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); System.Int32 @value = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.LayoutElement instance_of_this_method = (UnityEngine.UI.LayoutElement) typeof(UnityEngine.UI.LayoutElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.layoutPriority = value; return(__ret); }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.UI.LayoutElement layoutElement = (UnityEngine.UI.LayoutElement)value; writer.WriteProperty("ignoreLayout", layoutElement.ignoreLayout); writer.WriteProperty("minWidth", layoutElement.minWidth); writer.WriteProperty("minHeight", layoutElement.minHeight); writer.WriteProperty("preferredWidth", layoutElement.preferredWidth); writer.WriteProperty("preferredHeight", layoutElement.preferredHeight); writer.WriteProperty("flexibleWidth", layoutElement.flexibleWidth); writer.WriteProperty("flexibleHeight", layoutElement.flexibleHeight); writer.WriteProperty("layoutPriority", layoutElement.layoutPriority); writer.WriteProperty("useGUILayout", layoutElement.useGUILayout); writer.WriteProperty("enabled", layoutElement.enabled); writer.WriteProperty("tag", layoutElement.tag); writer.WriteProperty("name", layoutElement.name); writer.WriteProperty("hideFlags", layoutElement.hideFlags); }
static StackObject *set_flexibleHeight_15(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); System.Single @value = *(float *)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.LayoutElement instance_of_this_method = (UnityEngine.UI.LayoutElement) typeof(UnityEngine.UI.LayoutElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.flexibleHeight = value; return(__ret); }
public override void OnEnter() { GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject); if (_go!=null) { _layoutElement = _go.GetComponent<UnityEngine.UI.LayoutElement>(); } DoSetValues(); if (!everyFrame) { Finish(); } }
void MountTo(RectTransform rectTransform, float w, float h) { Vector2 childSize = new Vector2(w, h); rectTransform.localScale = new Vector3(layout.attr.scalex, layout.attr.scaley, 1); AppendOverParent(rectTransform, childSize); if (layout.attr.underline) { AppendUlOn(rectTransform.gameObject); } GameObject lineMount = situated.lastLine.gameObject; UnityEngine.UI.LayoutElement layoutElement = lineMount.GetComponent <UnityEngine.UI.LayoutElement>(); layoutElement.minWidth = layoutElement.minWidth + w; layoutElement.minHeight = layoutElement.minHeight + h; }
static int _m_DOPreferredSize(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.LayoutElement __cl_gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); int __gen_param_count = LuaAPI.lua_gettop(L); try { if (__gen_param_count == 4 && translator.Assignable <UnityEngine.Vector2>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 4)) { UnityEngine.Vector2 endValue; translator.Get(L, 2, out endValue); float duration = (float)LuaAPI.lua_tonumber(L, 3); bool snapping = LuaAPI.lua_toboolean(L, 4); DG.Tweening.Tweener __cl_gen_ret = __cl_gen_to_be_invoked.DOPreferredSize(endValue, duration, snapping); translator.Push(L, __cl_gen_ret); return(1); } if (__gen_param_count == 3 && translator.Assignable <UnityEngine.Vector2>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { UnityEngine.Vector2 endValue; translator.Get(L, 2, out endValue); float duration = (float)LuaAPI.lua_tonumber(L, 3); DG.Tweening.Tweener __cl_gen_ret = __cl_gen_to_be_invoked.DOPreferredSize(endValue, duration); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.UI.LayoutElement.DOPreferredSize!")); }
static int _m_CalculateLayoutInputVertical(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.LayoutElement __cl_gen_to_be_invoked = (UnityEngine.UI.LayoutElement)translator.FastGetCSObj(L, 1); try { { __cl_gen_to_be_invoked.CalculateLayoutInputVertical( ); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public Widget(string id = null) { GameObject = new UnityEngine.GameObject(); GameObject.AddComponent <WidgetComponent>().widget = this; if (id == null) { Id = "W" + Convert.ToString(staticId++); } else { Id = id; } //EventTrigger.Entry entry = new EventTrigger.Entry() { eventID = EventTriggerType.PointerEnter }; //entry.callback.AddListener( (BaseEventData d) => { // Debug.Log("Enter!"); // GUIController.HoverObject = this; //} ); //GameObject.AddComponent<EventTrigger>().triggers.Add(entry); GameObject.transform.SetParent(GUIController.Canvas.transform); layoutComponent = GameObject.AddComponent <UnityEngine.UI.LayoutElement>(); }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.UI.LayoutElement layoutElement = SaveGameType.CreateComponent <UnityEngine.UI.LayoutElement>(); ReadInto(layoutElement, reader); return(layoutElement); }
/// <summary> /// Read the data into the specified value. /// </summary> /// <param name="value">Value.</param> /// <param name="reader">Reader.</param> public override void ReadInto(object value, ISaveGameReader reader) { UnityEngine.UI.LayoutElement layoutElement = (UnityEngine.UI.LayoutElement)value; foreach (string property in reader.Properties) { switch (property) { case "ignoreLayout": layoutElement.ignoreLayout = reader.ReadProperty <System.Boolean>(); break; case "minWidth": layoutElement.minWidth = reader.ReadProperty <System.Single>(); break; case "minHeight": layoutElement.minHeight = reader.ReadProperty <System.Single>(); break; case "preferredWidth": layoutElement.preferredWidth = reader.ReadProperty <System.Single>(); break; case "preferredHeight": layoutElement.preferredHeight = reader.ReadProperty <System.Single>(); break; case "flexibleWidth": layoutElement.flexibleWidth = reader.ReadProperty <System.Single>(); break; case "flexibleHeight": layoutElement.flexibleHeight = reader.ReadProperty <System.Single>(); break; case "layoutPriority": #if UNITY_2017_1_OR_NEWER layoutElement.layoutPriority = reader.ReadProperty <System.Int32> (); #else reader.ReadProperty <System.Int32>(); #endif break; case "useGUILayout": layoutElement.useGUILayout = reader.ReadProperty <System.Boolean>(); break; case "enabled": layoutElement.enabled = reader.ReadProperty <System.Boolean>(); break; case "tag": layoutElement.tag = reader.ReadProperty <System.String>(); break; case "name": layoutElement.name = reader.ReadProperty <System.String>(); break; case "hideFlags": layoutElement.hideFlags = reader.ReadProperty <UnityEngine.HideFlags>(); break; } } }