init free 2.1.3

This commit is contained in:
2025-08-02 20:11:41 +08:00
commit 24bc0ab149
871 changed files with 312178 additions and 0 deletions
+540
View File
@@ -0,0 +1,540 @@
// Copyright (c) Supernova Technologies LLC
using System;
using System.Collections.Generic;
using Unity.Mathematics;
namespace Nova
{
/// <summary>
/// A two-dimensional indexer
/// </summary>
/// <seealso cref="Row"/>
/// <seealso cref="Column"/>
public struct GridIndex : IEquatable<GridIndex>
{
/// <summary>
/// The row index
/// </summary>
public int Row;
/// <summary>
/// The column index
/// </summary>
public int Column;
/// <summary>
/// Create a new grid index
/// </summary>
/// <param name="row">The value to assign to <see cref="Row"/></param>
/// <param name="col">The value to assign to <see cref="Column"/></param>
public GridIndex(int row, int col)
{
Row = row;
Column = col;
}
/// <summary>
/// Equality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if <c><paramref name="lhs"/>.Row == <paramref name="rhs"/>.Row &amp;&amp; <paramref name="lhs"/>.Column == <paramref name="rhs"/>.Column</c></returns>
public static bool operator ==(GridIndex lhs, GridIndex rhs)
{
return lhs.Column == rhs.Column &&
lhs.Row == rhs.Row;
}
/// <summary>
/// Inequality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if <c><paramref name="lhs"/>.Row != <paramref name="rhs"/>.Row || <paramref name="lhs"/>.Column != <paramref name="rhs"/>.Column</c></returns>
public static bool operator !=(GridIndex lhs, GridIndex rhs)
{
return lhs.Column != rhs.Column ||
lhs.Row != rhs.Row;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridIndex"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public bool Equals(GridIndex other)
{
return this == other;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridIndex"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public override bool Equals(object other)
{
switch (other)
{
case GridIndex index:
return this == index;
default:
return false;
}
}
/// <summary>
/// The hashcode for this <see cref="GridIndex"/>
/// </summary>
public override int GetHashCode()
{
int InternalVar_1 = 13;
InternalVar_1 = (InternalVar_1 * 7) + Row.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Column.GetHashCode();
return InternalVar_1;
}
/// <summary>
/// Convert this <see cref="GridIndex"/> to a string
/// </summary>
/// <returns>The string representation of this <see cref="GridIndex"/></returns>
public override string ToString()
{
return $"r: {Row}, c: {Column}";
}
}
/// <summary>
/// A read-only utility wrapper around an <see cref="IList{T}"/> (see <see cref="Source"/>) to simplify indexing into the list by rows and columns
/// </summary>
/// <typeparam name="T">The type of element in the underlying <see cref="Source"/></typeparam>
public readonly struct GridList<T> : IEquatable<GridList<T>>
{
private readonly ref struct InternalType_30
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public readonly int InternalField_110;
public readonly T this[int InternalParameter_188]
{
get
{
if (InternalParameter_188 < 0 || InternalParameter_188 >= InternalField_110)
{
UnityEngine.Debug.LogError($"Column [{InternalParameter_188}] out of range [0, {InternalField_110})");
return default(T);
}
int InternalVar_1 = InternalField_111 + (InternalParameter_188 * InternalField_112);
return (T)InternalField_113[InternalVar_1];
}
}
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_111;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_112;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly IList<T> InternalField_113;
internal InternalType_30(IList<T> InternalParameter_189, int InternalParameter_190, int InternalParameter_191, int InternalParameter_192)
{
this.InternalField_113 = InternalParameter_189;
this.InternalField_111 = InternalParameter_190;
this.InternalField_112 = InternalParameter_191;
this.InternalField_110 = InternalParameter_192;
}
}
private readonly ref struct InternalType_31
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public readonly int InternalField_114;
public readonly T this[int InternalParameter_193]
{
get
{
if (InternalParameter_193 < 0 || InternalParameter_193 >= InternalField_114)
{
UnityEngine.Debug.LogError($"Row [{InternalParameter_193}] out of range [0, {InternalField_114})");
return default(T);
}
int InternalVar_1 = InternalField_115 + (InternalParameter_193 * InternalField_116);
return (T)InternalField_117[InternalVar_1];
}
}
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_115;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_116;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly IList<T> InternalField_117;
internal InternalType_31(IList<T> InternalParameter_194, int InternalParameter_195, int InternalParameter_196, int InternalParameter_197)
{
this.InternalField_117 = InternalParameter_194;
this.InternalField_115 = InternalParameter_195;
this.InternalField_116 = InternalParameter_196;
this.InternalField_114 = InternalParameter_197;
}
}
/// <summary>
/// Indicates if this grid was configured to have a dynamic number of rows and a fixed number of columns
/// </summary>
public readonly bool InfiniteRows => InternalField_108 < 0;
/// <summary>
/// Indicates if this grid was configured to have a dynamic number of columns and a fixed number of rows
/// </summary>
public readonly bool InfiniteColumns => InternalField_109 < 0;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_108;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_109;
/// <summary>
/// The underlying list wrapped by this <see cref="GridList{T}"/>
/// </summary>
public readonly IList<T> Source;
/// <summary>
/// The number of rows in the grid
/// </summary>
public readonly int Rows
{
get
{
if (Source == null)
{
return 0;
}
if (InfiniteRows)
{
return GetRowIndex(Source.Count);
}
return math.min(Source.Count, InternalField_108);
}
}
/// <summary>
/// The number of columns in the grid
/// </summary>
public readonly int Columns
{
get
{
if (Source == null)
{
return 0;
}
if (InfiniteColumns)
{
return GetColumnIndex(Source.Count);
}
return math.min(Source.Count, InternalField_109);
}
}
/// <summary>
/// Get the element stored at the given <paramref name="row"/> and <paramref name="column"/>
/// </summary>
/// <param name="row">The row index</param>
/// <param name="column">The column index</param>
/// <returns>The element of type <typeparamref name="T"/> at the given <paramref name="row"/> and <paramref name="column"/></returns>
/// <exception cref="InvalidOperationException">Thrown when the grid hasn't been constructed via <see cref="CreateWithRows(IList{T}, int)"/> or <see cref="CreateWithColumns(IList{T}, int)"/></exception>
public readonly T this[int row, int column]
{
get
{
InternalMethod_245(this);
return InfiniteRows ? InternalMethod_243(column)[row] : InternalMethod_242(row)[column];
}
}
/// <summary>
/// Get the element stored at the given <paramref name="index"/>
/// </summary>
/// <param name="index">The <see cref="GridIndex"/> of the element to access</param>
/// <returns>The element of type <typeparamref name="T"/> at the given <paramref name="index"/></returns>
/// <exception cref="InvalidOperationException">Thrown when the grid hasn't been constructed via <see cref="CreateWithRows(IList{T}, int)"/> or <see cref="CreateWithColumns(IList{T}, int)"/></exception>
public readonly T this[GridIndex index]
{
get
{
InternalMethod_245(this);
return InfiniteRows ? InternalMethod_243(index.Column)[index.Row] : InternalMethod_242(index.Row)[index.Column];
}
}
/// <summary>
/// Convert a 1D index into the underlying list, <see cref="Source"/>, into a 2D <see cref="GridIndex"/> for the current grid
/// </summary>
/// <param name="sourceIndex">The index into the underlying list, <see cref="Source"/></param>
/// <returns>The <see cref="GridIndex"/> into this grid of the element at the <paramref name="sourceIndex"/> of the underlying list</returns>
/// <seealso cref="ToSourceIndex(GridIndex)"/>
/// <exception cref="InvalidOperationException">Thrown when the grid hasn't been constructed via <see cref="CreateWithRows(IList{T}, int)"/> or <see cref="CreateWithColumns(IList{T}, int)"/></exception>
public GridIndex ToGridIndex(int sourceIndex)
{
InternalMethod_245(this);
return new GridIndex()
{
Row = GetRowIndex(sourceIndex),
Column = GetColumnIndex(sourceIndex),
};
}
/// <summary>
/// Convert a 2D <paramref name="gridIndex"/> into the current grid into a 1D index into <see cref="Source"/>
/// </summary>
/// <param name="gridIndex">The index into the current grid</param>
/// <returns>The 1D index in the underlying list of the element at <paramref name="gridIndex"/> in this grid</returns>
/// <exception cref="InvalidOperationException">Thrown when the grid hasn't been constructed via <see cref="CreateWithRows(IList{T}, int)"/> or <see cref="CreateWithColumns(IList{T}, int)"/></exception>
public int ToSourceIndex(GridIndex gridIndex)
{
InternalMethod_245(this);
return InfiniteRows ? (gridIndex.Row * InternalField_109) + gridIndex.Column : (gridIndex.Column * InternalField_108) + gridIndex.Row;
}
/// <summary>
/// Get the grid row index of the element at <paramref name="sourceIndex"/>
/// </summary>
/// <param name="sourceIndex">A 1D index into <see cref="Source"/></param>
/// <returns>The row into the grid of the element at <paramref name="sourceIndex"/> into <see cref="Source"/></returns>
/// <exception cref="InvalidOperationException">Thrown when the grid hasn't been constructed via <see cref="CreateWithRows(IList{T}, int)"/> or <see cref="CreateWithColumns(IList{T}, int)"/></exception>
public readonly int GetRowIndex(int sourceIndex)
{
InternalMethod_245(this);
return InfiniteRows ? sourceIndex / InternalField_109 : sourceIndex % InternalField_108;
}
/// <summary>
/// Get the grid column index of the element at <paramref name="sourceIndex"/>
/// </summary>
/// <param name="sourceIndex">A 1D index into <see cref="Source"/></param>
/// <returns>The column into the grid of the element at <paramref name="sourceIndex"/> into <see cref="Source"/></returns>
/// <exception cref="InvalidOperationException">Thrown when the grid hasn't been constructed via <see cref="CreateWithRows(IList{T}, int)"/> or <see cref="CreateWithColumns(IList{T}, int)"/></exception>
public readonly int GetColumnIndex(int sourceIndex)
{
InternalMethod_245(this);
return InfiniteColumns ? sourceIndex / InternalField_108 : sourceIndex % InternalField_109;
}
private readonly InternalType_30 InternalMethod_242(int InternalParameter_182)
{
int InternalVar_1 = InternalParameter_182 * Columns;
int InternalVar_2 = InfiniteRows ? Columns : 1;
int InternalVar_3 = InternalVar_1 + Columns <= Source.Count ? Columns : InternalVar_1 + Columns - Source.Count;
return new InternalType_30(Source, InternalVar_1, InternalVar_2, InternalVar_3);
}
private readonly InternalType_31 InternalMethod_243(int InternalParameter_183)
{
int InternalVar_1 = InternalParameter_183 * Rows;
int InternalVar_2 = InfiniteColumns ? Rows : 1;
int InternalVar_3 = InternalVar_1 + Rows <= Source.Count ? Rows : InternalVar_1 + Rows - Source.Count;
return new InternalType_31(Source, InternalVar_1, InternalVar_2, InternalVar_3);
}
/// <summary>
/// Wraps the provided <paramref name="source"/> in a <see cref="GridList{T}"/> with a dynamic number of rows and a fixed number of <paramref name="columns"/>
/// </summary>
/// <param name="source">The underlying list to wrap in a in a <see cref="GridList{T}"/></param>
/// <param name="columns">The number of columns in the grid</param>
/// <returns>A new grid wrapping <paramref name="source"/> with a fixed number of <paramref name="columns"/></returns>
public static GridList<T> CreateWithColumns(IList<T> source, int columns)
{
return new GridList<T>(source, -1, math.max(1, columns));
}
/// <summary>
/// Wraps the provided <paramref name="source"/> in a <see cref="GridList{T}"/> with a dynamic number of columns and a fixed number of <paramref name="rows"/>
/// </summary>
/// <param name="source">The underlying list to wrap in a in a <see cref="GridList{T}"/></param>
/// <param name="rows">The number of rows in the grid</param>
/// <returns>A new grid wrapping <paramref name="source"/> with a fixed number of <paramref name="rows"/></returns>
public static GridList<T> CreateWithRows(IList<T> source, int rows)
{
return new GridList<T>(source, math.max(1, rows), -1);
}
private GridList(IList<T> InternalParameter_184, int InternalParameter_185 = 1, int InternalParameter_186 = 1)
{
this.Source = InternalParameter_184;
this.InternalField_108 = math.clamp(InternalParameter_185, -1, int.MaxValue);
this.InternalField_109 = math.clamp(InternalParameter_186, -1, int.MaxValue);
}
private static void InternalMethod_245(GridList<T> InternalParameter_187)
{
if (InternalParameter_187.InternalField_108 != 0 && InternalParameter_187.InternalField_109 != 0)
{
return;
}
throw new InvalidOperationException($"{typeof(GridList<T>).Name} has not been initialized. Use {nameof(GridList<T>)}.{nameof(CreateWithRows)} or {nameof(GridList<T>)}.{nameof(CreateWithRows)} to initialize.");
}
/// <summary>
/// Equality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if <c><paramref name="lhs"/>.Source == <paramref name="rhs"/>.Source &amp;&amp; <paramref name="lhs"/>.Rows == <paramref name="rhs"/>.Rows &amp;&amp; <paramref name="lhs"/>.Columns == <paramref name="rhs"/>.Columns</c></returns>
public static bool operator ==(GridList<T> lhs, GridList<T> rhs)
{
return lhs.Source == rhs.Source && lhs.InternalField_108 == rhs.InternalField_108 && lhs.InternalField_109 == rhs.InternalField_109;
}
/// <summary>
/// Inequality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if <c><paramref name="lhs"/>.Source != <paramref name="rhs"/>.Source || <paramref name="lhs"/>.Rows != <paramref name="rhs"/>.Rows || <paramref name="lhs"/>.Columns != <paramref name="rhs"/>.Columns</c></returns>
public static bool operator !=(GridList<T> lhs, GridList<T> rhs)
{
return lhs.Source != rhs.Source && lhs.InternalField_108 != rhs.InternalField_108 && lhs.InternalField_109 != rhs.InternalField_109;
}
/// <summary>
/// The hashcode for this <see cref="GridList{T}"/>
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
int InternalVar_1 = 13;
InternalVar_1 = (InternalVar_1 * 7) + InternalField_108.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + InternalField_109.GetHashCode();
if (Source != null)
{
InternalVar_1 = (InternalVar_1 * 7) + Source.GetHashCode();
}
return InternalVar_1;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridList{T}"/> to compare</param>
/// <returns>
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>
/// </returns>
public override bool Equals(object other)
{
if (other is GridList<T> grid)
{
return this == grid;
}
return false;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridList{T}"/> to compare</param>
/// <returns>
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>
/// </returns>
public bool Equals(GridList<T> other)
{
return this == other;
}
}
internal readonly ref struct InternalType_32
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public readonly int InternalProperty_59
{
get
{
if (InternalProperty_61)
{
return InternalMethod_254(InternalField_120);
}
return math.min(InternalField_120, InternalField_118);
}
}
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public readonly int InternalProperty_60
{
get
{
if (InternalProperty_62)
{
return InternalMethod_255(InternalField_120);
}
return math.min(InternalField_120, InternalField_119);
}
}
public GridIndex InternalMethod_252(int InternalParameter_198)
{
return new GridIndex()
{
Row = InternalMethod_254(InternalParameter_198),
Column = InternalMethod_255(InternalParameter_198),
};
}
public int InternalMethod_253(GridIndex InternalParameter_199)
{
return InternalProperty_61 ? (InternalParameter_199.Row * InternalField_119) + InternalParameter_199.Column : (InternalParameter_199.Column * InternalField_118) + InternalParameter_199.Row;
}
public readonly int InternalMethod_254(int InternalParameter_200)
{
return InternalProperty_61 ? InternalParameter_200 / InternalField_119 : InternalParameter_200 % InternalField_118;
}
public readonly int InternalMethod_255(int InternalParameter_201)
{
return InternalProperty_62 ? InternalParameter_201 / InternalField_118 : InternalParameter_201 % InternalField_119;
}
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public readonly bool InternalProperty_61 => InternalField_118 < 0;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
public readonly bool InternalProperty_62 => InternalField_119 < 0;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_118;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_119;
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private readonly int InternalField_120;
public static InternalType_32 InternalMethod_258(int InternalParameter_202, int InternalParameter_203)
{
return new InternalType_32(InternalParameter_202, InternalParameter_206: InternalParameter_203);
}
private InternalType_32(int InternalParameter_204, int InternalParameter_205 = -1, int InternalParameter_206 = -1)
{
this.InternalField_120 = InternalParameter_204;
this.InternalField_118 = math.clamp(InternalParameter_205, -1, int.MaxValue);
this.InternalField_119 = math.clamp(InternalParameter_206, -1, int.MaxValue);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f07cacefc2c9494eae3629cf307e62d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+517
View File
@@ -0,0 +1,517 @@
// Copyright (c) Supernova Technologies LLC
using Nova.InternalNamespace_0;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Nova
{
/// <summary>
/// A layout and 2D visual configuration of a "grid slice", a row <i> or </i> column in a <see cref="GridView"/> that's positioned along the <see cref="GridView.PrimaryAxis"/>
/// </summary>
/// <seealso cref="GridSlice"/>
/// <seealso cref="GridSlice3D"/>
[Serializable]
public struct GridSlice2D : IEquatable<GridSlice2D>
{
/// <summary>
/// The layout configuration of this grid slice
/// </summary>
/// <remarks>
/// Identical to the <see cref="UIBlock.Layout"/> configuration on <see cref="UIBlock"/>s
/// </remarks>
public Layout Layout;
/// <summary>
/// The auto layout configuration of this grid slice
/// </summary>
/// <remarks>
/// Identical to the <see cref="UIBlock.AutoLayout"/> configuration on <see cref="UIBlock"/>s
/// </remarks>
public AutoLayout AutoLayout;
/// <summary>
/// The fill color of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock.Color"/> configuration on <see cref="UIBlock"/>s</remarks>
public Color Color;
/// <summary>
/// The surface effect when there's scene lighting
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock.Surface"/> configuration on <see cref="UIBlock"/>s</remarks>
public Surface Surface;
/// <summary>
/// The corner radius of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock3D.CornerRadius"/> configuration on <see cref="UIBlock2D"/>s</remarks>
public Length CornerRadius;
/// <summary>
/// The border around this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock2D.Border"/> configuration on <see cref="UIBlock2D"/>s</remarks>
public Border Border;
/// <summary>
/// The drop shadow/inner shadow of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock2D.Shadow"/> configuration on <see cref="UIBlock2D"/>s</remarks>
public Shadow Shadow;
/// <summary>
/// The gradient fill of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock2D.Gradient"/> configuration on <see cref="UIBlock2D"/>s</remarks>
public RadialGradient Gradient;
/// <summary>
/// Create a new <see cref="GridSlice2D"/> configuration
/// </summary>
/// <param name="primaryAxis">The scrollable axis of this grid slice's parent</param>
/// <param name="crossAxis">The <see cref="AutoLayout">AutoLayout</see>.<see cref="AutoLayout.Axis">Axis</see> of this grid slice</param>
public GridSlice2D(Axis primaryAxis, Axis crossAxis)
{
Layout = Layout.TwoD;
AutoLayout = AutoLayout.Disabled;
AutoLayout.Axis = crossAxis;
Layout.AutoSize = AutoSize.Expand;
if (primaryAxis.TryGetIndex(out int InternalVar_1))
{
Layout.AutoSize[InternalVar_1] = AutoSize.Shrink;
}
Color = Color.clear;
Border = Border.InternalField_58;
Shadow = Shadow.InternalField_59;
CornerRadius = Length.Zero;
Gradient = RadialGradient.InternalField_57;
Surface = Surface.InternalField_49;
}
/// <summary>
/// Equality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if all fields of <paramref name="lhs"/> are equal to all field of <paramref name="rhs"/></returns>
public static bool operator ==(GridSlice2D lhs, GridSlice2D rhs)
{
return lhs.Layout == rhs.Layout &&
lhs.AutoLayout == rhs.AutoLayout &&
lhs.Color == rhs.Color &&
lhs.Surface == rhs.Surface &&
lhs.CornerRadius == rhs.CornerRadius &&
lhs.Border == rhs.Border &&
lhs.Shadow == rhs.Shadow &&
lhs.Gradient == rhs.Gradient;
}
/// <summary>
/// Inequality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if any field of <paramref name="lhs"/> is <b>not</b> equal to its corresponding field of <paramref name="rhs"/></returns>
public static bool operator !=(GridSlice2D lhs, GridSlice2D rhs)
{
return lhs.Layout != rhs.Layout ||
lhs.AutoLayout != rhs.AutoLayout ||
lhs.Color != rhs.Color ||
lhs.Surface != rhs.Surface ||
lhs.CornerRadius != rhs.CornerRadius ||
lhs.Border != rhs.Border ||
lhs.Shadow != rhs.Shadow ||
lhs.Gradient != rhs.Gradient;
}
/// <summary>
/// The hashcode for this <see cref="GridSlice2D"/>
/// </summary>
public override int GetHashCode()
{
int InternalVar_1 = 13;
InternalVar_1 = (InternalVar_1 * 7) + Layout.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + AutoLayout.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Color.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Surface.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + CornerRadius.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Border.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Shadow.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Gradient.GetHashCode();
return InternalVar_1;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridSlice2D"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public override bool Equals(object other)
{
if (other is GridSlice2D slice)
{
return this == slice;
}
return false;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridSlice2D"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public bool Equals(GridSlice2D other)
{
return this == other;
}
}
/// <summary>
/// A layout and 3D visual configuration of a "grid slice", a row <i> or </i> column in a <see cref="GridView"/> that's positioned along the <see cref="GridView.PrimaryAxis"/>
/// </summary>
/// <seealso cref="GridSlice"/>
/// <seealso cref="GridSlice2D"/>
[Serializable]
public struct GridSlice3D : IEquatable<GridSlice3D>
{
/// <summary>
/// The layout configuration of this grid slice
/// </summary>
/// <remarks>
/// Identical to the <see cref="UIBlock.Layout"/> configuration on <see cref="UIBlock"/>s
/// </remarks>
public Layout Layout;
/// <summary>
/// The auto layout configuration of this grid slice
/// </summary>
/// <remarks>
/// Identical to the <see cref="UIBlock.AutoLayout"/> configuration on <see cref="UIBlock"/>s
/// </remarks>
public AutoLayout AutoLayout;
/// <summary>
/// The fill color of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock.Color"/> configuration on <see cref="UIBlock"/>s</remarks>
public Color Color;
/// <summary>
/// The surface effect when there's scene lighting
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock.Surface"/> configuration on <see cref="UIBlock"/>s</remarks>
public Surface Surface;
/// <summary>
/// The corner radius of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock3D.CornerRadius"/> configuration on <see cref="UIBlock3D"/>s</remarks>
public Length CornerRadius;
/// <summary>
/// The edge radius of this grid slice
/// </summary>
/// <remarks>Identical to the <see cref="UIBlock3D.EdgeRadius"/> configuration on <see cref="UIBlock3D"/>s</remarks>
public Length EdgeRadius;
/// <summary>
/// Create a new <see cref="GridSlice3D"/> configuration
/// </summary>
/// <param name="primaryAxis">The scrollable axis of this grid slice's parent</param>
/// <param name="crossAxis">The <see cref="AutoLayout">AutoLayout</see>.<see cref="AutoLayout.Axis">Axis</see> of this grid slice</param>
public GridSlice3D(Axis primaryAxis, Axis crossAxis)
{
Layout = Layout.ThreeD;
AutoLayout = AutoLayout.Disabled;
AutoLayout.Axis = crossAxis;
Layout.AutoSize = AutoSize.Expand;
if (primaryAxis.TryGetIndex(out int InternalVar_1))
{
Layout.AutoSize[InternalVar_1] = AutoSize.Shrink;
}
Color = Color.clear;
CornerRadius = Length.Zero;
EdgeRadius = Length.Zero;
Surface = Surface.InternalField_50;
}
/// <summary>
/// Equality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if all fields of <paramref name="lhs"/> are equal to all field of <paramref name="rhs"/></returns>
public static bool operator ==(GridSlice3D lhs, GridSlice3D rhs)
{
return lhs.Layout == rhs.Layout &&
lhs.AutoLayout == rhs.AutoLayout &&
lhs.Color == rhs.Color &&
lhs.Surface == rhs.Surface &&
lhs.CornerRadius == rhs.CornerRadius &&
lhs.EdgeRadius == rhs.EdgeRadius;
}
/// <summary>
/// Inequality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if any field of <paramref name="lhs"/> is <b>not</b> equal to its corresponding field of <paramref name="rhs"/></returns>
public static bool operator !=(GridSlice3D lhs, GridSlice3D rhs)
{
return lhs.Layout != rhs.Layout ||
lhs.AutoLayout != rhs.AutoLayout ||
lhs.Color != rhs.Color ||
lhs.Surface != rhs.Surface ||
lhs.CornerRadius != rhs.CornerRadius ||
lhs.EdgeRadius != rhs.EdgeRadius;
}
/// <summary>
/// The hashcode for this <see cref="GridSlice3D"/>
/// </summary>
public override int GetHashCode()
{
int InternalVar_1 = 13;
InternalVar_1 = (InternalVar_1 * 7) + Layout.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + AutoLayout.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Color.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + Surface.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + CornerRadius.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + EdgeRadius.GetHashCode();
return InternalVar_1;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridSlice3D"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public override bool Equals(object other)
{
if (other is GridSlice3D slice)
{
return this == slice;
}
return false;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridSlice3D"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public bool Equals(GridSlice3D other)
{
return this == other;
}
}
/// <summary>
/// A layout-only configuration of a "grid slice", a row <i> or </i> column in a <see cref="GridView"/> that's positioned along the <see cref="GridView.PrimaryAxis"/>
/// </summary>
/// <seealso cref="GridSlice2D"/>
/// <seealso cref="GridSlice3D"/>
[Serializable]
public struct GridSlice : IEquatable<GridSlice>
{
/// <summary>
/// The layout configuration of this grid slice
/// </summary>
/// <remarks>
/// Identical to the <see cref="UIBlock.Layout"/> configuration on <see cref="UIBlock"/>s
/// </remarks>
public Layout Layout;
/// <summary>
/// The auto layout configuration of this grid slice
/// </summary>
/// <remarks>
/// Identical to the <see cref="UIBlock.AutoLayout"/> configuration on <see cref="UIBlock"/>s
/// </remarks>
public AutoLayout AutoLayout;
/// <summary>
/// Create a new <see cref="GridSlice"/> configuration
/// </summary>
/// <param name="primaryAxis">The scrollable axis of this grid slice's parent</param>
/// <param name="crossAxis">The <see cref="AutoLayout">AutoLayout</see>.<see cref="AutoLayout.Axis">Axis</see> of this grid slice</param>
public GridSlice(Axis primaryAxis, Axis crossAxis)
{
Layout = Layout.TwoD;
AutoLayout = AutoLayout.Disabled;
AutoLayout.Alignment = 0;
AutoLayout.Axis = crossAxis;
Layout.AutoSize = AutoSize.Expand;
if (primaryAxis.TryGetIndex(out int InternalVar_1))
{
Layout.AutoSize[InternalVar_1] = AutoSize.Shrink;
}
}
/// <summary>
/// Equality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if <c><paramref name="lhs"/>.Layout == <paramref name="rhs"/>.Layout &amp;&amp; <paramref name="lhs"/>.AutoLayout == <paramref name="rhs"/>.AutoLayout</c></returns>
public static bool operator ==(GridSlice lhs, GridSlice rhs)
{
return lhs.Layout == rhs.Layout && lhs.AutoLayout == rhs.AutoLayout;
}
/// <summary>
/// Inequality operator
/// </summary>
/// <param name="lhs">Left hand side</param>
/// <param name="rhs">Right hand side</param>
/// <returns><see langword="true"/> if <c><paramref name="lhs"/>.Layout != <paramref name="rhs"/>.Layout || <paramref name="lhs"/>.AutoLayout != <paramref name="rhs"/>.AutoLayout</c></returns>
public static bool operator !=(GridSlice lhs, GridSlice rhs)
{
return lhs.Layout != rhs.Layout || lhs.AutoLayout != rhs.AutoLayout;
}
/// <summary>
/// The hashcode for this <see cref="GridSlice"/>
/// </summary>
public override int GetHashCode()
{
int InternalVar_1 = 13;
InternalVar_1 = (InternalVar_1 * 7) + Layout.GetHashCode();
InternalVar_1 = (InternalVar_1 * 7) + AutoLayout.GetHashCode();
return InternalVar_1;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridSlice"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public override bool Equals(object other)
{
if (other is GridSlice slice)
{
return this == slice;
}
return false;
}
/// <summary>
/// Equality compare
/// </summary>
/// <param name="other">The other <see cref="GridSlice"/> to compare</param>
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
public bool Equals(GridSlice other)
{
return this == other;
}
}
internal class InternalType_35 : IDisposable
{
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private Queue<InternalType_42> InternalField_127 = new Queue<InternalType_42>();
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private Queue<InternalType_43> InternalField_128 = new Queue<InternalType_43>();
public InternalType_33 InternalMethod_294(Type InternalParameter_210)
{
if (InternalMethod_297(InternalParameter_210, out InternalType_33 InternalVar_1))
{
return InternalVar_1;
}
switch (InternalParameter_210)
{
case Type twoD when twoD == typeof(InternalType_42):
return new InternalType_42();
case Type threeD when threeD == typeof(InternalType_43):
return new InternalType_43();
default:
return null;
}
}
public void InternalMethod_295(InternalType_33 InternalParameter_211)
{
if (InternalParameter_211 == null)
{
return;
}
switch (InternalParameter_211)
{
case InternalType_42 twoDBlock:
InternalField_127.Enqueue(twoDBlock);
break;
case InternalType_43 threeDBlock:
InternalField_128.Enqueue(threeDBlock);
break;
}
}
public bool InternalMethod_296(out InternalType_33 InternalParameter_212)
{
if (InternalField_127.Count > 0)
{
InternalParameter_212 = InternalField_127.Dequeue();
return true;
}
if (InternalField_128.Count > 0)
{
InternalParameter_212 = InternalField_128.Dequeue();
return true;
}
InternalParameter_212 = null;
return false;
}
public bool InternalMethod_297(Type InternalParameter_213, out InternalType_33 InternalParameter_214)
{
switch (InternalParameter_213)
{
case Type twoD when twoD == typeof(InternalType_42) && InternalField_127.Count > 0:
InternalParameter_214 = InternalField_127.Dequeue();
return true;
case Type threeD when threeD == typeof(InternalType_43) && InternalField_128.Count > 0:
InternalParameter_214 = InternalField_128.Dequeue();
return true;
default:
InternalParameter_214 = null;
return false;
}
}
public int InternalMethod_298(Type InternalParameter_215)
{
switch (InternalParameter_215)
{
case Type twoD when twoD == typeof(InternalType_42):
return InternalField_127.Count;
case Type threeD when threeD == typeof(InternalType_43):
return InternalField_128.Count;
default:
return 0;
}
}
public void Dispose()
{
while (InternalMethod_296(out InternalType_33 InternalVar_1))
{
InternalVar_1.Dispose();
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0956e428e09440d4c92d160939360d6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,76 @@
// Copyright (c) Supernova Technologies LLC
using System;
using Nova;
namespace Nova
{
public static class UIBlockExtensions
{
/// <summary>
/// Subscribe to a gesture event on this <see cref="UIBlock"/>'s descendant hierarchy (inclusive of this <see cref="UIBlock"/>), filtered to the given <see cref="ItemVisuals"/> type, <typeparamref name="TVisuals"/>.
/// </summary>
/// <remarks>
/// The subscription only "lives" on this UIBlock, but the event will propagate up from descendents triggering gesture events with an <paramref name="gestureHandler"/> type-matched signature.
/// </remarks>
/// <typeparam name="TGesture">The type of gesture event to handle.</typeparam>
/// <typeparam name="TVisuals">The <see cref="ItemVisuals"/> type to target as the event propagates. If no object of this type is in the event propogation path, the <paramref name="gestureHandler"/> won't be invoked.</typeparam>
/// <param name="gestureHandler">The callback invoked when the event fires.</param>
/// <exception cref="ArgumentNullException">If <paramref name="uiBlock"/> or <paramref name="gestureHandler"/> is <c>null</c>.</exception>
/// <seealso cref="Gesture.OnClick"/>
/// <seealso cref="Gesture.OnPress"/>
/// <seealso cref="Gesture.OnRelease"/>
/// <seealso cref="Gesture.OnHover"/>
/// <seealso cref="Gesture.OnUnhover"/>
/// <seealso cref="Gesture.OnScroll"/>
/// <seealso cref="Gesture.OnMove"/>
/// <seealso cref="Gesture.OnDrag"/>
/// <seealso cref="Gesture.OnCancel"/>
/// <seealso cref="UIBlock.FireGestureEvent{TGesture}(TGesture)"/>
public static void AddGestureHandler<TGesture, TVisuals>(this UIBlock uiBlock, UIEventHandler<TGesture, TVisuals> gestureHandler) where TGesture : struct, IGestureEvent where TVisuals : ItemVisuals
{
if (uiBlock == null)
{
throw new ArgumentNullException(nameof(uiBlock));
}
if (gestureHandler == null)
{
throw new ArgumentNullException(nameof(gestureHandler));
}
uiBlock.InternalMethod_3270(gestureHandler);
}
/// <summary>
/// Unsubscribe from a gesture event previously subscribed to via <see cref="AddGestureHandler{TInteractionEvent, TVisuals}(UIBlock, UIEventHandler{TInteractionEvent, TVisuals})"/>.
/// </summary>
/// <typeparam name="TGesture">The type of gesture event to handle.</typeparam>
/// <typeparam name="TVisuals">The type to target as the event propagates. If no object of this type is in the event propogation path, the <paramref name="gestureHandler"/> won't be invoked.</typeparam>
/// <param name="gestureHandler">The callback to remove from the subscription list.</param>
/// <exception cref="ArgumentNullException">If <paramref name="uiBlock"/> or <paramref name="gestureHandler"/> is <c>null</c>.</exception>
/// <seealso cref="Gesture.OnClick"/>
/// <seealso cref="Gesture.OnPress"/>
/// <seealso cref="Gesture.OnRelease"/>
/// <seealso cref="Gesture.OnHover"/>
/// <seealso cref="Gesture.OnUnhover"/>
/// <seealso cref="Gesture.OnScroll"/>
/// <seealso cref="Gesture.OnMove"/>
/// <seealso cref="Gesture.OnDrag"/>
/// <seealso cref="Gesture.OnCancel"/>
/// <seealso cref="UIBlock.FireGestureEvent{TGesture}(TGesture)"/>
public static void RemoveGestureHandler<TGesture, TVisuals>(this UIBlock uiBlock, UIEventHandler<TGesture, TVisuals> gestureHandler) where TGesture : struct, IGestureEvent where TVisuals : ItemVisuals
{
if (uiBlock == null)
{
throw new ArgumentNullException(nameof(uiBlock));
}
if (gestureHandler == null)
{
throw new ArgumentNullException(nameof(gestureHandler));
}
uiBlock.InternalMethod_3269(gestureHandler);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1e0ba67676194b818883ea92c2757a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: