public ModLayoutManager(LayoutGroup layout, UIStyleManager styleManager, ModUIStyleApplier styleApplier, Vector3 scale, Graphic[] constantGraphics, Graphic[] backGraphics) : this(layout, styleManager, styleApplier, scale, constantGraphics) { backGraphics.ToList().ForEach(element => _backingGraphics.Add(element)); styleApplier.SetBackground(backGraphics); }
public ModLayoutManager(LayoutGroup layout, UIStyleManager styleManager, ModUIStyleApplier styleApplier, Vector3 scale) { _scale = scale; _styleManager = styleManager; _styleApplier = styleApplier; LayoutGroup = layout; LayoutGroup.childAlignment = TextAnchor.MiddleCenter; LayoutGroup.transform.localPosition = Vector3.zero; var rectTransform = (RectTransform)LayoutGroup.transform; rectTransform.pivot = NormalPivot; UpdateState(); }
public ModLayoutButton(Button button, IModMenu menu) : base(button, menu) { var scale = button.transform.localScale; Object.Destroy(Button.GetComponentInChildren <Text>(true).gameObject); var layoutObject = new GameObject("LayoutGroup", typeof(RectTransform)); layoutObject.transform.SetParent(button.transform); var target = layoutObject.AddComponent <Image>(); target.raycastTarget = true; target.color = Color.clear; var layoutGroup = layoutObject.AddComponent <HorizontalLayoutGroup>(); Initialize(menu); layoutGroup.childControlWidth = false; layoutGroup.childControlHeight = false; layoutGroup.childForceExpandHeight = false; layoutGroup.childForceExpandWidth = false; var styleManager = Object.FindObjectOfType <UIStyleManager>(); var styleApplier = ModUIStyleApplier.ReplaceStyleApplier(Button.gameObject); Layout = new ModLayoutManager(layoutGroup, styleManager, styleApplier, scale); }
public ModLayoutManager(LayoutGroup layout, UIStyleManager styleManager, ModUIStyleApplier styleApplier, Vector3 scale, Graphic[] constantGraphics) : this(layout, styleManager, styleApplier, scale) { constantGraphics.ToList().ForEach(element => _constantGraphics.Add(element)); }