Class SContainerOptions
Inheritance
SContainerOptions
Namespace: SUI
Assembly: SonsSdk.dll
Syntax
public class SContainerOptions : SUiElement<SContainerOptions>
Constructors
SContainerOptions(GameObject)
Declaration
public SContainerOptions(GameObject root)
Parameters
Type |
Name |
Description |
GameObject |
root |
|
Properties
this[SUiElement]
Declaration
public SContainerOptions this[SUiElement element] { get; }
Parameters
Property Value
Methods
AutoSize(string)
M = MinSize, P = PreferredSize.
First letter is width, second is height
Declaration
public SContainerOptions AutoSize(string mode = "XX")
Parameters
Type |
Name |
Description |
string |
mode |
|
Returns
Exceptions
AutoSize(FitMode, FitMode)
Configures automatic sizing for the container using ContentSizeFitter.
Declaration
public SContainerOptions AutoSize(ContentSizeFitter.FitMode horizontal, ContentSizeFitter.FitMode vertical)
Parameters
Type |
Name |
Description |
FitMode |
horizontal |
The horizontal fitting mode for content.
|
FitMode |
vertical |
The vertical fitting mode for content.
|
Returns
Background(BackgroundDefinition)
Declaration
public SContainerOptions Background(SUI.BackgroundDefinition backgroundDefinition)
Parameters
Returns
Background(bool)
Declaration
public SContainerOptions Background(bool show)
Parameters
Type |
Name |
Description |
bool |
show |
|
Returns
Background(string, bool)
Declaration
public SContainerOptions Background(string color, bool clean = false)
Parameters
Returns
Background(Color, EBackground, Type?)
Sets the background appearance of the container using a solid color and an optional background sprite.
Declaration
public SContainerOptions Background(Color color, EBackground type = EBackground.Sons, Image.Type? spriteType = null)
Parameters
Type |
Name |
Description |
Color |
color |
The desired background color.
|
EBackground |
type |
|
Image.Type? |
spriteType |
|
Returns
Background(Sprite, Color?, Type)
Sets the background appearance of the container using a solid color and an optional background sprite.
Declaration
public SContainerOptions Background(Sprite sprite, Color? color, Image.Type type = 0)
Parameters
Type |
Name |
Description |
Sprite |
sprite |
|
Color? |
color |
The desired background color.
|
Type |
type |
|
Returns
BindVisibility(Observable<bool>, bool)
Binds the visibility of the container to an observable boolean value.
Declaration
public SContainerOptions BindVisibility(Observable<bool> observable, bool toggleGameObject)
Parameters
Type |
Name |
Description |
Observable<bool> |
observable |
The observable boolean value to bind to.
|
bool |
toggleGameObject |
Whether to toggle the GameObject's active state based on the observable value or the canvasgroup alpha.
|
Returns
CanvasGroup(float, bool)
Declaration
public SContainerOptions CanvasGroup(float alpha = 1, bool interactable = true)
Parameters
Type |
Name |
Description |
float |
alpha |
|
bool |
interactable |
|
Returns
CellSize(float, float)
Sets the cell size of the GridLayoutGroup attached to the root object.
Declaration
public SContainerOptions CellSize(float width, float height)
Parameters
Type |
Name |
Description |
float |
width |
Width of the cell.
|
float |
height |
Height of the cell.
|
Returns
ChildControl(bool?, bool?)
Configures whether child elements in the container's horizontal or vertical layout should control their width and/or height.
Declaration
public SContainerOptions ChildControl(bool? width = null, bool? height = null)
Parameters
Type |
Name |
Description |
bool? |
width |
Optional. Set to true to enable child width control, false to disable. Set to null to keep the current setting.
|
bool? |
height |
Optional. Set to true to enable child height control, false to disable. Set to null to keep the current setting.
|
Returns
ChildExpand(bool?, bool?)
Configures whether child elements in the container's horizontal or vertical layout should expand to fill available space.
Declaration
public SContainerOptions ChildExpand(bool? width = null, bool? height = null)
Parameters
Type |
Name |
Description |
bool? |
width |
Optional. Set to true to enable child width expansion, false to disable. Set to null to keep the current setting.
|
bool? |
height |
Optional. Set to true to enable child height expansion, false to disable. Set to null to keep the current setting.
|
Returns
Grid(int, float)
Creates a grid layout with the given constraint count and spacing.
Declaration
public SContainerOptions Grid(int constraintCount, float spacing = 0)
Parameters
Type |
Name |
Description |
int |
constraintCount |
Number of the fixed rows or columns
|
float |
spacing |
|
Returns
Horizontal(float, string)
Configures the container's layout as horizontal with optional spacing and layout mode.
Declaration
public SContainerOptions Horizontal(float spacing = 0, string mode = null)
Parameters
Type |
Name |
Description |
float |
spacing |
Optional. The amount of spacing between elements.
|
string |
mode |
Optional. The layout mode to apply (e.g., flexible, fixed, etc.).
|
Returns
LayoutChildAlignment(TextAnchor)
Sets the alignment of child elements within the container's horizontal or vertical layout.
Declaration
public SContainerOptions LayoutChildAlignment(TextAnchor alignment)
Parameters
Type |
Name |
Description |
TextAnchor |
alignment |
The alignment for child elements.
|
Returns
LayoutMode(string)
E = Expand, C = Control.
First letter is width, second is height
Declaration
public SContainerOptions LayoutMode(string mode = "ee")
Parameters
Type |
Name |
Description |
string |
mode |
|
Returns
LayoutUseChildScale(bool?, bool?)
Configures whether child elements in the container's horizontal or vertical layout should use child scale settings.
Declaration
public SContainerOptions LayoutUseChildScale(bool? width = null, bool? height = null)
Parameters
Type |
Name |
Description |
bool? |
width |
Optional. Set to true to enable child width scaling, false to disable. Set to null to keep the current setting.
|
bool? |
height |
Optional. Set to true to enable child height scaling, false to disable. Set to null to keep the current setting.
|
Returns
Opacity(float)
Declaration
public SContainerOptions Opacity(float alpha)
Parameters
Type |
Name |
Description |
float |
alpha |
|
Returns
OverrideSorting(int)
Gets or adds a canvas and overrides the sorting order of the parent canvas.
Declaration
public SContainerOptions OverrideSorting(int sortingOrder)
Parameters
Type |
Name |
Description |
int |
sortingOrder |
|
Returns
Padding(float)
Sets equal padding for all sides of the container's layout.
Declaration
public SContainerOptions Padding(float padding)
Parameters
Type |
Name |
Description |
float |
padding |
The amount of padding to apply on all sides.
|
Returns
Padding(float, float, float, float)
Sets padding for the container's layout on all sides individually.
Declaration
public SContainerOptions Padding(float left, float right, float top, float bottom)
Parameters
Type |
Name |
Description |
float |
left |
The amount of padding for the left side.
|
float |
right |
The amount of padding for the right side.
|
float |
top |
The amount of padding for the top side.
|
float |
bottom |
The amount of padding for the bottom side.
|
Returns
PaddingHorizontal(float)
Sets horizontal padding for the container's layout.
Declaration
public SContainerOptions PaddingHorizontal(float padding)
Parameters
Type |
Name |
Description |
float |
padding |
The amount of horizontal padding to apply.
|
Returns
PaddingVertical(float)
Sets vertical padding for the container's layout.
Declaration
public SContainerOptions PaddingVertical(float padding)
Parameters
Type |
Name |
Description |
float |
padding |
The amount of vertical padding to apply.
|
Returns
Spacing(float)
Sets the spacing between elements in the container's horizontal or vertical layout.
Declaration
public virtual SContainerOptions Spacing(float spacing)
Parameters
Type |
Name |
Description |
float |
spacing |
The amount of spacing between elements.
|
Returns
Spacing(float, float)
Sets the spacing between rows and columns in the container's grid layout.
Declaration
public virtual SContainerOptions Spacing(float spacingRow, float spacingCol)
Parameters
Type |
Name |
Description |
float |
spacingRow |
The amount of spacing between rows.
|
float |
spacingCol |
The amount of spacing between columns.
|
Returns
Vertical(float, string)
Configures the container's layout as vertical with optional spacing and layout mode.
Declaration
public SContainerOptions Vertical(float spacing = 0, string mode = null)
Parameters
Type |
Name |
Description |
float |
spacing |
Optional. The amount of spacing between elements.
|
string |
mode |
Optional. The layout mode to apply (e.g., flexible, fixed, etc.).
|
Returns
VisibilityObservalbleChanged(bool)
Declaration
protected override void VisibilityObservalbleChanged(bool value)
Parameters
Type |
Name |
Description |
bool |
value |
|
Overrides
Operators
operator -(SContainerOptions, SUiElement)
Declaration
public static SContainerOptions operator -(SContainerOptions container, SUiElement element)
Parameters
Returns