From d2ab30e7a69bfe7efda63ae75812207377917bd3 Mon Sep 17 00:00:00 2001 From: miepzerino <o.skotnik@gmail.com> Date: Sun, 30 Mar 2025 18:50:27 +0000 Subject: [PATCH] Merge branch 'Flexalon-UI-Layouts' into develop --- Assets/Flexalon/Runtime/Layouts/FlexalonGridCell.cs | 61 ++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/Assets/Flexalon/Runtime/Layouts/FlexalonGridCell.cs b/Assets/Flexalon/Runtime/Layouts/FlexalonGridCell.cs new file mode 100644 index 0000000..5d24100 --- /dev/null +++ b/Assets/Flexalon/Runtime/Layouts/FlexalonGridCell.cs @@ -0,0 +1,61 @@ +using UnityEngine; + +namespace Flexalon +{ + /// <summary> Specifies which cell a gameObject should occupy in a grid layout. </summary> + [AddComponentMenu("Flexalon/Flexalon Grid Cell"), HelpURL("https://www.flexalon.com/docs/gridLayout")] + public class FlexalonGridCell : FlexalonComponent + { + [SerializeField, Min(0)] + private int _column; + /// <summary> The column of the cell. </summary> + public int Column + { + get => _column; + set + { + _column = Mathf.Max(0, value); + MarkDirty(); + } + } + + [SerializeField, Min(0)] + private int _row; + /// <summary> The row of the cell. </summary> + public int Row + { + get => _row; + set + { + _row = Mathf.Max(0, value); + MarkDirty(); + } + } + + [SerializeField, Min(0)] + private int _layer; + /// <summary> The layer of the cell. </summary> + public int Layer + { + get => _layer; + set + { + _layer = Mathf.Max(0, value); + MarkDirty(); + } + } + + /// <summary> The cell to occupy. </summary> + public Vector3Int Cell + { + get => new Vector3Int(_column, _row, _layer); + set + { + _column = Mathf.Max(0, value.x); + _row = Mathf.Max(0, value.y); + _layer = Mathf.Max(0, value.z); + MarkDirty(); + } + } + } +} \ No newline at end of file -- Gitblit v1.9.3