void OnSetDivisionAlignment() { UnityEngine.UI.HorizontalLayoutGroup layoutGroup = situated.root.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>(); layoutGroup.childForceExpandHeight = false; layoutGroup.childForceExpandWidth = false; layoutGroup.childAlignment = layout.GetDivAlignment(); }
/// <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.HorizontalLayoutGroup horizontalLayoutGroup = (UnityEngine.UI.HorizontalLayoutGroup)value; foreach (string property in reader.Properties) { switch (property) { case "spacing": horizontalLayoutGroup.spacing = reader.ReadProperty <System.Single> (); break; case "childForceExpandWidth": horizontalLayoutGroup.childForceExpandWidth = reader.ReadProperty <System.Boolean> (); break; case "childForceExpandHeight": horizontalLayoutGroup.childForceExpandHeight = reader.ReadProperty <System.Boolean> (); break; case "childControlWidth": horizontalLayoutGroup.childControlWidth = reader.ReadProperty <System.Boolean> (); break; case "childControlHeight": horizontalLayoutGroup.childControlHeight = reader.ReadProperty <System.Boolean> (); break; case "padding": horizontalLayoutGroup.padding = reader.ReadProperty <UnityEngine.RectOffset> (); break; case "childAlignment": horizontalLayoutGroup.childAlignment = reader.ReadProperty <UnityEngine.TextAnchor> (); break; case "useGUILayout": horizontalLayoutGroup.useGUILayout = reader.ReadProperty <System.Boolean> (); break; case "enabled": horizontalLayoutGroup.enabled = reader.ReadProperty <System.Boolean> (); break; case "tag": horizontalLayoutGroup.tag = reader.ReadProperty <System.String> (); break; case "name": horizontalLayoutGroup.name = reader.ReadProperty <System.String> (); break; case "hideFlags": horizontalLayoutGroup.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> (); break; } } }
static StackObject *SetLayoutVertical_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.HorizontalLayoutGroup instance_of_this_method = (UnityEngine.UI.HorizontalLayoutGroup) typeof(UnityEngine.UI.HorizontalLayoutGroup).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetLayoutVertical(); 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.HorizontalLayoutGroup horizontalLayoutGroup = (UnityEngine.UI.HorizontalLayoutGroup)value; writer.WriteProperty("spacing", horizontalLayoutGroup.spacing); writer.WriteProperty("childForceExpandWidth", horizontalLayoutGroup.childForceExpandWidth); writer.WriteProperty("childForceExpandHeight", horizontalLayoutGroup.childForceExpandHeight); writer.WriteProperty("childControlWidth", horizontalLayoutGroup.childControlWidth); writer.WriteProperty("childControlHeight", horizontalLayoutGroup.childControlHeight); writer.WriteProperty("padding", horizontalLayoutGroup.padding); writer.WriteProperty("childAlignment", horizontalLayoutGroup.childAlignment); writer.WriteProperty("useGUILayout", horizontalLayoutGroup.useGUILayout); writer.WriteProperty("enabled", horizontalLayoutGroup.enabled); writer.WriteProperty("tag", horizontalLayoutGroup.tag); writer.WriteProperty("name", horizontalLayoutGroup.name); writer.WriteProperty("hideFlags", horizontalLayoutGroup.hideFlags); }
static int _m_SetLayoutHorizontal(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.HorizontalLayoutGroup __cl_gen_to_be_invoked = (UnityEngine.UI.HorizontalLayoutGroup)translator.FastGetCSObj(L, 1); try { { __cl_gen_to_be_invoked.SetLayoutHorizontal( ); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
static int _m_CalculateLayoutInputVertical(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.HorizontalLayoutGroup gen_to_be_invoked = (UnityEngine.UI.HorizontalLayoutGroup)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.CalculateLayoutInputVertical( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
// it expects to call Attach() first befor any members vaild. // and should be reset the env for each call. public bool Attach(GameObject parent, string format) { // test of antecedent conditions if (null == parent) { Warning("Hello Kitten, that is what I going to say 'cause parent go is nil"); return(false); } // load prefab resources const int resMax = 4; string[] RlResourcePaths = { "Assets/Prefabs/ui/common/RichLinesText.prefab", "Assets/Prefabs/ui/common/RichLinesImage.prefab", "Assets/Prefabs/ui/common/RichLinesRoot.prefab", "Assets/Prefabs/ui/common/RichLinesMount.prefab", }; GameObject[] RlResourceGo = new GameObject[resMax]; for (int i = 0; i < resMax; ++i) { GameObject go = LoadResource(RlResourcePaths[i], typeof(GameObject)) as GameObject; if (null == go) { return(false); } RlResourceGo[i] = go; } // initialize situated = new Situation(); layout = new Layout(); situated.textGo = RlResourceGo[0]; situated.imageGo = RlResourceGo[1]; situated.root = MyInstantiate(RlResourceGo[2]); situated.format = format; // Destroying assets is not permitted to avoid data loss. // GameObject.Destroy(RlResourceGo[2]); // set layout root UnityEngine.UI.Text textRoot = situated.root.GetComponent <UnityEngine.UI.Text>(); textRoot.text = ""; textRoot.name = "RichZone"; RectTransform rectTransform = textRoot.rectTransform; situated.areaSize = GetGameObjectSize(parent); Vector2 middleCenter = new Vector2(0.5f, 0.5f); rectTransform.anchorMax = middleCenter; rectTransform.anchorMin = middleCenter; rectTransform.offsetMax = middleCenter; rectTransform.offsetMin = middleCenter; rectTransform.pivot = middleCenter; rectTransform.sizeDelta = situated.areaSize; rectTransform.SetParent(parent.transform); rectTransform.localScale = Vector3.one; rectTransform.localPosition = Vector3.zero; /*new Vector3(-situated.areaSize.x/2, 0)*/; UnityEngine.UI.HorizontalLayoutGroup horizontalLayoutGroup = situated.root.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>(); horizontalLayoutGroup.childForceExpandWidth = false; horizontalLayoutGroup.childForceExpandHeight = false; OnSetDivisionAlignment(); // set layout mount GameObject mountGo = MyInstantiate(/*situated.textGo*/ RlResourceGo[3]); if (null == mountGo) { return(false); } UnityEngine.UI.Text text = mountGo.GetComponent <UnityEngine.UI.Text>(); text.text = ""; text.name = "RichMount"; rectTransform = situated.lastLine = text.rectTransform; rectTransform.anchorMax = new Vector2(0, 0.5f); rectTransform.anchorMin = new Vector2(0, 0.5f); rectTransform.offsetMax = new Vector2(0, 0.5f); rectTransform.offsetMin = new Vector2(0, 0.5f); rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.SetParent(situated.root.transform, false); rectTransform.localScale = Vector3.one; rectTransform.localPosition = new Vector3(-situated.areaSize.x, 0, 0); situated.mount = mountGo; while (ParseOnce() && !IsEndOfInput()) { ; } // Debug.Log("[RichEngine]: RichLines.RichAnalyzer done with " + IsEndOfInput()); return(IsEndOfInput()); }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.UI.HorizontalLayoutGroup horizontalLayoutGroup = SaveGameType.CreateComponent <UnityEngine.UI.HorizontalLayoutGroup> (); ReadInto(horizontalLayoutGroup, reader); return(horizontalLayoutGroup); }
public static void SetPoolListLayoutHorizontal <T>(this Transform parent, T prefab, RectTransform holder, UnityEngine.UI.HorizontalLayoutGroup layout, int count, ref List <T> pool, Func <T, RectTransform> prefabRectGetter, Action <T, int> initPoolObj, bool inversePoolInit = false) where T : MonoBehaviour { float width = layout.padding.left; parent.SetPoolList(prefab, count, ref pool, (p, i) => { initPoolObj(p, i); width += prefabRectGetter(p).sizeDelta.x; if (i < count - 1) { width += layout.spacing; } }, inversePoolInit); width += layout.padding.right; holder.sizeDelta = new Vector2(width, holder.sizeDelta.y); }
public void SetBannerWidget(GameToggleButton[] banner) { this.m_banners = banner; this.m_gridLayout = banner[0].Widget.parent.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>(); }