public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme) { UiThemeUtil.AddChild(ref textBeh, "Label", transform, ui); if (UiThemeUtil.AddChild(ref boxShapeBeh, "Box", transform, ui)) { boxShapeBeh.gameObject.AddComponent <UiThemeShapeRipple>(); } UiThemeUtil.AddChild(ref checkShapeBeh, "Check", boxShapeBeh.transform, ui); ripple = boxShapeBeh.gameObject.GetComponent <UiThemeShapeRipple>(); textBeh.Initialize(ui, theme); boxShapeBeh.Initialize(ui, theme); checkShapeBeh.Initialize(ui, theme); ripple.Initialize(ui, theme); textBeh.SetAlignment(TextAnchor.MiddleRight); textBeh.SetColor(labelColor); textBeh.SetValue(label); textBeh.SetFontType(UIThemeFontType.Body); PositionBox(ui, boxShapeBeh.GetComponent <RectTransform>()); boxShapeBeh.SetHasShadow(true); boxShapeBeh.SetColorType(boxColor); boxShapeBeh.SetShapeType(UiThemeShapeType.RoundedSquare); boxShapeBeh.SetIsOutline(false); checkShapeBeh.SetHasShadow(false); var checkRect = checkShapeBeh.GetComponent <RectTransform>(); checkRect.offsetMax = Vector2.one * -2.0f; checkRect.offsetMin = Vector2.one * 2.0f; checkShapeBeh.SetShapeType(UiThemeShapeType.Check); checkShapeBeh.SetIsOutline(false); var textRect = textBeh.GetComponent <RectTransform>(); textRect.offsetMax = Vector2.right * (-ui.checkboxSize - 5); boxShapeBeh.SetColorType(boxColor); boxShapeBeh.SetShapeType(UiThemeShapeType.RoundedSquare); SetChecked(isChecked); SetClickDisabled(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)); }