public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme) { uiTheme = theme; uiSo = ui; shape = UnityUtil.GetRequiredComp <UiThemeShapeBeh>(this); SetDisabled(isClickDisabled); return(UnityUtil.Once(gameObject)); }
public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme) { shape = UnityUtil.GetRequiredComp <UiThemeShapeBeh>(this); shape.hideFlags = ui.isVerboseDebug ? HideFlags.None : HideFlags.HideInInspector; UiThemeUtil.AddChild(ref textBeh, "Text", transform, ui); shape.Initialize(ui, theme); textBeh.Initialize(ui, theme); textBeh.SetFontType(UIThemeFontType.Button); textBeh.SetAlignment(TextAnchor.MiddleCenter); textBeh.SetValue(text); shape.SetShapeType(shapeType); shapeRipple = UnityUtil.GetRequiredComp <UiThemeShapeRipple>(this); shapeRipple.Initialize(ui, theme); shapeRipple.SetDisabled(isClickDisabled); shapeRipple.hideFlags = ui.isVerboseDebug ? HideFlags.None : HideFlags.HideInInspector; shape.hideFlags = ui.isVerboseDebug ? HideFlags.None : HideFlags.HideInInspector; SetClickDisabled(isClickDisabled); return(UnityUtil.Once(gameObject)); }
public IEnumerable <GameObject> Initialize(UiSo aUi, UiTheme theme) { ui = aUi; windowShape = UnityUtil.GetRequiredComp <UiThemeShapeBeh>(this); windowShape.hideFlags = ui.GetHideFlags(); openMotion = UnityUtil.GetRequiredComp <UiMotionBeh>(this); openMotion.hideFlags = ui.GetHideFlags(); openMotion.offset = Vector2.right * (size.x + position.x); var rectTransform = GetComponent <RectTransform>(); rectTransform.anchorMin = Vector2.one; rectTransform.anchorMax = Vector2.one; rectTransform.pivot = Vector2.one; rectTransform.sizeDelta = size; if (UiThemeUtil.AddChild(ref layoutGroup, "Layout", transform, ui)) { layoutGroup.padding = new RectOffset(12, 12, 12, 12); layoutGroup.spacing = 6; } layoutGroup.childForceExpandHeight = false; layoutGroup.childForceExpandWidth = true; layoutGroup.childControlHeight = true; layoutGroup.childControlWidth = true; layoutGroup.gameObject.hideFlags = HideFlags.None; UiThemeUtil.AddChild(ref closeButtonRowLayout, "Modal Row", layoutGroup.transform, ui); closeButtonRowLayout.preferredWidth = 25; closeButtonRowLayout.preferredHeight = 25; closeButtonRowLayout.minHeight = 25; closeButtonRowLayout.minWidth = 25; closeButtonRowLayout.flexibleWidth = 1.0f; closeButtonRowLayout.flexibleHeight = 0; closeButtonRowLayout.gameObject.hideFlags = HideFlags.None; UiThemeUtil.AddChild(ref contentRowLayout, "Content Row", layoutGroup.transform, ui); contentRowLayout.flexibleWidth = 1.0f; contentRowLayout.flexibleHeight = 1.0f; contentRowLayout.gameObject.hideFlags = HideFlags.None; closeButtonRowLayout.transform.SetSiblingIndex(0); contentRowLayout.transform.SetSiblingIndex(1); UiThemeUtil.AddChild(ref closeButton, "Close Button", closeButtonRowLayout.transform, ui); closeButton.shapeType = UiThemeShapeType.Circle; closeButton.colorType = UIThemeColorType.Secondary; closeButton.text = "x"; closeButton.Initialize(ui, theme); closeButton.gameObject.hideFlags = ui.GetHideFlags(); var closeTransform = closeButton.GetComponent <RectTransform>(); closeTransform.anchorMax = Vector2.one; closeTransform.anchorMin = Vector2.right; closeTransform.pivot = Vector2.right + Vector2.up * .5f; closeTransform.sizeDelta = Vector2.right * 25; return(UnityUtil.Once(gameObject)); }