init free 2.1.3
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 404b984103e4f7f4eaa81d8403dfc99a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_1;
|
||||
using System;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A unique identifier of a scheduled <see cref="IAnimation"/>, <see cref="IAnimationWithEvents"/>, or any sequence/combination of the two
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <list type="table">
|
||||
/// <item><term>Chain</term> <description><see cref="AnimationHandleExtensions.Chain{T}(AnimationHandle, T, float, int)"/></description></item>
|
||||
/// <item><term>Include</term> <description><see cref="AnimationHandleExtensions.Include{T}(AnimationHandle, T)"/></description></item>
|
||||
/// <item><term>Pause</term> <description><see cref="AnimationHandleExtensions.Pause(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Resume</term> <description><see cref="AnimationHandleExtensions.Resume(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Cancel</term> <description><see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Complete</term> <description><see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/></description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public readonly struct AnimationHandle : IEquatable<AnimationHandle>
|
||||
{
|
||||
/// <summary>
|
||||
/// A constant value used to indicate a single animation iteration
|
||||
/// </summary>
|
||||
public const int Once = 1;
|
||||
|
||||
/// <summary>
|
||||
/// A constant value used to indicate an indefinitely looping animation
|
||||
/// </summary>
|
||||
public const int Infinite = -1;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly InternalType_125 InternalField_2977;
|
||||
|
||||
private AnimationHandle(InternalType_125 InternalParameter_2250)
|
||||
{
|
||||
InternalField_2977 = InternalParameter_2250;
|
||||
}
|
||||
|
||||
internal static AnimationHandle InternalMethod_2692(InternalType_125 InternalParameter_2249)
|
||||
{
|
||||
return new AnimationHandle(InternalParameter_2249);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality operator
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side</param>
|
||||
/// <param name="rhs">Right hand side</param>
|
||||
/// <returns><see langword="true"/> if lhs and rhs are equal</returns>
|
||||
public static bool operator ==(AnimationHandle lhs, AnimationHandle rhs)
|
||||
{
|
||||
return lhs.InternalField_2977.Equals(rhs.InternalField_2977);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inequality operator
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side</param>
|
||||
/// <param name="rhs">Right hand side</param>
|
||||
/// <returns><see langword="true"/> if lhs and rhs are <b>not</b> equal</returns>
|
||||
public static bool operator !=(AnimationHandle lhs, AnimationHandle rhs)
|
||||
{
|
||||
return !lhs.InternalField_2977.Equals(rhs.InternalField_2977);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="AnimationHandle"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == other</c></returns>
|
||||
public override bool Equals(object pther)
|
||||
{
|
||||
if (pther is AnimationHandle handle)
|
||||
{
|
||||
return InternalField_2977.Equals(handle.InternalField_2977);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the hashcode for this <see cref="AnimationHandle"/>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return InternalField_2977.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="AnimationHandle"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == other</c></returns>
|
||||
public bool Equals(AnimationHandle other)
|
||||
{
|
||||
return InternalField_2977.Equals(other.InternalField_2977);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90cbd10c1f9d3ef49aa2e74b2a1c14e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,181 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_1;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of <see cref="AnimationHandle"/> extension methods for additional scheduling and state management
|
||||
/// </summary>
|
||||
/// <seealso cref="IAnimationExtensions"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions"/>
|
||||
public static class AnimationHandleExtensions
|
||||
{
|
||||
|
||||
internal static void InternalMethod_2691(this AnimationHandle InternalParameter_2248)
|
||||
{
|
||||
InternalType_120.InternalField_406.InternalMethod_574(InternalParameter_2248.InternalField_2977, InternalParameter_461: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Immediately cancels all the animations in the animation chain tied to this handle. No more update steps will run.
|
||||
/// This is safe to call on invalid handles.
|
||||
/// </summary>
|
||||
/// <param name="handle">A handle in the animation chain to cancel</param>
|
||||
public static void Cancel(this AnimationHandle handle)
|
||||
{
|
||||
InternalType_120.InternalField_406.InternalMethod_574(handle.InternalField_2977, InternalParameter_461: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the animation referenced by this handle in its current state. The animation can be resumed at a future time.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle of the animation to pause</param>
|
||||
public static void Pause(this AnimationHandle handle)
|
||||
{
|
||||
InternalType_120.InternalField_406.InternalMethod_572(handle.InternalField_2977);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resumes a paused animation/animation chain
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle of the animation to resume</param>
|
||||
public static void Resume(this AnimationHandle handle)
|
||||
{
|
||||
InternalType_120.InternalField_406.InternalMethod_573(handle.InternalField_2977);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if an animation has run to completion
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle of the animation to check for completion</param>
|
||||
/// <returns><see langword="true"/> if the animation is no longer in the animation queue, meaning this will also return <see langword="true"/> for an animation handle that not been scheduled</returns>
|
||||
public static bool IsComplete(this AnimationHandle handle)
|
||||
{
|
||||
return InternalType_120.InternalField_406.InternalMethod_565(handle.InternalField_2977);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the animation tied to this handle into its last update step. If the
|
||||
/// animation is set to loop, this call to Complete will also move
|
||||
/// the animation into its final iteration, even if the loop is technically infinite.
|
||||
/// The animation will then run for that final frame.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle of the animation to complete</param>
|
||||
public static void Complete(this AnimationHandle handle)
|
||||
{
|
||||
InternalType_120.InternalField_406.InternalMethod_575(handle.InternalField_2977);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the provided <paramref name="animation"/> simultaneously with the animation represented by this <paramref name="handle"/>. The new <paramref name="animation"/> will inherit duration and iterations from the already scheduled animation.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the new <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="handle">The handle of the animation to combine <paramref name="animation"/> with</param>
|
||||
/// <param name="animation">The new animation to combine with the animation tied to <paramref name="handle"/></param>
|
||||
/// <returns>An <see cref="AnimationHandle"/> representing this new animation combination</returns>
|
||||
/// <seealso cref="IAnimationExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationExtensions.Loop{T}(T, float, int)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Loop{T}(T, float, int)"/>
|
||||
public static AnimationHandle Include<T>(this AnimationHandle handle, T animation) where T : struct, IAnimation
|
||||
{
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2702(handle.InternalField_2977, ref animation));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the provided <paramref name="animation"/> simultaneously with the animation represented by this <paramref name="handle"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the new <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="handle">The handle of the animation to combine <paramref name="animation"/> with</param>
|
||||
/// <param name="animation">The new animation to combine with the animation tied to <paramref name="handle"/></param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, to run this new <paramref name="animation"/></param>
|
||||
/// <param name="iterations">The number of times to run <paramref name="animation"/> before removing it from the animation queue</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/> representing this new animation combination</returns>
|
||||
/// <seealso cref="IAnimationExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationExtensions.Loop{T}(T, float, int)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Loop{T}(T, float, int)"/>
|
||||
public static AnimationHandle Include<T>(this AnimationHandle handle, T animation, float durationInSeconds, int iterations = AnimationHandle.Once) where T : struct, IAnimation
|
||||
{
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2700(handle.InternalField_2977, ref animation, durationInSeconds, iterations));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the provided <paramref name="animation"/> after the animation (or animation group) represented by this <paramref name="handle"/> has completed
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the new <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="handle">The handle of the animation to run after <paramref name="animation"/></param>
|
||||
/// <param name="animation">The new animation to run when the previous animation, tied to <paramref name="handle"/>, completes</param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, to run this new <paramref name="animation"/></param>
|
||||
/// <param name="iterations">The number of times to run <paramref name="animation"/> before removing it from the animation queue</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/> representing this new animation chain</returns>
|
||||
/// <seealso cref="IAnimationExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationExtensions.Loop{T}(T, float, int)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Loop{T}(T, float, int)"/>
|
||||
public static AnimationHandle Chain<T>(this AnimationHandle handle, T animation, float durationInSeconds, int iterations = AnimationHandle.Once) where T : struct, IAnimation
|
||||
{
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2733(handle.InternalField_2977, ref animation, durationInSeconds, iterations));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A set of <see cref="AnimationHandle"/> extension methods for additional scheduling and state management
|
||||
/// </summary>
|
||||
/// <seealso cref="IAnimationExtensions"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions"/>
|
||||
public static class AnimationHandleWithEventsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Runs the provided <paramref name="animation"/> simultaneously with the animation represented by this <paramref name="handle"/>. The new <paramref name="animation"/> will inherit duration and iterations from the already scheduled animation.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the new <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="handle">The handle of the animation to combine <paramref name="animation"/> with</param>
|
||||
/// <param name="animation">The new animation to combine with the animation tied to <paramref name="handle"/></param>
|
||||
/// <returns>An <see cref="AnimationHandle"/> representing this new animation combination</returns>
|
||||
/// <seealso cref="IAnimationExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationExtensions.Loop{T}(T, float, int)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Loop{T}(T, float, int)"/>
|
||||
public static AnimationHandle Include<T>(this AnimationHandle handle, T animation) where T : struct, IAnimationWithEvents
|
||||
{
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2728(handle.InternalField_2977, ref animation));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the provided <paramref name="animation"/> simultaneously with the animation represented by this <paramref name="handle"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the new <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="handle">The handle of the animation to combine <paramref name="animation"/> with</param>
|
||||
/// <param name="animation">The new animation to combine with the animation tied to <paramref name="handle"/></param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, to run this new <paramref name="animation"/></param>
|
||||
/// <param name="iterations">The number of times to run <paramref name="animation"/> before removing it from the animation queue</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/> representing this new animation combination</returns>
|
||||
/// <seealso cref="IAnimationExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationExtensions.Loop{T}(T, float, int)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Loop{T}(T, float, int)"/>
|
||||
public static AnimationHandle Include<U>(this AnimationHandle handle, U animation, float durationInSeconds, int iterations = AnimationHandle.Once) where U : struct, IAnimationWithEvents
|
||||
{
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2701(handle.InternalField_2977, ref animation, durationInSeconds, iterations));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the provided <paramref name="animation"/> after the animation (or animation group) represented by this <paramref name="handle"/> has completed
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the new <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="handle">The handle of the animation to run after</param>
|
||||
/// <param name="animation">The new animation to run when the previous animation, tied to <paramref name="handle"/>, completes</param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, to run this new <paramref name="animation"/></param>
|
||||
/// <param name="iterations">The number of times to run <paramref name="animation"/> before removing it from the animation queue</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/> representing this new animation chain</returns>
|
||||
/// <seealso cref="IAnimationExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationExtensions.Loop{T}(T, float, int)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Run{T}(T, float)"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions.Loop{T}(T, float, int)"/>
|
||||
public static AnimationHandle Chain<T>(this AnimationHandle handle, T animation, float durationInSeconds, int iterations = AnimationHandle.Once) where T : struct, IAnimationWithEvents
|
||||
{
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2734(handle.InternalField_2977, ref animation, durationInSeconds, iterations));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 738c059a4dfad5642be0cdeada9916b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,105 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A common interface to implement for simple animation structs which just need a call to <see cref="Update(float)"/>.
|
||||
/// </summary>
|
||||
/// <seealso cref="IAnimationWithEvents"/>
|
||||
/// <seealso cref="IAnimationExtensions"/>
|
||||
public interface IAnimation
|
||||
{
|
||||
/// <summary>
|
||||
/// Called once per frame while the animation is running and provides a <paramref name="percentDone"/>, [0, 1] where <c>1 == 100%</c>, for the current animation iteration.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Update(float)"/> will be called with a value of <c>0</c> at the start and <c>1</c> on complete in all scenarios <i>except</i>:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>If the animation is <c>0</c> seconds in duration, <c>percentDone == 0</c> <i>will not</i> be provided. <c>percentDone == 1</c> <i>will</i> be provided.</description></item>
|
||||
/// <item><description>If <see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/> is called before animation starts, <c>percentDone == 0</c> <i>will not</i> be provided. <c>percentDone == 1</c> <i>will</i> be provided.</description></item>
|
||||
/// <item><description>If <see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/> is called before the animation starts, <c>percentDone == 0</c> <i>will not</i> be provided.</description></item>
|
||||
/// <item><description>If <see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/> is called before the animation completes, <c>percentDone == 1</c> <i>will not</i> be provided.</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <param name="percentDone">The percent, [0, 1] where <c>1 == 100%</c>, of the animation that has already run.</param>
|
||||
///
|
||||
///
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// using Nova;
|
||||
/// using UnityEngine;
|
||||
///
|
||||
/// public struct PositionAnimation : <see cref="IAnimation"/>
|
||||
/// {
|
||||
/// public <see cref="UIBlock"/> BlockToAnimate;
|
||||
///
|
||||
/// public Vector3 StartPosition;
|
||||
/// public Vector3 EndPosition;
|
||||
///
|
||||
/// public void Update(float percentDone)
|
||||
/// {
|
||||
/// BlockToAnimate.<see cref="UIBlock.Position">Position</see>.<see cref="Length3.Value">Value</see> = Vector3.Lerp(StartPosition, EndPosition, percentDone);
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// </code>
|
||||
/// </example>
|
||||
void Update(float percentDone);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A common interface to implement for all animation structs which wish to receive a range of animation events beyond the baseline <c>Update(float percentDone)</c> event.
|
||||
/// </summary>
|
||||
/// <seealso cref="IAnimation"/>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions"/>
|
||||
public interface IAnimationWithEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// Called <i>before</i> the first call to <see cref="IAnimationWithEvents.Update"/> for each iteration.
|
||||
/// </summary>
|
||||
/// <param name="currentIteration">The current iteration that's about to run, beginning at 0.</param>
|
||||
void Begin(int currentIteration);
|
||||
|
||||
/// <summary>
|
||||
/// Called <i>after</i> the last call to <see cref="IAnimationWithEvents.Update"/> for each iteration.
|
||||
/// </summary>
|
||||
/// <remarks>Won't be called if the animation is canceled via <see cref="OnCanceled"/></remarks>
|
||||
void End();
|
||||
|
||||
/// <summary>
|
||||
/// Called once per frame while the animation is running and provides a <paramref name="percentDone"/>, [0, 1] where <c>1 == 100%</c>, for the current animation iteration.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Update(float)"/> will be called with a value of <c>0</c> at the start and <c>1</c> on complete in all scenarios <i>except</i>:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>If the animation is <c>0</c> seconds in duration, <c>percentDone == 0</c> <i>will not</i> be provided. <c>percentDone == 1</c> <i>will</i> be provided.</description></item>
|
||||
/// <item><description>If <see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/> is called before animation starts, <c>percentDone == 0</c> <i>will not</i> be provided. <c>percentDone == 1</c> <i>will</i> be provided.</description></item>
|
||||
/// <item><description>If <see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/> is called before the animation starts, <c>percentDone == 0</c> <i>will not</i> be provided.</description></item>
|
||||
/// <item><description>If <see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/> is called before the animation completes, <c>percentDone == 1</c> <i>will not</i> be provided.</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <param name="percentDone">The percent, [0, 1] where <c>1 == 100%</c>, of the animation that has already run for the current iteration.</param>
|
||||
void Update(float percentDone);
|
||||
|
||||
/// <summary>
|
||||
/// Called <i>after</i> <see cref="End"/> of the final iteration, which may be triggered automatically or explicitly via <see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Won't be called if the animation is canceled via <see cref="OnCanceled"/>.</remarks>
|
||||
void Complete();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the <see cref="AnimationHandle"/> tied to this animation is paused via <see cref="AnimationHandleExtensions.Pause(AnimationHandle)"/>.
|
||||
/// </summary>
|
||||
void OnPaused();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the <see cref="AnimationHandle"/> tied to this animation is resumed via <see cref="AnimationHandleExtensions.Resume(AnimationHandle)"/>.
|
||||
/// </summary>
|
||||
void OnResumed();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the <see cref="AnimationHandle"/> tied to this animation is canceled via <see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/>.
|
||||
/// </summary>
|
||||
void OnCanceled();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb2ef9c903b8a35479523ded4ab673d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,129 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of extension methods to schedule <see cref="IAnimationWithEvents"/>
|
||||
/// </summary>
|
||||
/// <seealso cref="IAnimationExtensions"/>
|
||||
/// <seealso cref="AnimationHandleExtensions"/>
|
||||
/// <seealso cref="AnimationHandleWithEventsExtensions"/>
|
||||
public static class IAnimationWithEventsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Queue an animation to run for <paramref name="durationInSeconds"/> starting at the end of the current frame.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="animation">The <see cref="IAnimation"/> struct configured to perform the animation via <see cref="IAnimation.Update(float)"/></param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, of the animation</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/>, which can be used to:
|
||||
/// <list type="table">
|
||||
/// <item><term>Chain</term> <description><see cref="AnimationHandleExtensions.Chain{T}(AnimationHandle, T, float, int)"/></description></item>
|
||||
/// <item><term>Include</term> <description><see cref="AnimationHandleExtensions.Include{T}(AnimationHandle, T)"/></description></item>
|
||||
/// <item><term>Pause</term> <description><see cref="AnimationHandleExtensions.Pause(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Resume</term> <description><see cref="AnimationHandleExtensions.Resume(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Cancel</term> <description><see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Complete</term> <description><see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/></description></item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <exception cref="ArgumentException">Throws when <paramref name="durationInSeconds"/> is invalid.</exception>
|
||||
public static AnimationHandle Run<T>(this T animation, float durationInSeconds) where T : struct, IAnimationWithEvents
|
||||
{
|
||||
IAnimationExtensions.InternalMethod_2751(durationInSeconds);
|
||||
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2950(ref animation, durationInSeconds, AnimationHandle.Once));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an animation to loop <paramref name="iterations"/> times for <paramref name="durationInSeconds"/> per iteration, where <c><paramref name="iterations"/> == -1</c> indicates "until canceled", starting at the end of the current frame.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="animation">The <see cref="IAnimation"/> struct configured to perform the animation via <see cref="IAnimation.Update(float)"/></param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, per iteration of the animation</param>
|
||||
/// <param name="iterations">The number of iterations to perform before the animation is removed from the animation queue. <c>-1</c> indicates "infinite iterations"</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/>, which can be used to:
|
||||
/// <list type="table">
|
||||
/// <item><term>Chain</term> <description><see cref="AnimationHandleExtensions.Chain{T}(AnimationHandle, T, float, int)"/></description></item>
|
||||
/// <item><term>Include</term> <description><see cref="AnimationHandleExtensions.Include{T}(AnimationHandle, T)"/></description></item>
|
||||
/// <item><term>Pause</term> <description><see cref="AnimationHandleExtensions.Pause(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Resume</term> <description><see cref="AnimationHandleExtensions.Resume(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Cancel</term> <description><see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Complete</term> <description><see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/></description></item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <exception cref="ArgumentException">Throws when <paramref name="durationInSeconds"/> is invalid.</exception>
|
||||
public static AnimationHandle Loop<T>(this T animation, float durationInSeconds, int iterations = AnimationHandle.Infinite) where T : struct, IAnimationWithEvents
|
||||
{
|
||||
IAnimationExtensions.InternalMethod_2751(durationInSeconds);
|
||||
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2950(ref animation, durationInSeconds, iterations));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A set of extension methods to schedule <see cref="IAnimation"/>s
|
||||
/// </summary>
|
||||
/// <seealso cref="IAnimationWithEventsExtensions"/>
|
||||
/// <seealso cref="AnimationHandleExtensions"/>
|
||||
/// <seealso cref="AnimationHandleWithEventsExtensions"/>
|
||||
public static class IAnimationExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Queue an animation to run for <paramref name="durationInSeconds"/> starting at the end of the current frame.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="animation">The <see cref="IAnimation"/> struct configured to perform the animation via <see cref="IAnimation.Update(float)"/></param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, of the animation</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/>, which can be used to:
|
||||
/// <list type="table">
|
||||
/// <item><term>Chain</term> <description><see cref="AnimationHandleExtensions.Chain{T}(AnimationHandle, T, float, int)"/></description></item>
|
||||
/// <item><term>Include</term> <description><see cref="AnimationHandleExtensions.Include{T}(AnimationHandle, T)"/></description></item>
|
||||
/// <item><term>Pause</term> <description><see cref="AnimationHandleExtensions.Pause(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Resume</term> <description><see cref="AnimationHandleExtensions.Resume(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Cancel</term> <description><see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Complete</term> <description><see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/></description></item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <exception cref="ArgumentException">Throws when <paramref name="durationInSeconds"/> is invalid.</exception>
|
||||
public static AnimationHandle Run<T>(this T animation, float durationInSeconds) where T : struct, IAnimation
|
||||
{
|
||||
IAnimationExtensions.InternalMethod_2751(durationInSeconds);
|
||||
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2949(ref animation, durationInSeconds, AnimationHandle.Once));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an animation to loop <paramref name="iterations"/> times for <paramref name="durationInSeconds"/> per iteration, where <c><paramref name="iterations"/> == -1</c> indicates "until canceled", starting at the end of the current frame.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the <paramref name="animation"/> struct</typeparam>
|
||||
/// <param name="animation">The <see cref="IAnimation"/> struct configured to perform the animation via <see cref="IAnimation.Update(float)"/></param>
|
||||
/// <param name="durationInSeconds">The duration, in seconds, per iteration of the animation</param>
|
||||
/// <param name="iterations">The number of iterations to perform before the animation is removed from the animation queue. <c>-1</c> indicates "infinite iterations"</param>
|
||||
/// <returns>An <see cref="AnimationHandle"/>, which can be used to:
|
||||
/// <list type="table">
|
||||
/// <item><term>Chain</term> <description><see cref="AnimationHandleExtensions.Chain{T}(AnimationHandle, T, float, int)"/></description></item>
|
||||
/// <item><term>Include</term> <description><see cref="AnimationHandleExtensions.Include{T}(AnimationHandle, T)"/></description></item>
|
||||
/// <item><term>Pause</term> <description><see cref="AnimationHandleExtensions.Pause(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Resume</term> <description><see cref="AnimationHandleExtensions.Resume(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Cancel</term> <description><see cref="AnimationHandleExtensions.Cancel(AnimationHandle)"/></description></item>
|
||||
/// <item><term>Complete</term> <description><see cref="AnimationHandleExtensions.Complete(AnimationHandle)"/></description></item>
|
||||
/// </list>
|
||||
/// </returns>
|
||||
/// <exception cref="ArgumentException">Throws when <paramref name="durationInSeconds"/> is invalid.</exception>
|
||||
public static AnimationHandle Loop<T>(this T animation, float durationInSeconds, int iterations = AnimationHandle.Infinite) where T : struct, IAnimation
|
||||
{
|
||||
IAnimationExtensions.InternalMethod_2751(durationInSeconds);
|
||||
|
||||
return AnimationHandle.InternalMethod_2692(InternalType_725.InternalMethod_2949(ref animation, durationInSeconds, iterations));
|
||||
}
|
||||
|
||||
internal static void InternalMethod_2751(float InternalParameter_2564)
|
||||
{
|
||||
if (InternalParameter_2564 < 0 || float.IsInfinity(InternalParameter_2564) || float.IsNaN(InternalParameter_2564))
|
||||
{
|
||||
throw new ArgumentException($"Provided {nameof(InternalParameter_2564)} must be within range [0, {float.MaxValue}]. Received [{InternalParameter_2564}].", nameof(InternalParameter_2564));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37a5b85ce693bb5479f06e465ffda449
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80d50da6cc7a8b444868d4a468bb7405
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Provide a display name to show in the the <see cref="ItemVisuals"/> dropdown inspector in place of the class name.
|
||||
/// </summary>
|
||||
///
|
||||
///
|
||||
/// <example><code>
|
||||
///
|
||||
/// [TypeMenuName("Button")]
|
||||
/// public class MainMenuButtonVisuals : ItemVisuals
|
||||
/// {
|
||||
/// // ...
|
||||
/// }
|
||||
///
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
public class TypeMenuNameAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The string to display in place of the custom ItemVisuals's class name.
|
||||
/// </summary>
|
||||
public readonly string DisplayName;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="TypeMenuNameAttribute">TypeMenuName</see>.
|
||||
/// </summary>
|
||||
/// <param name="displayName">The string to assign to <see cref="DisplayName"/></param>
|
||||
public TypeMenuNameAttribute(string displayName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 234119109a1ee1240a7166a1d5ff2592
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Organize the <see cref="ItemVisuals"/> dropdown by categories and subcategories.
|
||||
/// </summary>
|
||||
///
|
||||
///
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// [TypeMenuPath("My Project/Main Menu")]
|
||||
/// public class MainMenuButtonVisuals : ItemVisuals
|
||||
/// {
|
||||
/// // ...
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class TypeMenuPathAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to use, where each subpath is separated by \ or /.
|
||||
/// </summary>
|
||||
public readonly string Path;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="TypeMenuPathAttribute">TypeMenuPath</see>.
|
||||
/// </summary>
|
||||
/// <param name="path">The string to assign to <see cref="Path"/></param>
|
||||
public TypeMenuPathAttribute(string path)
|
||||
{
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 920238e7caaf40f4cabc720151f0f86c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 569634daa370b504b9a8f9ea0c41eaa8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,169 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Clips the rendered bounds of a <see cref="UIBlock"/> hierarchy to a rounded-corner rectangle or custom texture.
|
||||
/// Supports applying a color <see cref="Tint">tint</see> or fade to the <see cref="UIBlock"/> hierarchy as well.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Clipping can be performed via a <see cref="ClipMask.Mask">mask</see> texture or using the rectangular bounds of the
|
||||
/// <see cref="UIBlock"/> on this gameobject. If the attached <see cref="UIBlock"/> is a <see cref="UIBlock2D"/>, the <see cref="ClipMask"/>
|
||||
/// defaults to clipping to the rounded-corner rectangle bounds matching the <see cref="UIBlock2D"/>'s <see cref="UIBlock2D.CornerRadius">Corner Radius</see>.
|
||||
/// </remarks>
|
||||
[AddComponentMenu("Nova/Clip Mask")]
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteAlways]
|
||||
[HelpURL("https://novaui.io/manual/ClipMasks.html")]
|
||||
[RequireComponent(typeof(UIBlock))]
|
||||
public sealed class ClipMask : MonoBehaviour
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// The tint color applied to this <see cref="UIBlock"/> and its descendants.<br/>
|
||||
/// The tint is applied multiplicatively: <c>finalRenderedColor *= Tint</c>.<br/>
|
||||
/// Adjust <c>Tint.a</c> (alpha) to apply a fade. Set <c>Tint</c> to <c>Color.white</c> if no tint is desired.
|
||||
/// </summary>
|
||||
public Color Tint
|
||||
{
|
||||
get => info.Color;
|
||||
set
|
||||
{
|
||||
if (info.Color == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.Color = value;
|
||||
InternalMethod_299();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables clipping. Can be used to make the <see cref="ClipMask"/> exclusively apply a <see cref="Tint">Tint</see>.
|
||||
/// </summary>
|
||||
/// <seealso cref="Tint"/>
|
||||
public bool Clip
|
||||
{
|
||||
get => info.Clip;
|
||||
set
|
||||
{
|
||||
if (info.Clip == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.Clip = value;
|
||||
InternalMethod_299();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The texture to use as a mask when <c><see cref="Clip">Clip</see> == true</c>. Clip shape defaults to a rectangle or a rounded-corner rectangle,
|
||||
/// depending on the <see cref="UIBlock"/> attached to <c>this.gameObject</c>, when <c>Mask == null</c>.
|
||||
/// </summary>
|
||||
/// <seealso cref="ClipMask"/>
|
||||
public Texture Mask
|
||||
{
|
||||
get => maskTexture;
|
||||
set
|
||||
{
|
||||
if (maskTexture == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
maskTexture = value;
|
||||
InternalMethod_299();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Nova.UIBlock"/> on <c>this.gameObject</c>.
|
||||
/// </summary>
|
||||
public UIBlock UIBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_3039 == null)
|
||||
{
|
||||
InternalField_3039 = GetComponent<UIBlock>();
|
||||
}
|
||||
|
||||
return InternalField_3039;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlock InternalField_3039 = null;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_37 info = InternalType_37.InternalField_132;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Texture maskTexture = null;
|
||||
|
||||
internal void InternalMethod_299()
|
||||
{
|
||||
if (!UIBlock.InternalProperty_25 || !enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.InternalField_131 = maskTexture != null;
|
||||
|
||||
InternalType_274.InternalProperty_190.InternalField_874.InternalMethod_1498(UIBlock.InternalProperty_29, UnsafeUtility.As<InternalType_37, InternalNamespace_0.InternalType_109>(ref info), maskTexture);
|
||||
}
|
||||
|
||||
private void InternalMethod_300(InternalType_131 InternalParameter_216)
|
||||
{
|
||||
if (InternalType_274.InternalProperty_190 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_274.InternalProperty_190.InternalField_874.InternalMethod_1499(InternalParameter_216);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
UIBlock.InternalMethod_116();
|
||||
InternalMethod_299();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
InternalMethod_300(UIBlock.InternalProperty_29);
|
||||
|
||||
if (NovaApplication.IsEditor)
|
||||
{
|
||||
InternalType_131 InternalVar_1 = UIBlock.InternalProperty_29;
|
||||
NovaApplication.EditorDelayCall += () =>
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
InternalMethod_300(InternalVar_1);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Obfuscation]
|
||||
private void OnDidApplyAnimationProperties()
|
||||
{
|
||||
InternalMethod_299();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 388f1fceb3d2beb408ed2d18963ab884
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 529c4fa33b873fe44ba4c0adc321a117, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,440 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_0;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_4;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_9;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5.InternalNamespace_6;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// An abstract base class for custom components to synchronize a set of properties based on their transform hierarchy
|
||||
/// </summary>
|
||||
[ExecuteAlways, DisallowMultipleComponent, RequireComponent(typeof(UIBlockActivator))]
|
||||
public abstract class CoreBlock : MonoBehaviour, InternalType_146, ISerializationCallbackReceiver
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_145.InternalProperty_207 => InternalProperty_26 == null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_145.InternalProperty_208 => InternalProperty_28;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
int InternalType_145.InternalProperty_209 => transform.GetSiblingIndex();
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_38 = false;
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_39 = true;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_146.InternalProperty_213 { get => InternalField_38; set => InternalField_38 = value; }
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_146.InternalProperty_212 { get => InternalField_39; set => InternalField_39 = value; }
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_145 InternalType_145.InternalProperty_211 => InternalType_253.InternalProperty_190.InternalMethod_1157(InternalProperty_29);
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_145 InternalType_145.InternalProperty_210 => InternalProperty_27.InternalProperty_210;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal bool InternalProperty_25 => InternalField_48;
|
||||
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private CoreBlock InternalField_40 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private CoreBlock InternalProperty_26
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalField_40;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!InternalProperty_27.InternalProperty_151 || value == InternalField_40)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalField_40 != null && InternalField_40.InternalProperty_27.InternalProperty_197 && value == null)
|
||||
{
|
||||
bool InternalVar_1 = InternalField_40.InternalProperty_27.InternalProperty_213;
|
||||
|
||||
InternalProperty_27.InternalMethod_561();
|
||||
|
||||
if (InternalProperty_31 && !InternalVar_1)
|
||||
{
|
||||
InternalField_40.InternalProperty_27.InternalProperty_213 = false;
|
||||
}
|
||||
}
|
||||
|
||||
InternalField_40 = value;
|
||||
|
||||
if (InternalField_40 != null)
|
||||
{
|
||||
bool InternalVar_1 = InternalField_40.InternalProperty_27.InternalProperty_213;
|
||||
|
||||
InternalProperty_27.InternalMethod_562();
|
||||
|
||||
if (InternalField_46 && !InternalVar_1)
|
||||
{
|
||||
InternalField_40.InternalProperty_27.InternalProperty_213 = false;
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_115();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_146 InternalType_146.InternalProperty_210
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalProperty_26;
|
||||
}
|
||||
set
|
||||
{
|
||||
InternalProperty_26 = value as CoreBlock;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected InternalType_146 InternalProperty_27
|
||||
{
|
||||
get
|
||||
{
|
||||
InternalMethod_110();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected abstract bool InternalProperty_28 { get; }
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_68.InternalProperty_151 => InternalField_48;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_68.InternalProperty_152 => gameObject.activeInHierarchy;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_68.InternalProperty_153 => gameObject.activeSelf;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_68.InternalProperty_154 => InternalProperty_31;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Transform InternalType_141.InternalProperty_202 => transform;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_141.InternalProperty_203 => false;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_141.InternalProperty_204 => NovaApplication.IsEditor ? transform.childCount > 0 || transform.parent != null : true;
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_131 InternalField_41 = InternalType_131.InternalField_415;
|
||||
[SerializeField, HideInInspector, InternalType_22]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_131 sourceID = InternalType_131.InternalField_415;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_131 InternalType_134.InternalProperty_195 => InternalProperty_29;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_131 InternalProperty_29
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!InternalField_41.InternalProperty_192)
|
||||
{
|
||||
InternalField_41 = InternalType_131.InternalMethod_630();
|
||||
}
|
||||
|
||||
return InternalField_41;
|
||||
}
|
||||
}
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_133 InternalField_42 = InternalType_133.InternalField_418;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_133 InternalType_134.InternalProperty_196 => InternalField_42;
|
||||
void InternalType_134.InternalMethod_642(InternalType_133 InternalParameter_525) => InternalField_42 = InternalParameter_525;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_134.InternalProperty_197
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalField_42.InternalProperty_194;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
string InternalType_135.InternalProperty_198 => name;
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal int InternalProperty_84 => InternalType_253.InternalProperty_190.InternalMethod_3745(InternalProperty_29);
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected bool InternalProperty_31 => InternalField_47;
|
||||
|
||||
private protected abstract void InternalMethod_102();
|
||||
internal void InternalMethod_103() => OnTransformParentChanged();
|
||||
internal void InternalMethod_104() => OnTransformChildrenChanged();
|
||||
|
||||
private void OnTransformParentChanged()
|
||||
{
|
||||
if (!InternalProperty_25)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (transform.parent != null &&
|
||||
transform.parent.TryGetComponent(out CoreBlock InternalVar_1) &&
|
||||
InternalVar_1.InternalMethod_556())
|
||||
{
|
||||
InternalProperty_26 = InternalVar_1;
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalProperty_26 = null;
|
||||
}
|
||||
|
||||
if (NovaApplication.IsEditor)
|
||||
{
|
||||
InternalMethod_102();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTransformChildrenChanged()
|
||||
{
|
||||
if (!InternalProperty_25)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalProperty_27.InternalMethod_560();
|
||||
|
||||
if (NovaApplication.IsEditor)
|
||||
{
|
||||
InternalMethod_102();
|
||||
}
|
||||
}
|
||||
|
||||
internal void InternalMethod_105()
|
||||
{
|
||||
InternalProperty_27.InternalMethod_558();
|
||||
transform.SetAsFirstSibling();
|
||||
}
|
||||
|
||||
internal void InternalMethod_106()
|
||||
{
|
||||
Transform InternalVar_1 = transform.parent;
|
||||
InternalProperty_27.InternalMethod_559(InternalVar_1 == null ? 0 : InternalVar_1.childCount - 1);
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private List<InternalType_131> InternalField_43 = new List<InternalType_131>(0);
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
List<InternalType_131> InternalType_146.InternalProperty_214 => InternalField_43;
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private List<InternalType_146> InternalField_44 = new List<InternalType_146>(0);
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
List<InternalType_146> InternalType_146.InternalProperty_215 => InternalField_44;
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_521<InternalType_131> InternalProperty_32
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalField_43.InternalMethod_2043();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_521<InternalType_146> InternalProperty_33
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalField_44.InternalMethod_2043();
|
||||
}
|
||||
}
|
||||
|
||||
internal InternalType_146 InternalMethod_109(int InternalParameter_76)
|
||||
{
|
||||
InternalType_521<InternalType_146> InternalVar_1 = InternalProperty_33;
|
||||
|
||||
if (InternalParameter_76 < 0 || InternalParameter_76 >= InternalVar_1.InternalProperty_433)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", $"Expected: [0, {InternalVar_1.InternalProperty_433}) Received: {InternalParameter_76}");
|
||||
}
|
||||
|
||||
return InternalVar_1[InternalParameter_76];
|
||||
}
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected bool InternalField_45 = false;
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_46 = false;
|
||||
private protected void InternalMethod_110()
|
||||
{
|
||||
if (InternalField_46 || InternalField_45)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!InternalField_48)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_46 = true;
|
||||
|
||||
if (InternalField_3315 == null && TryGetComponent(out InternalField_3315))
|
||||
{
|
||||
InternalField_3315.InternalMethod_303(this);
|
||||
}
|
||||
|
||||
if (NovaApplication.IsEditor)
|
||||
{
|
||||
if (NovaApplication.InPlayer(this))
|
||||
{
|
||||
sourceID = InternalProperty_29;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceID = InternalProperty_29;
|
||||
}
|
||||
|
||||
InternalField_39 = true;
|
||||
InternalField_38 = false;
|
||||
|
||||
OnTransformParentChanged();
|
||||
|
||||
InternalProperty_27.InternalMethod_564();
|
||||
|
||||
InternalField_45 = true;
|
||||
InternalField_46 = false;
|
||||
}
|
||||
|
||||
void InternalType_134.InternalMethod_644() => InternalMethod_111();
|
||||
void InternalType_134.InternalMethod_645() => InternalMethod_112();
|
||||
private protected abstract void InternalMethod_111();
|
||||
private protected abstract void InternalMethod_112();
|
||||
internal abstract void InternalMethod_113();
|
||||
internal abstract void InternalMethod_114(InternalType_131 InternalParameter_77);
|
||||
private protected abstract void InternalMethod_115();
|
||||
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_47 = false;
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_48 = false;
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlockActivator InternalField_3315 = null;
|
||||
|
||||
internal void InternalMethod_116()
|
||||
{
|
||||
InternalProperty_27.InternalMethod_557();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (TryGetComponent(out InternalField_3315))
|
||||
{
|
||||
InternalField_3315.InternalMethod_303(this);
|
||||
}
|
||||
}
|
||||
|
||||
private protected virtual void OnDestroy()
|
||||
{
|
||||
((InternalType_4)this).InternalMethod_120();
|
||||
|
||||
if (InternalField_3315 != null)
|
||||
{
|
||||
InternalField_3315.InternalMethod_304(this);
|
||||
}
|
||||
}
|
||||
|
||||
private protected abstract void InternalMethod_117();
|
||||
private protected abstract void InternalMethod_118();
|
||||
|
||||
void InternalType_4.InternalMethod_119()
|
||||
{
|
||||
if (InternalField_48)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_48 = true;
|
||||
|
||||
InternalMethod_110();
|
||||
|
||||
InternalMethod_117();
|
||||
}
|
||||
|
||||
void InternalType_4.InternalMethod_120()
|
||||
{
|
||||
if (!InternalField_48)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_47 = true;
|
||||
|
||||
InternalMethod_113();
|
||||
sourceID = InternalType_131.InternalField_415;
|
||||
|
||||
InternalMethod_118();
|
||||
|
||||
InternalProperty_27.InternalMethod_563();
|
||||
|
||||
InternalField_47 = false;
|
||||
InternalField_48 = false;
|
||||
InternalField_45 = false;
|
||||
InternalField_46 = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevent users from inheriting
|
||||
/// </summary>
|
||||
internal CoreBlock() { }
|
||||
|
||||
#region
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize() { }
|
||||
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
{
|
||||
if (!NovaApplication.IsPlaying)
|
||||
{
|
||||
if (sourceID.InternalProperty_192)
|
||||
{
|
||||
sourceID = InternalType_131.InternalField_415;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (sourceID.InternalProperty_192 && sourceID != InternalProperty_29)
|
||||
{
|
||||
InternalMethod_114(sourceID);
|
||||
|
||||
sourceID = InternalType_131.InternalField_415;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21a2ee2c644a5f9458f1d2e64d55e89b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: a52d0879baacd427fb4b6227dab8952c, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,781 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_0;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_4;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_9;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A callback to configure a <see cref="GridSlice"/>, <see cref="GridSlice2D"/> or <see cref="GridSlice3D"/> before it's inserted into the grid view.
|
||||
/// </summary>
|
||||
/// <param name="sliceIndex">The virtual index of the slice along the <paramref name="primaryAxis"/></param>
|
||||
/// <param name="gridView">The <see cref="GridView"/> requesting the grid slice.</param>
|
||||
/// <param name="gridSlice">The grid slice of type <typeparamref name="T"/> to configure. This slice will then be inserted into the grid.</param>
|
||||
/// <typeparam name="T">
|
||||
/// The type of grid slice the provider will configure:
|
||||
/// <list type="bullet">
|
||||
/// <item><description><see cref="GridSlice"/></description></item>
|
||||
/// <item><description><see cref="GridSlice2D"/></description></item>
|
||||
/// <item><description><see cref="GridSlice3D"/></description></item>
|
||||
/// </list>
|
||||
/// </typeparam>
|
||||
/// <seealso cref="GridView.SetSliceProvider(GridSliceProviderCallback{GridSlice})"/>
|
||||
/// <seealso cref="GridView.SetSliceProvider(GridSliceProviderCallback{GridSlice2D})"/>
|
||||
/// <seealso cref="GridView.SetSliceProvider(GridSliceProviderCallback{GridSlice3D})"/>
|
||||
public delegate void GridSliceProviderCallback<T>(int sliceIndex, GridView gridView, ref T gridSlice);
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="ListView"/> whose list items can be arranged in a 2D layout.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Percent-based <see cref="Layout"/> properties on <see cref="UIBlock"/>s parented directly to a
|
||||
/// <see cref="GridView"/> are calculated relative to their "virtual" parent <see cref="GridSlice"/>,
|
||||
/// not the <see cref="GridView"/> itself.
|
||||
/// </remarks>
|
||||
[AddComponentMenu("Nova/Grid View")]
|
||||
[HelpURL("https://novaui.io/manual/GridView.html")]
|
||||
public sealed class GridView : ListView, ISerializationCallbackReceiver
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// The lowest slice index currently loaded into the grid view.
|
||||
/// </summary>
|
||||
public int MinLoadedSliceIndex => InternalProperty_48.InternalMethod_254(MinLoadedIndex);
|
||||
|
||||
/// <summary>
|
||||
/// The highest slice index currently loaded into the grid view.
|
||||
/// </summary>
|
||||
public int MaxLoadedSliceIndex => InternalProperty_48.InternalMethod_254(MaxLoadedIndex);
|
||||
|
||||
/// <summary>
|
||||
/// The number of elements to position along the <see cref="CrossAxis"/>.
|
||||
/// </summary>
|
||||
/// <seealso cref="CrossAxis"/>
|
||||
public int CrossAxisItemCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return crossAxisItemCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
int InternalVar_1 = Mathf.Max(1, value);
|
||||
if (InternalVar_1 == crossAxisItemCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
crossAxisItemCount = InternalVar_1;
|
||||
|
||||
if (!UIBlock.InternalProperty_25)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalMethod_411();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The scrolling axis to position elements in the grid. Assigned implicitly from the <see cref="AutoLayout.Axis"/> configured on the <see cref="ListView.UIBlock"/>.
|
||||
/// </summary>
|
||||
/// <seealso cref="CrossAxis"/>
|
||||
public Axis PrimaryAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
return UIBlock.InternalMethod_79().Axis;
|
||||
}
|
||||
set
|
||||
{
|
||||
UIBlock.AutoLayout.Axis = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The non-scrolling axis along which <see cref="GridSlice"/>'s will position items.
|
||||
/// </summary>
|
||||
/// <example>If the <see cref="PrimaryAxis"/> is set to Y, the <see cref="CrossAxis"/> is commonly set to X.</example>
|
||||
/// <seealso cref="CrossAxisItemCount"/>
|
||||
/// <seealso cref="PrimaryAxis"/>
|
||||
public Axis CrossAxis
|
||||
{
|
||||
get => crossAxis;
|
||||
set
|
||||
{
|
||||
if (crossAxis == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
crossAxis = value;
|
||||
|
||||
InternalType_521<InternalType_34> InternalVar_1 = InternalProperty_50;
|
||||
|
||||
for (int InternalVar_2 = 0; InternalVar_2 < InternalVar_1.InternalProperty_433; ++InternalVar_2)
|
||||
{
|
||||
InternalType_33 InternalVar_3 = InternalVar_1[InternalVar_2] as InternalType_33;
|
||||
InternalVar_3.InternalProperty_64.Axis = crossAxis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assigns the given <see cref="GridSliceProviderCallback{T}"/> as the sole handler for any grid slice requests. As a <see cref="GridView"/> is scrolled, new list items will
|
||||
/// be pulled into view, and <see cref="CrossAxisItemCount"/> list items will be visually parented to the returned <see cref="GridSlice"/>.
|
||||
/// </summary>
|
||||
/// <param name="provider"></param>
|
||||
/// <remarks>
|
||||
/// A <see cref="GridView"/> can only have a single <see cref="GridSliceProviderCallback{T}"/> at a given time, so assigning a value here will remove any existing slice providers.
|
||||
/// </remarks>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice2D})"/>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice3D})"/>
|
||||
public void SetSliceProvider(GridSliceProviderCallback<GridSlice> provider) => InternalMethod_196<GridSlice>(provider);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns the given <see cref="GridSliceProviderCallback{T}"/> as the sole handler for any grid slice requests. As a <see cref="GridView"/> is scrolled, new list items will
|
||||
/// be pulled into view, and <see cref="CrossAxisItemCount"/> list items will be visually parented to the returned <see cref="GridSlice2D"/>.
|
||||
/// </summary>
|
||||
/// <param name="provider"></param>
|
||||
/// <remarks>
|
||||
/// A <see cref="GridView"/> can only have a single <see cref="GridSliceProviderCallback{T}"/> at a given time, so assigning a value here will remove any existing slice providers.
|
||||
/// </remarks>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice})"/>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice3D})"/>
|
||||
public void SetSliceProvider(GridSliceProviderCallback<GridSlice2D> provider) => InternalMethod_196<GridSlice2D>(provider);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns the given <see cref="GridSliceProviderCallback{T}"/> as the sole handler for any grid slice requests. As a <see cref="GridView"/> is scrolled, new list items will
|
||||
/// be pulled into view, and <see cref="CrossAxisItemCount"/> list items will be visually parented to the returned <see cref="GridSlice3D"/>.
|
||||
/// </summary>
|
||||
/// <param name="provider"></param>
|
||||
/// <remarks>
|
||||
/// A <see cref="GridView"/> can only have a single <see cref="GridSliceProviderCallback{T}"/> at a given time, so assigning a value here will remove any existing slice providers.
|
||||
/// </remarks>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice})"/>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice2D})"/>
|
||||
public void SetSliceProvider(GridSliceProviderCallback<GridSlice3D> provider) => InternalMethod_196<GridSlice3D>(provider);
|
||||
|
||||
/// <summary>
|
||||
/// Clears any <see cref="GridSliceProviderCallback{T}"/> callback previously assigned via
|
||||
/// <list type="bullet">
|
||||
/// <item><description><see cref="SetSliceProvider(GridSliceProviderCallback{GridSlice})"/></description></item>
|
||||
/// <item><description><see cref="SetSliceProvider(GridSliceProviderCallback{GridSlice2D})"/></description></item>
|
||||
/// <item><description><see cref="SetSliceProvider(GridSliceProviderCallback{GridSlice3D})"/></description></item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice})"/>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice2D})"/>
|
||||
/// <seealso cref="SetSliceProvider(GridSliceProviderCallback{GridSlice3D})"/>
|
||||
public void ClearSliceProvider()
|
||||
{
|
||||
InternalField_90 = null;
|
||||
InternalField_91 = typeof(GridSlice);
|
||||
InternalField_92 = typeof(InternalType_42);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wraps the GridView's underlying data source in a <see cref="GridList{T}"/> to be indexable by a <see cref="GridIndex"/>,
|
||||
/// where <see cref="GridIndex.Row"/> is the index into the <see cref="PrimaryAxis"/> and <see cref="GridIndex.Column"/> is the index
|
||||
/// into the <see cref="CrossAxis"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="GridList{T}"/> to create. Must match the type parameter used when calling <see cref="ListView.SetDataSource{T}(IList{T})"/></typeparam>
|
||||
/// <returns>The GridView's underlying data source wrapped as a <see cref="GridList{T}"/></returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <typeparamref name="T"/> doesn't match the type parameter used when calling <see cref="ListView.SetDataSource{T}(IList{T})"/></exception>
|
||||
/// <exception cref="ArgumentException">Thrown when <see cref="ListView.SetDataSource{T}(IList{T})"/> hasn't been called or was set to <c><see langword="null"/></c></exception>
|
||||
/// <seealso cref="ListView.SetDataSource{T}(IList{T})"/>
|
||||
public GridList<T> GetDataSourceAsGrid<T>()
|
||||
{
|
||||
IList<T> InternalVar_1 = GetDataSource<T>();
|
||||
|
||||
if (InternalVar_1 == null)
|
||||
{
|
||||
if (InternalProperty_55 != null)
|
||||
{
|
||||
throw new ArgumentException($"Requesting a {nameof(GridList<T>)} of type {typeof(T).Name}, but the {nameof(GridView)}'s data source is tracking elements of type {InternalProperty_55.InternalMethod_2039().Name}. The provided Type argument, {nameof(T)}, must match the underlying data source element type.");
|
||||
}
|
||||
|
||||
throw new ArgumentException($"The {nameof(GridView)} has no underlying data source to wrap as a {typeof(GridList<T>)}. You must first call {nameof(SetDataSource)} before a {nameof(GridList<T>)} can be made from the {nameof(GridView)}.");
|
||||
}
|
||||
|
||||
return GridList<T>.CreateWithColumns(InternalVar_1, CrossAxisItemCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="ItemView"/> representing the object in the data source at the provided <see cref="GridIndex"/> if it's paged into the <see cref="GridView"/>.
|
||||
/// </summary>
|
||||
/// <param name="index">
|
||||
/// The <see cref="GridIndex"/> of the object in the data source represented by the requested
|
||||
/// <see cref="ItemView"/>, where <see cref="GridIndex.Row"/> is the index into the <see cref="PrimaryAxis"/>
|
||||
/// and <see cref="GridIndex.Column"/> is the index into the <see cref="CrossAxis"/>
|
||||
/// </param>
|
||||
/// <param name="gridItem"> The item in the GridView representing the data object in the data source at the provided <see cref="GridIndex"/>.</param>
|
||||
/// <returns>Returns <see langword="true"/> if the requested <see cref="ItemView"/> is found (paged into view), otherwise returns <see langword="false"/>.</returns>
|
||||
public bool TryGetGridItem(GridIndex index, out ItemView gridItem)
|
||||
{
|
||||
int InternalVar_1 = InternalProperty_48.InternalMethod_253(index);
|
||||
|
||||
return TryGetItemView(InternalVar_1, out gridItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the configured grid slice provider, set via <see cref="SetSliceProvider"/>, for the grid<br/>
|
||||
/// slice at the given index, <paramref name="sliceIndex"/>. Provides a way for the caller to reconfigure the visuals/layout of the requested grid slice.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the grid slice provider has been cleared or was never set or if <paramref name="sliceIndex"/> is outside the range defined by [<see cref="MinLoadedSliceIndex"/>, <see cref="MaxLoadedSliceIndex"/>], this call won't do anything.
|
||||
/// </remarks>
|
||||
/// <param name="sliceIndex">The virtual index of the grid slice to update.</param>
|
||||
public void UpdateGridSlice(int sliceIndex)
|
||||
{
|
||||
if (InternalField_90 == null || sliceIndex < MinLoadedSliceIndex || sliceIndex > MaxLoadedSliceIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int InternalVar_1 = sliceIndex - MinLoadedSliceIndex;
|
||||
|
||||
InternalType_33 InternalVar_2 = InternalProperty_50[InternalVar_1] as InternalType_33;
|
||||
|
||||
InternalMethod_202(InternalVar_2, InternalField_90, sliceIndex, PrimaryAxis, CrossAxis);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[SerializeField, InternalType_22]
|
||||
[Tooltip("The non-scrolling axis to position elements in the grid.\n\nE.g.\nIf the Primary Axis is set to Y, the Cross Axis is commonly set to X.")]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Axis crossAxis = Axis.X;
|
||||
[SerializeField, InternalType_22]
|
||||
[Min(1), Tooltip("The number of elements to position along the Cross Axis.\n\nE.g.\nIf the Cross Axis is set to X, this is the number of columns in the grid.")]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int crossAxisItemCount = 1;
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private MulticastDelegate InternalField_90;
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Type InternalField_91 = typeof(GridSlice);
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Type InternalField_92 = typeof(InternalType_42);
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_35 InternalField_93 = new InternalType_35();
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_35 InternalField_94 = new InternalType_35();
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int InternalField_95 = 0;
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int InternalField_96 = 0;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected override int InternalProperty_52 => CrossAxisItemCount;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_32 InternalProperty_48 => InternalType_32.InternalMethod_258(InternalProperty_55.InternalProperty_430, CrossAxisItemCount);
|
||||
|
||||
private protected override InternalType_521<InternalType_131> InternalMethod_2062()
|
||||
{
|
||||
return InternalProperty_51 == 0 ? base.InternalMethod_2062() : InternalProperty_49.InternalProperty_182;
|
||||
}
|
||||
|
||||
private protected override bool InternalMethod_919(int InternalParameter_855, out InternalType_5 InternalParameter_2352)
|
||||
{
|
||||
InternalParameter_2352 = null;
|
||||
|
||||
if (!TryGetItemView(InternalParameter_855, out ItemView InternalVar_1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
InternalParameter_2352 = InternalType_253.InternalProperty_190.InternalMethod_1158(InternalVar_1.UIBlock.InternalProperty_29) as InternalType_5;
|
||||
|
||||
return InternalParameter_2352 != null;
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_2060(bool firstSibling)
|
||||
{
|
||||
if ((firstSibling && InternalProperty_50.InternalProperty_433 <= InternalField_95) ||
|
||||
(!firstSibling && InternalProperty_50.InternalProperty_433 <= InternalField_96))
|
||||
{
|
||||
base.InternalMethod_2060(firstSibling);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_33 InternalVar_1 = (firstSibling ? InternalProperty_50[InternalField_95++] : InternalProperty_50[InternalProperty_51 - (++InternalField_96)]) as InternalType_33;
|
||||
|
||||
if (firstSibling)
|
||||
{
|
||||
for (int InternalVar_2 = 0; InternalVar_2 < crossAxisItemCount && InternalVar_1.InternalProperty_30 - InternalVar_2 > 0; ++InternalVar_2)
|
||||
{
|
||||
if (InternalField_98 > InternalField_99)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
InternalMethod_230();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int InternalVar_2 = 0; InternalVar_2 < crossAxisItemCount && InternalVar_1.InternalProperty_30 - InternalVar_2 > 0; ++InternalVar_2)
|
||||
{
|
||||
if (InternalField_99 < InternalField_98)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
InternalMethod_231();
|
||||
}
|
||||
}
|
||||
|
||||
InternalProperty_54.InternalMethod_58(InternalVar_1);
|
||||
|
||||
InternalField_94.InternalMethod_295(InternalVar_1);
|
||||
}
|
||||
|
||||
private protected override InternalType_66 InternalMethod_1858(bool InternalParameter_2057)
|
||||
{
|
||||
if (!InternalParameter_2057 && (InternalField_99 + 1) % InternalProperty_52 != 0)
|
||||
{
|
||||
InternalType_66 InternalVar_1 = InternalMethod_229(InternalParameter_175: false);
|
||||
|
||||
if (InternalVar_1 != null && InternalMethod_919(InternalField_99, out InternalType_5 InternalVar_2))
|
||||
{
|
||||
InternalVar_2.InternalMethod_442();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
InternalType_33 InternalVar_3 = InternalMethod_201(InternalParameter_2057);
|
||||
|
||||
int InternalVar_4 = 0;
|
||||
|
||||
if (InternalParameter_2057)
|
||||
{
|
||||
for (int InternalVar_5 = 0; InternalVar_5 < crossAxisItemCount; ++InternalVar_5)
|
||||
{
|
||||
InternalType_66 InternalVar_6 = InternalMethod_228(InternalParameter_174: false);
|
||||
|
||||
InternalVar_4 += (InternalVar_6 as MonoBehaviour) != null ? 1 : 0;
|
||||
|
||||
if (InternalField_98 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int InternalVar_5 = 0; InternalVar_5 < crossAxisItemCount; ++InternalVar_5)
|
||||
{
|
||||
InternalType_66 InternalVar_6 = InternalMethod_229(InternalParameter_175: false);
|
||||
|
||||
InternalVar_4 += (InternalVar_6 as MonoBehaviour) != null ? 1 : 0;
|
||||
|
||||
if (InternalField_99 == InternalProperty_55.InternalProperty_430 - 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (InternalVar_4 == 0)
|
||||
{
|
||||
InternalField_94.InternalMethod_295(InternalVar_3);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
InternalVar_3.InternalMethod_442();
|
||||
|
||||
InternalProperty_54.InternalMethod_59(InternalVar_3.InternalProperty_83);
|
||||
|
||||
return InternalVar_3;
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_224()
|
||||
{
|
||||
while (InternalField_94.InternalMethod_296(out InternalType_33 InternalVar_1))
|
||||
{
|
||||
InternalVar_1.InternalProperty_269 = false;
|
||||
InternalMethod_208(InternalVar_1);
|
||||
InternalVar_1.Dispose();
|
||||
InternalField_93.InternalMethod_295(InternalVar_1);
|
||||
}
|
||||
|
||||
InternalField_95 = 0;
|
||||
InternalField_96 = 0;
|
||||
}
|
||||
|
||||
private void InternalMethod_196<TSlice>(MulticastDelegate InternalParameter_142) where TSlice : struct
|
||||
{
|
||||
if (InternalParameter_142 == null)
|
||||
{
|
||||
ClearSliceProvider();
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_91 = typeof(TSlice);
|
||||
InternalField_92 = InternalMethod_200<TSlice>();
|
||||
InternalField_90 = InternalParameter_142;
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_220()
|
||||
{
|
||||
InternalField_93.Dispose();
|
||||
}
|
||||
|
||||
private protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
if (virtualBlockSerializer != null)
|
||||
{
|
||||
Destroy(virtualBlockSerializer);
|
||||
virtualBlockSerializer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_235()
|
||||
{
|
||||
InternalProperty_49.InternalMethod_540();
|
||||
|
||||
if (NovaApplication.InPlayer(this))
|
||||
{
|
||||
InternalMethod_411(InternalParameter_173: true);
|
||||
}
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_236()
|
||||
{
|
||||
InternalProperty_49.InternalMethod_539();
|
||||
}
|
||||
|
||||
private static void InternalMethod_197(InternalType_33 InternalParameter_143, GridSlice InternalParameter_144)
|
||||
{
|
||||
InternalParameter_143.InternalProperty_269 = false;
|
||||
InternalParameter_143.InternalProperty_63 = InternalParameter_144.Layout;
|
||||
InternalParameter_143.InternalProperty_64 = InternalParameter_144.AutoLayout;
|
||||
}
|
||||
|
||||
private static void InternalMethod_198(InternalType_33 InternalParameter_145, GridSlice2D InternalParameter_146)
|
||||
{
|
||||
InternalType_42 InternalVar_1 = InternalParameter_145 as InternalType_42;
|
||||
|
||||
InternalVar_1.InternalProperty_269 = true;
|
||||
InternalVar_1.InternalProperty_95 = InternalParameter_146.Color;
|
||||
InternalVar_1.InternalProperty_90 = InternalParameter_146.Gradient;
|
||||
InternalVar_1.InternalProperty_93 = InternalParameter_146.Surface;
|
||||
InternalVar_1.InternalProperty_94 = InternalParameter_146.CornerRadius;
|
||||
InternalVar_1.InternalProperty_91 = InternalParameter_146.Border;
|
||||
InternalVar_1.InternalProperty_92 = InternalParameter_146.Shadow;
|
||||
InternalVar_1.InternalProperty_63 = InternalParameter_146.Layout;
|
||||
InternalVar_1.InternalProperty_64 = InternalParameter_146.AutoLayout;
|
||||
}
|
||||
|
||||
private static void InternalMethod_199(InternalType_33 InternalParameter_147, GridSlice3D InternalParameter_148)
|
||||
{
|
||||
InternalType_43 InternalVar_1 = InternalParameter_147 as InternalType_43;
|
||||
|
||||
InternalVar_1.InternalProperty_269 = true;
|
||||
InternalVar_1.InternalProperty_96 = InternalParameter_148.Color;
|
||||
InternalVar_1.InternalProperty_97 = InternalParameter_148.Surface;
|
||||
InternalVar_1.InternalProperty_98 = InternalParameter_148.CornerRadius;
|
||||
InternalVar_1.InternalProperty_99 = InternalParameter_148.EdgeRadius;
|
||||
InternalVar_1.InternalProperty_63 = InternalParameter_148.Layout;
|
||||
InternalVar_1.InternalProperty_64 = InternalParameter_148.AutoLayout;
|
||||
}
|
||||
|
||||
private static Type InternalMethod_200<TSlice>() where TSlice : struct
|
||||
{
|
||||
if (typeof(TSlice) == typeof(GridSlice3D))
|
||||
{
|
||||
return typeof(InternalType_43);
|
||||
}
|
||||
|
||||
return typeof(InternalType_42);
|
||||
}
|
||||
|
||||
private InternalType_33 InternalMethod_201(bool InternalParameter_149)
|
||||
{
|
||||
int InternalVar_1 = InternalParameter_149 ? InternalField_98 - 1 : InternalField_99 + 1;
|
||||
int InternalVar_2 = InternalProperty_48.InternalMethod_254(InternalVar_1);
|
||||
|
||||
if (InternalField_94.InternalMethod_297(InternalField_92, out InternalType_33 InternalVar_3))
|
||||
{
|
||||
int InternalVar_4 = InternalVar_3.InternalProperty_209;
|
||||
int InternalVar_5 = InternalParameter_149 ? 0 : InternalProperty_51 - InternalField_94.InternalMethod_298(InternalField_92) - 1;
|
||||
|
||||
if (InternalParameter_149)
|
||||
{
|
||||
InternalField_96 = Mathf.Max(InternalField_96 - 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalField_95 = Mathf.Max(InternalField_95 - 1, 0);
|
||||
}
|
||||
|
||||
if (InternalVar_4 != InternalVar_5)
|
||||
{
|
||||
InternalMethod_207(InternalVar_3, InternalVar_5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalVar_3 = InternalField_93.InternalMethod_294(InternalField_92);
|
||||
|
||||
InternalVar_3.InternalMethod_287();
|
||||
InternalMethod_206(InternalVar_3, crossAxisItemCount, InternalParameter_157: InternalParameter_149);
|
||||
InternalVar_3.InternalMethod_279();
|
||||
}
|
||||
|
||||
InternalMethod_202(InternalVar_3, InternalField_90, InternalVar_2, UIBlock.InternalMethod_79().Axis, crossAxis);
|
||||
|
||||
return InternalVar_3;
|
||||
}
|
||||
|
||||
private void InternalMethod_202(InternalType_33 InternalParameter_150, MulticastDelegate InternalParameter_151, int InternalParameter_152, Axis InternalParameter_153, Axis InternalParameter_154)
|
||||
{
|
||||
if (InternalField_91 == typeof(GridSlice2D))
|
||||
{
|
||||
GridSlice2D InternalVar_1 = new GridSlice2D(InternalParameter_153, InternalParameter_154);
|
||||
|
||||
if (InternalParameter_151 != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridSliceProviderCallback<GridSlice2D> InternalVar_2 = (GridSliceProviderCallback<GridSlice2D>)InternalParameter_151;
|
||||
|
||||
InternalVar_2.Invoke(InternalParameter_152, this, ref InternalVar_1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_198(InternalParameter_150, InternalVar_1);
|
||||
}
|
||||
else if (InternalField_91 == typeof(GridSlice3D))
|
||||
{
|
||||
GridSlice3D InternalVar_1 = new GridSlice3D(InternalParameter_153, InternalParameter_154);
|
||||
|
||||
if (InternalParameter_151 != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridSliceProviderCallback<GridSlice3D> InternalVar_2 = (GridSliceProviderCallback<GridSlice3D>)InternalParameter_151;
|
||||
InternalVar_2.Invoke(InternalParameter_152, this, ref InternalVar_1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_199(InternalParameter_150, InternalVar_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
GridSlice InternalVar_1 = new GridSlice(InternalParameter_153, InternalParameter_154);
|
||||
|
||||
if (InternalParameter_151 != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridSliceProviderCallback<GridSlice> InternalVar_2 = (GridSliceProviderCallback<GridSlice>)InternalParameter_151;
|
||||
InternalVar_2.Invoke(InternalParameter_152, this, ref InternalVar_1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_197(InternalParameter_150, InternalVar_1);
|
||||
}
|
||||
}
|
||||
|
||||
internal void InternalMethod_411(bool InternalParameter_173 = false)
|
||||
{
|
||||
if (MinLoadedIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalParameter_173)
|
||||
{
|
||||
for (int InternalVar_1 = 0; InternalVar_1 < transform.childCount; ++InternalVar_1)
|
||||
{
|
||||
Transform InternalVar_2 = transform.GetChild(InternalVar_1);
|
||||
|
||||
if (!InternalVar_2.gameObject.activeSelf)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!InternalVar_2.TryGetComponent(out UIBlock InternalVar_3))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
((InternalType_4)InternalVar_3).InternalMethod_119();
|
||||
}
|
||||
}
|
||||
|
||||
while (MinLoadedIndex % crossAxisItemCount != 0)
|
||||
{
|
||||
InternalMethod_228(InternalParameter_174: false);
|
||||
}
|
||||
|
||||
int InternalVar_4 = UIBlock.InternalProperty_84 * crossAxisItemCount;
|
||||
|
||||
int InternalVar_5 = DataSourceItemCount % crossAxisItemCount;
|
||||
|
||||
if (InternalVar_5 != 0 && MaxLoadedIndex == DataSourceItemCount - 1)
|
||||
{
|
||||
InternalVar_4 -= crossAxisItemCount - InternalVar_5;
|
||||
}
|
||||
|
||||
if (InternalVar_4 == UIBlock.ChildCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalVar_4 > UIBlock.ChildCount)
|
||||
{
|
||||
int InternalVar_6 = UIBlock.InternalProperty_84 - Mathf.FloorToInt(UIBlock.ChildCount / (float)crossAxisItemCount);
|
||||
|
||||
for (int InternalVar_7 = 0; InternalVar_7 < InternalVar_6 && InternalProperty_51 > InternalField_96; ++InternalVar_7)
|
||||
{
|
||||
InternalType_33 InternalVar_8 = InternalProperty_50[InternalProperty_51 - (++InternalField_96)] as InternalType_33;
|
||||
|
||||
InternalProperty_54.InternalMethod_58(InternalVar_8);
|
||||
|
||||
InternalField_94.InternalMethod_295(InternalVar_8);
|
||||
}
|
||||
|
||||
InternalVar_6 = UIBlock.ChildCount - ((UIBlock.InternalProperty_84 - InternalVar_6) * crossAxisItemCount);
|
||||
|
||||
for (int InternalVar_7 = 0; InternalVar_7 < InternalVar_6; ++InternalVar_7)
|
||||
{
|
||||
InternalMethod_231();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool InternalVar_6 = UIBlock.ChildCount % crossAxisItemCount != 0;
|
||||
int InternalVar_7 = InternalVar_6 ? crossAxisItemCount - (UIBlock.ChildCount % crossAxisItemCount) : 0;
|
||||
|
||||
for (int InternalVar_8 = 0; InternalVar_8 < InternalVar_7 && InternalField_99 < DataSourceItemCount - 1; ++InternalVar_8)
|
||||
{
|
||||
InternalMethod_229(InternalParameter_175: false);
|
||||
}
|
||||
|
||||
InternalVar_7 = Mathf.CeilToInt(UIBlock.ChildCount / (float)crossAxisItemCount) - UIBlock.InternalProperty_84;
|
||||
|
||||
for (int InternalVar_8 = 0; InternalVar_8 < InternalVar_7; ++InternalVar_8)
|
||||
{
|
||||
InternalType_33 InternalVar_9 = InternalMethod_201(InternalParameter_149: true);
|
||||
|
||||
InternalVar_9.InternalMethod_442();
|
||||
|
||||
InternalProperty_54.InternalMethod_59(InternalVar_9.InternalProperty_83);
|
||||
}
|
||||
}
|
||||
|
||||
InternalProperty_56.InternalMethod_42();
|
||||
|
||||
InternalMethod_412();
|
||||
|
||||
Relayout();
|
||||
}
|
||||
|
||||
#region
|
||||
[SerializeField, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_118 virtualBlockSerializer = null;
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_100 InternalField_97 = InternalType_100.InternalField_312;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_100 InternalProperty_49
|
||||
{
|
||||
get
|
||||
{
|
||||
if (virtualBlockSerializer == null && InternalField_97.InternalProperty_180)
|
||||
{
|
||||
virtualBlockSerializer = ScriptableObject.CreateInstance<InternalType_118>();
|
||||
virtualBlockSerializer.InternalField_384 = InternalField_97;
|
||||
}
|
||||
|
||||
if (virtualBlockSerializer == null)
|
||||
{
|
||||
return InternalType_100.InternalField_312;
|
||||
}
|
||||
|
||||
return virtualBlockSerializer.InternalField_384;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_521<InternalType_34> InternalProperty_50 => InternalProperty_49.InternalProperty_183;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int InternalProperty_51 => InternalProperty_50.InternalProperty_433;
|
||||
|
||||
private void InternalMethod_206(InternalType_34 InternalParameter_155, int InternalParameter_156, bool InternalParameter_157)
|
||||
{
|
||||
if (!InternalProperty_49.InternalProperty_180)
|
||||
{
|
||||
virtualBlockSerializer = ScriptableObject.CreateInstance<InternalType_118>();
|
||||
InternalField_97 = new InternalType_100(UIBlock);
|
||||
virtualBlockSerializer.InternalField_384 = InternalField_97;
|
||||
}
|
||||
|
||||
InternalProperty_49.InternalMethod_536(InternalParameter_155, InternalParameter_156, InternalParameter_157);
|
||||
}
|
||||
|
||||
private void InternalMethod_207(InternalType_34 InternalParameter_158, int InternalParameter_159) => InternalProperty_49.InternalMethod_537(InternalParameter_158, InternalParameter_159);
|
||||
private void InternalMethod_208(InternalType_34 InternalParameter_160) => InternalProperty_49.InternalMethod_538(InternalParameter_160);
|
||||
|
||||
private void InternalMethod_412() => InternalProperty_49.InternalMethod_3740(CrossAxisItemCount);
|
||||
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize() { }
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
{
|
||||
InternalMethod_2409();
|
||||
|
||||
if (!NovaApplication.IsPlaying ||
|
||||
virtualBlockSerializer == null ||
|
||||
virtualBlockSerializer.InternalField_384 == InternalField_97 ||
|
||||
!virtualBlockSerializer.InternalField_384.InternalProperty_180 ||
|
||||
(InternalProperty_53 != null && virtualBlockSerializer.InternalField_384.InternalProperty_181.InternalProperty_29 == InternalProperty_53.InternalProperty_29))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_97 = InternalType_100.InternalMethod_541(virtualBlockSerializer.InternalField_384.InternalProperty_181.InternalProperty_29, InternalProperty_53);
|
||||
virtualBlockSerializer = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d98ac131f13464046ac83b0987d248af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ae3835e34a1b75848b8ef441b6b65647, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,821 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
|
||||
using Nova.InternalNamespace_16;
|
||||
using Nova.InternalNamespace_25;
|
||||
using Nova.InternalNamespace_0;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Navigator = Nova.InternalNamespace_0.InternalType_757<Nova.UIBlock>;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines on which event a "click" should be triggered.
|
||||
/// </summary>
|
||||
public enum ClickBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// On release, correlated with a pointer up event.
|
||||
/// </summary>
|
||||
OnRelease,
|
||||
/// <summary>
|
||||
/// On press, correlated with a pointer down event.
|
||||
/// </summary>
|
||||
OnPress,
|
||||
/// <summary>
|
||||
/// Don't trigger "click" events.
|
||||
/// </summary>
|
||||
None,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The animation applied to content once it's scrolled past the edges of its viewport.
|
||||
/// </summary>
|
||||
public enum OverscrollEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// An iOS-like bounce effect.
|
||||
/// </summary>
|
||||
Bounce,
|
||||
/// <summary>
|
||||
/// A stay-in-bounds effect.
|
||||
/// </summary>
|
||||
Clamp
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The coordinate space to use when tracking gesture positions across frames.
|
||||
/// </summary>
|
||||
public enum GestureSpace
|
||||
{
|
||||
/// <summary>
|
||||
/// The object's UIBlock root's local space.
|
||||
/// </summary>
|
||||
Root,
|
||||
|
||||
/// <summary>
|
||||
/// World space.
|
||||
/// </summary>
|
||||
World
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An abstract base class for gesture/interaction receiver components
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent, RequireComponent(typeof(UIBlock))]
|
||||
public abstract class GestureRecognizer : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// When <c>ObstructDrags == <see langword="true"/></c>, drag gestures will not be routed to content behind the attached <see cref="UIBlock"/>.<br/>
|
||||
/// When false, content behind the attached <see cref="UIBlock"/> can receive drag gestures if it is <i>draggable</i> in a direction this component is not.
|
||||
/// </summary>
|
||||
/// <remarks>Does not impact the <i>draggable</i> state of this component.</remarks>
|
||||
[SerializeField]
|
||||
public bool ObstructDrags = false;
|
||||
|
||||
/// <summary>
|
||||
/// The threshold that must be surpassed to initiate a drag event.
|
||||
/// </summary>
|
||||
/// <remarks>This threshold is generally used for high precision input devices, E.g. mouse, touchscreen, XR controller, and most other <b>ray</b> based input.</remarks>
|
||||
/// <see cref="InputAccuracy"/>
|
||||
/// <see cref="LowAccuracyDragThreshold"/>
|
||||
[SerializeField]
|
||||
public float DragThreshold = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The threshold that must be surpassed to initiate a drag event with a less physically stable input device.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This "Low Accuracy" threshold is generally used for lower accuracy input devices, E.g. XR hand tracking and other <b>sphere collider</b> based input.<br/><br/>
|
||||
/// To get the most reliable behavior between potentially conflicting press, drag,
|
||||
/// and scroll gestures while using the <see cref="Interaction.Point(Sphere, uint, object, int, InputAccuracy)"/> path,
|
||||
/// the entry point of the overlapping target <see cref="UIBlock"/>s
|
||||
/// <b>must</b> all be coplanar. If the entry points aren't coplanar, say a scrollable <see cref="ListView"/>'s
|
||||
/// front face is positioned behind a draggable list item's front face, attempts to scroll the <see cref="ListView"/>
|
||||
/// will likely fail, and the list item will be dragged instead.
|
||||
/// </remarks>
|
||||
/// <see cref="InputAccuracy"/>
|
||||
/// <see cref="DragThreshold"/>
|
||||
[SerializeField]
|
||||
public float LowAccuracyDragThreshold = 30;
|
||||
|
||||
/// <summary>
|
||||
/// Determines when this component should trigger click events.
|
||||
/// </summary>
|
||||
/// <seealso cref="Gesture.OnClick"/>
|
||||
[SerializeField]
|
||||
public ClickBehavior ClickBehavior = ClickBehavior.OnRelease;
|
||||
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool navigable = true;
|
||||
|
||||
/// <summary>
|
||||
/// Is this component navigable?
|
||||
/// </summary>
|
||||
public bool Navigable
|
||||
{
|
||||
get => navigable;
|
||||
set
|
||||
{
|
||||
if (navigable == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool InternalVar_1 = InternalProperty_164;
|
||||
|
||||
navigable = value;
|
||||
|
||||
bool InternalVar_2 = InternalProperty_164;
|
||||
|
||||
if (InternalVar_1 == InternalVar_2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalVar_1 && !InternalVar_2)
|
||||
{
|
||||
Navigator.InternalMethod_3565(UIBlock);
|
||||
}
|
||||
else if (!InternalVar_1 && InternalVar_2)
|
||||
{
|
||||
Navigator.InternalMethod_3564(UIBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected SelectBehavior onSelect = SelectBehavior.Click;
|
||||
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected bool autoSelect = false;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this component should automatically be selected whenever it's navigated to.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <see cref="OnSelect"/> is set to <see cref="SelectBehavior.ScopeNavigation"/>,
|
||||
/// setting this to <c>true</c> will effectively allow navigation moves to pass through
|
||||
/// the attached <see cref="UIBlock"/> onto the navigable descendant closest to the navigation
|
||||
/// source.
|
||||
/// </remarks>
|
||||
public bool AutoSelect
|
||||
{
|
||||
get => autoSelect;
|
||||
set
|
||||
{
|
||||
if (autoSelect == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
autoSelect = value;
|
||||
|
||||
if (InternalProperty_164 && OnSelect != SelectBehavior.Click)
|
||||
{
|
||||
Navigator.InternalMethod_3563(UIBlock, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines how this component should handle select events.
|
||||
/// </summary>
|
||||
/// <seealso cref="Navigate.OnSelect"/>
|
||||
public SelectBehavior OnSelect
|
||||
{
|
||||
get => onSelect;
|
||||
set
|
||||
{
|
||||
if (onSelect == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool InternalVar_1 = onSelect != SelectBehavior.Click;
|
||||
bool InternalVar_2 = value != SelectBehavior.Click;
|
||||
|
||||
onSelect = value;
|
||||
|
||||
if (!InternalProperty_164 || InternalVar_1 == InternalVar_2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalVar_1 && !InternalVar_2)
|
||||
{
|
||||
Navigator.InternalMethod_3566(UIBlock);
|
||||
}
|
||||
else if (!InternalVar_1 && InternalVar_2)
|
||||
{
|
||||
Navigator.InternalMethod_3563(UIBlock, AutoSelect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a <see cref="NavLink"/> per axis-aligned direction.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavNode Navigation = NavNode.TwoD;
|
||||
|
||||
/// <summary>
|
||||
/// The attached <see cref="Nova.UIBlock"/> receiving the interaction events, <see cref="IEvent.Receiver"/>
|
||||
/// </summary>
|
||||
public UIBlock UIBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_2995 == null)
|
||||
{
|
||||
InternalField_2995 = GetComponent<UIBlock>();
|
||||
}
|
||||
|
||||
return InternalField_2995;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevent users from inherting
|
||||
/// </summary>
|
||||
internal GestureRecognizer() { }
|
||||
|
||||
#region
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_14.InternalType_12 InternalField_2415 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected InternalType_14.InternalType_12 InternalProperty_766
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_2415 == null)
|
||||
{
|
||||
InternalField_2415 = InternalMethod_158;
|
||||
}
|
||||
|
||||
return InternalField_2415;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_14.InternalType_25 InternalField_2439 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected InternalType_14.InternalType_25 InternalProperty_770
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_2439 == null)
|
||||
{
|
||||
InternalField_2439 = InternalMethod_156;
|
||||
}
|
||||
|
||||
return InternalField_2439;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
[System.NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlock InternalField_2995 = null;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected bool InternalProperty_911 => UIBlock.InternalProperty_25 && isActiveAndEnabled;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected virtual bool InternalProperty_937 => false;
|
||||
|
||||
private protected struct InternalType_492
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public bool InternalField_2810;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public bool InternalField_2811;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public bool InternalField_2809;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public Vector3 InternalField_2933;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"State(H: {InternalField_2810}, P: {InternalField_2811}, D: {InternalField_2809})";
|
||||
}
|
||||
}
|
||||
|
||||
[System.NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Dictionary<uint, InternalType_492> InternalField_2817 = new Dictionary<uint, InternalType_492>();
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected Dictionary<uint, InternalType_492> InternalProperty_921 => InternalField_2817;
|
||||
|
||||
[System.NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private List<uint> InternalField_2816 = new List<uint>();
|
||||
|
||||
[System.NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int InternalField_2818 = int.MaxValue;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (Navigable)
|
||||
{
|
||||
Navigator.InternalMethod_3564(UIBlock);
|
||||
|
||||
if (OnSelect != SelectBehavior.Click)
|
||||
{
|
||||
Navigator.InternalMethod_3563(UIBlock, AutoSelect);
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_2750();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
while (InternalField_2816.Count > 0)
|
||||
{
|
||||
uint InternalVar_1 = InternalField_2816[InternalField_2816.Count - 1];
|
||||
|
||||
if (!UIBlock.InternalProperty_23.InternalMethod_465(InternalVar_1, out InternalNamespace_0.InternalType_78 InternalVar_2))
|
||||
{
|
||||
InternalVar_2 = new InternalNamespace_0.InternalType_78(InternalVar_1);
|
||||
}
|
||||
|
||||
InternalType_14.InternalType_13 InternalVar_3 = InternalType_14.InternalMethod_191(UIBlock, InternalVar_2);
|
||||
InternalMethod_156(ref InternalVar_3);
|
||||
}
|
||||
|
||||
InternalMethod_2664();
|
||||
|
||||
Navigator.InternalMethod_3565(UIBlock);
|
||||
|
||||
if (OnSelect != SelectBehavior.Click)
|
||||
{
|
||||
Navigator.InternalMethod_3566(UIBlock);
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalMethod_158(ref InternalType_14.InternalType_16<bool> InternalParameter_100)
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_76<bool>? InternalVar_1 = InternalParameter_100.InternalField_67;
|
||||
InternalType_76<bool> InternalVar_2 = InternalVar_1.GetValueOrDefault();
|
||||
|
||||
uint InternalVar_3 = InternalParameter_100.InternalField_3029.InternalField_257;
|
||||
|
||||
bool InternalVar_5 = InternalField_2817.TryGetValue(InternalVar_3, out InternalType_492 InternalVar_4);
|
||||
|
||||
bool InternalVar_6 = InternalVar_1.HasValue;
|
||||
bool InternalVar_7 = InternalVar_2.InternalField_247;
|
||||
|
||||
Matrix4x4 InternalVar_8 = Matrix4x4.identity;
|
||||
Vector3 InternalVar_9 = InternalVar_2.InternalField_248;
|
||||
|
||||
if (InternalProperty_1212 == GestureSpace.Root)
|
||||
{
|
||||
Transform InternalVar_10 = UIBlock.Root.transform;
|
||||
|
||||
InternalVar_8 = InternalVar_10.localToWorldMatrix;
|
||||
Matrix4x4 InternalVar_11 = Unity.Mathematics.math.inverse(InternalVar_8);
|
||||
InternalVar_9 = InternalVar_11.MultiplyPoint(InternalVar_2.InternalField_248);
|
||||
}
|
||||
|
||||
if (InternalVar_2.InternalField_246)
|
||||
{
|
||||
InternalMethod_1884(InternalVar_2.InternalField_248, ref InternalVar_4, ref InternalParameter_100.InternalField_3029);
|
||||
}
|
||||
|
||||
bool InternalVar_12 = InternalVar_4.InternalField_2933 != InternalVar_9;
|
||||
|
||||
if (InternalVar_6 && InternalVar_12 && InternalVar_4.InternalField_2810 && (InternalVar_2.InternalField_246 || InternalVar_7))
|
||||
{
|
||||
InternalMethod_2737(InternalVar_2.InternalField_248, ref InternalParameter_100.InternalField_3029);
|
||||
}
|
||||
|
||||
if (InternalVar_4.InternalField_2810 && InternalVar_7)
|
||||
{
|
||||
InternalMethod_2656(InternalVar_2.InternalField_248, ref InternalVar_4, ref InternalParameter_100.InternalField_3029);
|
||||
}
|
||||
|
||||
InternalMethod_339(ref InternalParameter_100, ref InternalVar_4, ref InternalVar_9, ref InternalVar_8);
|
||||
|
||||
if (InternalVar_4.InternalField_2811 && !InternalVar_7)
|
||||
{
|
||||
InternalMethod_2621(ref InternalVar_4, InternalVar_2.InternalField_246, InternalVar_6, ref InternalParameter_100.InternalField_3029);
|
||||
}
|
||||
|
||||
if (InternalVar_4.InternalField_2810 && !InternalVar_2.InternalField_246 && !InternalVar_7)
|
||||
{
|
||||
InternalMethod_470(ref InternalVar_4, ref InternalParameter_100.InternalField_3029);
|
||||
}
|
||||
|
||||
if (InternalVar_6 && InternalField_2816.Contains(InternalVar_3) == InternalVar_5)
|
||||
{
|
||||
if (!InternalVar_5)
|
||||
{
|
||||
InternalField_2816.Add(InternalVar_3);
|
||||
}
|
||||
|
||||
InternalVar_4.InternalField_2933 = InternalVar_9;
|
||||
|
||||
InternalField_2817[InternalVar_3] = InternalVar_4;
|
||||
}
|
||||
else if (InternalVar_5)
|
||||
{
|
||||
InternalField_2817.Remove(InternalVar_3);
|
||||
InternalField_2816.Remove(InternalVar_3);
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalMethod_156(ref InternalType_14.InternalType_13 InternalParameter_99)
|
||||
{
|
||||
if (!InternalField_2817.TryGetValue(InternalParameter_99.InternalField_69.InternalField_257, out InternalType_492 InternalVar_1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_2817.Remove(InternalParameter_99.InternalField_69.InternalField_257);
|
||||
InternalField_2816.Remove(InternalParameter_99.InternalField_69.InternalField_257);
|
||||
|
||||
if (InternalVar_1.InternalField_2810 || InternalVar_1.InternalField_2811 || InternalVar_1.InternalField_2809 || InternalProperty_937)
|
||||
{
|
||||
InternalMethod_2662(ref InternalParameter_99.InternalField_69);
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3197(InternalParameter_99.InternalField_69.InternalMethod_2179(), UIBlock));
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalMethod_1884(Vector3 InternalParameter_2146, ref InternalType_492 InternalParameter_29, ref InternalNamespace_0.InternalType_78 InternalParameter_28)
|
||||
{
|
||||
if (InternalParameter_29.InternalField_2810)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalParameter_29.InternalField_2810 = true;
|
||||
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3266(InternalParameter_28.InternalMethod_2179(), UIBlock, InternalParameter_2146));
|
||||
}
|
||||
|
||||
private void InternalMethod_470(ref InternalType_492 InternalParameter_27, ref InternalNamespace_0.InternalType_78 InternalParameter_26)
|
||||
{
|
||||
if (!InternalParameter_27.InternalField_2810)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3265(InternalParameter_26.InternalMethod_2179(), UIBlock));
|
||||
InternalParameter_27.InternalField_2810 = false;
|
||||
}
|
||||
|
||||
private void InternalMethod_2656(Vector3 InternalParameter_25, ref InternalType_492 InternalParameter_24, ref InternalNamespace_0.InternalType_78 InternalParameter_23)
|
||||
{
|
||||
if (InternalParameter_24.InternalField_2811)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_2818 = Time.frameCount;
|
||||
|
||||
InternalParameter_24.InternalField_2811 = true;
|
||||
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3264(InternalParameter_23.InternalMethod_2179(), UIBlock, InternalParameter_25));
|
||||
|
||||
if (!InternalParameter_24.InternalField_2809 && ClickBehavior == ClickBehavior.OnPress)
|
||||
{
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3226(InternalParameter_23.InternalMethod_2179(), UIBlock));
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalMethod_2621(ref InternalType_492 InternalParameter_22, bool InternalParameter_909, bool InternalParameter_908, ref InternalNamespace_0.InternalType_78 InternalParameter_907)
|
||||
{
|
||||
if (!InternalParameter_22.InternalField_2811)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Gesture.OnRelease InternalVar_1 = Gesture.InternalMethod_3227(InternalParameter_907.InternalMethod_2179(), UIBlock, InternalParameter_909, InternalParameter_22.InternalField_2809);
|
||||
|
||||
UIBlock.InternalMethod_91(InternalVar_1);
|
||||
|
||||
if (!InternalParameter_909)
|
||||
{
|
||||
InternalMethod_470(ref InternalParameter_22, ref InternalParameter_907);
|
||||
}
|
||||
|
||||
bool InternalVar_2 = Time.frameCount - InternalField_2818 >= InternalNamespace_0.InternalType_24.InternalProperty_945.InternalField_2768;
|
||||
|
||||
InternalField_2818 = int.MaxValue;
|
||||
|
||||
InternalParameter_22.InternalField_2811 = false;
|
||||
|
||||
if (InternalParameter_908 && InternalParameter_909 && !InternalParameter_22.InternalField_2809 && ClickBehavior == ClickBehavior.OnRelease)
|
||||
{
|
||||
if (InternalVar_2)
|
||||
{
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3226(InternalParameter_907.InternalMethod_2179(), UIBlock));
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalType_14.InternalType_13 InternalVar_3 = InternalType_14.InternalMethod_191(UIBlock, InternalParameter_907);
|
||||
InternalMethod_156(ref InternalVar_3);
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_2661(ref InternalParameter_22, ref InternalVar_1);
|
||||
InternalParameter_22.InternalField_2809 = false;
|
||||
}
|
||||
|
||||
private protected virtual void InternalMethod_2661(ref InternalType_492 InternalParameter_906, ref Gesture.OnRelease InternalParameter_951) { }
|
||||
private protected virtual void InternalMethod_2662(ref InternalNamespace_0.InternalType_78 InternalParameter_1327) { }
|
||||
|
||||
private void InternalMethod_2737(Vector3 InternalParameter_1326, ref InternalNamespace_0.InternalType_78 InternalParameter_1289)
|
||||
{
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_3267(InternalParameter_1289.InternalMethod_2179(), UIBlock, InternalParameter_1326));
|
||||
}
|
||||
|
||||
private protected abstract void InternalMethod_339(ref InternalType_14.InternalType_16<bool> InternalParameter_330, ref InternalType_492 InternalParameter_714, ref Vector3 InternalParameter_713, ref Matrix4x4 InternalParameter_712);
|
||||
|
||||
private protected abstract void InternalMethod_2750();
|
||||
private protected abstract void InternalMethod_2664();
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal bool InternalProperty_164 => InternalProperty_911 && Navigable;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected virtual GestureSpace InternalProperty_1212 => GestureSpace.Root;
|
||||
}
|
||||
|
||||
internal interface InternalType_493 : InternalType_523, InternalType_273, InternalType_75, InternalType_754 { }
|
||||
|
||||
/// <summary>
|
||||
/// Triggers pointer-based gesture events (e.g. hover, click, drag, etc.) on the attached <see cref="UIBlock"/>
|
||||
/// </summary>
|
||||
/// <seealso cref="Gesture.OnClick"/>
|
||||
/// <seealso cref="Gesture.OnPress"/>
|
||||
/// <seealso cref="Gesture.OnRelease"/>
|
||||
/// <seealso cref="Gesture.OnHover"/>
|
||||
/// <seealso cref="Gesture.OnUnhover"/>
|
||||
/// <seealso cref="Gesture.OnMove"/>
|
||||
/// <seealso cref="Gesture.OnDrag"/>
|
||||
/// <seealso cref="Gesture.OnCancel"/>
|
||||
|
||||
[AddComponentMenu("Nova/Interactable")]
|
||||
[HelpURL("https://novaui.io/manual/InputOverview.html#interactable--scroller")]
|
||||
public sealed class Interactable : GestureRecognizer, InternalType_493
|
||||
{
|
||||
[SerializeField, InternalType_22]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private ThreeD<bool> draggable = false;
|
||||
|
||||
/// <summary>
|
||||
/// Acts as a bit-mask indicating which axes can trigger drag events once a "drag threshold" is surpassed.
|
||||
/// </summary>
|
||||
/// <remarks>if <c><see cref="Draggable"/>[axis]</c> is <c><see langword="false"/></c>, the "drag threshold" along that <c>axis</c> is infinite and will never trigger a drag event.</remarks>
|
||||
/// <seealso cref="GestureRecognizer.DragThreshold"/>
|
||||
/// <seealso cref="GestureRecognizer.LowAccuracyDragThreshold"/>
|
||||
/// <seealso cref="Gesture.OnDrag"/>
|
||||
public ThreeD<bool> Draggable
|
||||
{
|
||||
get
|
||||
{
|
||||
return draggable;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (draggable.Equals(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
if (draggable.InternalMethod_3291(true) && value.InternalMethod_3292(false))
|
||||
{
|
||||
UIBlock.InternalProperty_23.InternalMethod_3549();
|
||||
}
|
||||
|
||||
if (draggable.InternalMethod_3292(false) && value.InternalMethod_3291(true))
|
||||
{
|
||||
UIBlock.InternalProperty_23.InternalMethod_3548(this);
|
||||
}
|
||||
}
|
||||
|
||||
draggable = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The coordinate space to use when tracking gesture positions across frames.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For scenarios where the local position, local rotation, or local scale of
|
||||
/// the <see cref="UIBlock"/>.<see cref="UIBlock.Root">Root</see> may change
|
||||
/// while a gesture is active, this should be set to <see cref="GestureSpace.World"/>.
|
||||
/// For most other cases, <see cref="GestureSpace.Root"/> is recommended.
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
public GestureSpace GestureSpace = GestureSpace.Root;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected override GestureSpace InternalProperty_1212 => GestureSpace;
|
||||
|
||||
[System.NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Dictionary<uint, InternalType_788> InternalField_3781 = new Dictionary<uint, InternalType_788>();
|
||||
|
||||
private protected override void InternalMethod_2750()
|
||||
{
|
||||
UIBlock.InternalMethod_89(this);
|
||||
|
||||
if (Draggable.InternalMethod_3291(true))
|
||||
{
|
||||
UIBlock.InternalProperty_23.InternalMethod_3548(this);
|
||||
}
|
||||
|
||||
UIBlock.InternalProperty_23.InternalMethod_3551(this);
|
||||
UIBlock.InternalProperty_23.InternalEvent_2 += InternalProperty_766;
|
||||
UIBlock.InternalProperty_23.InternalEvent_4 += InternalProperty_770;
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_2664()
|
||||
{
|
||||
UIBlock.InternalMethod_90(this);
|
||||
|
||||
if (Draggable.InternalMethod_3291(true))
|
||||
{
|
||||
UIBlock.InternalProperty_23.InternalMethod_3549();
|
||||
}
|
||||
|
||||
UIBlock.InternalProperty_23.InternalMethod_3552();
|
||||
UIBlock.InternalProperty_23.InternalEvent_2 -= InternalProperty_766;
|
||||
UIBlock.InternalProperty_23.InternalEvent_4 -= InternalProperty_770;
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_339(ref InternalType_14.InternalType_16<bool> InternalParameter_330, ref InternalType_492 InternalParameter_714, ref Vector3 currentPosRootSpace, ref Matrix4x4 InternalParameter_712)
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_76<bool>? InternalVar_1 = InternalParameter_330.InternalField_67;
|
||||
InternalType_76<bool> InternalVar_2 = InternalVar_1.GetValueOrDefault();
|
||||
InternalType_76<bool>? InternalVar_3 = InternalParameter_330.InternalField_70;
|
||||
InternalType_76<bool> InternalVar_4 = InternalVar_3.GetValueOrDefault();
|
||||
|
||||
bool InternalVar_5 = InternalVar_1.HasValue;
|
||||
bool InternalVar_6 = InternalParameter_714.InternalField_2933 != currentPosRootSpace;
|
||||
|
||||
if (InternalVar_5 && InternalVar_6 && InternalParameter_714.InternalField_2811 && InternalVar_2.InternalProperty_166)
|
||||
{
|
||||
Vector3 InternalVar_7 = InternalVar_3.HasValue ? InternalVar_4.InternalField_248 : InternalVar_2.InternalField_248;
|
||||
Vector3 InternalVar_8 = InternalVar_3.HasValue ? InternalParameter_714.InternalField_2933 : currentPosRootSpace;
|
||||
InternalMethod_3198(ref InternalParameter_714, ref InternalVar_7, ref InternalVar_2.InternalField_248, ref InternalVar_8, ref currentPosRootSpace, ref InternalParameter_712, ref InternalParameter_330.InternalField_3029);
|
||||
}
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_2661(ref InternalType_492 InternalParameter_906, ref Gesture.OnRelease InternalParameter_951)
|
||||
{
|
||||
InternalField_3781.Remove(InternalParameter_951.Interaction.ControlID);
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_2662(ref InternalNamespace_0.InternalType_78 interaction)
|
||||
{
|
||||
InternalField_3781.Remove(interaction.InternalField_257);
|
||||
}
|
||||
|
||||
private void InternalMethod_3198(ref InternalType_492 InternalParameter_3033, ref Vector3 InternalParameter_3639, ref Vector3 InternalParameter_3640, ref Vector3 InternalParameter_3641, ref Vector3 InternalParameter_3642, ref Matrix4x4 InternalParameter_3643, ref InternalNamespace_0.InternalType_78 InternalParameter_3644)
|
||||
{
|
||||
if (!InternalParameter_3033.InternalField_2809)
|
||||
{
|
||||
InternalField_3781.Add(InternalParameter_3644.InternalField_257, new InternalType_788()
|
||||
{
|
||||
InternalField_3782 = InternalParameter_3639,
|
||||
InternalField_3783 = InternalParameter_3641,
|
||||
});
|
||||
|
||||
InternalParameter_3033.InternalField_2809 = true;
|
||||
}
|
||||
|
||||
InternalType_788 InternalVar_1 = InternalField_3781[InternalParameter_3644.InternalField_257];
|
||||
|
||||
Gesture.Positions InternalVar_2 = new Gesture.Positions()
|
||||
{
|
||||
Start = InternalVar_1.InternalField_3782,
|
||||
Previous = InternalParameter_3639,
|
||||
Current = InternalParameter_3640
|
||||
};
|
||||
|
||||
Gesture.Positions InternalVar_3 = InternalVar_2;
|
||||
|
||||
if (InternalProperty_1212 == GestureSpace.Root)
|
||||
{
|
||||
InternalVar_3 = new Gesture.Positions()
|
||||
{
|
||||
Start = InternalParameter_3643.MultiplyPoint(InternalVar_1.InternalField_3783),
|
||||
Previous = InternalParameter_3643.MultiplyPoint(InternalParameter_3641),
|
||||
Current = InternalParameter_3640
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
UIBlock.InternalMethod_91(Gesture.InternalMethod_155(InternalParameter_3644.InternalMethod_2179(), UIBlock, ref InternalVar_2, ref InternalVar_3, Draggable));
|
||||
}
|
||||
|
||||
InternalType_77 InternalType_75.InternalMethod_3340<T>(Ray InternalParameter_329, InternalType_76<T> InternalParameter_328, InternalType_76<T> InternalParameter_2232, Transform InternalParameter_2233)
|
||||
{
|
||||
InternalType_77 InternalVar_1 = InternalType_77.InternalField_251;
|
||||
|
||||
if (typeof(T) != typeof(bool))
|
||||
{
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
Vector3 InternalVar_2 = InternalType_728.InternalMethod_3283(Draggable);
|
||||
|
||||
if (InternalVar_2 != Vector3.zero)
|
||||
{
|
||||
Vector3 InternalVar_3 = UIBlock.transform.TransformDirection(InternalVar_2.normalized);
|
||||
Vector3 InternalVar_4 = InternalParameter_329.direction;
|
||||
Vector3 InternalVar_5 = InternalParameter_329.origin;
|
||||
Vector3 InternalVar_6 = Vector3.Cross(InternalVar_4, InternalVar_3);
|
||||
|
||||
if (InternalVar_6 == Vector3.zero)
|
||||
{
|
||||
InternalVar_2 = !Draggable.X ? Vector3.right : !Draggable.Y ? Vector3.up : Vector3.forward;
|
||||
InternalVar_4 = UIBlock.transform.TransformDirection(InternalVar_2);
|
||||
InternalVar_5 = InternalParameter_328.InternalField_248;
|
||||
InternalVar_6 = Vector3.Cross(InternalVar_4, InternalVar_3);
|
||||
}
|
||||
|
||||
Vector3 InternalVar_7 = InternalType_187.InternalMethod_3642(InternalParameter_2232.InternalField_248 - InternalVar_5);
|
||||
float InternalVar_8 = InternalType_187.InternalMethod_907(InternalVar_4, InternalVar_7, InternalVar_6);
|
||||
InternalVar_8 = Mathf.Min(InternalVar_8, 180 - InternalVar_8);
|
||||
|
||||
InternalVar_1 = InternalVar_8 >= InternalMethod_2350(ref InternalParameter_2232) ? InternalType_77.InternalField_255 : InternalType_77.InternalField_252;
|
||||
}
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_754.InternalProperty_1153 => InternalProperty_164;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_754.InternalProperty_1154 => OnSelect == SelectBehavior.FireEvents;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_754.InternalProperty_1155 => OnSelect == SelectBehavior.ScopeNavigation;
|
||||
bool InternalType_754.InternalMethod_3559(Vector3 InternalParameter_3234) => true;
|
||||
bool InternalType_754.InternalMethod_3561(Vector3 InternalParameter_3238, out InternalType_5 InternalParameter_3239)
|
||||
{
|
||||
InternalParameter_3239 = null;
|
||||
|
||||
if (!InternalProperty_164)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Navigation.InternalMethod_2715(InternalParameter_3238, out InternalParameter_3239);
|
||||
}
|
||||
|
||||
bool InternalType_754.InternalMethod_3576(InternalType_5 InternalParameter_3264, InternalType_5 InternalParameter_3263, Vector3 InternalParameter_3262) => false;
|
||||
void InternalType_754.InternalMethod_3585(InternalType_5 InternalParameter_3313) { }
|
||||
|
||||
private float InternalMethod_2350<T>(ref InternalType_76<T> InternalParameter_2157) where T : unmanaged, System.IEquatable<T> => InternalParameter_2157.InternalField_250 ? LowAccuracyDragThreshold : DragThreshold;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_75.InternalProperty_741 => ObstructDrags;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
System.Type InternalType_523.InternalProperty_439 => typeof(UIBlock);
|
||||
|
||||
bool InternalType_523.InternalMethod_1635(InternalType_273 receiver, System.Type _, out InternalType_273 target)
|
||||
{
|
||||
target = UIBlock;
|
||||
return true;
|
||||
}
|
||||
|
||||
private struct InternalType_788
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public Vector3 InternalField_3782;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public Vector3 InternalField_3783;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd0e5f112b0a05b43b4ba50233a47743
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 4b05705d8fe2aa849a0f5de698c5bbd2, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,195 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_16;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// An abstract base class to be inherited by all user-defined, data-bindable <see cref="ItemView"/>.<see cref="ItemView.Visuals">Visuals</see> types.
|
||||
/// </summary>
|
||||
/// <remarks>All classes which inherit from <see cref="ItemVisuals"/> can be targeted by the UIBlock event system.</remarks>
|
||||
/// <seealso cref="ItemView"/>
|
||||
/// <seealso cref="ListView"/>
|
||||
/// <seealso cref="GridView"/>
|
||||
/// <seealso cref="UIBlockExtensions.AddGestureHandler{TInteractionEvent, TTarget}(UIBlock, UIEventHandler{TInteractionEvent, TTarget}))"/>
|
||||
/// <seealso cref="UIBlockExtensions.RemoveGestureHandler{TInteractionEvent, TTarget}(UIBlock, UIEventHandler{TInteractionEvent, TTarget})"/>
|
||||
/// <seealso cref="ListView.AddDataBinder{TData, TVisuals}(UIEventHandler{Data.OnBind{TData}, TVisuals, int})"/>
|
||||
/// <seealso cref="ListView.RemoveDataBinder{TData, TVisuals}(UIEventHandler{Data.OnBind{TData}, TVisuals, int})"/>
|
||||
/// <seealso cref="ListView.AddGestureHandler{TEvent, TVisuals}(UIEventHandler{TEvent, TVisuals, int})"/>
|
||||
/// <seealso cref="ListView.RemoveGestureHandler{TEvent, TVisuals}(UIEventHandler{TEvent, TVisuals, int})"/>
|
||||
[Serializable]
|
||||
public abstract class ItemVisuals : InternalType_273
|
||||
{
|
||||
/// <summary>
|
||||
/// The containing <see cref="ItemView"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, HideInInspector]
|
||||
public ItemView View = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A callback to provide a list item prefab to the requesting <see cref="ListView"/> or <see cref="GridView"/> which will represent the object in the data source at the given index.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The index type of the underlying data source</typeparam>
|
||||
/// <param name="index">The index into the underlying data source of the object the provided prefab will represent</param>
|
||||
/// <param name="sourcePrefab">The source prefab (<i>not</i> an instance) for the <see cref="ListView"/> to clone or pull from the list item prefab pool</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if the caller wishes to use an instance of the provided source prefab<br/>
|
||||
/// <see langword="false"/> if the caller wishes to have the <see cref="ListView"/> attempt to use a fallback prefab option
|
||||
/// </returns>
|
||||
public delegate bool PrefabProviderCallback<T>(T index, out ItemView sourcePrefab);
|
||||
|
||||
/// <summary>
|
||||
/// A UI Component which supports dynamic serialization of user-defined sets of visual fields (e.g. <see cref="Nova.UIBlock"/>s, any other <see cref="MonoBehaviour"/>s, etc.).
|
||||
/// The <see cref="ItemView"/> acts as a "middle man" when binding user-provided data types to a <see cref="ListView"/> or <see cref="GridView"/>
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(UIBlock)), DisallowMultipleComponent]
|
||||
[HelpURL("https://novaui.io/manual/ItemView.html")]
|
||||
[AddComponentMenu("Nova/Item View")]
|
||||
public sealed class ItemView : MonoBehaviour, InternalType_523, InternalType_4
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// The set of visual fields configured in the Editor.
|
||||
/// </summary>
|
||||
public ItemVisuals Visuals
|
||||
{
|
||||
get
|
||||
{
|
||||
if (visuals != null)
|
||||
{
|
||||
visuals.View = this;
|
||||
}
|
||||
|
||||
return visuals;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Nova.UIBlock"/> attached to <c>this.gameObject</c>.
|
||||
/// </summary>
|
||||
public UIBlock UIBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_73 == null)
|
||||
{
|
||||
TryGetComponent(out InternalField_73);
|
||||
}
|
||||
|
||||
return InternalField_73;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve <see cref="Visuals"/> as type <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type to cast, must inherit from <see cref="ItemVisuals"/>.</typeparam>
|
||||
/// <param name="visuals"><see cref="Visuals"/> casted to type <typeparamref name="T"/>, if it can be casted.</param>
|
||||
/// <returns><see langword="false"/> if <see cref="Visuals"/> is not of type <typeparamref name="T"/>.</returns>
|
||||
public bool TryGetVisuals<T>(out T visuals) where T : ItemVisuals
|
||||
{
|
||||
visuals = Visuals as T;
|
||||
return visuals != null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[SerializeReference, SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private ItemVisuals visuals = default;
|
||||
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlockActivator InternalField_71 = null;
|
||||
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_72 = false;
|
||||
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlock InternalField_73 = null;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Type InternalProperty_948 => InternalProperty_947 ? Visuals.GetType() : null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal bool InternalProperty_947 => Visuals != null;
|
||||
|
||||
internal void InternalMethod_163<TData>(TData InternalParameter_105)
|
||||
{
|
||||
if (!InternalProperty_947)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UIBlock.InternalMethod_91(Data.InternalMethod_159(this, InternalParameter_105), InternalProperty_948);
|
||||
}
|
||||
|
||||
internal void InternalMethod_164<TData>(TData InternalParameter_106)
|
||||
{
|
||||
if (!InternalProperty_947)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UIBlock.InternalMethod_91(Data.InternalMethod_160(this, InternalParameter_106), InternalProperty_948);
|
||||
}
|
||||
|
||||
bool InternalType_523.InternalMethod_1635(InternalType_273 receiver, Type _, out InternalType_273 target)
|
||||
{
|
||||
target = Visuals;
|
||||
return true;
|
||||
}
|
||||
|
||||
void InternalType_4.InternalMethod_119()
|
||||
{
|
||||
InternalMethod_165();
|
||||
}
|
||||
|
||||
void InternalType_4.InternalMethod_120() { }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InternalMethod_165();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (InternalField_71 != null)
|
||||
{
|
||||
InternalField_71.InternalMethod_304(this);
|
||||
}
|
||||
|
||||
UIBlock.InternalMethod_90(this);
|
||||
}
|
||||
|
||||
private void InternalMethod_165()
|
||||
{
|
||||
if (!NovaApplication.InPlayer(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalField_72)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryGetComponent(out InternalField_71))
|
||||
{
|
||||
InternalField_71.InternalMethod_303(this);
|
||||
}
|
||||
|
||||
UIBlock.InternalMethod_89(this);
|
||||
InternalField_72 = true;
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Type InternalType_523.InternalProperty_439 => typeof(ItemVisuals);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0a75001f00536d40ad613f41ed2bdc0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 0a55bf38352c472499dfda629552cb74, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e23569ec8e3ccb44f93ff9101c870fcb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: c7c552efab5f8834bad8af2fcd70aee0, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,420 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures a <see cref="UIBlock"/> hierarchy to render in screen-space.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(UIBlock))]
|
||||
[RequireComponent(typeof(SortGroup))]
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("Nova/Screen Space")]
|
||||
[ExecuteAlways]
|
||||
[HelpURL("https://novaui.io/manual/ScreenSpace.html")]
|
||||
public class ScreenSpace : MonoBehaviour, InternalType_765
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// Event that is fired after the <see cref="ScreenSpace"/> finishes updating its
|
||||
/// position, scale, etc. to match the camera.
|
||||
/// </summary>
|
||||
public event Action OnPostCameraSync;
|
||||
|
||||
/// <summary>
|
||||
/// Configures how to resize a <see cref="Nova.UIBlock"/> to fill a camera's viewport.
|
||||
/// </summary>
|
||||
public enum FillMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Maintain the width of the <see cref="UIBlock"/> at the <see cref="ReferenceResolution">ReferenceResolution</see> width,
|
||||
/// adjusting the height to match the camera's aspect ratio.
|
||||
/// </summary>
|
||||
FixedWidth,
|
||||
/// <summary>
|
||||
/// Maintain the height of the <see cref="UIBlock"/> at the <see cref="ReferenceResolution">ReferenceResolution</see> height,
|
||||
/// adjusting the width to match the camera's aspect ratio.
|
||||
/// </summary>
|
||||
FixedHeight,
|
||||
/// <summary>
|
||||
/// Set the <see cref="UIBlock">UIBlock's</see> <see cref="UIBlock.Size">Size</see> to the pixel-dimensions of the camera.
|
||||
/// </summary>
|
||||
MatchCameraResolution,
|
||||
/// <summary>
|
||||
/// Do not modify the <see cref="UIBlock">UIBlock's</see> <see cref="UIBlock.Size">Size</see> or scale.
|
||||
/// This can be used if you want to implement a custom resize behavior.
|
||||
/// </summary>
|
||||
Manual
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Nova.UIBlock"/> on <c>this.gameObject</c> that will be positioned and sized to
|
||||
/// fill the <see cref="TargetCamera">TargetCamera</see>.
|
||||
/// </summary>
|
||||
public UIBlock UIBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_837 == null)
|
||||
{
|
||||
InternalField_837 = GetComponent<UIBlock>();
|
||||
}
|
||||
|
||||
return InternalField_837;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The resolution to use as a reference when resizing the root UIBlock to match the camera's aspect ratio
|
||||
/// when <see cref="Mode">Mode</see> is set to <see cref="FillMode.FixedHeight"/> or <see cref="FillMode.FixedWidth"/>.
|
||||
/// </summary>
|
||||
public Vector2 ReferenceResolution
|
||||
{
|
||||
get => referenceResolution;
|
||||
set => referenceResolution = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The camera to render to.
|
||||
/// </summary>
|
||||
public Camera TargetCamera
|
||||
{
|
||||
get => targetCamera;
|
||||
set
|
||||
{
|
||||
if (targetCamera == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
targetCamera = value;
|
||||
InternalMethod_1618();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of additional cameras to render to.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// NOTE: The content belonging to the <see cref="ScreenSpace"/> will not be repositioned/sized for
|
||||
/// the additional cameras. It will be rendered positioned and sized based on the <see cref="TargetCamera"/>.
|
||||
/// </remarks>
|
||||
public int AdditionalCameraCount => additionalCameras.Count;
|
||||
|
||||
/// <summary>
|
||||
/// Adds an additional camera to render to, appending to the end of the list.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// NOTE: The content belonging to the <see cref="ScreenSpace"/> will not be repositioned/sized for
|
||||
/// the additional cameras. It will be rendered positioned and sized based on the <see cref="TargetCamera"/>.
|
||||
/// </remarks>
|
||||
/// <param name="cam">The camera to add.</param>
|
||||
public void AddAdditionalCamera(Camera cam)
|
||||
{
|
||||
if (cam == null)
|
||||
{
|
||||
Debug.LogWarning("Tried to add a null additional camera");
|
||||
return;
|
||||
}
|
||||
|
||||
additionalCameras.Add(cam);
|
||||
|
||||
InternalMethod_1618();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the additional camera at the specified index.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// NOTE: The content belonging to the <see cref="ScreenSpace"/> will not be repositioned/sized for
|
||||
/// the additional cameras. It will be rendered positioned and sized based on the <see cref="TargetCamera"/>.
|
||||
/// </remarks>
|
||||
/// <param name="index">The target index to replace.</param>
|
||||
/// <param name="cam">The camera to set.</param>
|
||||
/// <seealso cref="AddAdditionalCamera"/>
|
||||
public void SetAdditionalCamera(int index, Camera cam)
|
||||
{
|
||||
if (cam == null)
|
||||
{
|
||||
Debug.LogWarning("Tried to set a null additional camera");
|
||||
return;
|
||||
}
|
||||
|
||||
if (index < 0 || index >= additionalCameras.Count)
|
||||
{
|
||||
Debug.LogError($"Tried to set an additional camera with index {index} when {nameof(AdditionalCameraCount)} was {AdditionalCameraCount}");
|
||||
return;
|
||||
}
|
||||
|
||||
additionalCameras[index] = cam;
|
||||
|
||||
InternalMethod_1618();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the additional camera at the specified index.
|
||||
/// </summary>
|
||||
/// <param name="index">The index to retrieve.</param>
|
||||
/// <returns>The camera at the target index, or null if the index was invalid.</returns>
|
||||
/// <seealso cref="AddAdditionalCamera"/>
|
||||
public Camera GetAdditionalCamera(int index)
|
||||
{
|
||||
if (index < 0 || index >= additionalCameras.Count)
|
||||
{
|
||||
Debug.LogError($"Tried to get an additional camera with index {index} when {nameof(AdditionalCameraCount)} was {AdditionalCameraCount}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return additionalCameras[index];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the additional camera at the specified index. The remaining cameras
|
||||
/// in the list will be renumbered to replace the removed item.
|
||||
/// </summary>
|
||||
/// <param name="index">The index to remove.</param>
|
||||
/// <seealso cref="AddAdditionalCamera"/>
|
||||
public void RemoveAdditionalCamera(int index)
|
||||
{
|
||||
if (index < 0 || index >= additionalCameras.Count)
|
||||
{
|
||||
Debug.LogError($"Tried to remove an additional camera with index {index} when {nameof(AdditionalCameraCount)} was {AdditionalCameraCount}");
|
||||
return;
|
||||
}
|
||||
|
||||
additionalCameras.RemoveAt(index);
|
||||
|
||||
InternalMethod_1618();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="FillMode">FillMode</see> used for resizing <see cref="UIBlock">UIBlock</see> to fill
|
||||
/// <see cref="TargetCamera">TargetCamera</see>.
|
||||
/// </summary>
|
||||
public FillMode Mode
|
||||
{
|
||||
get => fillMode;
|
||||
set
|
||||
{
|
||||
fillMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The distance in front of the camera at which to render the Nova content.
|
||||
/// </summary>
|
||||
public float PlaneDistance
|
||||
{
|
||||
get => planeDistance;
|
||||
set => planeDistance = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Camera targetCamera = null;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Vector2 referenceResolution = new Vector2(1920, 1080);
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private FillMode fillMode = FillMode.FixedWidth;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private float planeDistance = 1f;
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlock InternalField_837 = null;
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private SortGroup InternalField_1434 = null;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool haveConfiguredSortGroup = false;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private List<Camera> additionalCameras = new List<Camera>();
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
int InternalType_765.InternalProperty_1156 => targetCamera.GetInstanceID();
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
List<Camera> InternalType_765.InternalProperty_248 => additionalCameras;
|
||||
|
||||
void InternalType_765.InternalMethod_3365() => InternalMethod_1617();
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
UIBlock.InternalMethod_116();
|
||||
|
||||
if (InternalField_1434 == null)
|
||||
{
|
||||
InternalField_1434 = GetComponent<SortGroup>();
|
||||
}
|
||||
|
||||
if (!haveConfiguredSortGroup)
|
||||
{
|
||||
haveConfiguredSortGroup = true;
|
||||
InternalField_1434.RenderOverOpaqueGeometry = true;
|
||||
InternalField_1434.RenderQueue = InternalType_776.InternalField_3710;
|
||||
}
|
||||
|
||||
if (targetCamera == null)
|
||||
{
|
||||
targetCamera = Camera.main;
|
||||
}
|
||||
|
||||
InternalMethod_1618();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
InternalMethod_1619(InternalField_837.InternalProperty_29);
|
||||
|
||||
if (NovaApplication.IsEditor)
|
||||
{
|
||||
InternalType_131 InternalVar_1 = UIBlock.InternalProperty_29;
|
||||
NovaApplication.EditorDelayCall += () =>
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
InternalMethod_1619(InternalVar_1);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal void InternalMethod_1618()
|
||||
{
|
||||
if (!UIBlock.InternalProperty_25 || !enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetCamera != null)
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_3647(UIBlock.InternalProperty_29, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalMethod_1619(UIBlock.InternalProperty_29);
|
||||
}
|
||||
}
|
||||
|
||||
private void InternalMethod_1619(InternalType_131 InternalParameter_1753)
|
||||
{
|
||||
if (InternalType_274.InternalProperty_190 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_274.InternalProperty_190.InternalMethod_3648(InternalParameter_1753, this);
|
||||
}
|
||||
|
||||
private void InternalMethod_1617(bool InternalParameter_1752 = false)
|
||||
{
|
||||
if (PrefabStageUtils.IsInPrefabStage &&
|
||||
PrefabStageUtils.TryGetCurrentStageRoot(out GameObject InternalVar_1) &&
|
||||
transform.IsChildOf(InternalVar_1.transform))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UIBlock == null || targetCamera == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ref Layout InternalVar_2 = ref InternalField_837.Layout;
|
||||
|
||||
InternalVar_2.Alignment = Alignment.Center;
|
||||
InternalVar_2.AutoSize = AutoSize.None;
|
||||
InternalVar_2.AspectRatioAxis = Axis.None;
|
||||
InternalVar_2.SizeMinMax = MinMax3.Unclamped;
|
||||
InternalVar_2.PositionMinMax = MinMax3.Unclamped;
|
||||
|
||||
if (InternalParameter_1752)
|
||||
{
|
||||
InternalField_837.TrySetWorldPosition(targetCamera.transform.position + targetCamera.transform.forward * planeDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalField_837.transform.position = targetCamera.transform.position + targetCamera.transform.forward * planeDistance;
|
||||
}
|
||||
|
||||
InternalField_837.transform.rotation = targetCamera.transform.rotation;
|
||||
|
||||
if (fillMode != FillMode.Manual)
|
||||
{
|
||||
Vector2 InternalVar_3 = new Vector2(targetCamera.pixelWidth, targetCamera.pixelHeight);
|
||||
|
||||
ref Length3 InternalVar_4 = ref InternalField_837.Size;
|
||||
switch (fillMode)
|
||||
{
|
||||
case FillMode.MatchCameraResolution:
|
||||
{
|
||||
InternalVar_4.XY.Value = InternalVar_3;
|
||||
break;
|
||||
}
|
||||
case FillMode.FixedHeight:
|
||||
{
|
||||
InternalVar_4.Y.Value = ReferenceResolution.y;
|
||||
|
||||
float InternalVar_5 = InternalVar_3.x / InternalVar_3.y;
|
||||
InternalVar_4.X.Value = InternalVar_5 * InternalVar_4.Y.Value;
|
||||
break;
|
||||
}
|
||||
case FillMode.FixedWidth:
|
||||
{
|
||||
InternalVar_4.X.Value = ReferenceResolution.x;
|
||||
|
||||
float InternalVar_5 = InternalVar_3.y / InternalVar_3.x;
|
||||
InternalVar_4.Y.Value = InternalVar_5 * InternalVar_4.X.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (targetCamera.orthographic)
|
||||
{
|
||||
float InternalVar_5 = 2f * targetCamera.orthographicSize / InternalVar_4.Y.Value;
|
||||
InternalField_837.transform.localScale = new Vector3(InternalVar_5, InternalVar_5, InternalVar_5);
|
||||
}
|
||||
else
|
||||
{
|
||||
float InternalVar_5 = 2f * planeDistance * Mathf.Tan(.5f * targetCamera.fieldOfView * Mathf.Deg2Rad) / InternalVar_4.Y.Value;
|
||||
InternalField_837.transform.localScale = new Vector3(InternalVar_5, InternalVar_5, InternalVar_5);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OnPostCameraSync?.Invoke();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"{nameof(ScreenSpace)}.{nameof(OnPostCameraSync)} handler failed with: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
InternalMethod_1617(InternalParameter_1752: true);
|
||||
}
|
||||
|
||||
[Obfuscation]
|
||||
private void OnDidApplyAnimationProperties()
|
||||
{
|
||||
InternalMethod_1618();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8109d3c2d7da4742b2b9da9454648b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 1000
|
||||
icon: {fileID: 2800000, guid: a075939ac091fe34c8bc16cc3b483cb3, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2541297f90fa9c14eab33d90c1489959
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: e8e393db9534f354f8bbea212c590914, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,171 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures the rendered sorting order of a <see cref="Nova.UIBlock"/> hierarchy.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.ZIndex"/>
|
||||
/// <seealso cref="TextBlock.ZIndex"/>
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteAlways]
|
||||
[AddComponentMenu("Nova/Sort Group")]
|
||||
[RequireComponent(typeof(UIBlock))]
|
||||
[HelpURL("https://novaui.io/manual/RenderOrder.html")]
|
||||
public sealed class SortGroup : MonoBehaviour
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// The sorting order of this <see cref="UIBlock"/> hierarchy. Hierarchies with a higher sorting order render on top of those with a lower sorting order.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value for hierarchies <i>without</i> a <see cref="SortGroup"/> component is <c>0</c>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="UIBlock2D.ZIndex"/>
|
||||
/// <seealso cref="TextBlock.ZIndex"/>
|
||||
/// <seealso cref="RenderQueue"/>
|
||||
public int SortingOrder
|
||||
{
|
||||
get => info.SortingOrder;
|
||||
set
|
||||
{
|
||||
if (info.SortingOrder == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
info.SortingOrder = value;
|
||||
InternalMethod_301();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The render queue value to set on all (transparent) materials used to render this <see cref="UIBlock"/> hierarchy.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value for hierarchies <i>without</i> a <see cref="SortGroup"/> component is <c>3000</c>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="UIBlock2D.ZIndex"/>
|
||||
/// <seealso cref="TextBlock.ZIndex"/>
|
||||
/// <seealso cref="SortingOrder"/>
|
||||
public int RenderQueue
|
||||
{
|
||||
get => info.RenderQueue;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, InternalType_178.InternalField_474);
|
||||
if (info.RenderQueue == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.RenderQueue = value;
|
||||
InternalMethod_301();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the content in the sort group should render over geometry rendered in the
|
||||
/// opaque render queue. This is useful for rendering in screen space.
|
||||
/// </summary>
|
||||
public bool RenderOverOpaqueGeometry
|
||||
{
|
||||
get => info.RenderOverOpaqueGeometry;
|
||||
set
|
||||
{
|
||||
if (info.RenderOverOpaqueGeometry == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.RenderOverOpaqueGeometry = value;
|
||||
InternalMethod_301();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Nova.UIBlock"/> on <c>this.gameObject</c>.
|
||||
/// </summary>
|
||||
public UIBlock UIBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_3036 == null)
|
||||
{
|
||||
InternalField_3036 = GetComponent<UIBlock>();
|
||||
}
|
||||
|
||||
return InternalField_3036;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UIBlock InternalField_3036 = null;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_40 info = InternalType_40.InternalField_137;
|
||||
|
||||
internal void InternalMethod_301()
|
||||
{
|
||||
if (!UIBlock.InternalProperty_25 || !enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1262(UIBlock.InternalProperty_29, UnsafeUtility.As<InternalType_40, InternalNamespace_0.InternalType_101>(ref info));
|
||||
}
|
||||
|
||||
private void InternalMethod_302(InternalType_131 InternalParameter_217)
|
||||
{
|
||||
if (InternalType_274.InternalProperty_190 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1261(InternalParameter_217);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
UIBlock.InternalMethod_116();
|
||||
|
||||
InternalMethod_301();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
InternalMethod_302(UIBlock.InternalProperty_29);
|
||||
|
||||
if (NovaApplication.IsEditor)
|
||||
{
|
||||
InternalType_131 InternalVar_1 = UIBlock.InternalProperty_29;
|
||||
NovaApplication.EditorDelayCall += () =>
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
InternalMethod_302(InternalVar_1);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Obfuscation]
|
||||
private void OnDidApplyAnimationProperties()
|
||||
{
|
||||
InternalMethod_301();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b2a531bfddefda4e85a827979d250a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: e23c6baf65aaa4551a266405b185ff6e, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,453 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_25;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_12;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5.InternalNamespace_6;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using TMPro;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="UIBlock"/> for rendering text
|
||||
/// </summary>
|
||||
[ExecuteAlways, RequireComponent(typeof(TMP.TextMeshProTextBlock))]
|
||||
[AddComponentMenu("Nova/TextBlock")]
|
||||
[HelpURL("https://novaui.io/manual/TextBlock.html")]
|
||||
public sealed class TextBlock : UIBlock, InternalType_6
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// A shorthand for setting TMP.text
|
||||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => TMP.text;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
TMP.text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The TextMeshPro component attached to <c>this.gameObject</c>, used to generate the underlying text mesh.
|
||||
/// </summary>
|
||||
public TextMeshPro TMP
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_3314 == null)
|
||||
{
|
||||
InternalField_3314 = GetComponent<TextMeshPro>();
|
||||
}
|
||||
return InternalField_3314;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The primary color of the text. Writes directly to <see cref="TMP"/>.Color.
|
||||
/// </summary>
|
||||
public override Color Color
|
||||
{
|
||||
get => TMP.color;
|
||||
set
|
||||
{
|
||||
TMP.color = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the render order of this UIBlock within a <see cref="SortGroup"/>.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="UIBlock"/>s with a higher ZIndex are rendered on top of <see cref="UIBlock"/>s with a lower ZIndex.</remarks>
|
||||
public short ZIndex
|
||||
{
|
||||
get => visibility.ZIndex;
|
||||
set
|
||||
{
|
||||
visibility.ZIndex = value;
|
||||
InternalType_274.InternalProperty_190.InternalMethod_3031(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The offset that is applied whenever text is being hugged (i.e. <see cref="UIBlock.AutoSize">AutoSize</see> is set to <see cref="AutoSize.Shrink">Shrink</see> on <c>x</c> or <c>y</c>).
|
||||
/// If text is not being hugged, this will be <see cref="Vector2.zero"/>.
|
||||
/// </summary>
|
||||
public Vector2 VisualOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!InternalProperty_27.InternalProperty_197 || !InternalProperty_436)
|
||||
{
|
||||
return Vector2.zero;
|
||||
}
|
||||
|
||||
ref InternalNamespace_0.InternalType_79 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1265(this, -1);
|
||||
var InternalVar_2 = AutoSize.XY;
|
||||
bool2 InternalVar_3 = new bool2(InternalVar_2.X == Nova.AutoSize.Shrink, InternalVar_2.Y == Nova.AutoSize.Shrink);
|
||||
return InternalVar_1.InternalMethod_2606(InternalVar_3);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_670 InternalField_51 = InternalType_670.InternalField_2828;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_79 InternalType_256<InternalNamespace_0.InternalType_79>.InternalProperty_270
|
||||
{
|
||||
get => throw new NotImplementedException("Shouldn't call this on text blocks");
|
||||
}
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal bool2 InternalProperty_35
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => (AutoSize.XY == Nova.AutoSize.Shrink).InternalMethod_3297();
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalProperty_436
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => math.any(InternalProperty_35);
|
||||
}
|
||||
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalField_3350 = false;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private bool InternalProperty_764
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => InternalField_3350;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
InternalField_3350 = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool InternalMethod_2726(InternalType_670 InternalParameter_3092)
|
||||
{
|
||||
|
||||
if (InternalField_51 == InternalParameter_3092)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
InternalField_51 = InternalParameter_3092;
|
||||
TMP.margin = InternalParameter_3092.InternalField_2829;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void InternalType_6.InternalMethod_2724(ref InternalType_670 InternalParameter_3091)
|
||||
{
|
||||
InternalProperty_764 = true;
|
||||
|
||||
if (!InternalMethod_2726(InternalParameter_3091))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TMP.Rebuild(UnityEngine.UI.CanvasUpdate.PreRender);
|
||||
InternalMethod_2723();
|
||||
}
|
||||
|
||||
|
||||
private void InternalMethod_2723()
|
||||
{
|
||||
TMP_UpdateManager.UnRegisterTextElementForRebuild(TMP);
|
||||
TMP.isTextObjectScaleStatic = TMP.isTextObjectScaleStatic;
|
||||
}
|
||||
|
||||
|
||||
private void InternalMethod_128(TMP_TextInfo InternalParameter_80)
|
||||
{
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#pragma warning disable CS0162
|
||||
if (NovaApplication.ConstIsEditor && TMP.textInfo.characterCount == 0 && !string.IsNullOrWhiteSpace(TMP.text))
|
||||
{
|
||||
this.InternalMethod_1959();
|
||||
}
|
||||
#pragma warning restore CS0162
|
||||
|
||||
ref InternalNamespace_0.InternalType_79 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1265(this, InternalParameter_80.meshInfo.Length);
|
||||
|
||||
int InternalVar_2 = 0;
|
||||
for (int InternalVar_3 = 0; InternalVar_3 < InternalParameter_80.meshInfo.Length; InternalVar_3++)
|
||||
{
|
||||
if (InternalVar_3 != 0)
|
||||
{
|
||||
InternalParameter_80.meshInfo[InternalVar_3].ClearUnusedVertices();
|
||||
}
|
||||
InternalVar_2 += InternalParameter_80.meshInfo[InternalVar_3].vertices.Length;
|
||||
}
|
||||
|
||||
InternalVar_2 /= 4;
|
||||
|
||||
if (InternalVar_2 == 0 && InternalVar_1.InternalField_3197 == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalVar_1.InternalField_3197 = InternalVar_2;
|
||||
InternalVar_1.InternalField_264 = transform.lossyScale.y;
|
||||
|
||||
float2 InternalVar_4 = InternalNamespace_0.InternalNamespace_5.InternalType_187.InternalField_2247;
|
||||
float2 InternalVar_5 = InternalNamespace_0.InternalNamespace_5.InternalType_187.InternalField_525;
|
||||
for (int InternalVar_6 = 0; InternalVar_6 < InternalParameter_80.characterCount; InternalVar_6++)
|
||||
{
|
||||
var InternalVar_7 = InternalParameter_80.characterInfo[InternalVar_6];
|
||||
InternalVar_4 = math.min(InternalVar_4, new float2(InternalVar_7.origin, InternalVar_7.descender));
|
||||
InternalVar_5 = math.max(InternalVar_5, new float2(InternalVar_7.xAdvance, InternalVar_7.ascender));
|
||||
}
|
||||
|
||||
if (InternalParameter_80.characterCount == 0)
|
||||
{
|
||||
InternalVar_4 = float2.zero;
|
||||
InternalVar_5 = float2.zero;
|
||||
}
|
||||
|
||||
InternalVar_1.InternalField_262 = new InternalType_306(InternalVar_4, InternalVar_5);
|
||||
|
||||
|
||||
int InternalVar_8 = InternalParameter_80.meshInfo.Length - 1;
|
||||
if (InternalVar_8 > 0)
|
||||
{
|
||||
(TMP as TMP.TextMeshProTextBlock).InternalMethod_3276();
|
||||
}
|
||||
|
||||
for (int InternalVar_9 = 0; InternalVar_9 < InternalVar_1.InternalField_261.InternalProperty_216; ++InternalVar_9)
|
||||
{
|
||||
ref InternalNamespace_0.InternalType_110 InternalVar_10 = ref InternalVar_1.InternalField_261.InternalMethod_800(InternalVar_9);
|
||||
int InternalVar_11 = InternalParameter_80.meshInfo[InternalVar_9].material.GetInstanceID();
|
||||
if (InternalVar_10.InternalField_354 != InternalVar_11)
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalField_875[InternalVar_11] = InternalParameter_80.meshInfo[InternalVar_9].material;
|
||||
}
|
||||
|
||||
TMP_MeshInfo InternalVar_12 = InternalParameter_80.meshInfo[InternalVar_9];
|
||||
InternalVar_10.InternalMethod_553(InternalVar_12);
|
||||
unsafe
|
||||
{
|
||||
TMPUtils.CopyUVs(InternalVar_10.InternalField_357.InternalProperty_232, InternalVar_10.InternalField_358.InternalProperty_232, ref InternalVar_12);
|
||||
}
|
||||
}
|
||||
|
||||
InternalType_457.InternalProperty_190.InternalMethod_1846(this, InternalVar_1.InternalField_262.InternalMethod_1363().xy);
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_111()
|
||||
{
|
||||
InternalField_51 = InternalType_670.InternalField_2828;
|
||||
InternalMethod_130();
|
||||
TMP.OnPreRenderText += InternalProperty_41;
|
||||
TMP.RegisterDirtyVerticesCallback(InternalProperty_40);
|
||||
|
||||
InternalMethod_136(this);
|
||||
|
||||
InternalProperty_38.hideFlags = HideFlags.HideInInspector;
|
||||
InternalProperty_38.enabled = false;
|
||||
|
||||
base.InternalMethod_111();
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_112()
|
||||
{
|
||||
TMP.OnPreRenderText -= InternalProperty_41;
|
||||
TMP.UnregisterDirtyVerticesCallback(InternalProperty_40);
|
||||
InternalMethod_137(this);
|
||||
base.InternalMethod_112();
|
||||
}
|
||||
|
||||
|
||||
private void InternalMethod_127()
|
||||
{
|
||||
|
||||
if (!InternalProperty_764)
|
||||
{
|
||||
InternalMethod_2723();
|
||||
}
|
||||
else if (InternalProperty_25 && !TMP.enabled)
|
||||
{
|
||||
ref InternalNamespace_0.InternalType_79 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1265(this, TMP.textInfo.meshInfo.Length);
|
||||
InternalVar_1.InternalField_3197 = 0;
|
||||
InternalVar_1.InternalField_262 = default;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static readonly Vector2 InternalField_52 = .5f * Vector2.one;
|
||||
private void InternalMethod_130()
|
||||
{
|
||||
InternalProperty_37.anchorMin = InternalField_52;
|
||||
InternalProperty_37.anchorMax = InternalField_52;
|
||||
InternalProperty_37.sizeDelta = Vector2.zero;
|
||||
}
|
||||
|
||||
internal override void InternalMethod_1856()
|
||||
{
|
||||
base.InternalMethod_1856();
|
||||
|
||||
if (!InternalProperty_25 || !InternalProperty_764)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalMethod_2726(InternalType_670.InternalMethod_2348(CalculatedSize.XY.Value, SizeMinMax.InternalMethod_2990().InternalProperty_121.xy, InternalProperty_35));
|
||||
}
|
||||
|
||||
|
||||
#region
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private TextMeshPro InternalField_3314 = null;
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private RectTransform InternalField_3310 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private RectTransform InternalProperty_37
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_3310 == null)
|
||||
{
|
||||
InternalField_3310 = GetComponent<RectTransform>();
|
||||
}
|
||||
return InternalField_3310;
|
||||
}
|
||||
}
|
||||
|
||||
[NonSerialized, HideInInspector]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private MeshRenderer InternalField_3309 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private MeshRenderer InternalProperty_38
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_3309 == null)
|
||||
{
|
||||
InternalField_3309 = GetComponent<MeshRenderer>();
|
||||
}
|
||||
return InternalField_3309;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UnityEngine.Events.UnityAction InternalField_54 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private UnityEngine.Events.UnityAction InternalProperty_40
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_54 == null)
|
||||
{
|
||||
InternalField_54 = InternalMethod_127;
|
||||
}
|
||||
|
||||
return InternalField_54;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Action<TMP_TextInfo> InternalField_55 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Action<TMP_TextInfo> InternalProperty_41
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_55 == null)
|
||||
{
|
||||
InternalField_55 = InternalMethod_128;
|
||||
}
|
||||
|
||||
return InternalField_55;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static HashSet<TextBlock> InternalField_56 = new HashSet<TextBlock>();
|
||||
private static void InternalMethod_136(TextBlock InternalParameter_81)
|
||||
{
|
||||
if (!InternalField_56.Add(InternalParameter_81))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalField_56.Count == 1)
|
||||
{
|
||||
TMPro_EventManager.TEXT_CHANGED_EVENT.Add(InternalMethod_138);
|
||||
}
|
||||
}
|
||||
|
||||
private static void InternalMethod_137(TextBlock InternalParameter_82)
|
||||
{
|
||||
if (!InternalField_56.Remove(InternalParameter_82))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalField_56.Count == 0)
|
||||
{
|
||||
TMPro_EventManager.TEXT_CHANGED_EVENT.Remove(InternalMethod_138);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void InternalMethod_138(UnityEngine.Object InternalParameter_83)
|
||||
{
|
||||
if (!(InternalParameter_83 is TextMeshPro textMeshPro))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TextBlock InternalVar_1 = textMeshPro.gameObject.GetComponent<TextBlock>();
|
||||
if (InternalVar_1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InternalVar_1.TMP.textInfo.characterCount > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalVar_1.InternalMethod_128(InternalVar_1.TMP.textInfo);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private TextBlock() : base()
|
||||
{
|
||||
visibility = InternalType_36.InternalMethod_307(InternalType_11.InternalField_65);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ccd57ae885e984419d40d63541fda7b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 11dd9f6250cdf814ab72e18d554adcb7, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova.TMP
|
||||
{
|
||||
[AddComponentMenu("Nova/Text Mesh Pro - TextBlock")]
|
||||
public sealed class TextMeshProTextBlock : TextMeshPro
|
||||
{
|
||||
public override void SetVerticesDirty()
|
||||
{
|
||||
base.SetVerticesDirty();
|
||||
|
||||
if (m_OnDirtyVertsCallback != null)
|
||||
{
|
||||
m_OnDirtyVertsCallback();
|
||||
}
|
||||
}
|
||||
|
||||
internal void InternalMethod_3276() => SetActiveSubTextObjectRenderers(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9a45f893942b7e4cbbeda81936ac353
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 0227f4506aa91451fac52fdff6a217a8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,967 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_16;
|
||||
using Nova.InternalNamespace_0;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_9;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_12;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using UnityEngine;
|
||||
|
||||
using InputModule = Nova.InternalNamespace_0.InternalType_759<Nova.UIBlock>;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies a set of <see cref="Nova.Layout"/> properties and <see cref="Nova.AutoLayout"/> properties across a connected transform hierarchy of UIBlocks
|
||||
/// </summary>
|
||||
[ExecuteAlways, AddComponentMenu("Nova/UIBlock")]
|
||||
[HelpURL("https://novaui.io/manual/UIBlock.html")]
|
||||
public class UIBlock : CoreBlock, InternalType_5
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// The UIBlock on <c>transform.parent</c>. If <c>transform.parent</c> is <c>null</c> or there is no UIBlock on <c>transform.parent</c>, this value will be <c>null</c>.
|
||||
/// </summary>
|
||||
/// <remarks>If <c>gameObject.activeInHierarchy</c> is <c><see langword="false"/></c>, this value will be <c>null</c>.</remarks>
|
||||
public UIBlock Parent => InternalProperty_27.InternalProperty_210 as UIBlock;
|
||||
|
||||
/// <summary>
|
||||
/// The root of this UIBlock's connected UIBlock hierarchy.
|
||||
/// </summary>
|
||||
/// <remarks>If <c>gameObject.activeInHierarchy</c> is <c><see langword="false"/></c>, this value will be <c>null</c>.</remarks>
|
||||
public UIBlock Root => InternalProperty_27.InternalProperty_211 as UIBlock;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the child UIBlock at the provided <paramref name="index"/>.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the child to retrieve</param>
|
||||
/// <returns>The child UIBlock at the provided <paramref name="index"/>.</returns>
|
||||
/// <exception cref="System.ArgumentOutOfRangeException">Throws when <c><paramref name="index"/> < 0</c> or <c><paramref name="index"/> >= <see cref="ChildCount"/></c></exception>
|
||||
/// <seealso cref="ChildCount"/>
|
||||
public UIBlock GetChild(int index)
|
||||
{
|
||||
return InternalMethod_109(index) as UIBlock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of enabled child <see cref="GameObject"/>'s with a UIBlock component.
|
||||
/// </summary>
|
||||
/// <remarks>If <c>gameObject.activeInHierarchy</c> is <see langword="false"/>, this value will be <c>0</c>.</remarks>
|
||||
/// <seealso cref="GetChild(int)"/>
|
||||
public int ChildCount => InternalProperty_32.InternalProperty_433;
|
||||
#region
|
||||
/// <summary>
|
||||
/// The primary body content color.
|
||||
/// </summary>
|
||||
[field: NonSerialized]
|
||||
public virtual Color Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Nova.Surface"/> configuration for this UIBlock, adjusts the mesh surface's appearance under scene lighting.
|
||||
/// </summary>
|
||||
public ref Surface Surface
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref UnsafeUtility.As<InternalNamespace_0.InternalType_73, Surface>(ref InternalType_274.InternalProperty_190.InternalMethod_1266(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether any visual properties should render.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is a global toggle for this <see cref="UIBlock"/> and, when set to <see langword="false"/>, will hide all visual properties. Layout behavior remains unchanged.
|
||||
/// </remarks>
|
||||
public bool Visible
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => visibility.Visible;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
visibility.Visible = value;
|
||||
InternalType_274.InternalProperty_190.InternalMethod_3031(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the GameObject's layer. Should be used instead of <c>gameobject.layer</c> to ensure that
|
||||
/// Nova is tracking the new layer.
|
||||
/// </summary>
|
||||
public int GameObjectLayer
|
||||
{
|
||||
get => gameObject.layer;
|
||||
set
|
||||
{
|
||||
gameObject.layer = value;
|
||||
|
||||
if (gameObject.layer == visibility.InternalField_130)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
visibility.InternalField_130 = value;
|
||||
InternalType_274.InternalProperty_190.InternalMethod_3031(this);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// The entire set of uncalculated UIBlock layout properties.
|
||||
/// </summary>
|
||||
public ref Layout Layout
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return ref layout;
|
||||
}
|
||||
|
||||
unsafe
|
||||
{
|
||||
return ref UnsafeUtility.AsRef<Layout>(InternalType_457.InternalProperty_190.InternalMethod_14(this).InternalField_1836);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length3"/> configuration used to calculate <see cref="CalculatedSize">Calculated Size</see>.
|
||||
/// </summary>
|
||||
/// <remarks><c>Size.<see cref="Length3.Percent">Percent</see></c> is a percentage of the <see cref="Parent">Parent's</see> <see cref="PaddedSize">Padded Size</see>.</remarks>
|
||||
/// <seealso cref="SizeMinMax"/>
|
||||
/// <seealso cref="CalculatedSize"/>
|
||||
public ref Length3 Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.Size;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax3"/> used to clamp <see cref="Size">Size</see> and <see cref="AutoSize">Auto Size</see> when calculating <see cref="CalculatedSize">CalculatedSize.</see>.
|
||||
/// </summary>
|
||||
public ref MinMax3 SizeMinMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.SizeMinMax;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The size of the UIBlock. Calculated by the Nova Engine once per dirty frame and whenenever <see cref="CalculateLayout"/> is called explicitly.
|
||||
/// </summary>
|
||||
/// <remarks>The final value here accounts for a combination of inputs from <see cref="Size">Size</see>, <see cref="SizeMinMax">Size Min Max</see>,
|
||||
/// <see cref="AutoSize">Auto Size</see>, <see cref="AspectRatioAxis">Aspect Ratio Axis</see>, and the <see cref="PaddedSize">Padded Size</see> of its <see cref="Parent">Parent</see>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="Size"/>
|
||||
/// <seealso cref="SizeMinMax"/>
|
||||
/// <seealso cref="AutoSize"/>
|
||||
/// <seealso cref="AspectRatioAxis"/>
|
||||
public ref readonly Length3.Calculated CalculatedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_53.InternalType_55, Length3.Calculated>(ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1832);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="Nova.AutoSize"/> value for each axis. Provides a way to have this UIBlock's <see cref="CalculatedSize">Calculated Size</see> adapt to the size of its <see cref="Parent">Parent</see> or size of its children automatically.
|
||||
/// </summary>
|
||||
/// <remarks>When set to a value other than <see cref="AutoSize.None"/> for a given axis, this will override any <see cref="Size">Size</see> configuration along that same axis.</remarks>
|
||||
public ref ThreeD<AutoSize> AutoSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.AutoSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When set to a value other than <see cref="Axis.None"/>, the aspect ratio of this UIBlock's <see cref="CalculatedSize">Calculated Size</see> will remain constant, even as <see cref="Size">Size</see> is modified.
|
||||
/// </summary>
|
||||
/// <remarks>Can be used in conjuction with <see cref="AutoSize">Auto Size</see>, but only <see cref="AutoSize">Auto Size</see> along the AspectRatioAxis will be honored.</remarks>
|
||||
public ref Axis AspectRatioAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.AspectRatioAxis;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="LengthBounds"/> configuration used to calculate <see cref="CalculatedMargin">CalculatedMargin</see>. Describes a spatial buffer applied outward from <see cref="CalculatedSize">Calculated Size</see>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <c>Margin.<see cref="LengthBounds.Percent">Percent</see></c> is a percentage of the <see cref="Parent">Parent's</see> <see cref="PaddedSize">Padded Size</see>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="MarginMinMax"/>
|
||||
/// <seealso cref="CalculatedMargin"/>
|
||||
/// <seealso cref="LayoutSize"/>
|
||||
public ref LengthBounds Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.Margin;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMaxBounds"/> used to clamp <see cref="Margin">Margin</see> when calculating <see cref="CalculatedMargin">Calculated Margin</see>.
|
||||
/// </summary>
|
||||
/// <seealso cref="Margin"/>
|
||||
/// <seealso cref="CalculatedMargin"/>
|
||||
/// <seealso cref="LayoutSize"/>
|
||||
public ref MinMaxBounds MarginMinMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.MarginMinMax;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The amount of space applied <i>outward</i> from the bounds defined by <see cref="RotatedSize">Rotated Size</see>. Calculated by the Nova Engine once per dirty frame and whenenever <see cref="CalculateLayout"/> is called explicitly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The final value here accounts for a combination of inputs from <see cref="Margin">Margin</see>, <see cref="MarginMinMax">Margin Min Max</see>, and the <see cref="PaddedSize">Padded Size</see> of its <see cref="Parent">Parent</see>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="Margin"/>
|
||||
/// <seealso cref="MarginMinMax"/>
|
||||
/// <seealso cref="LayoutSize"/>
|
||||
public ref readonly LengthBounds.Calculated CalculatedMargin
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_56.InternalType_58, LengthBounds.Calculated>(ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1835);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A per-axis alignment for this UIBlock relative to its <see cref="Parent">Parent's</see> bounds (<see cref="PaddedSize"/>). <see cref="CalculatedPosition">CalculatedPosition</see> is an offset in the <see cref="Alignment"/> coordinate space.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Axis Alignment</term>
|
||||
/// <description>Shift Direction</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term><see cref="HorizontalAlignment.Left"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.X</c> shifts right</description><br/></item>
|
||||
/// <item>
|
||||
/// <term><see cref="HorizontalAlignment.Center"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.X</c> shifts right</description><br/></item>
|
||||
/// <item>
|
||||
/// <term><see cref="HorizontalAlignment.Right"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.X</c> shifts left</description><br/>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term><see cref="VerticalAlignment.Bottom"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.Y</c> shifts up</description><br/></item>
|
||||
/// <item>
|
||||
/// <term><see cref="VerticalAlignment.Center"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.Y</c> shifts up</description><br/></item>
|
||||
/// <item>
|
||||
/// <term><see cref="VerticalAlignment.Top"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.Y</c> shifts down</description><br/>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term><see cref="DepthAlignment.Front"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.Z</c> shifts forward</description><br/></item>
|
||||
/// <item>
|
||||
/// <term><see cref="DepthAlignment.Center"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.Z</c> shifts forward</description><br/></item>
|
||||
/// <item>
|
||||
/// <term><see cref="DepthAlignment.Back"/></term>
|
||||
/// <description>A positive <c><see cref="CalculatedPosition">Calculated Position</see>.Z</c> shifts backward</description><br/>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public ref Alignment Alignment
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.Alignment;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If <see langword="true"/>, the <see cref="LayoutSize">Layout Size</see> will account for the bounds of <see cref="CalculatedSize">Calculated Size</see> rotated by <c><see cref="Transform.localRotation">transform.localRotation</see></c>.<br/>
|
||||
/// If <see langword="false"/>, the UIBlock will still render rotated, but the <see cref="LayoutSize">Layout Size</see> will not account for <c><see cref="Transform.localRotation">transform.localRotation</see></c>.
|
||||
/// </summary>
|
||||
public ref bool RotateSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.RotateSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If <see cref="RotateSize">Rotate Size</see> is <see langword="true"/>, returns <see cref="CalculatedSize">Calculated Size</see> rotated by <c><see cref="Transform.localRotation">transform.localRotation</see></c>.<br/>
|
||||
/// If <see cref="RotateSize">Rotate Size</see> is <see langword="false"/>, returns <see cref="CalculatedSize">Calculated Size</see>.
|
||||
/// </summary>
|
||||
public Vector3 RotatedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (RotateSize)
|
||||
{
|
||||
return InternalType_182.InternalMethod_859(CalculatedSize.Value, transform.localRotation);
|
||||
}
|
||||
|
||||
return CalculatedSize.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total <see cref="Bounds"/> of this UIBlock's immediate children in local space.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// May require a call to <see cref="CalculateLayout"/> for up-to-date values if child content has changed within a frame.
|
||||
/// </remarks>
|
||||
public Bounds ChildBounds => new Bounds(InternalProperty_19, InternalProperty_18);
|
||||
|
||||
/// <summary>
|
||||
/// The total <see cref="Bounds"/> of this UIBlock's hierarchy, inclusive of all decendent HierarchyBounds, in local space.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// May require a call to <see cref="CalculateLayout"/> for up-to-date values if hierarchy content has changed within a frame.
|
||||
/// </remarks>
|
||||
public Bounds HierarchyBounds => new Bounds(InternalProperty_21, InternalProperty_20);
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length3"/> configuration used to calculate <see cref="CalculatedPosition">Calculated Position</see>. Describes a per-axis offset from its <see cref="Alignment">Alignment</see>.</summary>
|
||||
/// <remarks>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>
|
||||
/// <c>Position.<see cref="Length3.Percent">Percent</see></c> is a percentage of
|
||||
/// the <see cref="Parent">Parent's</see> <see cref="PaddedSize">Padded Size</see>.
|
||||
/// </description></item>
|
||||
/// <item><description>
|
||||
/// This value will be converted and written to <c><see cref="Transform.localPosition">transform.localPosition</see></c>
|
||||
/// as part of the Nova Engine update at the end of the current frame.
|
||||
/// </description></item>
|
||||
/// <item><description>
|
||||
/// If the <see cref="Parent">Parent's</see> <c><see cref="AutoLayout">AutoLayout</see>.<see cref="AutoLayout.Enabled">Enabled</see> == <see langword="true"/></c>,
|
||||
/// the <see cref="AutoLayout"/> will override this <c>Position</c> along the <see cref="Nova.AutoLayout"/>.<see cref="AutoLayout.Axis">Axis.</see>
|
||||
/// </description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <seealso cref="Alignment"/>
|
||||
/// <seealso cref="PositionMinMax"/>
|
||||
/// <seealso cref="CalculatedPosition"/>
|
||||
public ref Length3 Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.Position;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax3"/> used to clamp <see cref="Position">Position</see> when calculating <see cref="CalculatedPosition">Calculated Position</see>.
|
||||
/// </summary>
|
||||
public ref MinMax3 PositionMinMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.PositionMinMax;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The local position of the UIBlock, offset from its configured <see cref="Alignment">Alignment</see>. Calculated by the Nova Engine once per dirty frame and whenenever <see cref="CalculateLayout"/> is called explicitly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The final value here accounts for a combination of inputs from <see cref="Position">Position</see>, <see cref="PositionMinMax">Position Min Max</see>, <c><see cref="Transform.localPosition">transform.localPosition</see></c>,
|
||||
/// the <see cref="PaddedSize">Padded Size</see> of its <see cref="Parent">Parent</see>, and the <see cref="AutoLayout">AutoLayout</see> of its <see cref="Parent">Parent</see>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="Position"/>
|
||||
/// <seealso cref="PositionMinMax"/>
|
||||
/// <seealso cref="AutoLayout"/>
|
||||
/// <seealso cref="Alignment"/>
|
||||
public ref readonly Length3.Calculated CalculatedPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_53.InternalType_55, Length3.Calculated>(ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1833);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="LengthBounds"/> configuration used to calculate <see cref="CalculatedPadding">Calculated Padding</see>. Describes a spatial buffer applied inward from <see cref="CalculatedSize">Calculated Size</see>.
|
||||
/// </summary>
|
||||
/// <remarks><c>Padding.<see cref="LengthBounds.Percent">Percent</see></c> is a percentage of this UIBlock's <see cref="CalculatedSize">Calculated Size</see>.</remarks>
|
||||
/// <seealso cref="PaddingMinMax"/>
|
||||
/// <seealso cref="CalculatedPadding"/>
|
||||
/// <seealso cref="PaddedSize"/>
|
||||
public ref LengthBounds Padding
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.Padding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMaxBounds"/> used to clamp <see cref="Padding">Padding</see> when calculating <see cref="CalculatedPadding">Calculated Padding</see>.
|
||||
/// </summary>
|
||||
/// <seealso cref="Padding"/>
|
||||
/// <seealso cref="CalculatedPadding"/>
|
||||
/// <seealso cref="PaddedSize"/>
|
||||
public ref MinMaxBounds PaddingMinMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref Layout.PaddingMinMax;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The amount of space applied <i>inward</i> from the bounds defined by <see cref="CalculatedSize">Calculated Size</see>. Calculated by the Nova Engine once per dirty frame and whenenever <see cref="CalculateLayout"/> is called explicitly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The final value here accounts for a combination of inputs from <see cref="Padding">Padding</see>, <see cref="PaddingMinMax">Padding Min Max</see>, and <see cref="CalculatedSize">Calculated Size</see>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="Padding"/>
|
||||
/// <seealso cref="PaddingMinMax"/>
|
||||
/// <seealso cref="PaddedSize"/>
|
||||
public ref readonly LengthBounds.Calculated CalculatedPadding
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_56.InternalType_58, LengthBounds.Calculated>(ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1834);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equivalent to <c><see cref="CalculatedSize">CalculatedSize</see> - <see cref="CalculatedPadding">CalculatedPadding</see>.<see cref="LengthBounds.Calculated.Size">Size</see></c>.
|
||||
/// </summary>
|
||||
/// <remarks>A UIBlock is laid-out (positioned, sized, autosized, etc.) relative to its <see cref="Parent">Parent's</see> <see cref="PaddedSize">Padded Size</see>.</remarks>
|
||||
public Vector3 PaddedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalProperty_403;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The final, unscaled size of this UIBlock in its <see cref="Parent">Parent's</see> local space, used for positioning.<br/>
|
||||
/// Equivalent to <c><see cref="RotatedSize">RotatedSize</see> + <see cref="CalculatedMargin">CalculatedMargin</see>.<see cref="LengthBounds.Calculated.Size">Size</see></c>.
|
||||
/// </summary>
|
||||
/// <seealso cref="RotateSize"/>
|
||||
public Vector3 LayoutSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return RotatedSize + CalculatedMargin.Size;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Position all direct child UIBlocks sequentially along the X, Y, or Z axis.
|
||||
/// </summary>
|
||||
public ref AutoLayout AutoLayout
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return ref autoLayout;
|
||||
}
|
||||
|
||||
unsafe
|
||||
{
|
||||
return ref UnsafeUtility.AsRef<AutoLayout>(InternalType_457.InternalProperty_190.InternalMethod_14(this).InternalField_1227);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The calculated output of <see cref="AutoLayout.Spacing"/>. Calculated by the Nova Engine once per dirty frame and whenenever <see cref="CalculateLayout"/> is called explicitly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The final value here accounts for a combination of inputs from <see cref="AutoLayout.Spacing"/>, <see cref="AutoLayout.SpacingMinMax"/>, and the <see cref="PaddedSize">Padded Size</see> of this UIBlock.</remarks>
|
||||
public ref readonly Length.Calculated CalculatedSpacing
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_45.InternalType_47, Length.Calculated>(ref InternalType_457.InternalProperty_190.InternalMethod_3753(this).InternalField_3739);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The calculated output of <see cref="AutoLayout.Cross"/>.<see cref="CrossLayout.Spacing">Spacing</see>. Calculated by the Nova Engine once per dirty frame and whenenever <see cref="CalculateLayout"/> is called explicitly.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The final value here accounts for a combination of inputs from <see cref="AutoLayout.Cross"/>.<see cref="CrossLayout.Spacing">Spacing</see>, <see cref="AutoLayout.Cross"/>.<see cref="CrossLayout.SpacingMinMax">SpacingMinMax</see>, and the <see cref="PaddedSize">Padded Size</see> of this UIBlock.</remarks>
|
||||
public ref readonly Length.Calculated CalculatedCrossSpacing
|
||||
{
|
||||
get
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_45.InternalType_47, Length.Calculated>(ref InternalType_457.InternalProperty_190.InternalMethod_3753(this).InternalField_3740);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Nova Engine will automatically process all modified layout properties at the end of each frame. However, some UI scenarios may require knowing the <see cref="CalculatedSize">Calculated Size</see>
|
||||
/// or another calculated layout value intra-frame, before the Nova Engine has had a chance to run. Calling this method will force an inline recalculation of all modified layout properties on this UIBlock.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method only guarantees up-to-date calculated values for this UIBlock alone, meaning other UIBlocks in this UIBlock's hierarchy may not be updated in their entirety until the Nova Engine runs without
|
||||
/// their own explicit call to <c>CalculateLayout()</c>.<br/>
|
||||
/// This call will always overwrite <c>transform.localPosition</c> with the calculated layout position.
|
||||
/// <c><see cref="GameObject.activeInHierarchy">gameObject.activeInHierarchy</see></c> must be <see langword="true"/>, otherwise nothing will be recalculated.
|
||||
/// </remarks>
|
||||
public void CalculateLayout()
|
||||
{
|
||||
if (!InternalProperty_25)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalType_64.InternalProperty_200.InternalMethod_427(InternalProperty_29);
|
||||
|
||||
transform.localPosition = InternalType_457.InternalProperty_190.InternalMethod_1851(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move this <see cref="UIBlock"/> to the given Transform <paramref name="worldPosition"/>
|
||||
/// and update <see cref="Position"/> accordingly such that when the Nova Engine
|
||||
/// recalculates the modified layout properties, the <i>resulting</i>
|
||||
/// <c>transform.position</c> will equal <paramref name="worldPosition"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Preserves <see cref="Alignment"/> and the current <see cref="Position"/>'s <see cref="LengthType"/>s.
|
||||
/// </remarks>
|
||||
/// <param name="worldPosition">The <c>transform.position</c> to convert to a layout position.</param>
|
||||
/// <returns>
|
||||
/// <see langword="false"/> if <c>gameObject.activeInHierarchy == false</c>, since layout properties
|
||||
/// cannot be calculated in that state, otherwise returns <see langword="true"/>.
|
||||
/// </returns>
|
||||
/// <seealso cref="TrySetLocalPosition(Vector3)"/>
|
||||
public bool TrySetWorldPosition(Vector3 worldPosition)
|
||||
{
|
||||
if (!InternalProperty_25)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector3 InternalVar_1 = worldPosition;
|
||||
|
||||
if (transform.parent != null)
|
||||
{
|
||||
InternalVar_1 = transform.parent.InverseTransformPoint(worldPosition);
|
||||
}
|
||||
|
||||
return TrySetLocalPosition(InternalVar_1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move this <see cref="UIBlock"/> to the given Transform <paramref name="localPosition"/>
|
||||
/// and update <see cref="Position"/> accordingly such that when the Nova Engine
|
||||
/// recalculates the modified layout properties, the <i>resulting</i>
|
||||
/// <c>transform.localPosition</c> will equal <paramref name="localPosition"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Preserves <see cref="Alignment"/> and the current <see cref="Position"/>'s <see cref="LengthType"/>s.
|
||||
/// </remarks>
|
||||
/// <param name="localPosition">The <c>transform.localPosition</c> to convert to a layout position.</param>
|
||||
/// <returns>
|
||||
/// <see langword="false"/> if <c>gameObject.activeInHierarchy == false</c>, since layout properties
|
||||
/// cannot be calculated in that state, otherwise returns <see langword="true"/>.
|
||||
/// </returns>
|
||||
/// <seealso cref="TrySetWorldPosition(Vector3)"/>
|
||||
public bool TrySetLocalPosition(Vector3 localPosition)
|
||||
{
|
||||
if (!InternalProperty_25)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CalculateLayout();
|
||||
|
||||
InternalType_21.InternalMethod_2736(this, localPosition);
|
||||
transform.localPosition = localPosition;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// Subscribe to a gesture event on this <see cref="UIBlock"/> and optionally on its descendent hierarchy, depending on the value of <paramref name="includeHierarchy"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <paramref name="includeHierarchy"/> is <see langword="true"/>, <paramref name="gestureHandler"/> will be invoked whenever the given gesture type is triggered on this <see cref="UIBlock"/> <i>or</i> one of its decendents.<br/>
|
||||
/// If <paramref name="includeHierarchy"/> is <see langword="false"/>, <paramref name="gestureHandler"/> will be invoked only when the given gesture type occurs on <i>this</i> <see cref="UIBlock"/> directy.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TGesture">The type of gesture event to handle.</typeparam>
|
||||
/// <param name="gestureHandler">The callback invoked when the gesture event fires.</param>
|
||||
/// <param name="includeHierarchy">Capture gestures from the descendent hierarchy or scope to this <i>this</i> <see cref="UIBlock"/> directy.</param>
|
||||
/// <exception cref="ArgumentNullException">If <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="FireGestureEvent{TGesture}(TGesture)"/>
|
||||
public void AddGestureHandler<TGesture>(UIEventHandler<TGesture> gestureHandler, bool includeHierarchy = true) where TGesture : struct, IGestureEvent
|
||||
{
|
||||
if (gestureHandler == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(gestureHandler));
|
||||
}
|
||||
|
||||
InternalMethod_3272(gestureHandler, includeHierarchy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribe from a gesture event previously subscribed to via <see cref="AddGestureHandler{TGesture}(UIEventHandler{TGesture}, bool)"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TGesture">The type of gesture event to handle.</typeparam>
|
||||
/// <param name="gestureHandler">The callback to remove from the subscription list.</param>
|
||||
/// <exception cref="ArgumentNullException">If <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="FireGestureEvent{TGesture}(TGesture)"/>
|
||||
public void RemoveGestureHandler<TGesture>(UIEventHandler<TGesture> gestureHandler) where TGesture : struct, IGestureEvent
|
||||
{
|
||||
if (gestureHandler == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(gestureHandler));
|
||||
}
|
||||
|
||||
InternalMethod_3271(gestureHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fire a gesture event on this <see cref="UIBlock"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The event will traverse <i>up</i> the <see cref="UIBlock"/> hierarchy until it reaches a <see cref="UIBlock"/> ancestor (inclusive of this <see cref="UIBlock"/>) with a registered event handler for the given gesture type, <typeparamref name="TGesture"/>.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TGesture">The type of gesture event to fire.</typeparam>
|
||||
/// <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="AddGestureHandler{TGesture}(UIEventHandler{TGesture}, bool)"/>
|
||||
/// <seealso cref="RemoveGestureHandler{TGesture}(UIEventHandler{TGesture})"/>
|
||||
public void FireGestureEvent<TGesture>(TGesture gestureEvent) where TGesture : struct, IGestureEvent
|
||||
{
|
||||
gestureEvent.Receiver = this;
|
||||
gestureEvent.Target = this;
|
||||
InternalMethod_91(gestureEvent);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Layout layout = Layout.TwoD;
|
||||
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private AutoLayout autoLayout = AutoLayout.Disabled;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_69 InternalType_67.InternalProperty_142 => ref UnsafeUtility.As<Layout, InternalNamespace_0.InternalType_69>(ref layout);
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_70 InternalType_67.InternalProperty_143 => ref UnsafeUtility.As<AutoLayout, InternalNamespace_0.InternalType_70>(ref autoLayout);
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Vector3 InternalType_67.InternalProperty_87 { get => PreviewSize; set { PreviewSize = value; } }
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref readonly InternalNamespace_0.InternalType_53.InternalType_55 InternalType_67.InternalProperty_144 => ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1832;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref readonly InternalNamespace_0.InternalType_53.InternalType_55 InternalType_67.InternalProperty_145 => ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1833;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref readonly InternalNamespace_0.InternalType_56.InternalType_58 InternalType_67.InternalProperty_146 => ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1834;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref readonly InternalNamespace_0.InternalType_56.InternalType_58 InternalType_67.InternalProperty_147 => ref InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalField_1835;
|
||||
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected InternalType_36 visibility = InternalType_36.InternalMethod_307(InternalType_11.InternalField_63);
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_71 InternalType_255.InternalProperty_267 => ref UnsafeUtility.As<InternalType_36, InternalNamespace_0.InternalType_71>(ref visibility);
|
||||
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected Surface surface = Surface.InternalField_49;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_73 InternalType_255.InternalProperty_268
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref UnsafeUtility.As<Surface, InternalNamespace_0.InternalType_73>(ref surface);
|
||||
}
|
||||
|
||||
[SerializeField, HideInInspector]
|
||||
[InternalType_22]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Vector3 PreviewSize = Vector2.one;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private protected override bool InternalProperty_28 => InternalType_274.InternalProperty_190.InternalMethod_1258(InternalProperty_29);
|
||||
private protected override void InternalMethod_115()
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1260(InternalProperty_29, InternalProperty_27.InternalProperty_207);
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_102() => InternalType_457.InternalProperty_190.InternalProperty_206.InternalMethod_685(this);
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
InternalType_67 InternalVar_1 = this;
|
||||
|
||||
if (!InternalType_457.InternalProperty_190.InternalMethod_1852(InternalVar_1))
|
||||
{
|
||||
InternalNamespace_0.InternalType_53 InternalVar_2 = InternalVar_1.InternalProperty_142.InternalField_214;
|
||||
InternalVar_2.InternalProperty_115 = transform.localPosition;
|
||||
InternalVar_2.InternalProperty_118 = false;
|
||||
InternalVar_1.InternalProperty_142.InternalField_214 = InternalVar_2;
|
||||
}
|
||||
|
||||
if (InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
InternalMethod_73();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void InternalMethod_73()
|
||||
{
|
||||
visibility.InternalField_130 = gameObject.layer;
|
||||
InternalType_253.InternalProperty_190.InternalMethod_622(this);
|
||||
InternalType_457.InternalProperty_190.InternalMethod_622(this);
|
||||
InternalType_274.InternalProperty_190.InternalMethod_622(this);
|
||||
}
|
||||
|
||||
internal override void InternalMethod_114(InternalType_131 InternalParameter_77)
|
||||
{
|
||||
InternalType_253.InternalProperty_190.InternalMethod_624(InternalParameter_77, this);
|
||||
InternalType_457.InternalProperty_190.InternalMethod_624(InternalParameter_77, this);
|
||||
InternalType_274.InternalProperty_190.InternalMethod_624(InternalParameter_77, this);
|
||||
}
|
||||
|
||||
internal override void InternalMethod_113()
|
||||
{
|
||||
InternalType_253.InternalProperty_190.InternalMethod_623(this);
|
||||
InternalType_457.InternalProperty_190.InternalMethod_623(this);
|
||||
InternalType_274.InternalProperty_190.InternalMethod_623(this);
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_111()
|
||||
{
|
||||
visibility.InternalField_130 = gameObject.layer;
|
||||
InternalType_253.InternalProperty_190.InternalMethod_626(this);
|
||||
InternalType_457.InternalProperty_190.InternalMethod_626(this);
|
||||
InternalType_274.InternalProperty_190.InternalMethod_626(this);
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_112()
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_627(this);
|
||||
InternalType_457.InternalProperty_190.InternalMethod_627(this);
|
||||
InternalType_253.InternalProperty_190.InternalMethod_627(this);
|
||||
}
|
||||
|
||||
|
||||
internal virtual void InternalMethod_1856()
|
||||
{
|
||||
InternalMethod_73();
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_117() { }
|
||||
|
||||
private protected override void InternalMethod_118()
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
InternalMethod_83();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Obfuscation]
|
||||
private protected virtual void OnDidApplyAnimationProperties()
|
||||
{
|
||||
InternalMethod_73();
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
bool InternalType_255.InternalProperty_269
|
||||
{
|
||||
get => Visible;
|
||||
set => Visible = value;
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal CalculatedLayout InternalProperty_17 => InternalType_457.InternalProperty_190.InternalMethod_1857(this).InternalMethod_953<InternalNamespace_0.InternalNamespace_12.InternalType_454, CalculatedLayout>();
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Vector3 InternalProperty_18 => InternalProperty_27.InternalProperty_196.InternalProperty_194 ? (Vector3)InternalType_457.InternalProperty_190.InternalMethod_1847(this) : Vector3.zero;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Vector3 InternalProperty_19 => InternalProperty_27.InternalProperty_196.InternalProperty_194 ? (Vector3)InternalType_457.InternalProperty_190.InternalMethod_1848(this) : Vector3.zero;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Vector3 InternalProperty_20 => InternalProperty_27.InternalProperty_196.InternalProperty_194 ? (Vector3)InternalType_457.InternalProperty_190.InternalMethod_1849(this) : Vector3.zero;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Vector3 InternalProperty_21 => InternalProperty_27.InternalProperty_196.InternalProperty_194 ? (Vector3)InternalType_457.InternalProperty_190.InternalMethod_1850(this) : Vector3.zero;
|
||||
|
||||
|
||||
|
||||
internal Vector3 InternalMethod_3351(bool InternalParameter_678)
|
||||
{
|
||||
if (!InternalParameter_678)
|
||||
{
|
||||
return Vector3.Scale(RotatedSize, transform.lossyScale);
|
||||
}
|
||||
|
||||
Vector3 InternalVar_1 = transform.parent == null ? Vector3.one : transform.parent.lossyScale;
|
||||
|
||||
return Vector3.Scale(RotatedSize, transform.lossyScale) + Vector3.Scale(CalculatedMargin.Size, InternalVar_1);
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Vector3 InternalType_67.InternalProperty_148 => PaddedSize;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Vector3 InternalType_67.InternalProperty_149 => RotatedSize;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Vector3 InternalType_67.InternalProperty_150 => LayoutSize;
|
||||
|
||||
internal ref readonly AutoLayout InternalMethod_79()
|
||||
{
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return ref autoLayout;
|
||||
}
|
||||
|
||||
unsafe
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_70, AutoLayout>(ref InternalType_457.InternalProperty_190.InternalMethod_1859(this));
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal bool InternalProperty_22
|
||||
{
|
||||
get
|
||||
{
|
||||
return InternalType_457.InternalProperty_190.InternalMethod_1855(this);
|
||||
}
|
||||
}
|
||||
|
||||
void InternalType_67.InternalMethod_442() => CalculateLayout();
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_74 InternalType_5.InternalProperty_34 => InternalProperty_23;
|
||||
|
||||
[HideInInspector, NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InputModule InternalField_36 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_74 InternalProperty_23
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_36 == null)
|
||||
{
|
||||
InternalField_36 = new InputModule(this);
|
||||
}
|
||||
|
||||
return InternalField_36;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal bool InternalMethod_82<T>() where T : unmanaged, IEquatable<T>
|
||||
{
|
||||
if (InternalField_36 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return InternalProperty_23.InternalMethod_463<T>();
|
||||
}
|
||||
|
||||
|
||||
private protected void InternalMethod_83()
|
||||
{
|
||||
if (InternalField_36 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalProperty_23.InternalMethod_468();
|
||||
}
|
||||
|
||||
[HideInInspector, NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_522 InternalField_37 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_522 InternalProperty_24
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InternalField_37 == null)
|
||||
{
|
||||
InternalField_37 = new InternalType_522(this);
|
||||
}
|
||||
|
||||
return InternalField_37;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevent users from inheriting
|
||||
/// </summary>
|
||||
internal UIBlock() { }
|
||||
|
||||
internal void InternalMethod_3272<TEvent>(UIEventHandler<TEvent> InternalParameter_3094, bool InternalParameter_3056) where TEvent : struct, IEvent => InternalProperty_24.InternalMethod_1634(InternalParameter_3094, !InternalParameter_3056);
|
||||
internal void InternalMethod_3271<TEvent>(UIEventHandler<TEvent> InternalParameter_3055) where TEvent : struct, IEvent => InternalProperty_24.InternalMethod_1633(InternalParameter_3055);
|
||||
internal void InternalMethod_3270<TEvent, TTarget>(UIEventHandler<TEvent, TTarget> InternalParameter_3054) where TEvent : struct, IEvent where TTarget : class, InternalType_273 => InternalProperty_24.InternalMethod_1632(InternalParameter_3054);
|
||||
internal void InternalMethod_3269<TEvent, TTarget>(UIEventHandler<TEvent, TTarget> InternalParameter_3053) where TEvent : struct, IEvent where TTarget : class, InternalType_273 => InternalProperty_24.InternalMethod_1623(InternalParameter_3053);
|
||||
|
||||
internal void InternalMethod_89(InternalType_523 InternalParameter_72) => InternalProperty_24.InternalMethod_2075(InternalParameter_72);
|
||||
internal void InternalMethod_90(InternalType_523 InternalParameter_73) => InternalProperty_24.InternalMethod_2076(InternalParameter_73);
|
||||
|
||||
internal void InternalMethod_91<TEvent>(TEvent InternalParameter_74, Type InternalParameter_75 = null) where TEvent : struct, IEvent => InternalType_522.InternalMethod_2077(this, InternalParameter_74, InternalParameter_75);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bed4401130c3b04193ec5a2e02ee773
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: a52d0879baacd427fb4b6227dab8952c, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,409 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="UIBlock"/> with an adjustable, rounded-corner rectangle mesh.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Supports a wide range of stylistic features including:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>Rendering images</description></item>
|
||||
/// <item><description><see cref="Nova.Border"/></description></item>
|
||||
/// <item><description><see cref="RadialGradient"/></description></item>
|
||||
/// <item><description><see cref="Nova.Shadow"/></description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
[ExecuteAlways]
|
||||
[HelpURL("https://novaui.io/manual/UIBlock2D.html")]
|
||||
[AddComponentMenu("Nova/UIBlock 2D")]
|
||||
public sealed class UIBlock2D : UIBlock, InternalType_7
|
||||
{
|
||||
#region Public
|
||||
|
||||
/// <summary>
|
||||
/// A gradient effect, visually blended with the body <see cref="Color">Color</see> and image (i.e. <see cref="Sprite">Sprite</see>, <see cref="Texture">Texture</see>, or <see cref="RenderTexture">RenderTexture</see>), if it exists.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Gradient">Gradient</see>.<see cref="RadialGradient.Center">Center</see>.<see cref="Length.Percent">Percent</see> and
|
||||
/// <see cref="Gradient">Gradient</see>.<see cref="RadialGradient.Radius">Radius</see>.<see cref="Length.Percent">Percent</see> are relative to
|
||||
/// <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>Vector2 calculatedGradientCenter = Gradient.Center.Percent * CalculatedSize.XY.Value <br/>
|
||||
/// Vector2 calculatedGradientRadii = Gradient.Radius.Percent * CalculatedSize.XY.Value</c>
|
||||
/// </remarks>
|
||||
/// <seealso cref="RadialGradient"/>
|
||||
public ref RadialGradient Gradient
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_268.InternalMethod_953<InternalNamespace_0.InternalType_108, RadialGradient>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A visual border drawn around the perimeter of the body.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Border">Border</see>.<see cref="Border.Width">Width</see>.<see cref="Length.Percent">Percent</see> is relative to half
|
||||
/// the minimum dimension (X or Y) of <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>float calculatedBorderWidth = Border.Width.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value)</c>
|
||||
/// </remarks>
|
||||
/// <seealso cref="Nova.Border"/>
|
||||
public ref Border Border
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_269.InternalMethod_953<InternalNamespace_0.InternalType_106, Border>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The radial fill/cutout configuration.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="RadialFill">RadialFill</see>.<see cref="RadialFill.Center">Center</see>.<see cref="Length.Percent">Percent</see> is
|
||||
/// relative to <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>Vector2 calculatedRadialFillCenter = RadialFill.Center.Percent * CalculatedSize.XY.Value</c>
|
||||
/// </remarks>
|
||||
public ref RadialFill RadialFill
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_3412.InternalMethod_953<InternalNamespace_0.InternalType_486, RadialFill>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A drop shadow, inner shadow, or glow effect.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Shadow">Shadow</see>.<see cref="Shadow.Width">Width</see>.<see cref="Length.Percent">Percent</see> and
|
||||
/// <see cref="Shadow">Shadow</see>.<see cref="Shadow.Blur">Blur</see>.<see cref="Length.Percent">Percent</see> are
|
||||
/// relative to half the minimum dimension (X or Y) of <see cref="UIBlock.CalculatedSize">CalculatedSize</see>.
|
||||
/// Mathematically speaking:<br/>
|
||||
/// <c>float calculatedShadowWidth = Shadow.Width.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value) <br/>
|
||||
/// float calculatedShadowBlur = Shadow.Blur.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value)</c> <br/><br/>
|
||||
/// <see cref="Shadow">Shadow</see>.<see cref="Shadow.Offset">Offset</see>.<see cref="Length.Percent">Percent</see> is relative to
|
||||
/// <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>Vector2 calculatedShadowOffset = Shadow.Offset.Percent * CalculatedSize.XY.Value</c>
|
||||
/// </remarks>
|
||||
/// <seealso cref="Nova.Shadow"/>
|
||||
public ref Shadow Shadow
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_270.InternalMethod_953<InternalNamespace_0.InternalType_107, Shadow>();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The position and scale adjustments applied to the attached image (i.e. <see cref="Sprite">Sprite</see>, <see cref="Texture">Texture</see>, or <see cref="RenderTexture">RenderTexture</see>), if it exists.
|
||||
/// </summary>
|
||||
/// <seealso cref="Nova.ImageAdjustment"/>
|
||||
/// <seealso cref="Texture"/>
|
||||
/// <seealso cref="Sprite"/>
|
||||
/// <seealso cref="SetImage(RenderTexture)"/>
|
||||
/// <seealso cref="SetImage(Sprite)"/>
|
||||
/// <seealso cref="SetImage(Texture2D)"/>
|
||||
public ref ImageAdjustment ImageAdjustment
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271.InternalField_274.InternalMethod_953<InternalNamespace_0.InternalType_113, ImageAdjustment>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the render order of this UIBlock within a <see cref="SortGroup"/>.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="UIBlock"/>s with a higher ZIndex are rendered on top of <see cref="UIBlock"/>s with a lower ZIndex.</remarks>
|
||||
public short ZIndex
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => visibility.ZIndex;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
visibility.ZIndex = value;
|
||||
InternalType_274.InternalProperty_190.InternalMethod_3031(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the body <see cref="UIBlock.Color">Color</see>, <see cref="Gradient">Gradient</see>, and image (i.e. <see cref="Sprite">Sprite</see>, <see cref="Texture">Texture</see>, or <see cref="RenderTexture">RenderTexture</see>) should render.
|
||||
/// </summary>
|
||||
public bool BodyEnabled
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_273;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_273 = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply local anti-aliasing to edges around the body and <see cref="Border"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Drastically improves visual quality in most user interfaces. In certain situations, however, such as rendering a transparent image or<br/>
|
||||
/// if an image has edge softening already baked into its texture, enabling this property may result in some undesired visual artifacts.
|
||||
/// </remarks>
|
||||
public bool SoftenEdges
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_272;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_272 = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The primary body content color.
|
||||
/// </summary>
|
||||
public override Color Color
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_266;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_266 = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration used to calculate a corner radius, applies to all four corners of the body, <see cref="Border"/>, and <see cref="Shadow"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="CornerRadius">CornerRadius</see>.<see cref="Length.Percent">Percent</see> is relative to half
|
||||
/// the minimum dimension (X or Y) of <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>float calculatedCornerRadius = CornerRadius.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value)</c>
|
||||
/// </remarks>
|
||||
public ref Length CornerRadius
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_267.InternalMethod_9();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure how to store (and attempt to batch) the attached image's (i.e. <see cref="Sprite">Sprite</see>, <see cref="Texture">Texture</see>, or <see cref="RenderTexture">RenderTexture</see>) underlying texture.
|
||||
/// </summary>
|
||||
/// <seealso cref="NovaSettings.PackedImagesEnabled"/>
|
||||
public ImagePackMode ImagePackMode
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => (ImagePackMode)InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271.InternalField_275;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
ref InternalNamespace_0.InternalType_81 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271;
|
||||
InternalVar_1.InternalField_275 = (InternalNamespace_0.InternalType_695)value;
|
||||
InternalMethod_142(ref InternalVar_1);
|
||||
visuals.Image.Mode = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// Retrieve the image texture previously assigned through <see cref="SetImage(Texture2D)"/> or in the Editor.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Will be null if the image is actually a <see cref="UnityEngine.RenderTexture"/> or <see cref="UnityEngine.Sprite"/>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="RenderTexture"/>
|
||||
/// <seealso cref="Sprite"/>
|
||||
public Texture2D Texture
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => texture as Texture2D;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the image texture previously assigned through <see cref="SetImage(RenderTexture)"/> or in the Editor.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Will be null if the image is actually a <see cref="Texture2D"/> or <see cref="UnityEngine.Sprite"/>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="Texture"/>
|
||||
/// <seealso cref="Sprite"/>
|
||||
public RenderTexture RenderTexture
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => texture as RenderTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the sprite previously assigned through <see cref="SetImage(Sprite)"/> or in the Editor.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Will be null if the image is actually a <see cref="Texture2D"/> or <see cref="UnityEngine.RenderTexture"/>.
|
||||
/// </remarks>
|
||||
/// <seealso cref="Texture"/>
|
||||
/// <seealso cref="RenderTexture"/>
|
||||
public Sprite Sprite
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => sprite;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// Clear the current image assignment.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Clears anything previously assigned via <see cref="SetImage(Texture2D)"/>, <see cref="SetImage(Sprite)"/>, <see cref="SetImage(RenderTexture)"/> or in the Editor.
|
||||
/// </remarks>
|
||||
public void ClearImage()
|
||||
{
|
||||
sprite = null;
|
||||
texture = null;
|
||||
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalMethod_141();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Render the provided <paramref name="texture"/> in the body of this <see cref="UIBlock2D"/>. Replaces any existing image assignment.
|
||||
/// </summary>
|
||||
/// <param name="texture">The texture to render in the body of this <see cref="UIBlock2D"/>.</param>
|
||||
public void SetImage(Texture2D texture) => InternalMethod_140(texture);
|
||||
|
||||
/// <summary>
|
||||
/// Render the provided <paramref name="renderTexture"/> in the body of this <see cref="UIBlock2D"/>. Replaces any existing image assignment.
|
||||
/// </summary>
|
||||
/// <param name="renderTexture">The texture to render in the body of this <see cref="UIBlock2D"/>.</param>
|
||||
public void SetImage(RenderTexture renderTexture) => InternalMethod_140(renderTexture);
|
||||
|
||||
/// <summary>
|
||||
/// Render the provided <paramref name="sprite"/> in the body of this <see cref="UIBlock2D"/>. Replaces any existing image assignment.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sliced sprites and <see cref="SpritePackingMode.Tight"/> packed sprites are not supported.
|
||||
/// </remarks>
|
||||
/// <param name="sprite">The sprite to render in the body of this <see cref="UIBlock2D"/>.</param>
|
||||
public void SetImage(Sprite sprite)
|
||||
{
|
||||
if (sprite != null && sprite.packed && sprite.packingMode == SpritePackingMode.Tight)
|
||||
{
|
||||
Debug.LogError("Tight-packed sprite atlas not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
texture = null;
|
||||
this.sprite = sprite;
|
||||
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalMethod_141();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_8 visuals = InternalType_8.InternalField_61;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Texture texture = null;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Sprite sprite = null;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_80 InternalType_256<InternalNamespace_0.InternalType_80>.InternalProperty_270
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref visuals.InternalMethod_953<InternalType_8, InternalNamespace_0.InternalType_80>();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void InternalMethod_140(Texture InternalParameter_84)
|
||||
{
|
||||
sprite = null;
|
||||
texture = InternalParameter_84;
|
||||
|
||||
if (!InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalMethod_141();
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_111()
|
||||
{
|
||||
InternalMethod_142(ref visuals.Image.InternalMethod_953<InternalType_39, InternalNamespace_0.InternalType_81>());
|
||||
base.InternalMethod_111();
|
||||
}
|
||||
|
||||
private void InternalMethod_141()
|
||||
{
|
||||
ref InternalNamespace_0.InternalType_81 InternalVar_1 = ref InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalField_271;
|
||||
InternalMethod_142(ref InternalVar_1);
|
||||
visuals.Image.InternalField_135 = InternalVar_1.InternalField_276;
|
||||
}
|
||||
|
||||
private void InternalMethod_142(ref InternalNamespace_0.InternalType_81 InternalParameter_85)
|
||||
{
|
||||
if (sprite != null)
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_2334(Sprite, InternalParameter_85.InternalField_275, ref InternalParameter_85.InternalField_276);
|
||||
}
|
||||
else if (texture != null)
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_2332(texture, InternalParameter_85.InternalField_275, ref InternalParameter_85.InternalField_276);
|
||||
}
|
||||
else if (InternalParameter_85.InternalField_276.InternalProperty_185)
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_2332(texture, InternalParameter_85.InternalField_275, ref InternalParameter_85.InternalField_276);
|
||||
}
|
||||
visuals.Image.InternalField_135 = InternalParameter_85.InternalField_276;
|
||||
}
|
||||
|
||||
private protected override void InternalMethod_112()
|
||||
{
|
||||
base.InternalMethod_112();
|
||||
|
||||
if (visuals.Image.InternalField_135.InternalProperty_86 && InternalType_274.InternalProperty_190 != null)
|
||||
{
|
||||
ref InternalNamespace_0.InternalType_81 InternalVar_1 = ref visuals.Image.InternalMethod_953<InternalType_39, InternalNamespace_0.InternalType_81>();
|
||||
InternalType_274.InternalProperty_190.InternalField_876.InternalMethod_1386(ref InternalVar_1.InternalField_276);
|
||||
}
|
||||
}
|
||||
|
||||
internal override void InternalMethod_1856()
|
||||
{
|
||||
if (InternalProperty_27.InternalProperty_197)
|
||||
{
|
||||
InternalMethod_142(ref visuals.Image.InternalMethod_953<InternalType_39, InternalNamespace_0.InternalType_81>());
|
||||
}
|
||||
|
||||
base.InternalMethod_1856();
|
||||
}
|
||||
|
||||
[Obfuscation]
|
||||
private protected override void OnDidApplyAnimationProperties()
|
||||
{
|
||||
base.OnDidApplyAnimationProperties();
|
||||
InternalMethod_141();
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_8.Calculated InternalProperty_42 => InternalType_274.InternalProperty_190.InternalMethod_1695(this).InternalMethod_953<InternalNamespace_0.InternalType_80, InternalType_8>().InternalMethod_148(CalculatedSize.XY.Value);
|
||||
|
||||
private UIBlock2D() : base()
|
||||
{
|
||||
visibility = InternalType_36.InternalMethod_307(InternalType_11.InternalField_64);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c395591f6f08fb41897eb437d91b587
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- texture: {instanceID: 0}
|
||||
- sprite: {instanceID: 0}
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: f9205791e06d8f1449b6fca6218eb414, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_10;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="UIBlock"/> with an adjustable, rounded-corner, rounded-edge cube mesh.
|
||||
/// </summary>
|
||||
[AddComponentMenu("Nova/UIBlock 3D")]
|
||||
[HelpURL("https://novaui.io/manual/UIBlock3D.html")]
|
||||
public sealed class UIBlock3D : UIBlock, InternalType_9
|
||||
{
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// The primary body content color.
|
||||
/// </summary>
|
||||
public override Color Color
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => InternalType_274.InternalProperty_190.InternalMethod_1694(this).InternalField_277;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
InternalType_274.InternalProperty_190.InternalMethod_1694(this).InternalField_277 = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration used to calculate a corner radius, applies to all eight corners of the body's front and back faces (XY planes).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="CornerRadius">CornerRadius</see>.<see cref="Length.Percent">Percent</see> is relative to half
|
||||
/// the minimum dimension (X or Y) of <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>float calculatedCornerRadius = CornerRadius.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value)</c>
|
||||
/// </remarks>
|
||||
public ref Length CornerRadius
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1694(this).InternalField_278.InternalMethod_9();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration used to calculate an edge radius, applies to all eight edges of the body's front and back faces (XY planes).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="EdgeRadius">EdgeRadius</see>.<see cref="Length.Percent">Percent</see> is relative to half
|
||||
/// the minimum dimension (X, Y, or Z) of <see cref="UIBlock.CalculatedSize">CalculatedSize</see>. Mathematically speaking:<br/>
|
||||
/// <c>float unclampedEdgeRadius = EdgeRadius.Percent * 0.5f * Mathf.Min(CalculatedSize.X.Value, CalculatedSize.Y.Value, CalculatedSize.Z.Value)</c>.<br/><br/>
|
||||
/// When rendering, EdgeRadius will not exceed the calculated value of <see cref="CornerRadius"/>. Mathematically speaking:<br/>
|
||||
/// <c> float calculatedEdgeRadius = Mathf.Min(unclampedEdgeRadius, calculatedCornerRadius)</c>.
|
||||
/// </remarks>
|
||||
public ref Length EdgeRadius
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref InternalType_274.InternalProperty_190.InternalMethod_1694(this).InternalField_279.InternalMethod_9();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private InternalType_10 visuals = InternalType_10.InternalField_62;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
ref InternalNamespace_0.InternalType_82 InternalType_256<InternalNamespace_0.InternalType_82>.InternalProperty_270
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => ref UnsafeUtility.As<InternalType_10, InternalNamespace_0.InternalType_82>(ref visuals);
|
||||
}
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal InternalType_10.Calculated InternalProperty_43 => InternalType_274.InternalProperty_190.InternalMethod_1694(this).InternalMethod_953<InternalNamespace_0.InternalType_82, InternalType_10>().InternalMethod_153(CalculatedSize.Value);
|
||||
|
||||
/// <summary>
|
||||
/// Initialize values for 3D block
|
||||
/// </summary>
|
||||
private UIBlock3D() : base()
|
||||
{
|
||||
Layout = Layout.ThreeD;
|
||||
visibility = InternalType_36.InternalMethod_307(InternalType_11.InternalField_66);
|
||||
surface = Surface.InternalField_50;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 816c4f69f9c763745b3e13081538e4c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 0452ff48a35cb4778880772ff88063c0, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a02ef8d5246b494f9085d6116743fda
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 && <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 && <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>
|
||||
/// 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:
|
||||
@@ -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 && <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:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5e25f9cf0fd9d14e9f60b089d34fb22
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,736 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Alignment along the X axis.
|
||||
/// </summary>
|
||||
public enum HorizontalAlignment : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Positive offset shifts right. Negative offset shifts left.
|
||||
/// </summary>
|
||||
Left = -1,
|
||||
/// <summary>
|
||||
/// Positive offset shifts right. Negative offset shifts left.
|
||||
/// </summary>
|
||||
Center = 0,
|
||||
/// <summary>
|
||||
/// Positive offset shifts left. Negative offset shifts right.
|
||||
/// </summary>
|
||||
Right = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alignment along the Y axis.
|
||||
/// </summary>
|
||||
public enum VerticalAlignment : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Positive offset shifts up. Negative offset shifts down.
|
||||
/// </summary>
|
||||
Bottom = -1,
|
||||
/// <summary>
|
||||
/// Positive offset shifts up. Negative offset shifts down.
|
||||
/// </summary>
|
||||
Center = 0,
|
||||
/// <summary>
|
||||
/// Positive offset shifts down. Negative offset shifts up.
|
||||
/// </summary>
|
||||
Top = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alignment along the Z axis.
|
||||
/// </summary>
|
||||
public enum DepthAlignment : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Positive offset shifts forward. Negative offset shifts backward.
|
||||
/// </summary>
|
||||
Front = -1,
|
||||
/// <summary>
|
||||
/// Positive offset shifts forward. Negative offset shifts backward.
|
||||
/// </summary>
|
||||
Center = 0,
|
||||
/// <summary>
|
||||
/// Positive offset shifts backward. Negative offset shifts forward.
|
||||
/// </summary>
|
||||
Back = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="HorizontalAlignment"/>, <see cref="VerticalAlignment"/>, and <see cref="DepthAlignment"/>.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public struct Alignment : System.IEquatable<Alignment>
|
||||
{
|
||||
#region
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Center = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Left = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Center, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Right = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Center, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Top = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Top, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Bottom = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Bottom, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Front = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment Back = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopLeft = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Top);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopRight = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Top);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopCenter = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Top);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomLeft = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Bottom);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomRight = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Bottom);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomCenter = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Bottom);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterLeft = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterRight = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterCenter = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center);
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopLeftFront = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Top, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopLeftBack = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Top, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopLeftCenter = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Top, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopRightFront = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Top, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopRightBack = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Top, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopRightCenter = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Top, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopCenterFront = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Top, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopCenterBack = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Top, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment TopCenterCenter = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Top, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomLeftFront = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Bottom, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomLeftBack = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Bottom, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomLeftCenter = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Bottom, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomRightFront = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Bottom, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomRightBack = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Bottom, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomRightCenter = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Bottom, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomCenterFront = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Bottom, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomCenterBack = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Bottom, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment BottomCenterCenter = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Bottom, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterLeftFront = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Center, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterLeftBack = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Center, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterLeftCenter = new Alignment(HorizontalAlignment.Left, VerticalAlignment.Center, DepthAlignment.Center);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterRightFront = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Center, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterRightBack = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Center, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterRightCenter = new Alignment(HorizontalAlignment.Right, VerticalAlignment.Center, DepthAlignment.Center);
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Front"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterCenterFront = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center, DepthAlignment.Front);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Back"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterCenterBack = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center, DepthAlignment.Back);
|
||||
/// <summary>
|
||||
/// <see cref="X"/> == <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="Y"/> == <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="Z"/> == <see cref="DepthAlignment.Center"/>
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public static readonly Alignment CenterCenterCenter = new Alignment(HorizontalAlignment.Center, VerticalAlignment.Center, DepthAlignment.Center);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The X axis alignment
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <see cref="HorizontalAlignment.Right"/>
|
||||
/// </value>
|
||||
[SerializeField]
|
||||
public HorizontalAlignment X;
|
||||
/// <summary>
|
||||
/// The Y axis alignment
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="VerticalAlignment.Top"/>
|
||||
/// </value>
|
||||
[SerializeField]
|
||||
public VerticalAlignment Y;
|
||||
/// <summary>
|
||||
/// The Z axis alignment
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see cref="DepthAlignment.Front"/><br/>
|
||||
/// <see cref="DepthAlignment.Center"/><br/>
|
||||
/// <see cref="DepthAlignment.Back"/>
|
||||
/// </value>
|
||||
[SerializeField]
|
||||
public DepthAlignment Z;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new alignment
|
||||
/// </summary>
|
||||
/// <param name="x">The alignment assigned to <see cref="X"/></param>
|
||||
/// <param name="y">The alignment assigned to <see cref="Y"/></param>
|
||||
/// <param name="z">The alignment assigned to <see cref="Z"/></param>
|
||||
public Alignment(HorizontalAlignment x, VerticalAlignment y, DepthAlignment z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a 3D alignment
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// The alignment assigned to <see cref="X"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// 0 => <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="HorizontalAlignment.Right"/>
|
||||
/// </param>
|
||||
/// <param name="y">The alignment assigned to <see cref="Y"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// 0 => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="VerticalAlignment.Top"/>
|
||||
/// </param>
|
||||
/// <param name="z">The alignment assigned to <see cref="Z"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="DepthAlignment.Front"/><br/>
|
||||
/// 0 => <see cref="DepthAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="DepthAlignment.Back"/>
|
||||
/// </param>
|
||||
public Alignment(int x, int y, int z)
|
||||
{
|
||||
X = (HorizontalAlignment)Mathf.Clamp(x, (int)HorizontalAlignment.Left, (int)HorizontalAlignment.Right);
|
||||
Y = (VerticalAlignment)Mathf.Clamp(y, (int)VerticalAlignment.Bottom, (int)VerticalAlignment.Top);
|
||||
Z = (DepthAlignment)Mathf.Clamp(z, (int)DepthAlignment.Front, (int)DepthAlignment.Back);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a 3D alignment.
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// The alignment assigned to <see cref="X"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// 0 => <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="HorizontalAlignment.Right"/>
|
||||
/// </param>
|
||||
/// <param name="y">The alignment assigned to <see cref="Y"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// 0 => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="VerticalAlignment.Top"/>
|
||||
/// </param>
|
||||
/// <param name="z">The alignment assigned to <see cref="Z"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="DepthAlignment.Front"/><br/>
|
||||
/// 0 => <see cref="DepthAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="DepthAlignment.Back"/>
|
||||
/// </param>
|
||||
public Alignment(float x, float y, float z) : this((int)InternalType_187.InternalMethod_892(x), (int)InternalType_187.InternalMethod_892(y), (int)InternalType_187.InternalMethod_892(z)) { }
|
||||
|
||||
/// <summary>
|
||||
/// Construct a 2D alignment.
|
||||
/// </summary>
|
||||
/// <param name="x">The alignment assigned to <see cref="X"/></param>
|
||||
/// <param name="y">The alignment assigned to <see cref="Y"/></param>
|
||||
/// <remarks><see cref="Z"/> will be assigned to <see cref="DepthAlignment.Center"/></remarks>
|
||||
public Alignment(HorizontalAlignment x, VerticalAlignment y) : this(x, y, DepthAlignment.Center) { }
|
||||
|
||||
/// <summary>
|
||||
/// Construct a 2D alignment.
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// The alignment assigned to <see cref="X"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// 0 => <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="HorizontalAlignment.Right"/>
|
||||
/// </param>
|
||||
/// <param name="y">The alignment assigned to <see cref="Y"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// 0 => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="VerticalAlignment.Top"/>
|
||||
/// </param>
|
||||
/// <remarks><see cref="Z"/> will be assigned to <see cref="DepthAlignment.Center"/></remarks>
|
||||
public Alignment(int x, int y) : this(x, y, (int)DepthAlignment.Center) { }
|
||||
|
||||
/// <summary>
|
||||
/// Construct a 2D alignment.
|
||||
/// </summary>
|
||||
/// <param name="x">
|
||||
/// The alignment assigned to <see cref="X"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// 0 => <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="HorizontalAlignment.Right"/>
|
||||
/// </param>
|
||||
/// <param name="y">The alignment assigned to <see cref="Y"/>, clamped between [-1, 1] <br/>
|
||||
/// -1 => <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// 0 => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// 1 => <see cref="VerticalAlignment.Top"/>
|
||||
/// </param>
|
||||
/// <remarks><see cref="Z"/> will be assigned to <see cref="DepthAlignment.Center"/></remarks>
|
||||
public Alignment(float x, float y) : this((int)InternalType_187.InternalMethod_892(x), (int)InternalType_187.InternalMethod_892(y)) { }
|
||||
|
||||
/// <summary>
|
||||
/// Access each alignment by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write.<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The alignment for the given <paramref name="axis"/> index.<br/><br/>
|
||||
/// <see cref="HorizontalAlignment.Left"/> => -1<br/>
|
||||
/// <see cref="HorizontalAlignment.Center"/> => 0 <br/>
|
||||
/// <see cref="HorizontalAlignment.Right"/> => 1<br/><br/>
|
||||
/// <see cref="VerticalAlignment.Bottom"/> => -1<br/>
|
||||
/// <see cref="VerticalAlignment.Center"/> => 0<br/>
|
||||
/// <see cref="VerticalAlignment.Top"/> => 1<br/><br/>
|
||||
/// <see cref="DepthAlignment.Front"/> => -1<br/>
|
||||
/// <see cref="DepthAlignment.Center"/> => 0<br/>
|
||||
/// <see cref="DepthAlignment.Back"/> => 1
|
||||
/// </returns>
|
||||
/// <exception cref="System.IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public int this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return (int)X;
|
||||
case 1:
|
||||
return (int)Y;
|
||||
case 2:
|
||||
return (int)Z;
|
||||
}
|
||||
|
||||
throw new System.IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = (HorizontalAlignment)value;
|
||||
return;
|
||||
case 1:
|
||||
Y = (VerticalAlignment)value;
|
||||
return;
|
||||
case 2:
|
||||
Z = (DepthAlignment)value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new System.IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts an <see cref="Alignment"/> to a Vector3.
|
||||
/// </summary>
|
||||
/// <param name="alignment">The alignment to convert.</param>
|
||||
/// <returns>
|
||||
/// <see cref="HorizontalAlignment.Left"/> => -1<br/>
|
||||
/// <see cref="HorizontalAlignment.Center"/> => 0 <br/>
|
||||
/// <see cref="HorizontalAlignment.Right"/> => 1<br/><br/>
|
||||
/// <see cref="VerticalAlignment.Bottom"/> => -1<br/>
|
||||
/// <see cref="VerticalAlignment.Center"/> => 0<br/>
|
||||
/// <see cref="VerticalAlignment.Top"/> => 1<br/><br/>
|
||||
/// <see cref="DepthAlignment.Front"/> => -1<br/>
|
||||
/// <see cref="DepthAlignment.Center"/> => 0<br/>
|
||||
/// <see cref="DepthAlignment.Back"/> => 1
|
||||
/// </returns>
|
||||
public static explicit operator Vector3(Alignment alignment)
|
||||
{
|
||||
return new Vector3((int)alignment.X, (int)alignment.Y, (int)alignment.Z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Vector3 to an <see cref="Alignment"/>.
|
||||
/// </summary>
|
||||
/// <param name="alignment">The alignment to convert.</param>
|
||||
/// <returns>
|
||||
/// <paramref name="alignment"/>.x < 0 => <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <paramref name="alignment"/>.x == 0 => <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <paramref name="alignment"/>.x > 0 => <see cref="HorizontalAlignment.Right"/><br/><br/>
|
||||
/// <paramref name="alignment"/>.y < 0 => <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <paramref name="alignment"/>.y == 0 => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <paramref name="alignment"/>.y > 0 => <see cref="VerticalAlignment.Top"/><br/><br/>
|
||||
/// <paramref name="alignment"/>.z < 0 => <see cref="DepthAlignment.Front"/><br/>
|
||||
/// <paramref name="alignment"/>.z == 0 => <see cref="DepthAlignment.Center"/><br/>
|
||||
/// <paramref name="alignment"/>.z > 0 => <see cref="DepthAlignment.Back"/>
|
||||
/// </returns>
|
||||
public static explicit operator Alignment(Vector3 alignment)
|
||||
{
|
||||
return new Alignment(alignment.x, alignment.y, alignment.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Vector2 to an <see cref="Alignment"/>.
|
||||
/// </summary>
|
||||
/// <param name="alignment">The alignment to convert.</param>
|
||||
/// <returns>
|
||||
/// <paramref name="alignment"/>.x < 0 => <see cref="HorizontalAlignment.Left"/><br/>
|
||||
/// <paramref name="alignment"/>.x == 0 => <see cref="HorizontalAlignment.Center"/><br/>
|
||||
/// <paramref name="alignment"/>.x > 0 => <see cref="HorizontalAlignment.Right"/><br/><br/>
|
||||
/// <paramref name="alignment"/>.y < 0 => <see cref="VerticalAlignment.Bottom"/><br/>
|
||||
/// <paramref name="alignment"/>.y == 0 => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <paramref name="alignment"/>.y > 0 => <see cref="VerticalAlignment.Top"/><br/><br/>
|
||||
/// <paramref name="alignment"/>.z == 0 => <see cref="DepthAlignment.Center"/><br/>
|
||||
/// </returns>
|
||||
public static explicit operator Alignment(Vector2 alignment)
|
||||
{
|
||||
return new Alignment(alignment.x, alignment.y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts an alignment to a Vector2.
|
||||
/// </summary>
|
||||
/// <param name="alignment">The alignment to convert.</param>
|
||||
/// <returns>
|
||||
/// <see cref="HorizontalAlignment.Left"/> => -1<br/>
|
||||
/// <see cref="HorizontalAlignment.Center"/> => 0 <br/>
|
||||
/// <see cref="HorizontalAlignment.Right"/> => 1<br/><br/>
|
||||
/// <see cref="VerticalAlignment.Bottom"/> => -1<br/>
|
||||
/// <see cref="VerticalAlignment.Center"/> => 0<br/>
|
||||
/// <see cref="VerticalAlignment.Top"/> => 1<br/><br/>
|
||||
/// </returns>
|
||||
public static explicit operator Vector2(Alignment alignment)
|
||||
{
|
||||
return new Vector2((int)alignment.X, (int)alignment.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negation operator, inverts the alignment.
|
||||
/// </summary>
|
||||
/// <param name="alignment">The alignment to negate.</param>
|
||||
/// <returns>
|
||||
/// <see cref="HorizontalAlignment.Left"/> => <see cref="HorizontalAlignment.Right"/><br/>
|
||||
/// <see cref="HorizontalAlignment.Center"/> => <see cref="HorizontalAlignment.Center"/> <br/>
|
||||
/// <see cref="HorizontalAlignment.Right"/> => <see cref="HorizontalAlignment.Left"/><br/><br/>
|
||||
/// <see cref="VerticalAlignment.Bottom"/> => <see cref="VerticalAlignment.Top"/><br/>
|
||||
/// <see cref="VerticalAlignment.Center"/> => <see cref="VerticalAlignment.Center"/><br/>
|
||||
/// <see cref="VerticalAlignment.Top"/> => <see cref="VerticalAlignment.Bottom"/><br/><br/>
|
||||
/// <see cref="DepthAlignment.Front"/> => <see cref="DepthAlignment.Back"/><br/>
|
||||
/// <see cref="DepthAlignment.Center"/> => <see cref="DepthAlignment.Center"/><br/>
|
||||
/// <see cref="DepthAlignment.Back"/> => <see cref="DepthAlignment.Front"/>
|
||||
/// </returns>
|
||||
public static Alignment operator -(Alignment alignment)
|
||||
{
|
||||
return (Alignment)(-(Vector3)alignment);
|
||||
}
|
||||
|
||||
/// <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"/>.X == <paramref name="rhs"/>.X && <paramref name="lhs"/>.Y == <paramref name="rhs"/>.Y && <paramref name="lhs"/>.Z == <paramref name="rhs"/>.Z
|
||||
/// </c>
|
||||
/// </returns>
|
||||
public static bool operator ==(Alignment lhs, Alignment rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z;
|
||||
}
|
||||
|
||||
/// <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"/>.X != <paramref name="rhs"/>.X || <paramref name="lhs"/>.Y != <paramref name="rhs"/>.Y || <paramref name="lhs"/>.Z != <paramref name="rhs"/>.Z
|
||||
/// </c>
|
||||
/// </returns>
|
||||
public static bool operator !=(Alignment lhs, Alignment rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y || lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Alignment"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Alignment alignment)
|
||||
{
|
||||
return this == alignment;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Alignment"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ((int)X).GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ((int)Y).GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ((int)Z).GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Alignment"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{X}, {Y}, {Z}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Alignment"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(Alignment other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fda06303a163124f9e231679a42aa37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,508 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// X, Y, or Z axis.
|
||||
/// </summary>
|
||||
public enum Axis
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an invalid or disabled value.
|
||||
/// </summary>
|
||||
None = InternalNamespace_0.InternalType_96.InternalField_304,
|
||||
/// <summary>
|
||||
/// X Axis.
|
||||
/// </summary>
|
||||
X = InternalNamespace_0.InternalType_96.InternalField_305,
|
||||
/// <summary>
|
||||
/// Y Axis.
|
||||
/// </summary>
|
||||
Y = InternalNamespace_0.InternalType_96.InternalField_306,
|
||||
/// <summary>
|
||||
/// Z Axis.
|
||||
/// </summary>
|
||||
Z = InternalNamespace_0.InternalType_96.InternalField_307,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A static utility class to assist converting between an <see cref="Axis"/> and an index.
|
||||
/// </summary>
|
||||
public static class AxisIndex
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension to convert an <see cref="Axis"/> to an index.
|
||||
/// </summary>
|
||||
/// <param name="axis">
|
||||
/// <see cref="Axis.X"/> => 0<br/>
|
||||
/// <see cref="Axis.Y"/> => 1<br/>
|
||||
/// <see cref="Axis.Z"/> => 2<br/>
|
||||
/// Anything else => -1
|
||||
/// </param>
|
||||
/// <returns>The index of the axis</returns>
|
||||
public static int Index(this Axis axis)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case Axis.X:
|
||||
return 0;
|
||||
case Axis.Y:
|
||||
return 1;
|
||||
case Axis.Z:
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extension to convert an <see cref="Axis"/> to an index when applicable.
|
||||
/// </summary>
|
||||
/// <param name="axis">
|
||||
/// <see cref="Axis.X"/> => 0<br/>
|
||||
/// <see cref="Axis.Y"/> => 1<br/>
|
||||
/// <see cref="Axis.Z"/> => 2<br/></param>
|
||||
/// <param name="index">The index of <paramref name="axis"/></param>
|
||||
/// <returns><see langword="true"/> if <paramref name="axis"/> == <see cref="Axis.X"/>, <see cref="Axis.Y"/>, or <see cref="Axis.Z"/></returns>
|
||||
public static bool TryGetIndex(this Axis axis, out int index)
|
||||
{
|
||||
index = axis.Index();
|
||||
return index != -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="Axis"/> mapped to the given <paramref name="index"/>.
|
||||
/// </summary>
|
||||
/// <param name="index">The index to convert into an <see cref="Axis"/><br/>
|
||||
/// 0 => <see cref="Axis.X"/><br/>
|
||||
/// 1 => <see cref="Axis.Y"/><br/>
|
||||
/// 2 => <see cref="Axis.Z"/><br/>
|
||||
/// Anything else => <see cref="Axis.None"/></param>
|
||||
/// <returns><paramref name="index"/> as an <see cref="Axis"/></returns>
|
||||
public static Axis GetAxis(int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return Axis.X;
|
||||
case 1:
|
||||
return Axis.Y;
|
||||
case 2:
|
||||
return Axis.Z;
|
||||
}
|
||||
|
||||
return Axis.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A secondary axis configuration of an <see cref="AutoLayout"/>. Children will first be positioned
|
||||
/// along the cross axis before wrapping to the primary axis, a.k.a. the <see cref="AutoLayout"/>.<see cref="AutoLayout.Axis">Axis</see>.
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
[System.Serializable]
|
||||
public struct CrossLayout : System.IEquatable<CrossLayout>
|
||||
{
|
||||
/// <summary>
|
||||
/// The axis along which children are positioned before wrapping to the primary axis.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Axis Axis;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration inserted between children along the cross axis.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length Spacing;
|
||||
|
||||
/// <summary>
|
||||
/// The Min/Max values to clamp <see cref="Spacing"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public MinMax SpacingMinMax;
|
||||
|
||||
/// <summary>
|
||||
/// A flag to indicate <see cref="Spacing"/> should automatically adjust relative to the space available in the parent container.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool AutoSpace;
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the order children are positioned such that the child with the highest <c>transform.siblingIndex</c> is positioned first.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool ReverseOrder;
|
||||
|
||||
[SerializeField, HideInInspector, InternalType_22]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int alignment;
|
||||
|
||||
/// <summary>
|
||||
/// Makes the cross axis size of "Expanded" elements as well as "Auto" spacing more uniform, so the remaining overflow items better align to implicit grid cells.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the configured minimum size of a given "Expanded" child is larger than the configured minimum size of one or more "Expanded" siblings, the child will span
|
||||
/// across multiple grid cells.<br/><br/>
|
||||
/// Does not impact the size of elements not set to <see cref="AutoSize.Expand"/> along the cross axis.
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
public bool ExpandToGrid;
|
||||
|
||||
/// <summary>
|
||||
/// Alignment [-1, 1] of the children along the <see cref="AutoLayout.Cross"/> <see cref="Axis">Axis</see>.
|
||||
/// </summary>
|
||||
///
|
||||
/// <seealso cref="HorizontalAlignment"/>
|
||||
/// <seealso cref="VerticalAlignment"/>
|
||||
/// <seealso cref="DepthAlignment"/>
|
||||
/// <seealso cref="Nova.Alignment"/>
|
||||
public int Alignment { get { return alignment; } set { alignment = InternalType_187.InternalMethod_883(value, -1, 1); } }
|
||||
|
||||
/// <summary>
|
||||
/// False if Axis == Axis.None, otherwise true.
|
||||
/// </summary>
|
||||
public readonly bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return Axis.TryGetIndex(out int _);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 ==(CrossLayout lhs, CrossLayout rhs)
|
||||
{
|
||||
return lhs.Axis == rhs.Axis &&
|
||||
lhs.AutoSpace == rhs.AutoSpace &&
|
||||
lhs.ReverseOrder == rhs.ReverseOrder &&
|
||||
lhs.Alignment == rhs.Alignment &&
|
||||
lhs.ExpandToGrid == rhs.ExpandToGrid &&
|
||||
lhs.Spacing == rhs.Spacing &&
|
||||
lhs.SpacingMinMax == rhs.SpacingMinMax;
|
||||
}
|
||||
|
||||
/// <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 !=(CrossLayout lhs, CrossLayout rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="CrossLayout"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is CrossLayout autolayout)
|
||||
{
|
||||
return this == autolayout;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="CrossLayout"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(CrossLayout other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="CrossLayout"/></summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ((int)Axis).GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Spacing.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + SpacingMinMax.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + AutoSpace.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ReverseOrder.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Alignment.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ExpandToGrid.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="CrossLayout"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Axis == Axis.None)
|
||||
{
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
string InternalVar_1 = ReverseOrder ? "Reverse" : "Default";
|
||||
string InternalVar_2 = Axis == Axis.X ? ((HorizontalAlignment)Alignment).ToString() :
|
||||
Axis == Axis.Y ? ((VerticalAlignment)Alignment).ToString() :
|
||||
((DepthAlignment)Alignment).ToString();
|
||||
|
||||
string InternalVar_3 = AutoSpace ? "Auto" : Spacing.ToString();
|
||||
|
||||
return $"Axis = {Axis}, Align = {InternalVar_2}, Spacing = {InternalVar_3}, Order = {InternalVar_1}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A disabled <see cref="CrossLayout"/>.
|
||||
/// </summary>
|
||||
public static readonly CrossLayout Disabled = new CrossLayout() { Alignment = -1, Spacing = Length.Zero, SpacingMinMax = MinMax.Positive };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Automatically position children sequentially along the X, Y, or Z axis
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
[System.Serializable]
|
||||
public struct AutoLayout : System.IEquatable<AutoLayout>
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary axis along which children are positioned.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Axis Axis;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration inserted between children.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length Spacing;
|
||||
|
||||
/// <summary>
|
||||
/// The Min/Max values to clamp <see cref="Spacing"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public MinMax SpacingMinMax;
|
||||
|
||||
/// <summary>
|
||||
/// A flag to indicate <see cref="Spacing"/> should automatically adjust relative to the space available in the parent container.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool AutoSpace;
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the order children are positioned such that the child with the highest <c>transform.siblingIndex</c> is positioned first.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool ReverseOrder;
|
||||
|
||||
[SerializeField, HideInInspector, InternalType_22]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int alignment;
|
||||
|
||||
/// <summary>
|
||||
/// Alignment [-1, 1] of the children along the <see cref="AutoLayout"/> <see cref="Axis">Axis</see>.
|
||||
/// </summary>
|
||||
///
|
||||
/// <seealso cref="HorizontalAlignment"/>
|
||||
/// <seealso cref="VerticalAlignment"/>
|
||||
/// <seealso cref="DepthAlignment"/>
|
||||
/// <seealso cref="Nova.Alignment"/>
|
||||
public int Alignment
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return alignment;
|
||||
}
|
||||
set
|
||||
{
|
||||
alignment = InternalType_187.InternalMethod_883(value, -1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An offset applied to all children positioned by this <see cref="AutoLayout"/> along the <see cref="AutoLayout"/> <see cref="Axis">Axis</see>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public float Offset;
|
||||
|
||||
/// <summary>
|
||||
/// A secondary axis configuration of an <see cref="AutoLayout"/>. Children will first be positioned
|
||||
/// along the cross axis before wrapping to the primary axis, a.k.a. the <see cref="AutoLayout"/>.<see cref="AutoLayout.Axis">Axis</see>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public CrossLayout Cross;
|
||||
|
||||
/// <summary>
|
||||
/// False if Axis == Axis.None, otherwise true.
|
||||
/// </summary>
|
||||
public readonly bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return Axis.TryGetIndex(out int _);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 ==(AutoLayout lhs, AutoLayout rhs)
|
||||
{
|
||||
return lhs.Axis == rhs.Axis &&
|
||||
lhs.AutoSpace == rhs.AutoSpace &&
|
||||
lhs.ReverseOrder == rhs.ReverseOrder &&
|
||||
lhs.Alignment == rhs.Alignment &&
|
||||
lhs.Offset == rhs.Offset &&
|
||||
lhs.Spacing == rhs.Spacing &&
|
||||
lhs.SpacingMinMax == rhs.SpacingMinMax &&
|
||||
lhs.Cross == rhs.Cross;
|
||||
}
|
||||
|
||||
/// <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 !=(AutoLayout lhs, AutoLayout rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="AutoLayout"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is AutoLayout autolayout)
|
||||
{
|
||||
return this == autolayout;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="AutoLayout"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(AutoLayout other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="AutoLayout"/></summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ((int)Axis).GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Spacing.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + SpacingMinMax.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + AutoSpace.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ReverseOrder.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Alignment.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Offset.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="AutoLayout"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Axis == Axis.None)
|
||||
{
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
string InternalVar_1 = ReverseOrder ? "Reverse" : "Default";
|
||||
string InternalVar_2 = Axis == Axis.X ? ((HorizontalAlignment)Alignment).ToString() :
|
||||
Axis == Axis.Y ? ((VerticalAlignment)Alignment).ToString() :
|
||||
((DepthAlignment)Alignment).ToString();
|
||||
|
||||
string InternalVar_3 = AutoSpace ? "Auto" : Spacing.ToString();
|
||||
|
||||
return $"Axis = {Axis}, Align = {InternalVar_2}, Spacing = {InternalVar_3}, Order = {InternalVar_1}";
|
||||
}
|
||||
|
||||
#region
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly int InternalProperty_12 => Axis == Axis.Y ? -1 : 1;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly int InternalProperty_13
|
||||
{
|
||||
get
|
||||
{
|
||||
int InternalVar_1 = ReverseOrder ? -1 : 1;
|
||||
return InternalProperty_12 * InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly int InternalProperty_14 => Alignment == 1 ? -1 : 1;
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly bool InternalProperty_15
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Axis == Axis.Y) ^ (Alignment == 1) ^ ReverseOrder;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly bool InternalProperty_16 => Enabled && Alignment == 0;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="AutoLayout"/> configured to position elements along the X axis.
|
||||
/// </summary>
|
||||
public static readonly AutoLayout Horizontal = new AutoLayout() { Axis = Axis.X, AutoSpace = true, SpacingMinMax = MinMax.Positive, Cross = CrossLayout.Disabled };
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="AutoLayout"/> configured to position elements along the Y axis.
|
||||
/// </summary>
|
||||
public static readonly AutoLayout Vertical = new AutoLayout() { Axis = Axis.Y, AutoSpace = true, SpacingMinMax = MinMax.Positive, Cross = CrossLayout.Disabled };
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="AutoLayout"/> configured to position elements along the Z axis.
|
||||
/// </summary>
|
||||
public static readonly AutoLayout Zed = new AutoLayout() { Axis = Axis.Z, AutoSpace = true, SpacingMinMax = MinMax.Positive, Cross = CrossLayout.Disabled };
|
||||
|
||||
/// <summary>
|
||||
/// A disabled <see cref="AutoLayout"/>.
|
||||
/// </summary>
|
||||
public static readonly AutoLayout Disabled = new AutoLayout() { Alignment = -1, Spacing = Length.Zero, SpacingMinMax = MinMax.Positive, Cross = CrossLayout.Disabled };
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static ref AutoLayout InternalMethod_71(ref InternalNamespace_0.InternalType_70 InternalParameter_66)
|
||||
{
|
||||
return ref UnsafeUtility.As<InternalNamespace_0.InternalType_70, AutoLayout>(ref InternalParameter_66);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static ref InternalNamespace_0.InternalType_70 InternalMethod_72(ref AutoLayout InternalParameter_67)
|
||||
{
|
||||
return ref UnsafeUtility.As<AutoLayout, InternalNamespace_0.InternalType_70>(ref InternalParameter_67);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e794f9fd2080a9543a0dd2e735a93edc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,158 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the direction for a border to expand.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.Border"/>
|
||||
/// <seealso cref="Border"/>
|
||||
public enum BorderDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The border expands outward.
|
||||
/// </summary>
|
||||
Out = InternalNamespace_0.InternalType_111.InternalField_359,
|
||||
/// <summary>
|
||||
/// The border is centered on the edge, expands both inward and outward.
|
||||
/// </summary>
|
||||
Center = InternalNamespace_0.InternalType_111.InternalField_360,
|
||||
/// <summary>
|
||||
/// The border expands inward.
|
||||
/// </summary>
|
||||
In = InternalNamespace_0.InternalType_111.InternalField_361,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A visual border to draw around a parent element.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.Border"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
public struct Border : IEquatable<Border>
|
||||
{
|
||||
/// <summary>
|
||||
/// The color of the border.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Color Color;
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration for the width of the border.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length Width;
|
||||
/// <summary>
|
||||
/// A flag to toggle the visibility of the border.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool Enabled;
|
||||
/// <summary>
|
||||
/// The direction the border will expand as <see cref="Width"/> increases. Either <see cref="BorderDirection.In"/>, <see cref="BorderDirection.Center"/>, or <see cref="BorderDirection.Out"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public BorderDirection Direction;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Border"/>.
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="enabled"></param>
|
||||
/// <param name="borderDirection"></param>
|
||||
public Border(Color color, Length width, bool enabled = true, BorderDirection borderDirection = BorderDirection.Out)
|
||||
{
|
||||
Color = color;
|
||||
Width = width;
|
||||
Enabled = enabled;
|
||||
Direction = borderDirection;
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal static readonly Border InternalField_58 = new Border()
|
||||
{
|
||||
Enabled = false,
|
||||
Color = Color.white,
|
||||
Width = Length.One,
|
||||
Direction = BorderDirection.In,
|
||||
};
|
||||
|
||||
public static bool operator ==(Border lhs, Border rhs)
|
||||
{
|
||||
return
|
||||
lhs.Color.Equals(rhs.Color) &&
|
||||
lhs.Width.Equals(rhs.Width) &&
|
||||
lhs.Enabled.Equals(rhs.Enabled) &&
|
||||
lhs.Direction == rhs.Direction;
|
||||
|
||||
}
|
||||
|
||||
public static bool operator !=(Border lhs, Border rhs) => !(rhs == lhs);
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Color.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Width.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Enabled.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Direction.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Border"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Border border)
|
||||
{
|
||||
return this == border;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Border"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(Border other) => this == other;
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Border"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (!Enabled)
|
||||
{
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
return $"Color = {Color}, Width = {Width}, Direction = {Direction}";
|
||||
}
|
||||
|
||||
internal Calculated InternalMethod_146(float InternalParameter_87)
|
||||
{
|
||||
return new Calculated(Width, InternalParameter_87);
|
||||
}
|
||||
|
||||
[Obfuscation]
|
||||
internal readonly struct Calculated
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length.Calculated Width;
|
||||
|
||||
internal Calculated(Length borderWidth, float relativeTo)
|
||||
{
|
||||
var InternalVar_1 = new InternalNamespace_0.InternalType_45.InternalType_47(borderWidth.InternalMethod_1(), InternalNamespace_0.InternalType_45.InternalType_46.InternalField_151, relativeTo);
|
||||
Width = InternalVar_1.InternalMethod_18();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25183df87b3add440a6bd9f179d8d458
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5aebb4a7dd36ce94c84b1eb6b5d37d39
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,162 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies how a parent element renders an image based on the aspect ratio of the image and the parent element itself.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.ImageAdjustment"/>
|
||||
/// <seealso cref="ImageAdjustment"/>
|
||||
public enum ImageScaleMode
|
||||
{
|
||||
/// <summary>
|
||||
/// No automatic adjustment is made to the image's scale. If the aspect ratio of the parent element and image do not match, the image will stretch.
|
||||
/// </summary>
|
||||
Manual = InternalNamespace_0.InternalType_112.InternalField_362,
|
||||
/// <summary>
|
||||
/// As the parent's size changes, the image scale will adjust automatically to ensure the full
|
||||
/// image fits within its parent container. Preserves the image's native aspect ratio (unstretched).
|
||||
/// </summary>
|
||||
Fit = InternalNamespace_0.InternalType_112.InternalField_363,
|
||||
/// <summary>
|
||||
/// As the parent's size changes, the image scale will adjust automatically to ensure the image
|
||||
/// maximally fills its parent container. Preserves the image's native aspect ratio (unstretched).
|
||||
/// </summary>
|
||||
Envelope = InternalNamespace_0.InternalType_112.InternalField_364,
|
||||
/// <summary>
|
||||
/// The image will be displayed as a 9-sliced sprite.<br/> NOTE: the <see cref="ImageAdjustment.PixelsPerUnitMultiplier"/>
|
||||
/// value determines the width of the borders.
|
||||
/// </summary>
|
||||
/// <seealso cref="ImageScaleMode.Tiled"/>
|
||||
Sliced = InternalNamespace_0.InternalType_112.InternalField_3426,
|
||||
/// <summary>
|
||||
/// The image will be displayed as a 9-sliced sprite with the sections being tiled instead of stretched.<br/>
|
||||
/// NOTE: the <see cref="ImageAdjustment.PixelsPerUnitMultiplier"/>
|
||||
/// value determines the width of the borders and the size of the tiles.
|
||||
/// </summary>
|
||||
Tiled = InternalNamespace_0.InternalType_112.InternalField_3427,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The position and scale adjustments to apply when rendering an image.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.ImageAdjustment"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
public struct ImageAdjustment : IEquatable<ImageAdjustment>
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the center position of the image in UV space, where UVs go from <c>(-1, -1)</c> (bottom-left) to <c>(1, 1)</c> (top-right).
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Vector2 CenterUV;
|
||||
/// <summary>
|
||||
/// Specifies how much to scale the image in UV space, where UVs go from <c>(-1, -1)</c> (bottom-left) to <c>(1, 1)</c> (top-right).</summary>
|
||||
/// <remarks>E.g.<br/>
|
||||
/// <list type="bullet">
|
||||
/// <item><description><c>UVScale == Vector2.one * 2</c> will zoom <i>in</i> by a factor of <c>2</c>, rendering the inner half of the image and clipping the outer half.</description></item>
|
||||
/// <item><description><c>UVScale == Vector2.one * 0.5f</c> will zoom <i>out</i> by a factor of <c>2</c>, rendering the full image surrounded by either empty space, tiling of the same image, or adjacent<br/>
|
||||
/// sprites in the source sprite sheet. Surrounding content is dependent on the underlying <see cref="Texture">Texture</see> or <see cref="Sprite">Sprite</see> settings, not this <see cref="UVScale">UVScale</see> field.</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
public Vector2 UVScale;
|
||||
/// <summary>
|
||||
/// A multiplier that scales how <see cref="ImageScaleMode.Sliced"/> and <see cref="ImageScaleMode.Tiled"/> images are rendered.
|
||||
/// Specifically, <see cref="PixelsPerUnitMultiplier">PixelsPerUnitMultiplier</see> determines how many pixels from the target image
|
||||
/// fit into a 1x1 square in the target <see cref="UIBlock2D"/>'s local space.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public float PixelsPerUnitMultiplier;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private ImageScaleMode scaleMode;
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: Gets the current scale mode.<br/>
|
||||
/// <c>set</c>: Sets the scale mode and resets both <see cref="CenterUV"/> and <see cref="UVScale"/> to
|
||||
/// <c>Vector2.zero</c> and <c>Vector2.one</c>, respectively.
|
||||
/// </summary>
|
||||
public ImageScaleMode ScaleMode
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => scaleMode;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
if (scaleMode == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
scaleMode = value;
|
||||
CenterUV = Vector2.zero;
|
||||
UVScale = Vector2.one;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="ImageAdjustment"/> with <see cref="ScaleMode"/> set to <see cref="ImageScaleMode.Manual"/>.
|
||||
/// </summary>
|
||||
/// <param name="centerUV"></param>
|
||||
/// <param name="uvScale"></param>
|
||||
public ImageAdjustment(Vector2 centerUV, Vector2 uvScale)
|
||||
{
|
||||
CenterUV = centerUV;
|
||||
UVScale = uvScale;
|
||||
scaleMode = ImageScaleMode.Manual;
|
||||
PixelsPerUnitMultiplier = 1f;
|
||||
}
|
||||
|
||||
public static bool operator ==(ImageAdjustment lhs, ImageAdjustment rhs)
|
||||
{
|
||||
return
|
||||
lhs.CenterUV.Equals(rhs.CenterUV) &&
|
||||
lhs.UVScale.Equals(rhs.UVScale) &&
|
||||
lhs.scaleMode == rhs.ScaleMode &&
|
||||
lhs.PixelsPerUnitMultiplier.Equals(rhs.PixelsPerUnitMultiplier);
|
||||
}
|
||||
public static bool operator !=(ImageAdjustment lhs, ImageAdjustment rhs) => !(rhs == lhs);
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + CenterUV.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + UVScale.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + scaleMode.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + PixelsPerUnitMultiplier.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is ImageAdjustment asType)
|
||||
{
|
||||
return this == asType;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="ImageAdjustment"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(ImageAdjustment other) => this == other;
|
||||
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal static readonly ImageAdjustment InternalField_60 = new ImageAdjustment()
|
||||
{
|
||||
UVScale = Vector2.one,
|
||||
CenterUV = Vector2.zero,
|
||||
scaleMode = ImageScaleMode.Fit,
|
||||
PixelsPerUnitMultiplier = 1f,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5f63ca7d29aa0e4e8c41964ecdb456c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,82 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies how the Nova Engine should store and attempt to batch a given texture.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.ImagePackMode"/>
|
||||
/// <seealso cref="NovaSettings.PackedImagesEnabled"/>
|
||||
public enum ImagePackMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Store the texture by itself. Useful if the underlying texture's content changes regularly (such as for a video player) or
|
||||
/// if <see cref="Packed"/> causes visual artifacts. An unpacked texture will be rendered in its own draw call.
|
||||
/// </summary>
|
||||
Unpacked = InternalNamespace_0.InternalType_695.InternalField_2939,
|
||||
/// <summary>
|
||||
/// Store the texture with other compatible textures (compatible being determined by texture format, mips, dimensions, etc.).<br/>
|
||||
/// Packed textures can be batched, potentially leading to <i>many</i> fewer draw calls than if all textures were <see cref="Unpacked"/>.
|
||||
/// </summary>
|
||||
Packed = InternalNamespace_0.InternalType_695.InternalField_2831,
|
||||
}
|
||||
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
internal struct InternalType_38 : IEquatable<InternalType_38>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private int InternalField_133;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public bool InternalProperty_86
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => InternalField_133 != -1;
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public static readonly InternalType_38 InternalField_134 = new InternalType_38()
|
||||
{
|
||||
InternalField_133 = -1,
|
||||
};
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator InternalType_38(InternalNamespace_0.InternalType_103 InternalParameter_221) => new InternalType_38()
|
||||
{
|
||||
InternalField_133 = InternalParameter_221,
|
||||
};
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator InternalNamespace_0.InternalType_103(InternalType_38 InternalParameter_222) => InternalParameter_222.InternalField_133;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(InternalType_38 other) => InternalField_133 == other.InternalField_133;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
internal struct InternalType_39
|
||||
{
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public ImageAdjustment Adjustment;
|
||||
[SerializeField]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public ImagePackMode Mode;
|
||||
[NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public InternalType_38 InternalField_135;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal static readonly InternalType_39 InternalField_136 = new InternalType_39()
|
||||
{
|
||||
Adjustment = ImageAdjustment.InternalField_60,
|
||||
InternalField_135 = InternalType_38.InternalField_134,
|
||||
Mode = ImagePackMode.Packed,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d80e7e801d3c1b4fb66edc0216e1730
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,767 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_4;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_11;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5.InternalNamespace_6;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
using InputRouter = Nova.InternalNamespace_0.InternalType_90<Nova.UIBlockHit>.InternalType_91;
|
||||
using Navigator = Nova.InternalNamespace_0.InternalType_757<Nova.UIBlock>;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A way to indicate the physical stability of an input device as it's used to perform various interactions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Some examples:
|
||||
/// <list type="table">
|
||||
/// <item>
|
||||
/// <term>High Accuracy</term>
|
||||
/// <description>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>Mouse</description></item>
|
||||
/// <item><description>Finger (touchscreen)</description></item>
|
||||
/// <item><description>Stylus (touchscreen)</description></item>
|
||||
/// <item><description>XR Controller Ray</description></item>
|
||||
/// </list>
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item><term>Low Accuracy</term>
|
||||
/// <description>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>XR Hands</description></item>
|
||||
/// <item><description>XR Finger Tips</description></item>
|
||||
/// </list>
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public enum InputAccuracy
|
||||
{
|
||||
/// <summary>
|
||||
/// High accuracy, physically stable.
|
||||
/// </summary>
|
||||
High = 0,
|
||||
/// <summary>
|
||||
/// Lower accuracy, less physically stable.
|
||||
/// </summary>
|
||||
Low = 1
|
||||
}
|
||||
|
||||
internal static class InternalType_491
|
||||
{
|
||||
public static InternalType_432 InternalMethod_2349(ref this Sphere InternalParameter_2156)
|
||||
{
|
||||
return new InternalType_432() { InternalField_1663 = InternalParameter_2156.Center, InternalField_1664 = InternalParameter_2156.Radius };
|
||||
}
|
||||
}
|
||||
|
||||
internal static class InternalType_490
|
||||
{
|
||||
public static InternalNamespace_0.InternalType_78 InternalMethod_2204(this Interaction.Update InternalParameter_2155)
|
||||
{
|
||||
return new InternalNamespace_0.InternalType_78(InternalParameter_2155.Ray, InternalParameter_2155.ControlID, InternalParameter_2155.UserData);
|
||||
}
|
||||
|
||||
public static Interaction.Update InternalMethod_2179(ref this InternalNamespace_0.InternalType_78 InternalParameter_2154)
|
||||
{
|
||||
return new Interaction.Update(InternalParameter_2154.InternalField_258, InternalParameter_2154.InternalField_257, InternalParameter_2154.InternalField_259);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The details of a <see cref="Ray"/>-><see cref="Nova.UIBlock"/> or <see cref="Sphere"/>-><see cref="Nova.UIBlock"/> intersection.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <list type="bullet">
|
||||
/// <item><description><see cref="Interaction.Raycast(Ray, out UIBlockHit, float, int)"/></description></item>
|
||||
/// <item><description><see cref="Interaction.RaycastAll(Ray, List{UIBlockHit}, float, int)"/></description></item>
|
||||
/// <item><description><see cref="Interaction.SphereCollide(Sphere, out UIBlockHit, int)"/></description></item>
|
||||
/// <item><description><see cref="Interaction.SphereCollideAll(Sphere, List{UIBlockHit}, int)"/></description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
[System.Serializable]
|
||||
public struct UIBlockHit : System.IEquatable<UIBlockHit>, InternalType_84
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
InternalType_5 InternalType_84.InternalProperty_169 { get => UIBlock; set => UIBlock = value as UIBlock; }
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Vector3 InternalType_84.InternalProperty_170 { get => Position; set => Position = value; }
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
Vector3 InternalType_84.InternalProperty_171 { get => Normal; set => Normal = value; }
|
||||
|
||||
/// <summary>
|
||||
/// The UI Block that was hit.
|
||||
/// </summary>
|
||||
public UIBlock UIBlock;
|
||||
|
||||
/// <summary>
|
||||
/// The hit position on the UI Block in world space.
|
||||
/// </summary>
|
||||
public Vector3 Position;
|
||||
|
||||
/// <summary>
|
||||
/// The hit normal in world space.
|
||||
/// </summary>
|
||||
public Vector3 Normal;
|
||||
|
||||
/// <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"/>.UIBlock == <paramref name="rhs"/>.UIBlock && <paramref name="lhs"/>.Position == <paramref name="rhs"/>.Position && <paramref name="lhs"/>.Normal == <paramref name="rhs"/>.Normal.</c>
|
||||
/// </returns>
|
||||
public static bool operator ==(UIBlockHit lhs, UIBlockHit rhs)
|
||||
{
|
||||
return lhs.UIBlock == rhs.UIBlock && lhs.Position == rhs.Position && lhs.Normal == rhs.Normal;
|
||||
}
|
||||
|
||||
/// <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"/>.UIBlock != <paramref name="rhs"/>.UIBlock || <paramref name="lhs"/>.Position != <paramref name="rhs"/>.Position || <paramref name="lhs"/>.Normal != <paramref name="rhs"/>.Normal</c>.
|
||||
/// </returns>
|
||||
public static bool operator !=(UIBlockHit lhs, UIBlockHit rhs)
|
||||
{
|
||||
return lhs.UIBlock != rhs.UIBlock || lhs.Position != rhs.Position || lhs.Normal != rhs.Normal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The hashcode for this <see cref="UIBlockHit"/>.
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Position.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Normal.GetHashCode();
|
||||
|
||||
if (UIBlock != null)
|
||||
{
|
||||
InternalVar_1 = (InternalVar_1 * 7) + UIBlock.GetHashCode();
|
||||
}
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="UIBlockHit"/> to compare.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>.
|
||||
/// </returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is UIBlockHit hit)
|
||||
{
|
||||
return this == hit;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="UIBlockHit"/> to compare.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>.
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(UIBlockHit other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The static access point to provide input events and leverage the Nova input system.
|
||||
/// </summary>
|
||||
public static class Interaction
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single update of an interaction.
|
||||
/// </summary>
|
||||
/// <seealso cref="Interaction.Point(Update, bool, bool, float, int, InputAccuracy)"/>
|
||||
/// <seealso cref="Interaction.Scroll(Update, Vector3, float, int, InputAccuracy)"/>
|
||||
/// <seealso cref="Interaction.Cancel(Update)"/>
|
||||
/// <seealso cref="IGestureEvent"/>
|
||||
public struct Update : System.IEquatable<Update>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ControlID"/> of <see cref="Uninitialized"/>.
|
||||
/// </summary>
|
||||
public const uint UninitializedControlID = uint.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an uninitialized interaction.
|
||||
/// </summary>
|
||||
public static readonly Update Uninitialized = new Update(UninitializedControlID);
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier of the input control.
|
||||
/// </summary>
|
||||
/// <remarks>Likely represents a single finger on a touchscreen, a mouse button, a joystick, etc.</remarks>
|
||||
public uint ControlID;
|
||||
|
||||
/// <summary>
|
||||
/// The pointer ray in world space.
|
||||
/// </summary>
|
||||
public Ray Ray;
|
||||
|
||||
/// <summary>
|
||||
/// Any additional data to pass along to the receiver of the current interaction.
|
||||
/// </summary>
|
||||
public object UserData;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="Update"/>.
|
||||
/// </summary>
|
||||
/// <param name="ray">The world space ray indicating where the input control is "pointing".</param>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.</param>
|
||||
/// <param name="userData">Any additional data to pass along to the receiver of the current interaction.</param>
|
||||
public Update(Ray ray, uint controlID = 0, object userData = null)
|
||||
{
|
||||
Ray = ray;
|
||||
ControlID = controlID;
|
||||
UserData = userData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an interaction without a <see cref="Ray"/> or <see cref="UserData"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Useful for when the caller just wants a wrapped <see cref="ControlID"/>.</remarks>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.
|
||||
/// </param>
|
||||
public Update(uint controlID)
|
||||
{
|
||||
ControlID = controlID;
|
||||
Ray = new Ray(InternalType_187.InternalField_535, InternalType_187.InternalField_535);
|
||||
UserData = null;
|
||||
}
|
||||
|
||||
/// <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 ==(Update lhs, Update rhs)
|
||||
{
|
||||
return lhs.ControlID == rhs.ControlID &&
|
||||
lhs.Ray.origin == rhs.Ray.origin &&
|
||||
lhs.Ray.direction == rhs.Ray.direction &&
|
||||
lhs.UserData == rhs.UserData;
|
||||
}
|
||||
|
||||
/// <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 !=(Update lhs, Update rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The hashcode for this <see cref="Update"/>.
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ControlID.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Ray.GetHashCode();
|
||||
|
||||
if (UserData != null)
|
||||
{
|
||||
InternalVar_1 = (InternalVar_1 * 7) + UserData.GetHashCode();
|
||||
}
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Update"/> to compare.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>.
|
||||
/// </returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Update ray)
|
||||
{
|
||||
return this == ray;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Update"/> to compare.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>.
|
||||
/// </returns>
|
||||
public bool Equals(Update other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Update"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return UserData != null ? $"ControlID = {ControlID}, Ray = {Ray}, UseData = {UserData}" : $"ControlID = {ControlID}, Ray = {Ray}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A layer mask to select all GameObject layers, equivalent to <c>Physics.AllLayers</c>.
|
||||
/// </summary>
|
||||
public const int AllLayers = InternalType_178.InternalField_469;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private const float InternalField_3301 = 10;
|
||||
|
||||
[System.NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static InputRouter InternalField_3274 = new InputRouter();
|
||||
[System.NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static List<InternalType_428> InternalField_3273 = new List<InternalType_428>();
|
||||
[System.NonSerialized]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static List<UIBlockHit> InternalField_3272 = new List<UIBlockHit>();
|
||||
|
||||
internal static void InternalMethod_3196()
|
||||
{
|
||||
if (!Compat.NovaApplication.IsPlaying)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_3274.InternalMethod_505();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the latest valid <see cref="UIBlockHit"/> to receive an interaction event from the provided <paramref name="controlID"/>.
|
||||
/// </summary>
|
||||
/// <param name="controlID">The unique identifier of the input control.</param>
|
||||
/// <param name="receiverHit">The latest valid <see cref="UIBlockHit"/> created with the same <paramref name="controlID"/>.</param>
|
||||
/// <returns>If a receiver is found and the interaction is valid, returns <see langword="true"/>. If the receiver was not found or the interaction has been canceled, returns <see langword="false"/>.</returns>
|
||||
public static bool TryGetActiveReceiver(uint controlID, out UIBlockHit receiverHit)
|
||||
{
|
||||
if (InternalField_3274.InternalMethod_503<bool>(controlID, out receiverHit))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return InternalField_3274.InternalMethod_503<InternalType_755<Vector3>>(controlID, out receiverHit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a sphere collision against all active <see cref="UIBlock"/>s in the scene and populates the provided list with <see cref="UIBlockHit"/>s for all <see cref="UIBlock"/>s colliding with the provided <paramref name="sphere"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Performed by the Nova Input System, independent of the <see cref="Physics"/> and <see cref="Physics2D"/> systems.</remarks>
|
||||
/// <param name="sphere">The sphere, in world space, to cast</param>
|
||||
/// <param name="hitsToPopulate">The list to populate with all <see cref="UIBlockHit"/> collisions, sorted by top-most-rendered (at index 0).</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <exception cref="System.ArgumentNullException">if <c><paramref name="hitsToPopulate"/> == null</c>.</exception>
|
||||
public static void SphereCollideAll(Sphere sphere, List<UIBlockHit> hitsToPopulate, int layerMask = AllLayers)
|
||||
{
|
||||
if (hitsToPopulate == null)
|
||||
{
|
||||
throw new System.ArgumentNullException($"Provided list of {nameof(hitsToPopulate)} is null.");
|
||||
}
|
||||
|
||||
InternalMethod_3195(sphere.InternalMethod_2349(), InternalField_3273, hitsToPopulate, layerMask);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a sphere collision test against all active <see cref="UIBlock"/>s in the scene and retrieves a <see cref="UIBlockHit"/> for the top-most-rendered <see cref="UIBlock"/> colliding with the provided <paramref name="sphere"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Performed by the Nova Input System, independent of the <see cref="Physics"/> and <see cref="Physics2D"/> systems.</remarks>
|
||||
/// <param name="sphere">The sphere, in world space, to cast</param>
|
||||
/// <param name="blockHit">A <see cref="UIBlockHit"/> for the top-most-rendered <see cref="UIBlock"/> colliding with the provided <paramref name="sphere"/>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <returns><see langword="true"/> if <i>any</i> <see cref="UIBlock"/> (on the <paramref name="layerMask"/>) collides with the provided <paramref name="sphere"/>.</returns>
|
||||
public static bool SphereCollide(Sphere sphere, out UIBlockHit blockHit, int layerMask = AllLayers)
|
||||
{
|
||||
if (InternalType_429.InternalProperty_200.InternalMethod_1690(sphere.InternalMethod_2349(), out InternalType_428 InternalVar_1, layerMask))
|
||||
{
|
||||
blockHit.UIBlock = InternalVar_1.InternalField_1642 as UIBlock;
|
||||
blockHit.Position = InternalVar_1.InternalField_1643;
|
||||
blockHit.Normal = InternalVar_1.InternalField_1644;
|
||||
return InternalVar_1.InternalField_1642 != null;
|
||||
}
|
||||
|
||||
blockHit.UIBlock = null;
|
||||
blockHit.Position = InternalType_187.InternalField_550;
|
||||
blockHit.Normal = InternalType_187.InternalField_550;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a raycast against all active <see cref="UIBlock"/>s in the scene and populates the provided list with <see cref="UIBlockHit"/>s for all <see cref="UIBlock"/>s intersecting with the provided <paramref name="ray"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Performed by the Nova Input System, independent of the <see cref="Physics"/> and <see cref="Physics2D"/> systems.</remarks>
|
||||
/// <param name="ray">The ray, in world space, to cast</param>
|
||||
/// <param name="hitsToPopulate">The list to populate with all <see cref="UIBlockHit"/> collisions, sorted by top-most-rendered (at index 0).</param>
|
||||
/// <param name="maxDistance">The max distance from the ray origin (in world space) to consider an intersection point a "hit".</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <exception cref="System.ArgumentNullException">if <c><paramref name="hitsToPopulate"/> == null</c>.</exception>
|
||||
public static void RaycastAll(Ray ray, List<UIBlockHit> hitsToPopulate, float maxDistance = float.PositiveInfinity, int layerMask = AllLayers)
|
||||
{
|
||||
InternalMethod_3009(ray, InternalField_3273, hitsToPopulate, maxDistance, layerMask);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a raycast against all active <see cref="UIBlock"/>s in the scene and retrieves a <see cref="UIBlockHit"/> for the top-most-rendered <see cref="UIBlock"/> colliding with the provided <paramref name="ray"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Performed by the Nova Input System, independent of the <see cref="Physics"/> and <see cref="Physics2D"/> systems.</remarks>
|
||||
/// <param name="ray">The ray, in world space, to cast</param>
|
||||
/// <param name="blockHit">A <see cref="UIBlockHit"/> for the top-most-rendered <see cref="UIBlock"/> colliding with the provided <paramref name="ray"/>.</param>
|
||||
/// <param name="maxDistance">The max distance from the ray origin (in world space) to consider an intersection point a "hit".</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <returns><see langword="true"/> if <i>any</i> <see cref="UIBlock"/> (on the <paramref name="layerMask"/> and within range) collides with the provided <paramref name="ray"/>.</returns>
|
||||
public static bool Raycast(Ray ray, out UIBlockHit blockHit, float maxDistance = float.PositiveInfinity, int layerMask = AllLayers)
|
||||
{
|
||||
if (InternalType_429.InternalProperty_200.InternalMethod_1691(ray, out InternalType_428 InternalVar_1, maxDistance, layerMask))
|
||||
{
|
||||
blockHit.UIBlock = InternalVar_1.InternalField_1642 as UIBlock;
|
||||
blockHit.Position = InternalVar_1.InternalField_1643;
|
||||
blockHit.Normal = InternalVar_1.InternalField_1644;
|
||||
return InternalVar_1.InternalField_1642 != null;
|
||||
}
|
||||
|
||||
blockHit.UIBlock = null;
|
||||
blockHit.Position = InternalType_187.InternalField_550;
|
||||
blockHit.Normal = InternalType_187.InternalField_550;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a sphere collision test with the provided <see cref="Sphere"/>,
|
||||
/// creates an <see cref="Update"/> from the results, and routes the <see cref="Update"/>
|
||||
/// to the collided <see cref="UIBlock"/> or the <see cref="UIBlock"/> currently capturing
|
||||
/// the active interaction.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Point updates are only delivered to <see cref="UIBlock"/>s with an attached
|
||||
/// <see cref="Interactable"/> or <see cref="Scroller"/> component.<br/><br/>
|
||||
/// To get the most reliable behavior between potentially conflicting press, drag,
|
||||
/// and scroll gestures, the entry point of the overlapping target <see cref="UIBlock"/>s
|
||||
/// <b>must</b> all be coplanar. If the entry points aren't coplanar, say a scrollable <see cref="ListView"/>'s
|
||||
/// front face is positioned behind a draggable list item's front face, attempts to scroll the <see cref="ListView"/>
|
||||
/// will likely fail, and the list item will be dragged instead.
|
||||
/// </remarks>
|
||||
/// <param name="sphere">The sphere, in world space, to cast</param>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.</param>
|
||||
/// <param name="userData">Any additional data to pass along to the receiver of the current interaction. See <see cref="Update.UserData"/>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <param name="accuracy">The accuracy of the input source, defaults to <see cref="InputAccuracy.Low"/>.</param>
|
||||
/// <seealso cref="Point(Update, bool, bool, float, int, InputAccuracy)"/>
|
||||
/// <seealso cref="Raycast(Ray, out UIBlockHit, float, int)"/>
|
||||
/// <seealso cref="RaycastAll(Ray, List{UIBlockHit}, float, int)"/>
|
||||
/// <seealso cref="SphereCollide(Sphere, out UIBlockHit, int)"/>
|
||||
/// <seealso cref="SphereCollideAll(Sphere, List{UIBlockHit}, int)"/>
|
||||
/// <seealso cref="Cancel(Update)"/>
|
||||
public static void Point(Sphere sphere, uint controlID, object userData = null, int layerMask = AllLayers, InputAccuracy accuracy = InputAccuracy.Low)
|
||||
{
|
||||
if (controlID < 0 || controlID >= InputRouter.InternalField_2940)
|
||||
{
|
||||
throw new System.ArgumentException($"Invalid Control ID [{controlID}]. Expected within range [0, {InputRouter.InternalField_2940}]");
|
||||
}
|
||||
|
||||
InternalType_432 InternalVar_1 = sphere.InternalMethod_2349();
|
||||
InternalMethod_3195(InternalVar_1, InternalField_3273, InternalField_3272, layerMask);
|
||||
|
||||
bool InternalVar_2 = InternalField_3272.Count > 0;
|
||||
|
||||
bool InternalVar_3 = false;
|
||||
bool InternalVar_4 = false;
|
||||
UIBlockHit InternalVar_5 = default;
|
||||
bool InternalVar_6 = false;
|
||||
|
||||
if (InternalVar_2)
|
||||
{
|
||||
InternalVar_6 = InternalField_3274.InternalMethod_502<bool>(controlID, out InternalVar_5);
|
||||
bool2 InternalVar_7 = InternalMethod_2992<bool>(InternalField_3272, InternalParameter_2418: InternalVar_5.UIBlock);
|
||||
|
||||
InternalVar_3 = InternalVar_7.x;
|
||||
InternalVar_4 = InternalVar_7.y;
|
||||
|
||||
if (InternalVar_3 && !InternalVar_4 && InternalVar_6)
|
||||
{
|
||||
Plane InternalVar_8 = new Plane(InternalVar_5.Normal, InternalVar_5.Position);
|
||||
Vector3 InternalVar_9 = InternalVar_8.ClosestPointOnPlane(InternalVar_1.InternalField_1663);
|
||||
InternalVar_4 = Vector3.Distance(InternalVar_9, InternalVar_1.InternalField_1663) <= InternalVar_1.InternalField_1664;
|
||||
}
|
||||
}
|
||||
|
||||
bool InternalVar_10 = false;
|
||||
if (!InternalVar_3 && (InternalVar_6 || InternalField_3274.InternalMethod_502<bool>(controlID, out InternalVar_5)))
|
||||
{
|
||||
Plane InternalVar_11 = new Plane(InternalVar_5.Normal, InternalVar_5.Position);
|
||||
Vector3 InternalVar_12 = InternalVar_11.ClosestPointOnPlane(InternalVar_1.InternalField_1663);
|
||||
|
||||
if (InternalVar_11.GetSide(InternalVar_1.InternalField_1663))
|
||||
{
|
||||
InternalField_3272.Add(new UIBlockHit() { UIBlock = InternalVar_5.UIBlock, Position = InternalVar_12, Normal = InternalVar_5.Normal });
|
||||
InternalVar_3 = true;
|
||||
InternalVar_4 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
float InternalVar_13 = Vector3.Distance(InternalVar_1.InternalField_1663, InternalVar_12);
|
||||
|
||||
if (InternalVar_13 <= InternalVar_1.InternalField_1664)
|
||||
{
|
||||
UIBlock InternalVar_14 = InternalVar_5.UIBlock.Root;
|
||||
|
||||
Bounds InternalVar_15 = new Bounds(InternalVar_14.InternalProperty_21, InternalVar_14.InternalProperty_20 + (Vector3.one * 2 * InternalType_187.InternalField_494));
|
||||
Vector3 InternalVar_16 = InternalType_187.InternalMethod_3642(InternalVar_14.transform.InverseTransformPoint(InternalVar_12));
|
||||
|
||||
if (InternalVar_15.Contains(InternalVar_16))
|
||||
{
|
||||
InternalField_3272.Add(new UIBlockHit() { UIBlock = InternalVar_5.UIBlock, Position = InternalVar_12, Normal = InternalVar_5.Normal });
|
||||
InternalVar_2 = true;
|
||||
}
|
||||
}
|
||||
else if (InternalVar_13 > InternalVar_1.InternalField_1664 * InternalField_3301)
|
||||
{
|
||||
InternalVar_10 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 InternalVar_17 = InternalField_3272.Count > 0 ? (InternalField_3272[0].Position - sphere.Center).normalized : Vector3.zero;
|
||||
|
||||
Ray InternalVar_18 = new Ray(sphere.Center - InternalVar_17 * sphere.Radius, InternalVar_17);
|
||||
Update InternalVar_19 = new Update(InternalVar_18, controlID, userData);
|
||||
|
||||
if (InternalVar_10)
|
||||
{
|
||||
InternalField_3274.InternalMethod_501(InternalVar_19.InternalMethod_2204());
|
||||
}
|
||||
else
|
||||
{
|
||||
bool InternalVar_20 = InternalVar_2 && (InternalVar_3 == InternalVar_4) && InternalField_3272.Count > 0;
|
||||
|
||||
InternalMethod_3007(ref InternalVar_19, InternalField_3272, InternalParameter_2887: InternalVar_20, InternalType_85.InternalField_285, InternalParameter_2420: accuracy == InputAccuracy.Low);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a raycast with the provided <see cref="Update.Ray"/> and routes the <paramref name="update"/> update to the collided <see cref="UIBlock"/> or the <see cref="UIBlock"/> currently capturing the active interaction.
|
||||
/// </summary>
|
||||
/// <remarks>Point updates are only delivered to <see cref="UIBlock"/>s with an attached <see cref="Interactable"/> or <see cref="Scroller"/> component.</remarks>
|
||||
/// <param name="update">The data tied to this interaction update. <see cref="Update.Ray"/> is in world space.</param>
|
||||
/// <param name="pointerDown">A flag to indicate the "pressed" state of the control represented by <see cref="Update.ControlID"/>.</param>
|
||||
/// <param name="allowDrag">A flag to indicate whether or not this call to <see cref="Point(Update, bool, bool, float, int, InputAccuracy)"/> can trigger or update an <see cref="Gesture.OnDrag"/> event.</param>
|
||||
/// <param name="maxDistance">The max distance from the ray origin (in world space) to consider an intersection point a "hit".</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <param name="accuracy">The accuracy of the input source, defaults to <see cref="InputAccuracy.High"/>.</param>
|
||||
/// <seealso cref="Point(Sphere, uint, object, int, InputAccuracy)"/>
|
||||
/// <seealso cref="Raycast(Ray, out UIBlockHit, float, int)"/>
|
||||
/// <seealso cref="RaycastAll(Ray, List{UIBlockHit}, float, int)"/>
|
||||
/// <seealso cref="SphereCollide(Sphere, out UIBlockHit, int)"/>
|
||||
/// <seealso cref="SphereCollideAll(Sphere, List{UIBlockHit}, int)"/>
|
||||
/// <seealso cref="Cancel(Update)"/>
|
||||
public static void Point(Update update, bool pointerDown, bool allowDrag = true, float maxDistance = float.PositiveInfinity, int layerMask = AllLayers, InputAccuracy accuracy = InputAccuracy.High)
|
||||
{
|
||||
InternalType_85 InternalVar_1 = pointerDown ? InternalType_85.InternalField_1162 : InternalType_85.InternalField_284;
|
||||
InternalMethod_3008<bool>(update, maxDistance, layerMask, InternalField_3272, InternalVar_1);
|
||||
|
||||
InternalType_85 InternalVar_2 = allowDrag ? InternalType_85.InternalField_285 : InternalType_85.InternalField_1162;
|
||||
InternalMethod_3007(ref update, InternalField_3272, pointerDown, InternalVar_2, InternalParameter_2420: accuracy == InputAccuracy.Low);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a raycast with the provided <see cref="Update.Ray"/> and routes the <paramref name="scroll"/> update to the collided <see cref="UIBlock"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Scroll updates are only delivered to <see cref="UIBlock"/>s with an attached <see cref="Scroller"/> component.</remarks>
|
||||
/// <param name="update">The data tied to this interaction update. <see cref="Update.Ray"/> is in world space.</param>
|
||||
/// <param name="scroll">A normalized scroll vector</param>
|
||||
/// <param name="maxDistance">The max distance from the ray origin (in world space) to consider an intersection point a "hit".</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <param name="accuracy">The accuracy of the input source, defaults to <see cref="InputAccuracy.High"/>.</param>
|
||||
public static void Scroll(Update update, Vector3 scroll, float maxDistance = float.PositiveInfinity, int layerMask = AllLayers, InputAccuracy accuracy = InputAccuracy.High)
|
||||
{
|
||||
InternalMethod_3008<InternalType_755<Vector3>>(update, maxDistance, layerMask, InternalField_3272, InternalType_85.InternalField_284);
|
||||
InternalMethod_3007(ref update, InternalField_3272, new InternalType_755<Vector3>(ref scroll), InternalType_85.InternalField_284, InternalParameter_2420: accuracy == InputAccuracy.Low);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel the most recent/current gesture triggered by the input control mapped to <paramref name="update"/>.<see cref="Update.ControlID">ControlID</see>.
|
||||
/// </summary>
|
||||
/// <param name="update">The data tied to this interaction update. <see cref="Update.Ray"/> is in world space.</param>
|
||||
public static void Cancel(Update update)
|
||||
{
|
||||
InternalField_3274.InternalMethod_501(update.InternalMethod_2204());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancel the recent/current gesture triggered by the input control mapped to <paramref name="controlID"/>.
|
||||
/// </summary>
|
||||
/// <param name="controlID">The unique identifier of the input control whose gesture the caller wishes to cancel.</param>
|
||||
public static void Cancel(uint controlID = 0)
|
||||
{
|
||||
InternalField_3274.InternalMethod_501(new InternalNamespace_0.InternalType_78(controlID));
|
||||
}
|
||||
|
||||
#region
|
||||
private static void InternalMethod_3195(InternalType_432 InternalParameter_3027, List<InternalType_428> InternalParameter_3026, List<UIBlockHit> InternalParameter_2944, int InternalParameter_2943)
|
||||
{
|
||||
InternalParameter_3026.Clear();
|
||||
InternalParameter_2944.Clear();
|
||||
|
||||
InternalType_429.InternalProperty_200.InternalMethod_1689(InternalParameter_3027, InternalParameter_3026, InternalParameter_2943);
|
||||
|
||||
for (int InternalVar_1 = 0; InternalVar_1 < InternalParameter_3026.Count; ++InternalVar_1)
|
||||
{
|
||||
InternalType_428 InternalVar_2 = InternalParameter_3026[InternalVar_1];
|
||||
|
||||
InternalParameter_2944.Add(new UIBlockHit()
|
||||
{
|
||||
UIBlock = InternalVar_2.InternalField_1642 as UIBlock,
|
||||
Position = InternalVar_2.InternalField_1643,
|
||||
Normal = InternalVar_2.InternalField_1644,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static bool InternalMethod_3009(Ray InternalParameter_2942, List<InternalType_428> InternalParameter_2941, List<UIBlockHit> InternalParameter_2940, float InternalParameter_2939, int InternalParameter_2938)
|
||||
{
|
||||
InternalParameter_2941.Clear();
|
||||
InternalParameter_2940.Clear();
|
||||
InternalType_429.InternalProperty_200.InternalMethod_1686(InternalParameter_2942, InternalParameter_2941, InternalParameter_2939, InternalParameter_2938);
|
||||
|
||||
for (int InternalVar_1 = 0; InternalVar_1 < InternalParameter_2941.Count; ++InternalVar_1)
|
||||
{
|
||||
InternalType_428 InternalVar_2 = InternalParameter_2941[InternalVar_1];
|
||||
|
||||
InternalParameter_2940.Add(new UIBlockHit()
|
||||
{
|
||||
UIBlock = InternalVar_2.InternalField_1642 as UIBlock,
|
||||
Position = InternalVar_2.InternalField_1643,
|
||||
Normal = InternalVar_2.InternalField_1644
|
||||
});
|
||||
}
|
||||
|
||||
return InternalParameter_2940.Count > 0;
|
||||
}
|
||||
|
||||
|
||||
private static void InternalMethod_3008<TInput>(Update InternalParameter_2937, float InternalParameter_2893, int InternalParameter_2892, List<UIBlockHit> InternalParameter_2891, InternalType_85 InternalParameter_2890) where TInput : unmanaged, System.IEquatable<TInput>
|
||||
{
|
||||
uint InternalVar_1 = InternalParameter_2937.ControlID;
|
||||
if (InternalVar_1 < 0 || InternalVar_1 >= InputRouter.InternalField_2940)
|
||||
{
|
||||
throw new System.ArgumentException($"Invalid Control ID [{InternalVar_1}]. Expected within range [0, {InputRouter.InternalField_2940}]");
|
||||
}
|
||||
|
||||
if (InternalMethod_3009(InternalParameter_2937.Ray, InternalField_3273, InternalParameter_2891, InternalParameter_2893, InternalParameter_2892))
|
||||
{
|
||||
_ = InternalMethod_2992<TInput>(InternalParameter_2891);
|
||||
}
|
||||
|
||||
if (InternalParameter_2891.Count > 0 || InternalParameter_2890 == InternalType_85.InternalField_284)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!InternalField_3274.InternalMethod_502<TInput>(InternalVar_1, out UIBlockHit InternalVar_2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Plane InternalVar_3 = new Plane(InternalVar_2.Normal, InternalVar_2.Position);
|
||||
Vector3 InternalVar_4 = InternalVar_2.Position;
|
||||
|
||||
if (InternalVar_3.Raycast(InternalParameter_2937.Ray, out float InternalVar_5))
|
||||
{
|
||||
InternalVar_4 = InternalParameter_2937.Ray.GetPoint(InternalType_187.InternalMethod_869(InternalVar_5, InternalParameter_2893));
|
||||
}
|
||||
|
||||
InternalParameter_2891.Add(new UIBlockHit() { Normal = InternalVar_3.normal, Position = InternalVar_4, UIBlock = InternalVar_2.UIBlock });
|
||||
}
|
||||
|
||||
|
||||
private static void InternalMethod_3007<TInput>(ref Update InternalParameter_2889, List<UIBlockHit> InternalParameter_2888, TInput InternalParameter_2887, InternalType_85 InternalParameter_2421, bool InternalParameter_2420) where TInput : unmanaged, System.IEquatable<TInput>
|
||||
{
|
||||
InternalField_3274.InternalMethod_2056(InternalParameter_2889.InternalMethod_2204(), InternalParameter_2887, InternalParameter_2693: InternalParameter_2888.InternalMethod_2043(), InternalParameter_2421, InternalParameter_2420);
|
||||
}
|
||||
|
||||
private static bool2 InternalMethod_2992<T>(List<UIBlockHit> InternalParameter_2419, UIBlock InternalParameter_2418 = null) where T : unmanaged, System.IEquatable<T>
|
||||
{
|
||||
bool InternalVar_1 = false;
|
||||
|
||||
for (int InternalVar_2 = InternalParameter_2419.Count - 1; InternalVar_2 >= 0; --InternalVar_2)
|
||||
{
|
||||
UIBlockHit InternalVar_3 = InternalParameter_2419[InternalVar_2];
|
||||
|
||||
if (!InternalVar_3.UIBlock.InternalMethod_82<T>())
|
||||
{
|
||||
InternalParameter_2419.RemoveAt(InternalVar_2);
|
||||
continue;
|
||||
}
|
||||
|
||||
InternalVar_1 |= InternalVar_3.UIBlock == InternalParameter_2418;
|
||||
|
||||
if (InternalVar_2 < InternalParameter_2419.Count - 1)
|
||||
{
|
||||
InternalType_75 InternalVar_4 = InternalVar_3.UIBlock.InternalProperty_23.InternalProperty_1149;
|
||||
|
||||
if (InternalVar_4 != null && InternalVar_4.InternalProperty_741)
|
||||
{
|
||||
InternalParameter_2419.RemoveRange(InternalVar_2 + 1, InternalParameter_2419.Count - InternalVar_2 - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new bool2(InternalParameter_2419.Count > 0, InternalVar_1 && InternalParameter_2418 != null);
|
||||
}
|
||||
|
||||
private static InternalType_521<UIBlockHit> InternalMethod_2991<T>(List<UIBlockHit> InternalParameter_2417) where T : unmanaged, System.IEquatable<T>
|
||||
{
|
||||
UIBlockHit InternalVar_1 = default;
|
||||
|
||||
for (int InternalVar_2 = 0; InternalVar_2 < InternalParameter_2417.Count; ++InternalVar_2)
|
||||
{
|
||||
UIBlockHit InternalVar_3 = InternalParameter_2417[InternalVar_2];
|
||||
|
||||
if (InternalVar_3.UIBlock.InternalMethod_82<T>())
|
||||
{
|
||||
InternalVar_1 = InternalVar_3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InternalParameter_2417.Clear();
|
||||
|
||||
if (InternalVar_1.UIBlock != null)
|
||||
{
|
||||
InternalParameter_2417.Add(InternalVar_1);
|
||||
}
|
||||
|
||||
return InternalParameter_2417.InternalMethod_2043();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c677245c1dbe2cb49be2bffbb81754ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,232 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Have an element resize automatically based on the size of its parent or the size of its children
|
||||
/// </summary>
|
||||
public enum AutoSize
|
||||
{
|
||||
/// <summary>
|
||||
/// No autosizing
|
||||
/// </summary>
|
||||
None = InternalNamespace_0.InternalType_83.InternalField_280,
|
||||
/// <summary>
|
||||
/// Match size of parent
|
||||
/// </summary>
|
||||
Expand = InternalNamespace_0.InternalType_83.InternalField_281,
|
||||
/// <summary>
|
||||
/// Match size of children
|
||||
/// </summary>
|
||||
Shrink = InternalNamespace_0.InternalType_83.InternalField_282,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The configurable set of layout properties used for sizing/positioning elements in a hierarchy
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
[System.Serializable]
|
||||
public struct Layout : System.IEquatable<Layout>
|
||||
{
|
||||
/// <summary>
|
||||
/// The 3D size configuration of this <see cref="Layout"/>
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length3 Size;
|
||||
/// <summary>
|
||||
/// The 3D position configuration of this <see cref="Layout"/>
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length3 Position;
|
||||
/// <summary>
|
||||
/// The 3D padding configuration of this <see cref="Layout"/>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Padding is space applied inwards from the size bounds
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
public LengthBounds Padding;
|
||||
/// <summary>
|
||||
/// The 3D margin configuration of this <see cref="Layout"/>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Margin is space applied outwards from the size bounds
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
public LengthBounds Margin;
|
||||
|
||||
/// <summary>
|
||||
/// The min/max range used to clamp <see cref="Size"/> during the layout calculation process
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public MinMax3 SizeMinMax;
|
||||
|
||||
/// <summary>
|
||||
/// The min/max range used to clamp <see cref="Position"/> during the layout calculation process
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public MinMax3 PositionMinMax;
|
||||
/// <summary>
|
||||
/// The min/max range used to clamp <see cref="Padding"/> during the layout calculation process
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public MinMaxBounds PaddingMinMax;
|
||||
/// <summary>
|
||||
/// The min/max range used to clamp <see cref="Margin"/> during the layout calculation process
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public MinMaxBounds MarginMinMax;
|
||||
|
||||
/// <summary>
|
||||
/// The 3D alignment configuration for this <see cref="Layout"/>
|
||||
/// </summary>
|
||||
/// <remarks><see cref="Position"/> is a configured offset from the point of alignment per-axis </remarks>
|
||||
[SerializeField]
|
||||
public Alignment Alignment;
|
||||
|
||||
/// <summary>
|
||||
/// Allows <see cref="Size"/> to automatically adapt to the size of a parent <see cref="Layout"/> or set of child <see cref="Layout">Layouts</see>
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public ThreeD<AutoSize> AutoSize;
|
||||
|
||||
/// <summary>
|
||||
/// A flag indicating to the layout system to account for the owner's rotation when performing certain <see cref="Size"/> and <see cref="Position"/> calculations
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool RotateSize;
|
||||
|
||||
[SerializeField, HideInInspector]
|
||||
[InternalType_22]
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal Vector3 AspectRatio;
|
||||
|
||||
/// <summary>
|
||||
/// Lock the aspect ratio of <see cref="Size"/> by setting the "unlocked" axis
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Axis AspectRatioAxis;
|
||||
|
||||
/// <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 ==(Layout lhs, Layout rhs)
|
||||
{
|
||||
return lhs.Size == rhs.Size &&
|
||||
lhs.Position == rhs.Position &&
|
||||
lhs.Padding == rhs.Padding &&
|
||||
lhs.Margin == rhs.Margin &&
|
||||
lhs.SizeMinMax == rhs.SizeMinMax &&
|
||||
lhs.PositionMinMax == rhs.PositionMinMax &&
|
||||
lhs.PaddingMinMax == rhs.PaddingMinMax &&
|
||||
lhs.MarginMinMax == rhs.MarginMinMax &&
|
||||
lhs.Alignment == rhs.Alignment &&
|
||||
lhs.AutoSize.Equals(rhs.AutoSize) &&
|
||||
lhs.RotateSize == rhs.RotateSize &&
|
||||
lhs.AspectRatio == rhs.AspectRatio &&
|
||||
lhs.AspectRatioAxis == rhs.AspectRatioAxis;
|
||||
}
|
||||
|
||||
/// <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 !=(Layout lhs, Layout rhs)
|
||||
{
|
||||
return lhs.Size != rhs.Size ||
|
||||
lhs.Position != rhs.Position ||
|
||||
lhs.Padding != rhs.Padding ||
|
||||
lhs.Margin != rhs.Margin ||
|
||||
lhs.SizeMinMax != rhs.SizeMinMax ||
|
||||
lhs.PositionMinMax != rhs.PositionMinMax ||
|
||||
lhs.PaddingMinMax != rhs.PaddingMinMax ||
|
||||
lhs.MarginMinMax != rhs.MarginMinMax ||
|
||||
lhs.Alignment != rhs.Alignment ||
|
||||
!lhs.AutoSize.Equals(rhs.AutoSize) ||
|
||||
lhs.RotateSize != rhs.RotateSize ||
|
||||
lhs.AspectRatio != rhs.AspectRatio ||
|
||||
lhs.AspectRatioAxis != rhs.AspectRatioAxis;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The hashcode for this <see cref="Layout"/>
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Size.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Position.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Padding.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Margin.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + SizeMinMax.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + PositionMinMax.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + PaddingMinMax.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + MarginMinMax.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Alignment.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + AutoSize.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + RotateSize.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + AspectRatio.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + AspectRatioAxis.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Layout"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Layout layout)
|
||||
{
|
||||
return this == layout;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Layout"/> to compare</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(Layout other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="Length.One"/> cube layout
|
||||
/// </summary>
|
||||
public static readonly Layout ThreeD = new Layout()
|
||||
{
|
||||
Size = Length3.FixedValue(10, 10, 10),
|
||||
SizeMinMax = MinMax3.Positive,
|
||||
Position = Length3.Zero,
|
||||
PositionMinMax = MinMax3.Unclamped,
|
||||
PaddingMinMax = MinMaxBounds.Positive,
|
||||
MarginMinMax = MinMaxBounds.Unclamped,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="Length.One"/> rectangle layout
|
||||
/// </summary>
|
||||
public static readonly Layout TwoD = new Layout()
|
||||
{
|
||||
Size = Length2.FixedValue(10, 10),
|
||||
SizeMinMax = MinMax3.Positive,
|
||||
Position = Length3.Zero,
|
||||
PositionMinMax = MinMax3.Unclamped,
|
||||
PaddingMinMax = MinMaxBounds.Positive,
|
||||
MarginMinMax = MinMaxBounds.Unclamped,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a58c14d923ee62b46b7f8bef4edbacd2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,448 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a type of <see cref="Length"/>.
|
||||
/// </summary>
|
||||
public enum LengthType
|
||||
{
|
||||
/// <summary>
|
||||
/// A fixed value measurement.
|
||||
/// </summary>
|
||||
Value = InternalNamespace_0.InternalType_59.InternalField_201,
|
||||
|
||||
/// <summary>
|
||||
/// A relative measurement as a percentage.
|
||||
/// </summary>
|
||||
Percent = InternalNamespace_0.InternalType_59.InternalField_202,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A measurement represented as a fixed value or as a percentage.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_2)]
|
||||
public struct Length : IEquatable<Length>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_2 = InternalNamespace_0.InternalType_45.InternalField_144;
|
||||
|
||||
/// <summary>
|
||||
/// Zero <see cref="Length"/>.
|
||||
/// </summary>
|
||||
/// <value>An empty <see cref="Length"/>.</value>
|
||||
public static readonly Length Zero = default(Length);
|
||||
|
||||
/// <summary>
|
||||
/// Fixed <see cref="Length"/> of 1.
|
||||
/// </summary>
|
||||
/// <value>A unit <see cref="Length"/>.</value>
|
||||
public static readonly Length One = new Length() { Raw = 1, Type = LengthType.Value };
|
||||
|
||||
/// <summary>
|
||||
/// The numeric value associated with this <see cref="Length"/>.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// If <c><see cref="Type"/> == <see cref="LengthType.Percent"/></c>, <see cref="Raw"/> represents a measurement as a percentage, <c>1 == 100%</c>.
|
||||
/// <br/>
|
||||
/// If <c><see cref="Type"/> == <see cref="LengthType.Value"/></c>, <see cref="Raw"/> represents a measurement in units.
|
||||
/// </value>
|
||||
[SerializeField]
|
||||
[field: FieldOffset(0 * sizeof(float))]
|
||||
public float Raw;
|
||||
|
||||
/// <summary>
|
||||
/// The type of <seealso cref="Length"/>.
|
||||
/// </summary>
|
||||
/// <value>Tells the system how to interpret <see cref="Raw"/></value>.
|
||||
[SerializeField]
|
||||
[field: FieldOffset(1 * sizeof(float))]
|
||||
public LengthType Type;
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: If <c><see cref="Type"/> == <see cref="LengthType.Value"/></c>, returns <see cref="Raw"/>. Otherwise returns <c>float.NaN</c>.<br/>
|
||||
/// <c>set</c>: Assigns <see cref="Raw"/> to the provided float value and assigns <see cref="Type"/> to <see cref="LengthType.Value"/>.
|
||||
/// </summary>
|
||||
public float Value
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return Type == LengthType.Value ? Raw : float.NaN;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (float.IsNaN(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Type = LengthType.Value;
|
||||
Raw = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: If <c><see cref="Type"/> == <see cref="LengthType.Percent"/></c>, returns <see cref="Raw"/>. Otherwise returns <c>float.NaN</c>.<br/>
|
||||
/// <c>set</c>: Assigns <see cref="Raw"/> to the provided float value and assigns <see cref="Type"/> to <see cref="LengthType.Percent"/>.<br/><br/>
|
||||
/// <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
public float Percent
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return Type == LengthType.Percent ? Raw : float.NaN;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (float.IsNaN(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Type = LengthType.Percent;
|
||||
Raw = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Construct a new <see cref="Length"/>.</summary>
|
||||
/// <param name="raw">The numeric value, <see cref="Raw"/>.</param>
|
||||
/// <param name="type">The type of length, <see cref="Type"/>.</param>
|
||||
public Length(float raw, LengthType type)
|
||||
{
|
||||
Raw = raw;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Percent">Percent</see> <see cref="Length"/>, <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
/// <param name="percent">The measurement of the length as a percent, <c>1 == 100%</c>.</param>
|
||||
/// <returns>A new <see cref="LengthType.Percent">Percent</see> <see cref="Length"/>.</returns>
|
||||
public static Length Percentage(float percent)
|
||||
{
|
||||
return new Length(percent, LengthType.Percent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Value">Value</see> <see cref="Length"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The measurement of the length in units.</param>
|
||||
/// <returns>A new <see cref="LengthType.Value">Value</see> <see cref="Length"/>.</returns>
|
||||
public static Length FixedValue(float value)
|
||||
{
|
||||
return new Length(value, LengthType.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length"/>.</returns>
|
||||
public static Length operator *(Length lhs, float rhs)
|
||||
{
|
||||
lhs.Raw *= rhs;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length"/>.</returns>
|
||||
public static Length operator /(Length lhs, float rhs)
|
||||
{
|
||||
return lhs * (1 / rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="rhs"/> by <paramref name="lhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length"/>.</returns>
|
||||
public static Length operator *(float lhs, Length rhs)
|
||||
{
|
||||
return rhs * lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length"/>.</returns>
|
||||
public static Length operator /(float lhs, Length rhs)
|
||||
{
|
||||
rhs.Raw = lhs / rhs.Raw;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numeric negation operator, multiplies <paramref name="rhs"/> by -1.
|
||||
/// </summary>
|
||||
/// <param name="rhs">Right hand size.</param>
|
||||
/// <returns>A new <see cref="Length"/>, <c>length</c>, where <c>length.Raw == -<paramref name="rhs"/>.Raw</c>.</returns>
|
||||
public static Length operator -(Length rhs)
|
||||
{
|
||||
return rhs * -1;
|
||||
}
|
||||
|
||||
/// <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"/>.Raw == <paramref name="rhs"/>.Raw && <paramref name="lhs"/>.Type == <paramref name="rhs"/>.Type</c>.</returns>
|
||||
public static bool operator ==(Length lhs, Length rhs)
|
||||
{
|
||||
return lhs.Raw == rhs.Raw && lhs.Type == rhs.Type;
|
||||
}
|
||||
|
||||
/// <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"/>.Raw != <paramref name="rhs"/>.Raw || <paramref name="lhs"/>.Type != <paramref name="rhs"/>.Type</c>.</returns>
|
||||
public static bool operator !=(Length lhs, Length rhs)
|
||||
{
|
||||
return lhs.Raw != rhs.Raw || lhs.Type != rhs.Type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a float, <paramref name="f"/> to a <see cref="LengthType.Value">Value</see> <see cref="Length"/>.
|
||||
/// </summary>
|
||||
/// <param name="f">The length in units, <see cref="Value"/>.</param>
|
||||
public static implicit operator Length(float f)
|
||||
{
|
||||
return FixedValue(f);
|
||||
}
|
||||
|
||||
internal static float InternalMethod_2428(float InternalParameter_2638, Length InternalParameter_2637, MinMax InternalParameter_2636, float InternalParameter_2635)
|
||||
{
|
||||
return InternalParameter_2637.Type == LengthType.Percent ? InternalParameter_2635 == 0 ? InternalParameter_2637.Raw : InternalParameter_2636.Clamp(InternalParameter_2638) / InternalParameter_2635 : InternalParameter_2636.Clamp(InternalParameter_2638);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Length"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Length length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Length"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Length other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Length"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + ((int)Type).GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Raw.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Length"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return Type == LengthType.Value ? $"{Raw.ToString(InternalType_667.InternalField_3021, InternalType_667.InternalField_3020)}" : $"{(Raw * 100).ToString(InternalType_667.InternalField_3021, InternalType_667.InternalField_3020)}%";
|
||||
}
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// A calculated, readonly output of a <see cref="Length"/>.
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_4)]
|
||||
public readonly struct Calculated : IEquatable<Calculated>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_4 = InternalNamespace_0.InternalType_45.InternalType_47.InternalField_152;
|
||||
|
||||
/// <summary>
|
||||
/// The measurement of the relevant <seealso cref="Length"/> in units.
|
||||
/// </summary>
|
||||
/// <value><c>Value = <see cref="Percent">Percent</see> * relative</c>.</value>
|
||||
[FieldOffset(0 * sizeof(float))]
|
||||
public readonly float Value;
|
||||
|
||||
/// <summary>
|
||||
/// The measurement of the relevant <seealso cref="Length"/> as a percent of a relative value, <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
/// <value><c>Percent = <see cref="Value">Value</see> / relative</c>.</value>
|
||||
[FieldOffset(1 * sizeof(float))]
|
||||
public readonly float Percent;
|
||||
|
||||
/// <summary>
|
||||
/// Addition operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == <paramref name="lhs"/>.Value + <paramref name="rhs"/>.Value</c> and <c>length.Percent == <paramref name="lhs"/>.Percent + <paramref name="rhs"/>.Percent</c>.</returns>
|
||||
public static Calculated operator +(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return new Calculated(lhs.Value + rhs.Value, lhs.Percent + rhs.Percent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subtraction operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == <paramref name="lhs"/>.Value - <paramref name="rhs"/>.Value</c> and <c>length.Percent == <paramref name="lhs"/>.Percent - <paramref name="rhs"/>.Percent</c>.</returns>
|
||||
public static Calculated operator -(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return new Calculated(lhs.Value - rhs.Value, lhs.Percent - rhs.Percent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == <paramref name="lhs"/>.Value / <paramref name="rhs"/>.Value</c> and <c>length.Percent == <paramref name="lhs"/>.Percent / <paramref name="rhs"/>.Percent</c>.</returns>
|
||||
public static Calculated operator /(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return new Calculated(lhs.Value / rhs.Value, lhs.Percent / rhs.Percent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == <paramref name="lhs"/>.Value * <paramref name="rhs"/>.Value</c> and <c>length.Percent == <paramref name="lhs"/>.Percent * <paramref name="rhs"/>.Percent</c>.</returns>
|
||||
public static Calculated operator *(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return new Calculated(lhs.Value * rhs.Value, lhs.Percent * rhs.Percent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == <paramref name="lhs"/>.Value * <paramref name="rhs"/></c> and <c>length.Percent == <paramref name="lhs"/>.Percent * <paramref name="rhs"/></c>.</returns>
|
||||
public static Calculated operator *(Calculated lhs, float rhs)
|
||||
{
|
||||
return new Calculated(lhs.Value * rhs, lhs.Percent * rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == <paramref name="lhs"/>.Value / <paramref name="rhs"/></c> and <c>length.Percent == <paramref name="lhs"/>.Percent / <paramref name="rhs"/></c>.</returns>
|
||||
public static Calculated operator /(Calculated lhs, float rhs)
|
||||
{
|
||||
return new Calculated(lhs.Value / rhs, lhs.Percent / rhs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numeric negation operator.
|
||||
/// </summary>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Calculated"/>, <c>length</c>, where <c>length.Value == -<paramref name="lhs"/>.Value</c> and <c>length.Percent == -<paramref name="lhs"/>.Percent</c>.</returns>
|
||||
public static Calculated operator -(Calculated rhs)
|
||||
{
|
||||
return new Calculated(-rhs.Value, -rhs.Percent);
|
||||
}
|
||||
|
||||
/// <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"/>.Value == <paramref name="rhs"/>.Value && <paramref name="lhs"/>.Percent == <paramref name="lhs"/>.Percent</c>.</returns>
|
||||
public static bool operator ==(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.Value == rhs.Value && lhs.Percent == rhs.Percent;
|
||||
}
|
||||
|
||||
/// <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"/>.Value != <paramref name="rhs"/>.Value || <paramref name="lhs"/>.Percent != <paramref name="lhs"/>.Percent</c>.</returns>
|
||||
public static bool operator !=(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.Value != rhs.Value || lhs.Percent != rhs.Percent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Calculated"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Calculated length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Calculated"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == other</c>.</returns>
|
||||
public bool Equals(Calculated other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Calculated"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Percent.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Value.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <param name="value">The measurement of the length in units.</param>
|
||||
/// <param name="percent">The measurement of the length as a percent.</param>
|
||||
public Calculated(float value, float percent)
|
||||
{
|
||||
Value = value;
|
||||
Percent = percent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{{Val = {Value.ToString(InternalType_667.InternalField_3021, InternalType_667.InternalField_3020)}, {(Percent * 100).ToString(InternalType_667.InternalField_3021, InternalType_667.InternalField_3020)}%}}";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b23f0777fa831294087581dc72a9f95e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,600 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A 2D <see cref="Length"/> or a <see cref="Length"/> Pair.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="X"/> and <see cref="First"/> read from and write to the same location in memory, as do <see cref="Y"/> and <see cref="Second"/>. This makes them interchangable and subject to user preference or context.</remarks>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit)]
|
||||
public struct Length2 : IEquatable<Length2>
|
||||
{
|
||||
/// <summary>
|
||||
/// The X-axis component of this 2D Length.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="First"/>, making the two interchangeable.</remarks>
|
||||
[SerializeField]
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
public Length X;
|
||||
/// <summary>
|
||||
/// The Y-axis component of this 2D Length.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="Second"/>, making the two interchangeable.</remarks>
|
||||
[SerializeField]
|
||||
[FieldOffset(1 * Length.InternalField_2)]
|
||||
public Length Y;
|
||||
|
||||
/// <summary>
|
||||
/// The first component of this Length Pair.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="X"/>, making the two interchangeable.</remarks>
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
[NonSerialized]
|
||||
public Length First;
|
||||
|
||||
/// <summary>
|
||||
/// The second component of this Length Pair.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="Y"/>, making the two interchangeable.</remarks>
|
||||
[FieldOffset(1 * Length.InternalField_2)]
|
||||
[NonSerialized]
|
||||
public Length Second;
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: If <c><see cref="Type"/> == <see cref="LengthType.Value"/></c>, returns <see cref="Raw"/>. Otherwise returns <c>float.NaN</c>.<br/>
|
||||
/// <c>set</c>: Assigns <see cref="Raw"/> to the provided float value and assigns <see cref="Type"/> to <see cref="LengthType.Value"/>.
|
||||
/// </summary>
|
||||
public Vector2 Value
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new Vector2(X.Value, Y.Value);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Value = value.x;
|
||||
Y.Value = value.y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: If <c><see cref="Type"/> == <see cref="LengthType.Percent"/></c>, returns <see cref="Raw"/>. Otherwise returns <c>float.NaN</c>.<br/>
|
||||
/// <c>set</c>: Assigns <see cref="Raw"/> to the provided float value and assigns <see cref="Type"/> to <see cref="LengthType.Percent"/>.<br/><br/>
|
||||
/// <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
public Vector2 Percent
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new Vector2(X.Percent, Y.Percent);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Percent = value.x;
|
||||
Y.Percent = value.y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The numeric values associated with this <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// If <see cref="Length.Type"/> == <see cref="LengthType.Percent"/>, <see cref="Raw"/> represents a measurement as a percentage, <c>1 == 100%</c>.
|
||||
/// <br/>
|
||||
/// If <see cref="Length.Type"/> == <see cref="LengthType.Value"/>, <see cref="Raw"/> represents a measurement in units.
|
||||
/// </value>
|
||||
public Vector2 Raw
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new Vector2(X.Raw, Y.Raw);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Raw = value.x;
|
||||
Y.Raw = value.y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of each <seealso cref="Length"/>. Tells the system how to interpret <see cref="Raw"/> per component.
|
||||
/// </summary>
|
||||
public TwoD<LengthType> Type
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new TwoD<LengthType>(X.Type, Y.Type);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Type = value.X;
|
||||
Y.Type = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access each component by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/>, <see cref="First"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/>, <see cref="Second"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length"/> for the given index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 1</exception>
|
||||
public Length this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Value">Value</see> <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The measurement of the length in units.</param>
|
||||
/// <returns>A new <see cref="LengthType.Value">Value</see> <see cref="Length2"/>.</returns>
|
||||
public static Length2 FixedValue(Vector2 value)
|
||||
{
|
||||
Length2 InternalVar_1 = new Length2();
|
||||
InternalVar_1.X = Length.FixedValue(value.x);
|
||||
InternalVar_1.Y = Length.FixedValue(value.y);
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Value">Value</see> <see cref="Length2"/> from <paramref name="x"/> and <paramref name="y"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The measurement of the x-axis in units.</param>
|
||||
/// <param name="y">The measurement of the y-axis in units.</param>
|
||||
/// <returns>A new <see cref="LengthType.Value">Value</see> <see cref="Length2"/>.</returns>
|
||||
public static Length2 FixedValue(float x, float y)
|
||||
{
|
||||
Length2 InternalVar_1 = new Length2();
|
||||
InternalVar_1.X = Length.FixedValue(x);
|
||||
InternalVar_1.Y = Length.FixedValue(y);
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Percent">Percent</see> <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
/// <param name="percent">The measurement of the length as a percentage.</param>
|
||||
/// <returns>A new <see cref="Length2"/> as a component-wise percentage.</returns>
|
||||
public static Length2 Percentage(Vector2 percent)
|
||||
{
|
||||
Length2 InternalVar_1 = new Length2();
|
||||
InternalVar_1.X = Length.Percentage(percent.x);
|
||||
InternalVar_1.Y = Length.Percentage(percent.y);
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Percent">Percent</see> <see cref="Length2"/> from <paramref name="x"/> and <paramref name="y"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The measurement of the x-axis as a percentage.</param>
|
||||
/// <param name="y">The measurement of the y-axis as a percentage.</param>
|
||||
/// <returns>A new <see cref="Length2"/> as a component-wise percentage.</returns>
|
||||
public static Length2 Percentage(float x, float y)
|
||||
{
|
||||
Length2 InternalVar_1 = new Length2();
|
||||
InternalVar_1.X = Length.Percentage(x);
|
||||
InternalVar_1.Y = Length.Percentage(y);
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new Length2 and assigns each component to <paramref name="length"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">The <see cref="Length"/> to assign.</param>
|
||||
public static implicit operator Length2(Length length)
|
||||
{
|
||||
return new Length2()
|
||||
{
|
||||
X = length,
|
||||
Y = length,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator *(Length2 lhs, float rhs)
|
||||
{
|
||||
lhs.X *= rhs;
|
||||
lhs.Y *= rhs;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator /(Length2 lhs, float rhs)
|
||||
{
|
||||
lhs.X /= rhs;
|
||||
lhs.Y /= rhs;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="rhs"/> by <paramref name="lhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator *(float lhs, Length2 rhs)
|
||||
{
|
||||
return rhs * lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator /(float lhs, Length2 rhs)
|
||||
{
|
||||
rhs.X = lhs / rhs.X;
|
||||
rhs.Y = lhs / rhs.Y;
|
||||
|
||||
return rhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="lhs"/> by <paramref name="rhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator *(Length2 lhs, Vector2 rhs)
|
||||
{
|
||||
lhs.X *= rhs.x;
|
||||
lhs.Y *= rhs.y;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator /(Length2 lhs, Vector2 rhs)
|
||||
{
|
||||
lhs.X /= rhs.x;
|
||||
lhs.Y /= rhs.y;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="rhs"/> by <paramref name="lhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length2"/>.</returns>
|
||||
public static Length2 operator *(Vector2 lhs, Length2 rhs)
|
||||
{
|
||||
return rhs * lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>A new <see cref="Length2"/> quotient.</returns>
|
||||
public static Length2 operator /(Vector2 lhs, Length2 rhs)
|
||||
{
|
||||
rhs.X = lhs.x / rhs.X;
|
||||
rhs.Y = lhs.y / rhs.Y;
|
||||
|
||||
return rhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numeric negation operator, multiplies <paramref name="rhs"/> by -1.
|
||||
/// </summary>
|
||||
/// <param name="rhs">Right hand size.</param>
|
||||
/// <returns>A new <see cref="Length2"/>, <c>lengths</c>, where <c>lengths.Raw == -<paramref name="rhs"/>.Raw</c>.</returns>
|
||||
public static Length2 operator -(Length2 rhs)
|
||||
{
|
||||
return rhs * -1;
|
||||
}
|
||||
|
||||
/// <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"/>.X == <paramref name="rhs"/>.X && <paramref name="lhs"/>.Y == <paramref name="rhs"/>.Y</c>.</returns>
|
||||
public static bool operator ==(Length2 lhs, Length2 rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y;
|
||||
}
|
||||
|
||||
/// <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"/>.X != <paramref name="rhs"/>.X || <paramref name="lhs"/>.Y != <paramref name="rhs"/>.Y</c>.</returns>
|
||||
public static bool operator !=(Length2 lhs, Length2 rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Vector2"/>, <paramref name="v"/>, into a <see cref="LengthType.Value">Value</see> <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
/// <param name="v">The length in units, <see cref="Value"/>.</param>
|
||||
/// <returns>A <see cref="LengthType.Value">Value</see> <see cref="Length2"/> where <c><see cref="Value"/> == <paramref name="v"/></c>.</returns>
|
||||
public static implicit operator Length2(Vector2 v)
|
||||
{
|
||||
return FixedValue(v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The length to assign to <see cref="X"/>.</param>
|
||||
/// <param name="y">The length to assign to <see cref="Y"/>.</param>
|
||||
public Length2(Length x, Length y)
|
||||
{
|
||||
X = First = x;
|
||||
Y = Second = y;
|
||||
}
|
||||
|
||||
internal static Vector2 InternalMethod_2426(Vector2 InternalParameter_2634, Length2 InternalParameter_2633, MinMax2 InternalParameter_2632, Vector2 InternalParameter_2631)
|
||||
{
|
||||
return new Vector2(Length.InternalMethod_2428(InternalParameter_2634.x, InternalParameter_2633.X, InternalParameter_2632.X, InternalParameter_2631.x),
|
||||
Length.InternalMethod_2428(InternalParameter_2634.y, InternalParameter_2633.Y, InternalParameter_2632.Y, InternalParameter_2631.y));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Length2"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Length2 other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Length2"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Length2 length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Length2"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + X.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Y.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Length2({X}, {Y})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A fixed <see cref="Length2"/> set to <see cref="Length.Zero"/> along all dimensions.
|
||||
/// </summary>
|
||||
public static readonly Length2 Zero = new Length2(Length.Zero, Length.Zero);
|
||||
|
||||
/// <summary>
|
||||
/// A fixed <see cref="Length2"/> set to <see cref="Length.One"/> along along all dimensions.
|
||||
/// </summary>
|
||||
public static readonly Length2 One = new Length2()
|
||||
{
|
||||
X = Length.One,
|
||||
Y = Length.One
|
||||
};
|
||||
|
||||
#region
|
||||
|
||||
/// <summary>
|
||||
/// A calculated, readonly output of a <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="X"/> and <see cref="First"/> read from the same location in memory, as do <see cref="Y"/> and <see cref="Second"/>. This makes them interchangable and subject to user preference or context.</remarks>
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_6)]
|
||||
public readonly struct Calculated : IEquatable<Calculated>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_6 = 2 * Length.Calculated.InternalField_4;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length2.X"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="First"/>, making the two interchangeable.</remarks>
|
||||
[FieldOffset(0 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated X;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length2.Y"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="Second"/>, making the two interchangeable.</remarks>
|
||||
[FieldOffset(1 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Y;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length2.First"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="X"/>, making the two interchangeable.</remarks>
|
||||
[NonSerialized, FieldOffset(0 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated First;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length2.Second"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="Y"/>, making the two interchangeable.</remarks>
|
||||
[NonSerialized, FieldOffset(1 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Second;
|
||||
|
||||
/// <summary>
|
||||
/// The sum of <c><see cref="First">First</see>.<see cref="Length.Calculated.Value">Value</see> + <see cref="Second">Second</see>.<see cref="Length.Calculated.Value">Value</see></c>.
|
||||
/// </summary>
|
||||
public readonly Length.Calculated Sum() => First + Second;
|
||||
|
||||
/// <summary>
|
||||
/// Access each component by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read<br/>
|
||||
/// <value>0 => <see cref="X"/>, <see cref="First"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/>, <see cref="Second"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length.Calculated"/> for the given index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 1</exception>
|
||||
public readonly Length.Calculated this[int axis]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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"/>.<see cref="X">X</see> == <paramref name="rhs"/>.<see cref="X">X</see>
|
||||
/// && <paramref name="lhs"/>.<see cref="Y">Y</see> == <paramref name="rhs"/>.<see cref="Y">Y</see></c>.</returns>
|
||||
public static bool operator ==(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y;
|
||||
}
|
||||
|
||||
/// <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"/>.<see cref="X">X</see> != <paramref name="rhs"/>.<see cref="X">X</see> || <paramref name="lhs"/>.<see cref="Y">Y</see> != <paramref name="rhs"/>.<see cref="Y">Y</see></c>.</returns>
|
||||
public static bool operator !=(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Calculated length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Calculated other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Calculated"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + X.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Y.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Calc2({X}, {Y})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The measurement of the relevant <seealso cref="Length2"/> in units.
|
||||
/// </summary>
|
||||
public readonly Vector2 Value => new Vector2(X.Value, Y.Value);
|
||||
|
||||
/// <summary>
|
||||
/// The measurement of the relevant <seealso cref="Length2"/> as a percent of a relative value, <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
public readonly Vector2 Percent => new Vector2(X.Percent, Y.Percent);
|
||||
|
||||
public Calculated(Length.Calculated x, Length.Calculated y)
|
||||
{
|
||||
X = First = x;
|
||||
Y = Second = y;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1eb2618797aafdc4bb20c817a97845f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,663 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A 3D <see cref="Length"/>.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit)]
|
||||
public struct Length3 : IEquatable<Length3>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_7 = 3 * Length.InternalField_2;
|
||||
|
||||
/// <summary>
|
||||
/// The X-axis component of this 3D Length.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
public Length X;
|
||||
|
||||
/// <summary>
|
||||
/// The Y-axis component of this 3D Length.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(1 * Length.InternalField_2)]
|
||||
public Length Y;
|
||||
|
||||
/// <summary>
|
||||
/// The Z-axis component of this 3D Length.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(2 * Length.InternalField_2)]
|
||||
public Length Z;
|
||||
|
||||
/// <summary>
|
||||
/// The XY components of this 3D Length as a <see cref="Length2"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
[NonSerialized]
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public Length2 XY;
|
||||
|
||||
/// <summary>
|
||||
/// The numeric values associated with this <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// If <see cref="Length.Type"/> == <see cref="LengthType.Percent"/>, <see cref="Raw"/> represents a measurement as a percentage, <c>1 == 100%</c>.
|
||||
/// <br/>
|
||||
/// If <see cref="Length.Type"/> == <see cref="LengthType.Value"/>, <see cref="Raw"/> represents a measurement in units.
|
||||
/// </value>
|
||||
public Vector3 Raw
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new Vector3(X.Raw, Y.Raw, Z.Raw);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Raw = value.x;
|
||||
Y.Raw = value.y;
|
||||
Z.Raw = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: If <c><see cref="Type"/> == <see cref="LengthType.Value"/></c>, returns <see cref="Raw"/>. Otherwise returns <c>float.NaN</c>.<br/>
|
||||
/// <c>set</c>: Assigns <see cref="Raw"/> to the provided float value and assigns <see cref="Type"/> to <see cref="LengthType.Value"/>.
|
||||
/// </summary>
|
||||
public Vector3 Value
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new Vector3(X.Value, Y.Value, Z.Value);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Value = value.x;
|
||||
Y.Value = value.y;
|
||||
Z.Value = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <c>get</c>: If <c><see cref="Type"/> == <see cref="LengthType.Percent"/></c>, returns <see cref="Raw"/>. Otherwise returns <c>float.NaN</c>.<br/>
|
||||
/// <c>set</c>: Assigns <see cref="Raw"/> to the provided float value and assigns <see cref="Type"/> to <see cref="LengthType.Percent"/>.<br/><br/>
|
||||
/// <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
public Vector3 Percent
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new Vector3(X.Percent, Y.Percent, Z.Percent);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Percent = value.x;
|
||||
Y.Percent = value.y;
|
||||
Z.Percent = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type of each <seealso cref="Length"/>. Tells the system how to interpret <see cref="Raw"/> per component.
|
||||
/// </summary>
|
||||
public ThreeD<LengthType> Type
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
return new ThreeD<LengthType>(X.Type, Y.Type, Z.Type);
|
||||
}
|
||||
set
|
||||
{
|
||||
X.Type = value.X;
|
||||
Y.Type = value.Y;
|
||||
Z.Type = value.Z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access each component by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length"/> for the given index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public Length this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
case 2:
|
||||
return Z;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
case 2:
|
||||
Z = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Value">Value</see> <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The measurement of the length in units.</param>
|
||||
/// <returns>A new <see cref="LengthType.Value">Value</see> <see cref="Length3"/>.</returns>
|
||||
public static Length3 FixedValue(Vector3 value)
|
||||
{
|
||||
Length3 InternalVar_1 = new Length3();
|
||||
InternalVar_1.X = Length.FixedValue(value.x);
|
||||
InternalVar_1.Y = Length.FixedValue(value.y);
|
||||
InternalVar_1.Z = Length.FixedValue(value.z);
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Value">Value</see> <see cref="Length3"/> from <paramref name="x"/>, <paramref name="y"/>, and <paramref name="z"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The measurement of the x-axis in units.</param>
|
||||
/// <param name="y">The measurement of the y-axis in units.</param>
|
||||
/// <param name="z">The measurement of the z-axis in units.</param>
|
||||
/// <returns>A new <see cref="LengthType.Value">Value</see> <see cref="Length3"/>.</returns>
|
||||
public static Length3 FixedValue(float x, float y, float z)
|
||||
{
|
||||
Length3 InternalVar_1 = new Length3();
|
||||
InternalVar_1.X = Length.FixedValue(x);
|
||||
InternalVar_1.Y = Length.FixedValue(y);
|
||||
InternalVar_1.Z = Length.FixedValue(z);
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Percent">Percent</see> <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
/// <param name="percent">The measurement of the length as a percentage.</param>
|
||||
/// <returns>A new <see cref="Length3"/> as a component-wise percentage.</returns>
|
||||
public static Length3 Percentage(Vector3 percent)
|
||||
{
|
||||
Length3 InternalVar_1 = new Length3();
|
||||
InternalVar_1.X = Length.Percentage(percent.x);
|
||||
InternalVar_1.Y = Length.Percentage(percent.y);
|
||||
InternalVar_1.Z = Length.Percentage(percent.z);
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="LengthType.Percent">Percent</see> <see cref="Length3"/> from <paramref name="x"/>, <paramref name="y"/>, and <paramref name="z"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The measurement of the x-axis as a percentage.</param>
|
||||
/// <param name="y">The measurement of the y-axis as a percentage.</param>
|
||||
/// <param name="z">The measurement of the z-axis as a percentage.</param>
|
||||
/// <returns>A new <see cref="Length3"/> as a component-wise percentage.</returns>
|
||||
public static Length3 Percentage(float x, float y, float z)
|
||||
{
|
||||
Length3 InternalVar_1 = new Length3();
|
||||
InternalVar_1.X = Length.Percentage(x);
|
||||
InternalVar_1.Y = Length.Percentage(y);
|
||||
InternalVar_1.Z = Length.Percentage(z);
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A fixed <see cref="Length3"/> set to <see cref="Length.Zero"/> along all dimensions.
|
||||
/// </summary>
|
||||
public static readonly Length3 Zero = new Length3()
|
||||
{
|
||||
X = Length.Zero,
|
||||
Y = Length.Zero,
|
||||
Z = Length.Zero,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A fixed <see cref="Length3"/> set to <see cref="Length.One"/> along all dimensions.
|
||||
/// </summary>
|
||||
public static readonly Length3 One = new Length3()
|
||||
{
|
||||
X = Length.One,
|
||||
Y = Length.One,
|
||||
Z = Length.One,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator *(Length3 lhs, float rhs)
|
||||
{
|
||||
lhs.X *= rhs;
|
||||
lhs.Y *= rhs;
|
||||
lhs.Z *= rhs;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator /(Length3 lhs, float rhs)
|
||||
{
|
||||
lhs.X /= rhs;
|
||||
lhs.Y /= rhs;
|
||||
lhs.Z /= rhs;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="rhs"/> by <paramref name="lhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator *(float lhs, Length3 rhs)
|
||||
{
|
||||
return rhs * lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/>.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator /(float lhs, Length3 rhs)
|
||||
{
|
||||
rhs.X = lhs / rhs.X;
|
||||
rhs.Y = lhs / rhs.Y;
|
||||
rhs.Z = lhs / rhs.Z;
|
||||
|
||||
return rhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="lhs"/> by <paramref name="rhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator *(Length3 lhs, Vector3 rhs)
|
||||
{
|
||||
lhs.X *= rhs.x;
|
||||
lhs.Y *= rhs.y;
|
||||
lhs.Z *= rhs.z;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator /(Length3 lhs, Vector3 rhs)
|
||||
{
|
||||
lhs.X /= rhs.x;
|
||||
lhs.Y /= rhs.y;
|
||||
lhs.Z /= rhs.z;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplication operator, scales <paramref name="rhs"/> by <paramref name="lhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The product as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator *(Vector3 lhs, Length3 rhs)
|
||||
{
|
||||
return rhs * lhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Division operator, divides <paramref name="lhs"/> by <paramref name="rhs"/> component-wise.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns>The quotient as a <see cref="Length3"/>.</returns>
|
||||
public static Length3 operator /(Vector3 lhs, Length3 rhs)
|
||||
{
|
||||
rhs.X = lhs.x / rhs.X;
|
||||
rhs.Y = lhs.y / rhs.Y;
|
||||
rhs.Z = lhs.z / rhs.Z;
|
||||
|
||||
return rhs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numeric negation operator, multiplies <paramref name="rhs"/> by -1.
|
||||
/// </summary>
|
||||
/// <param name="rhs">Right hand size.</param>
|
||||
/// <returns>A new <see cref="Length3"/>, <c>lengths</c>, where <c>lengths.Raw == -<paramref name="rhs"/>.Raw</c>.</returns>
|
||||
public static Length3 operator -(Length3 rhs)
|
||||
{
|
||||
return rhs * -1;
|
||||
}
|
||||
|
||||
/// <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"/>.X == <paramref name="rhs"/>.X && <paramref name="lhs"/>.Y == <paramref name="rhs"/>.Y && <paramref name="lhs"/>.Z == <paramref name="rhs"/>.Z</c>.</returns>
|
||||
public static bool operator ==(Length3 lhs, Length3 rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z;
|
||||
}
|
||||
|
||||
/// <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"/>.X != <paramref name="rhs"/>.X || <paramref name="lhs"/>.Y != <paramref name="rhs"/>.Y || <paramref name="lhs"/>.Z != <paramref name="rhs"/>.Z</c>.</returns>
|
||||
public static bool operator !=(Length3 lhs, Length3 rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y || lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Length3"/> and assigns each component to the provided <paramref name="length"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">The <see cref="Length"/> to assign.</param>
|
||||
public static implicit operator Length3(Length length)
|
||||
{
|
||||
return new Length3(length, length, length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Length3"/> with the <see cref="X">X</see> and <see cref="Y">Y</see> components assigned to <paramref name="lengths"/>.<see cref="Length2.X">X</see> and <paramref name="lengths"/>.<see cref="Length2.Y">Y</see>, respectively, and the <see cref="Z">Z</see> component to <see cref="Length.Zero"/>.
|
||||
/// </summary>
|
||||
/// <param name="lengths">The <see cref="Length"/>s to assign.</param>
|
||||
public static implicit operator Length3(Length2 lengths)
|
||||
{
|
||||
return new Length3(lengths, Length.Zero);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Vector3"/>, <paramref name="v"/>, into a <see cref="LengthType.Value">Value</see> <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
/// <param name="v">The length in units, <see cref="Value"/>.</param>
|
||||
/// <returns>A <see cref="LengthType.Value">Value</see> <see cref="Length3"/> where <c><see cref="Value"/> == <paramref name="v"/></c>.</returns>
|
||||
public static implicit operator Length3(Vector3 v)
|
||||
{
|
||||
return FixedValue(v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The length assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The length assigned to <see cref="Y">Y</see>.</param>
|
||||
/// <param name="z">The length assigned to <see cref="Z">Z</see>.</param>
|
||||
public Length3(Length x, Length y, Length z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
||||
XY = new Length2(x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Length3"/> from a <see cref="Length2"/> and <paramref name="z"/> component.
|
||||
/// </summary>
|
||||
/// <param name="xy">The lengths assigned to <see cref="X">X</see> and <see cref="Y">Y</see>.</param>
|
||||
/// <param name="z">The length assigned to <see cref="Z">Z</see>.</param>
|
||||
public Length3(Length2 xy, Length z)
|
||||
{
|
||||
X = xy.X;
|
||||
Y = xy.Y;
|
||||
Z = z;
|
||||
|
||||
XY = xy;
|
||||
}
|
||||
|
||||
internal static Vector3 InternalMethod_2424(Vector3 InternalParameter_2630, Length3 InternalParameter_2594, MinMax3 InternalParameter_2593, Vector3 InternalParameter_2592)
|
||||
{
|
||||
return new Vector3(Length.InternalMethod_2428(InternalParameter_2630.x, InternalParameter_2594.X, InternalParameter_2593.X, InternalParameter_2592.x),
|
||||
Length.InternalMethod_2428(InternalParameter_2630.y, InternalParameter_2594.Y, InternalParameter_2593.Y, InternalParameter_2592.y),
|
||||
Length.InternalMethod_2428(InternalParameter_2630.z, InternalParameter_2594.Z, InternalParameter_2593.Z, InternalParameter_2592.z));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Length3"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Length3 length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Length3"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Length3 other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Length3"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + X.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Y.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Z.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Length3({X}, {Y}, {Z})";
|
||||
}
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// A calculated, readonly output of a <see cref="Length3"/>.
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_9)]
|
||||
public readonly struct Calculated : IEquatable<Calculated>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_9 = 3 * Length.Calculated.InternalField_4;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length3.X"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(0 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated X;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length3.Y"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(1 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Y;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="Length3.Z"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(2 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Z;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length2.Calculated"/> output of <see cref="Length3.XY"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * Length.Calculated.InternalField_4)]
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public readonly Length2.Calculated XY;
|
||||
|
||||
/// <summary>
|
||||
/// Access each component by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length.Calculated"/> for the given index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public readonly Length.Calculated this[int axis]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
case 2:
|
||||
return Z;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A component-wise measurement of the relevant <seealso cref="Length3"/> in units.
|
||||
/// </summary>
|
||||
/// <value><c>Value = <see cref="Percent">Percent</see> * relative</c></value>
|
||||
public readonly Vector3 Value => new Vector3(X.Value, Y.Value, Z.Value);
|
||||
|
||||
/// <summary>
|
||||
/// A component-wise measurement of the relevant <seealso cref="Length3"/> as a percent of a relative value, <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
/// <value><c>Percent = <see cref="Value">Value</see> / relative</c></value>
|
||||
public readonly Vector3 Percent => new Vector3(X.Percent, Y.Percent, Z.Percent);
|
||||
|
||||
/// <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"/>.<see cref="X">X</see> == <paramref name="rhs"/>.<see cref="X">X</see>
|
||||
/// && <paramref name="lhs"/>.<see cref="Y">Y</see> == <paramref name="rhs"/>.<see cref="Y">Y</see>
|
||||
/// && <paramref name="lhs"/>.<see cref="Z">Z</see> == <paramref name="rhs"/>.<see cref="Z">Z</see></c>.</returns>
|
||||
public static bool operator ==(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z;
|
||||
}
|
||||
|
||||
/// <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"/>.<see cref="X">X</see> != <paramref name="rhs"/>.<see cref="X">X</see>
|
||||
/// || <paramref name="lhs"/>.<see cref="Y">Y</see> != <paramref name="rhs"/>.<see cref="Y">Y</see>
|
||||
/// || <paramref name="lhs"/>.<see cref="Z">Z</see> != <paramref name="rhs"/>.<see cref="Z">Z</see></c>.</returns>
|
||||
public static bool operator !=(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y || lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Calculated"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + X.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Y.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Z.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Calc3({X}, {Y}, {Z})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Calculated length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Calculated other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The length assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The length assigned to <see cref="Y">Y</see>.</param>
|
||||
/// <param name="z">The length assigned to <see cref="Z">Z</see>.</param>
|
||||
public Calculated(Length.Calculated x, Length.Calculated y, Length.Calculated z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
||||
XY = new Length2.Calculated(x, y);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c48e6b0c35007bf45b39d9d05a50ad3e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,643 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of <see cref="Length">Lengths</see> used to configure offsets from each face of an axis-aligned bounding box.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit)]
|
||||
public struct LengthBounds : IEquatable<LengthBounds>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_10 = InternalNamespace_0.InternalType_56.InternalField_181;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a bounds' left face.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
public Length Left;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a bounds' right face.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(1 * Length.InternalField_2)]
|
||||
public Length Right;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a bounds' bottom face.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(2 * Length.InternalField_2)]
|
||||
public Length Bottom;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a bounds' top face.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(3 * Length.InternalField_2)]
|
||||
public Length Top;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a bounds' front face.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(4 * Length.InternalField_2)]
|
||||
public Length Front;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a bounds' back face.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(5 * Length.InternalField_2)]
|
||||
public Length Back;
|
||||
|
||||
/// <summary>
|
||||
/// The XY face offsets of this <see cref="LengthBounds"/> as a <see cref="LengthRect"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0)]
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public LengthRect XY;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Left">Left</see> and <see cref="Right">Right</see> as a <see cref="Length2"/> pair.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <value><c>this.<see cref="Left">Left</see></c> => <see cref="X">X</see>.<see cref="Length2.First">First</see></value><br/>
|
||||
/// <value><c>this.<see cref="Right">Right</see></c> => <see cref="X">X</see>.<see cref="Length2.Second">Second</see></value>.
|
||||
/// </remarks>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
public Length2 X;
|
||||
/// <summary>
|
||||
/// <see cref="Bottom">Bottom</see> and <see cref="Top">Top</see> as a <see cref="Length2"/> pair.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <value><c>this.<see cref="Bottom">Bottom</see></c> => <see cref="Y">Y</see>.<see cref="Length2.First">First</see></value><br/>
|
||||
/// <value><c>this.<see cref="Top">Top</see></c> => <see cref="Y">Y</see>.<see cref="Length2.Second">Second</see></value>.
|
||||
/// </remarks>
|
||||
[NonSerialized]
|
||||
[FieldOffset(2 * Length.InternalField_2)]
|
||||
public Length2 Y;
|
||||
/// <summary>
|
||||
/// <see cref="Front">Front</see> and <see cref="Back">Back</see> as a <see cref="Length2"/> pair.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <value><c>this.<see cref="Front">Front</see></c> => <see cref="Z">Z</see>.<see cref="Length2.First">First</see></value><br/>
|
||||
/// <value><c>this.<see cref="Back">Back</see></c> => <see cref="Z">Z</see>.<see cref="Length2.Second">Second</see></value>.
|
||||
/// </remarks>
|
||||
[NonSerialized]
|
||||
[FieldOffset(4 * Length.InternalField_2)]
|
||||
public Length2 Z;
|
||||
|
||||
/// <summary>
|
||||
/// Assign all offsets, <see cref="Left">Left</see>, <see cref="Right">Right</see>, <see cref="Bottom">Bottom</see>, <see cref="Top">Top</see>,
|
||||
/// <see cref="Front">Front</see>, and <see cref="Back">Back</see>, to a <see cref="LengthType.Value">Value</see> <see cref="Length"/> with the given value.
|
||||
/// </summary>
|
||||
public float Value
|
||||
{
|
||||
set
|
||||
{
|
||||
Length InternalVar_1 = Length.FixedValue(value);
|
||||
|
||||
Left = InternalVar_1;
|
||||
Right = InternalVar_1;
|
||||
Bottom = InternalVar_1;
|
||||
Top = InternalVar_1;
|
||||
Front = InternalVar_1;
|
||||
Back = InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assign all offsets, <see cref="Left">Left</see>, <see cref="Right">Right</see>, <see cref="Bottom">Bottom</see>, <see cref="Top">Top</see>,
|
||||
/// <see cref="Front">Front</see>, and <see cref="Back">Back</see>, to a <see cref="LengthType.Percent">Percent</see> <see cref="Length"/> with the given percent, <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
public float Percent
|
||||
{
|
||||
set
|
||||
{
|
||||
Length InternalVar_1 = Length.Percentage(value);
|
||||
|
||||
Left = InternalVar_1;
|
||||
Right = InternalVar_1;
|
||||
Bottom = InternalVar_1;
|
||||
Top = InternalVar_1;
|
||||
Front = InternalVar_1;
|
||||
Back = InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access each <see cref="Length2"/> by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length2"/> for the given <paramref name="axis"/>.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public Length2 this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
case 2:
|
||||
return Z;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
case 2:
|
||||
Z = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
internal bool InternalMethod_25()
|
||||
{
|
||||
return XY.InternalMethod_28() || X.First != Z.First || X.First != Z.Second;
|
||||
}
|
||||
|
||||
/// <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"/>.Left == <paramref name="rhs"/>.Left && <paramref name="lhs"/>.Right == <paramref name="rhs"/>.Right
|
||||
/// && <paramref name="lhs"/>.Bottom == <paramref name="rhs"/>.Bottom && <paramref name="lhs"/>.Top == <paramref name="rhs"/>.Top
|
||||
/// && <paramref name="lhs"/>.Front == <paramref name="rhs"/>.Front && <paramref name="lhs"/>.Back == <paramref name="rhs"/>.Back
|
||||
/// </c>.
|
||||
/// </returns>
|
||||
public static bool operator ==(LengthBounds lhs, LengthBounds rhs)
|
||||
{
|
||||
return lhs.XY == rhs.XY && lhs.Z == rhs.Z;
|
||||
}
|
||||
|
||||
/// <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"/>.Left != <paramref name="rhs"/>.Left || <paramref name="lhs"/>.Right != <paramref name="rhs"/>.Right
|
||||
/// || <paramref name="lhs"/>.Bottom != <paramref name="rhs"/>.Bottom || <paramref name="lhs"/>.Top != <paramref name="rhs"/>.Top
|
||||
/// || <paramref name="lhs"/>.Front != <paramref name="rhs"/>.Front || <paramref name="lhs"/>.Back != <paramref name="rhs"/>.Back</c>.</returns>
|
||||
public static bool operator !=(LengthBounds lhs, LengthBounds rhs)
|
||||
{
|
||||
return lhs.XY != rhs.XY && lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="LengthBounds"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is LengthBounds length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="LengthBounds"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Top.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Bottom.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Front.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Back.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="LengthBounds"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Left == Right)
|
||||
{
|
||||
if (Left == Bottom && Left == Top &&
|
||||
Left == Front && Left == Back)
|
||||
{
|
||||
return $"LengthBounds(All: {Left})";
|
||||
}
|
||||
|
||||
if (Bottom == Top && Front == Back)
|
||||
{
|
||||
return $"LengthBounds(X: {Left}, Y: {Bottom}, Z: {Front})";
|
||||
}
|
||||
}
|
||||
|
||||
return $"Length(L: {Left}, R: {Right}, B: {Bottom}, T: {Top}, F: {Front}, B: {Back})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="LengthBounds"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(LengthBounds other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthBounds"/> and assigns each edge offset to a <see cref="LengthType.Value">Value</see> <see cref="Length"/> of <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">The length to assign in units.</param>
|
||||
public static implicit operator LengthBounds(float length)
|
||||
{
|
||||
return new LengthBounds()
|
||||
{
|
||||
Left = length,
|
||||
Right = length,
|
||||
Bottom = length,
|
||||
Top = length,
|
||||
Front = length,
|
||||
Back = length,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthBounds"/> and assigns each edge offset to the provided <paramref name="length"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">The length to assign to each edge offset.</param>
|
||||
public static implicit operator LengthBounds(Length length)
|
||||
{
|
||||
return new LengthBounds()
|
||||
{
|
||||
Left = length,
|
||||
Right = length,
|
||||
Bottom = length,
|
||||
Top = length,
|
||||
Front = length,
|
||||
Back = length,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthBounds"/> where <see cref="XY"/> == <paramref name="rect"/> and <see cref="Z"/> == <see cref="Length2.Zero"/>.
|
||||
/// </summary>
|
||||
/// <param name="rect">The values assigned to <see cref="XY"/>.</param>
|
||||
public static implicit operator LengthBounds(LengthRect rect)
|
||||
{
|
||||
return new LengthBounds()
|
||||
{
|
||||
XY = rect,
|
||||
Z = Length2.Zero
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthBounds"/>, specified per face.
|
||||
/// </summary>
|
||||
/// <param name="left">The length assigned to <see cref="Left">Left</see>.</param>
|
||||
/// <param name="right">The length assigned to <see cref="Right">Right</see>.</param>
|
||||
/// <param name="bottom">The length assigned to <see cref="Bottom">Bottom</see>.</param>
|
||||
/// <param name="top">The length assigned to <see cref="Top">Top</see>.</param>
|
||||
/// <param name="front">The length assigned to <see cref="Front">Front</see>.</param>
|
||||
/// <param name="back">The length assigned to <see cref="Back">Back</see>.</param>
|
||||
public LengthBounds(Length left, Length right, Length bottom, Length top, Length front, Length back)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
Top = top;
|
||||
Front = front;
|
||||
Back = back;
|
||||
|
||||
X = new Length2(left, right);
|
||||
Y = new Length2(bottom, top);
|
||||
Z = new Length2(front, back);
|
||||
|
||||
XY = new LengthRect()
|
||||
{
|
||||
X = X,
|
||||
Y = Y,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthBounds"/>, specified per axis.
|
||||
/// </summary>
|
||||
/// <param name="x">The lengths assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The lengths assigned to <see cref="Y">Y</see>.</param>
|
||||
/// <param name="z">The lengths assigned to <see cref="Z">Z</see>.</param>
|
||||
public LengthBounds(Length2 x, Length2 y, Length2 z)
|
||||
{
|
||||
Left = x.First;
|
||||
Right = x.Second;
|
||||
Bottom = y.First;
|
||||
Top = y.Second;
|
||||
Front = z.First;
|
||||
Back = z.Second;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
||||
XY = new LengthRect()
|
||||
{
|
||||
X = x,
|
||||
Y = y
|
||||
};
|
||||
}
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// A calculated, readonly output of a <see cref="LengthBounds"/>.
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = 3 * Length2.Calculated.InternalField_6)]
|
||||
public readonly struct Calculated : IEquatable<Calculated>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_11 = 6 * InternalNamespace_0.InternalType_45.InternalType_47.InternalField_152;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthBounds.Left"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(0 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Left;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthBounds.Right"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(1 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Right;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthBounds.Bottom"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(2 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Bottom;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthBounds.Top"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(3 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Top;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthBounds.Front"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(4 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Front;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthBounds.Back"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(5 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Back;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length2.Calculated"/> output of <see cref="LengthBounds.X"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, FieldOffset(0 * Length2.Calculated.InternalField_6)]
|
||||
public readonly Length2.Calculated X;
|
||||
/// <summary>
|
||||
/// The <see cref="Length2.Calculated"/> output of <see cref="LengthBounds.Y"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, FieldOffset(1 * Length2.Calculated.InternalField_6)]
|
||||
public readonly Length2.Calculated Y;
|
||||
/// <summary>
|
||||
/// The <see cref="Length2.Calculated"/> output of <see cref="LengthBounds.Z"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, FieldOffset(2 * Length2.Calculated.InternalField_6)]
|
||||
public readonly Length2.Calculated Z;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="LengthRect.Calculated"/> output of <see cref="LengthBounds.XY"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, FieldOffset(0 * LengthRect.Calculated.InternalField_14)]
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public readonly LengthRect.Calculated XY;
|
||||
|
||||
/// <summary>The sum of face offsets along the X axis in units</summary>
|
||||
/// <remarks>
|
||||
/// Equivalent to <c><see cref="Left">Left</see>.<see cref="Length.Calculated.Value">Value</see> + <see cref="Right">Right</see>.<see cref="Length.Calculated.Value">Value</see></c>.
|
||||
/// </remarks>
|
||||
public readonly float Width => Left.Value + Right.Value;
|
||||
/// <summary>The sum of face offsets along the Y axis in units</summary>
|
||||
/// <remarks>
|
||||
/// Equivalent to <c><see cref="Bottom">Bottom</see>.<see cref="Length.Calculated.Value">Value</see> + <see cref="Top">Top</see>.<see cref="Length.Calculated.Value">Value</see> </c>.
|
||||
/// </remarks>
|
||||
public readonly float Height => Bottom.Value + Top.Value;
|
||||
/// <summary>The sum of face offsets along the Z axis in units</summary>
|
||||
/// <remarks>
|
||||
/// Equivalent to <c><see cref="Front">Front</see>.<see cref="Length.Calculated.Value">Value</see> + <see cref="Back">Back</see>.<see cref="Length.Calculated.Value">Value</see> </c>.
|
||||
/// </remarks>
|
||||
public readonly float Depth => Front.Value + Back.Value;
|
||||
|
||||
/// <summary>
|
||||
/// A per-axis sum of face offsets.
|
||||
/// </summary>
|
||||
/// <returns>A Vector3, <c>v</c>, where <c>v.x == <see cref="Width">Width</see></c>, <c>v.y == <see cref="Height">Height</see></c>, and <c>v.z == <see cref="Depth">Depth</see></c>.</returns>
|
||||
public readonly Vector3 Size => new Vector3(Width, Height, Depth);
|
||||
|
||||
/// <summary>
|
||||
/// The midpoint shift of the combined face offsets along their respective axes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Equivalent to <c>0.5f * <see langword="new"/> Vector3(<see cref="Left">Left</see>.<see cref="Length.Calculated.Value">Value</see> - <see cref="Right">Right</see>.<see cref="Length.Calculated.Value">Value</see>,
|
||||
/// <see cref="Bottom">Bottom</see>.<see cref="Length.Calculated.Value">Value</see> - <see cref="Top">Top</see>.<see cref="Length.Calculated.Value">Value</see>,
|
||||
/// <see cref="Front">Front</see>.<see cref="Length.Calculated.Value">Value</see> - <see cref="Back">Back</see>.<see cref="Length.Calculated.Value">Value</see>)</c>.
|
||||
/// </remarks>
|
||||
public readonly Vector3 Offset => 0.5f * new Vector3(Left.Value - Right.Value, Bottom.Value - Top.Value, Front.Value - Back.Value);
|
||||
|
||||
/// <summary>
|
||||
/// Access each <see cref="Length2.Calculated"/> by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length2.Calculated"/> for the given <paramref name="axis"/>.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public readonly Length2.Calculated this[int axis]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
case 2:
|
||||
return Z;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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"/>.Left == <paramref name="rhs"/>.Left && <paramref name="lhs"/>.Right == <paramref name="rhs"/>.Right
|
||||
/// && <paramref name="lhs"/>.Bottom == <paramref name="rhs"/>.Bottom && <paramref name="lhs"/>.Top == <paramref name="rhs"/>.Top
|
||||
/// && <paramref name="lhs"/>.Front == <paramref name="rhs"/>.Front && <paramref name="lhs"/>.Back == <paramref name="rhs"/>.Back
|
||||
/// </c>.
|
||||
/// </returns>
|
||||
public static bool operator ==(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.XY == rhs.XY && lhs.Z == rhs.Z;
|
||||
}
|
||||
|
||||
|
||||
/// <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"/>.Left != <paramref name="rhs"/>.Left || <paramref name="lhs"/>.Right != <paramref name="rhs"/>.Right
|
||||
/// || <paramref name="lhs"/>.Bottom != <paramref name="rhs"/>.Bottom || <paramref name="lhs"/>.Top != <paramref name="rhs"/>.Top
|
||||
/// || <paramref name="lhs"/>.Front != <paramref name="rhs"/>.Front || <paramref name="lhs"/>.Back != <paramref name="rhs"/>.Back</c>.</returns>
|
||||
public static bool operator !=(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.XY != rhs.XY && lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Calculated length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Calculated"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Top.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Bottom.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Front.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Back.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Left == Right)
|
||||
{
|
||||
if (Left == Bottom && Left == Top &&
|
||||
Left == Front && Left == Back)
|
||||
{
|
||||
return $"CalcBounds(All: {Left})";
|
||||
}
|
||||
|
||||
if (Bottom == Top && Front == Back)
|
||||
{
|
||||
return $"CalcBounds(X: {Left}, Y: {Bottom}, Z: {Front})";
|
||||
}
|
||||
}
|
||||
|
||||
return $"Calc(L: {Left}, R: {Right}, B: {Bottom}, T: {Top}, F: {Front}, B: {Back})";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Calculated other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
/// <param name="left">The length assigned to <see cref="Left">Left</see>.</param>
|
||||
/// <param name="right">The length assigned to <see cref="Right">Right</see>.</param>
|
||||
/// <param name="bottom">The length assigned to <see cref="Bottom">Bottom</see>.</param>
|
||||
/// <param name="top">The length assigned to <see cref="Top">Top</see>.</param>
|
||||
/// <param name="front">The length assigned to <see cref="Front">Front</see>.</param>
|
||||
/// <param name="back">The length assigned to <see cref="Back">Back</see>.</param>
|
||||
public Calculated(Length.Calculated left, Length.Calculated right, Length.Calculated bottom, Length.Calculated top, Length.Calculated front, Length.Calculated back)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
Top = top;
|
||||
Front = front;
|
||||
Back = back;
|
||||
|
||||
X = new Length2.Calculated(left, right);
|
||||
Y = new Length2.Calculated(bottom, top);
|
||||
Z = new Length2.Calculated(front, back);
|
||||
|
||||
XY = new LengthRect.Calculated(X, Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The lengths assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The lengths assigned to <see cref="Y">Y</see>.</param>
|
||||
/// <param name="z">The lengths assigned to <see cref="Z">Z</see>.</param>
|
||||
public Calculated(Length2.Calculated x, Length2.Calculated y, Length2.Calculated z)
|
||||
{
|
||||
Left = x.First;
|
||||
Right = x.Second;
|
||||
Bottom = y.First;
|
||||
Top = y.Second;
|
||||
Front = z.First;
|
||||
Back = z.Second;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
||||
XY = new LengthRect.Calculated(x, y);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97b191d090528824ba0ffe03f71eefe0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,524 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of <see cref="Length">Lengths</see> used to configure offsets from each edge of a rectangle.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit)]
|
||||
public struct LengthRect : IEquatable<LengthRect>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_12 = 4 * InternalNamespace_0.InternalType_45.InternalField_144;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a rectangle's left edge.
|
||||
/// </summary>
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
public Length Left;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a rectangle's right edge.
|
||||
/// </summary>
|
||||
[FieldOffset(1 * Length.InternalField_2)]
|
||||
public Length Right;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a rectangle's bottom edge.
|
||||
/// </summary>
|
||||
[FieldOffset(2 * Length.InternalField_2)]
|
||||
public Length Bottom;
|
||||
/// <summary>
|
||||
/// The <see cref="Length">Length</see> offset from a rectangle's top edge.
|
||||
/// </summary>
|
||||
[FieldOffset(3 * Length.InternalField_2)]
|
||||
public Length Top;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Left">Left</see> and <see cref="Right">Right</see> as a <see cref="Length2"/> pair.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <value><c>this.<see cref="Left">Left</see></c> => <see cref="X">X</see>.<see cref="Length2.First">First</see></value><br/>
|
||||
/// <value><c>this.<see cref="Right">Right</see></c> => <see cref="X">X</see>.<see cref="Length2.Second">Second</see></value>.
|
||||
/// </remarks>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * Length.InternalField_2)]
|
||||
public Length2 X;
|
||||
/// <summary>
|
||||
/// <see cref="Bottom">Bottom</see> and <see cref="Top">Top</see> as a <see cref="Length2"/> pair.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <value><c>this.<see cref="Bottom">Bottom</see></c> => <see cref="Y">Y</see>.<see cref="Length2.First">First</see></value><br/>
|
||||
/// <value><c>this.<see cref="Top">Top</see></c> => <see cref="Y">Y</see>.<see cref="Length2.Second">Second</see></value>.
|
||||
/// </remarks>
|
||||
[NonSerialized]
|
||||
[FieldOffset(2 * Length.InternalField_2)]
|
||||
public Length2 Y;
|
||||
|
||||
/// <summary>
|
||||
/// Assign all offsets, <see cref="Left">Left</see>, <see cref="Right">Right</see>, <see cref="Bottom">Bottom</see>, and <see cref="Top">Top</see>, to a <see cref="LengthType.Value">Value</see> <see cref="Length"/> with the given value.
|
||||
/// </summary>
|
||||
public float Value
|
||||
{
|
||||
set
|
||||
{
|
||||
Length InternalVar_1 = Length.FixedValue(value);
|
||||
|
||||
Left = InternalVar_1;
|
||||
Right = InternalVar_1;
|
||||
Bottom = InternalVar_1;
|
||||
Top = InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assign all offsets, <see cref="Left">Left</see>, <see cref="Right">Right</see>, <see cref="Bottom">Bottom</see>, and <see cref="Top">Top</see>, to a <see cref="LengthType.Percent">Percent</see> <see cref="Length"/> with the given percent, <c>1 == 100%</c>.
|
||||
/// </summary>
|
||||
public float Percent
|
||||
{
|
||||
set
|
||||
{
|
||||
Length InternalVar_1 = Length.Percentage(value);
|
||||
|
||||
Left = InternalVar_1;
|
||||
Right = InternalVar_1;
|
||||
Bottom = InternalVar_1;
|
||||
Top = InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access each <see cref="Length2"/> by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length2"/> for the given <paramref name="axis"/>.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 1</exception>
|
||||
public Length2 this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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"/>.Left == <paramref name="rhs"/>.Left && <paramref name="lhs"/>.Right == <paramref name="rhs"/>.Right
|
||||
/// && <paramref name="lhs"/>.Bottom == <paramref name="rhs"/>.Bottom && <paramref name="lhs"/>.Top == <paramref name="rhs"/>.Top</c>.</returns>
|
||||
public static bool operator ==(LengthRect lhs, LengthRect rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y;
|
||||
}
|
||||
|
||||
/// <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"/>.Left != <paramref name="rhs"/>.Left || <paramref name="lhs"/>.Right != <paramref name="rhs"/>.Right
|
||||
/// || <paramref name="lhs"/>.Bottom != <paramref name="rhs"/>.Bottom || <paramref name="lhs"/>.Top != <paramref name="rhs"/>.Top</c>.</returns>
|
||||
public static bool operator !=(LengthRect lhs, LengthRect rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="LengthRect"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is LengthRect length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="LengthRect"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(LengthRect other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="LengthRect"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Top.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Bottom.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="LengthRect"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Left == Right)
|
||||
{
|
||||
if (Left == Bottom && Left == Top)
|
||||
{
|
||||
return $"LengthRect(All: {Left})";
|
||||
}
|
||||
|
||||
if (Bottom == Top)
|
||||
{
|
||||
return $"LengthRect(X: {Left}, Y: {Bottom})";
|
||||
}
|
||||
}
|
||||
|
||||
return $"LengthRect(L: {Left}, R: {Right}, B: {Bottom}, T: {Top})";
|
||||
}
|
||||
|
||||
internal bool InternalMethod_28()
|
||||
{
|
||||
return X.First != X.Second || X.First != Y.First || X.First != Y.Second;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new LengthRect and assigns each edge offset to a <see cref="LengthType.Value">Value</see> <see cref="Length"/> of <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The length to assign in units.</param>
|
||||
public static implicit operator LengthRect(float value)
|
||||
{
|
||||
return new LengthRect()
|
||||
{
|
||||
Left = value,
|
||||
Right = value,
|
||||
Top = value,
|
||||
Bottom = value,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new LengthRect and assigns each edge offset to the provided <paramref name="length"/>.
|
||||
/// </summary>
|
||||
/// <param name="length">The length to assign to each edge offset.</param>
|
||||
public static implicit operator LengthRect(Length length)
|
||||
{
|
||||
return new LengthRect()
|
||||
{
|
||||
Left = length,
|
||||
Right = length,
|
||||
Top = length,
|
||||
Bottom = length,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new LengthRect and assigns each edge offset to a <see cref="LengthType.Value">Value</see> <see cref="Length"/> along its respective axis.
|
||||
/// </summary>
|
||||
/// <param name="v">The lengths to assign to each edge offset, by axis, in units.</param>
|
||||
public static implicit operator LengthRect(Vector2 v)
|
||||
{
|
||||
return new LengthRect()
|
||||
{
|
||||
Left = v.x,
|
||||
Right = v.x,
|
||||
Top = v.y,
|
||||
Bottom = v.y,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new LengthRect and assigns each edge offset to the provided <see cref="Length"/> along its respective axis.
|
||||
/// </summary>
|
||||
/// <param name="lengths">The lengths to assign to each edge offset, by axis.</param>
|
||||
public static implicit operator LengthRect(Length2 lengths)
|
||||
{
|
||||
return new LengthRect()
|
||||
{
|
||||
Left = lengths.X,
|
||||
Right = lengths.X,
|
||||
Top = lengths.Y,
|
||||
Bottom = lengths.Y,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthRect"/>, specified per face.
|
||||
/// </summary>
|
||||
/// <param name="left">The length assigned to <see cref="Left">Left</see>.</param>
|
||||
/// <param name="right">The length assigned to <see cref="Right">Right</see>.</param>
|
||||
/// <param name="bottom">The length assigned to <see cref="Bottom">Bottom</see>.</param>
|
||||
/// <param name="top">The length assigned to <see cref="Top">Top</see>.</param>
|
||||
public LengthRect(Length left, Length right, Length bottom, Length top)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
Top = top;
|
||||
|
||||
X = new Length2(left, right);
|
||||
Y = new Length2(bottom, top);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="LengthRect"/>, specified per axis.
|
||||
/// </summary>
|
||||
/// <param name="x">The lengths assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The lengths assigned to <see cref="Y">Y</see>.</param>
|
||||
public LengthRect(Length2 x, Length2 y)
|
||||
{
|
||||
Left = x.First;
|
||||
Right = x.Second;
|
||||
Bottom = y.First;
|
||||
Top = y.Second;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
#region
|
||||
/// <summary>
|
||||
/// A calculated, readonly output of a <see cref="LengthRect"/>.
|
||||
/// </summary>
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_14)]
|
||||
public readonly struct Calculated : IEquatable<Calculated>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_14 = 2 * Length2.Calculated.InternalField_6;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthRect.Left"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(0 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Left;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthRect.Right"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(1 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Right;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthRect.Bottom"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(2 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Bottom;
|
||||
/// <summary>
|
||||
/// The <see cref="Length.Calculated"/> output of <see cref="LengthRect.Top"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(3 * Length.Calculated.InternalField_4)]
|
||||
public readonly Length.Calculated Top;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Length2.Calculated"/> output of <see cref="LengthRect.X"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, FieldOffset(0 * Length2.Calculated.InternalField_6)]
|
||||
public readonly Length2.Calculated X;
|
||||
/// <summary>
|
||||
/// The <see cref="Length2.Calculated"/> output of <see cref="LengthRect.Y"/>.
|
||||
/// </summary>
|
||||
[NonSerialized, FieldOffset(1 * Length2.Calculated.InternalField_6)]
|
||||
public readonly Length2.Calculated Y;
|
||||
|
||||
/// <summary>
|
||||
/// Access each <see cref="Length2.Calculated"/> by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="Length2.Calculated"/> for the given <paramref name="axis"/>.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 1</exception>
|
||||
public readonly Length2.Calculated this[int axis]
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The sum of edge offsets along the X axis in units</summary>
|
||||
/// <remarks>
|
||||
/// Equivalent to <c><see cref="Left">Left</see>.<see cref="Length.Calculated.Value">Value</see> + <see cref="Right">Right</see>.<see cref="Length.Calculated.Value">Value</see></c>.
|
||||
/// </remarks>
|
||||
public readonly float Width => Left.Value + Right.Value;
|
||||
|
||||
/// <summary>The sum of edge offsets along the Y axis in units</summary>
|
||||
/// <remarks>
|
||||
/// Equivalent to <c><see cref="Bottom">Bottom</see>.<see cref="Length.Calculated.Value">Value</see> + <see cref="Top">Top</see>.<see cref="Length.Calculated.Value">Value</see> </c>.
|
||||
/// </remarks>
|
||||
public readonly float Height => Bottom.Value + Top.Value;
|
||||
|
||||
/// <summary>
|
||||
/// A per-axis sum of edge offsets.
|
||||
/// </summary>
|
||||
/// <returns>A Vector2, <c>v</c>, where <c>v.x == <see cref="Width">Width</see></c> and <c>v.y == <see cref="Height">Height</see></c>.</returns>
|
||||
public Vector2 Size => new Vector2(Width, Height);
|
||||
|
||||
/// <summary>
|
||||
/// The midpoint shift of the combined edge offsets along their respective axes.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Equivalent to <c>0.5f * <see langword="new"/> Vector2(<see cref="Left">Left</see>.<see cref="Length.Calculated.Value">Value</see> - <see cref="Right">Right</see>.<see cref="Length.Calculated.Value">Value</see>
|
||||
/// , <see cref="Bottom">Bottom</see>.<see cref="Length.Calculated.Value">Value</see> - <see cref="Top">Top</see>.<see cref="Length.Calculated.Value">Value</see>)</c>.
|
||||
/// </remarks>
|
||||
public Vector2 Offset => 0.5f * new Vector2(Left.Value - Right.Value, Bottom.Value - Top.Value);
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Calculated length)
|
||||
{
|
||||
return this == length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="Calculated"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Top.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Bottom.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Left == Right)
|
||||
{
|
||||
if (Left == Bottom && Left == Top)
|
||||
{
|
||||
return $"CalcRect(All: {Left})";
|
||||
}
|
||||
|
||||
if (Bottom == Top)
|
||||
{
|
||||
return $"CalcRect(X: {Left}, Y: {Bottom})";
|
||||
}
|
||||
}
|
||||
|
||||
return $"Calc(L: {Left}, R: {Right}], B: {Bottom}, T: {Top})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Calculated"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(Calculated other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <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"/>.Left == <paramref name="rhs"/>.Left && <paramref name="lhs"/>.Right == <paramref name="rhs"/>.Right
|
||||
/// && <paramref name="lhs"/>.Bottom == <paramref name="rhs"/>.Bottom && <paramref name="lhs"/>.Top == <paramref name="rhs"/>.Top</c>.</returns>
|
||||
public static bool operator ==(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y;
|
||||
}
|
||||
|
||||
/// <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"/>.Left != <paramref name="rhs"/>.Left || <paramref name="lhs"/>.Right != <paramref name="rhs"/>.Right
|
||||
/// || <paramref name="lhs"/>.Bottom != <paramref name="rhs"/>.Bottom || <paramref name="lhs"/>.Top != <paramref name="rhs"/>.Top</c>.</returns>
|
||||
public static bool operator !=(Calculated lhs, Calculated rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
/// <param name="left">The length assigned to <see cref="Left">Left</see>.</param>
|
||||
/// <param name="right">The length assigned to <see cref="Right">Right</see>.</param>
|
||||
/// <param name="bottom">The length assigned to <see cref="Bottom">Bottom</see>.</param>
|
||||
/// <param name="top">The length assigned to <see cref="Top">Top</see>.</param>
|
||||
public Calculated(Length.Calculated left, Length.Calculated right, Length.Calculated bottom, Length.Calculated top)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
Top = top;
|
||||
|
||||
X = new Length2.Calculated(left, right);
|
||||
Y = new Length2.Calculated(bottom, top);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Calculated"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The lengths assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The lengths assigned to <see cref="Y">Y</see>.</param>
|
||||
public Calculated(Length2.Calculated x, Length2.Calculated y)
|
||||
{
|
||||
Left = x.First;
|
||||
Right = x.Second;
|
||||
Bottom = y.First;
|
||||
Top = y.Second;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4a9e88a746412d43b18b447305df503
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A min/max range.
|
||||
/// </summary>
|
||||
///<seealso cref="Length"/>
|
||||
///<seealso cref="Length.Calculated"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_3025)]
|
||||
public struct MinMax : IEquatable<MinMax>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_3025 = InternalNamespace_0.InternalType_45.InternalType_46.InternalField_147;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum allowed measurement in units.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(0 * sizeof(float))]
|
||||
public float Min;
|
||||
/// <summary>
|
||||
/// The maximum allowed measurement in units.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(1 * sizeof(float))]
|
||||
public float Max;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not this MinMax has a minimum.
|
||||
/// </summary>
|
||||
/// <returns><see langword="true"/> if <see cref="Min"/> is finite.</returns>
|
||||
public readonly bool HasMin => !float.IsInfinity(Min);
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether or not this MinMax has a maximum.
|
||||
/// </summary>
|
||||
/// <returns><see langword="true"/> if <see cref="Max"/> is finite.</returns>
|
||||
public readonly bool HasMax => !float.IsInfinity(Max);
|
||||
|
||||
/// <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"/>.Min == <paramref name="rhs"/>.Min && <paramref name="lhs"/>.Max == <paramref name="rhs"/>.Max</c>.</returns>
|
||||
public static bool operator ==(in MinMax lhs, in MinMax rhs)
|
||||
{
|
||||
return lhs.Min == rhs.Min && lhs.Max == rhs.Max;
|
||||
}
|
||||
|
||||
/// <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"/>.Min != <paramref name="rhs"/>.Min || <paramref name="lhs"/>.Max != <paramref name="rhs"/>.Max</c>.</returns>
|
||||
public static bool operator !=(in MinMax lhs, in MinMax rhs)
|
||||
{
|
||||
return lhs.Max != rhs.Max || lhs.Min != rhs.Min;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamps <paramref name="value"/> to the range defined by <see cref="Min"/> and <see cref="Max"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to clamp.</param>
|
||||
/// <returns><paramref name="value"/> clamped to the range defined by <see cref="Min"/> and <see cref="Max"/>.</returns>
|
||||
public float Clamp(float value)
|
||||
{
|
||||
if (!float.IsInfinity(value))
|
||||
{
|
||||
return Min > value ? Min :
|
||||
Max < value ? Max :
|
||||
value;
|
||||
}
|
||||
|
||||
if (HasMin)
|
||||
{
|
||||
return Min;
|
||||
}
|
||||
|
||||
if (HasMax)
|
||||
{
|
||||
return Max;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamps <paramref name="value"/> to the range defined by <paramref name="min"/> and <paramref name="max"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to clamp.</param>
|
||||
/// <param name="min">The min value of the acceptable range.</param>
|
||||
/// <param name="max">The max value of the acceptable range.</param>
|
||||
/// <returns><paramref name="value"/> clamped to the range defined by <paramref name="min"/> and <paramref name="max"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Clamp(float value, float min, float max)
|
||||
{
|
||||
return new MinMax(min, max).Clamp(value);
|
||||
}
|
||||
|
||||
/// <summary>Construct a new <see cref="MinMax"/> for the given range.</summary>
|
||||
/// <param name="min">The min value of the acceptable range.</param>
|
||||
/// <param name="max">The max value of the acceptable range.</param>
|
||||
public MinMax(float min, float max)
|
||||
{
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMax"/> where <see cref="Min"/> == <c>float.NegativeInfinity</c> and <see cref="Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMax Unclamped = new MinMax() { Min = float.NegativeInfinity, Max = float.PositiveInfinity };
|
||||
/// <summary>
|
||||
/// A <see cref="MinMax"/> where <see cref="Min"/> == 0 and <see cref="Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMax Positive = new MinMax() { Min = 0, Max = float.PositiveInfinity };
|
||||
|
||||
/// <summary>The hashcode for this <see cref="MinMax"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Min.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Max.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="object"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == other</c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is MinMax minMax)
|
||||
{
|
||||
return this == minMax;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMax"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == other</c>.</returns>
|
||||
public bool Equals(MinMax other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="MinMax"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{Min.ToString(InternalType_667.InternalField_3021, InternalType_667.InternalField_3020)}, {Max.ToString(InternalType_667.InternalField_3021, InternalType_667.InternalField_3020)}]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88216c9605409184fbe4e7fad06dc696
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,200 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A min/max range, per 2D component, X and Y.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="X"/> and <see cref="First"/> read from and write to the same location in memory, as do <see cref="Y"/> and <see cref="Second"/>. This makes them interchangable and subject to user preference or context.</remarks>
|
||||
/// <seealso cref="Length2"/>
|
||||
/// <seealso cref="Length2.Calculated"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_3024)]
|
||||
public struct MinMax2 : IEquatable<MinMax2>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_3024 = 2 * MinMax.InternalField_3025;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the X component.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="First"/>, making the two interchangeable.</remarks>
|
||||
[FieldOffset(0 * MinMax.InternalField_3025)]
|
||||
public MinMax X;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Y component.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="Second"/>, making the two interchangeable.</remarks>
|
||||
[FieldOffset(1 * MinMax.InternalField_3025)]
|
||||
public MinMax Y;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the First component.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="X"/>, making the two interchangeable.</remarks>
|
||||
[NonSerialized, FieldOffset(0 * MinMax.InternalField_3025)]
|
||||
public MinMax First;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Second component.
|
||||
/// </summary>
|
||||
/// <remarks>Memory aligned with <see cref="Y"/>, making the two interchangeable.</remarks>
|
||||
[NonSerialized, FieldOffset(1 * MinMax.InternalField_3025)]
|
||||
public MinMax Second;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum allowed measurement in units, component-wise.
|
||||
/// </summary>
|
||||
public Vector2 Min
|
||||
{
|
||||
readonly get => new Vector2(X.Min, Y.Min);
|
||||
set
|
||||
{
|
||||
X.Min = value.x;
|
||||
Y.Min = value.y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum allowed measurement in units, component-wise.
|
||||
/// </summary>
|
||||
public Vector2 Max
|
||||
{
|
||||
readonly get => new Vector2(X.Max, Y.Max);
|
||||
set
|
||||
{
|
||||
X.Max = value.x;
|
||||
Y.Max = value.y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new <see cref="MinMax2"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="MinMax"/> to assign to <see cref="X"/>, <see cref="First"/>.</param>
|
||||
/// <param name="y">The <see cref="MinMax"/> to assign to <see cref="Y"/>, <see cref="Second"/>.</param>
|
||||
public MinMax2(MinMax x, MinMax y)
|
||||
{
|
||||
X = First = x;
|
||||
Y = Second = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access each component by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/>, <see cref="First"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/>, <see cref="Second"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="MinMax"/> for the given index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 1</exception>
|
||||
public MinMax this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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"/>.<see cref="X">X</see> == <paramref name="rhs"/>.<see cref="X">X</see> && <paramref name="lhs"/>.<see cref="Y">Y</see> == <paramref name="rhs"/>.<see cref="Y">Y</see></c>.</returns>
|
||||
public static bool operator ==(MinMax2 lhs, MinMax2 rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y;
|
||||
}
|
||||
|
||||
/// <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"/>.<see cref="X">X</see> != <paramref name="rhs"/>.<see cref="X">X</see> || <paramref name="lhs"/>.<see cref="Y">Y</see> != <paramref name="rhs"/>.<see cref="Y">Y</see></c>.</returns>
|
||||
public static bool operator !=(MinMax2 lhs, MinMax2 rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMax2"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is MinMax2 minMax)
|
||||
{
|
||||
return this == minMax;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="MinMax2"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + X.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Y.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMax2"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(MinMax2 other)
|
||||
{
|
||||
return X == other.X && Y == other.Y;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="MinMax2"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"MinMax2({X}, {Y})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMax2"/> where <see cref="Min"/> == <c>float.NegativeInfinity</c> and <see cref="Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMax2 Unclamped = new MinMax2() { Min = float.NegativeInfinity * Vector2.one, Max = float.PositiveInfinity * Vector2.one };
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMax2"/> where <see cref="Min"/> == 0 and <see cref="Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMax2 Positive = new MinMax2() { Min = Vector2.zero, Max = float.PositiveInfinity * Vector2.one };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22eb67c6476fb8c4884430f45a226b70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,232 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A min/max range, per 3D component, X, Y, and Z.
|
||||
/// </summary>
|
||||
/// <seealso cref="Length3"/>
|
||||
/// <seealso cref="Length3.Calculated"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_3023)]
|
||||
public struct MinMax3 : IEquatable<MinMax3>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_3023 = 3 * MinMax.InternalField_3025;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the X component.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(0 * MinMax.InternalField_3025)]
|
||||
public MinMax X;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Y component.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(1 * MinMax.InternalField_3025)]
|
||||
public MinMax Y;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Z component.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(2 * MinMax.InternalField_3025)]
|
||||
public MinMax Z;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax2"/> used to clamp the X and Y components.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * MinMax.InternalField_3025)]
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public MinMax2 XY;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum allowed measurement in units, component-wise.
|
||||
/// </summary>
|
||||
public Vector3 Min
|
||||
{
|
||||
readonly get => new Vector3(X.Min, Y.Min, Z.Min);
|
||||
set
|
||||
{
|
||||
X.Min = value.x;
|
||||
Y.Min = value.y;
|
||||
Z.Min = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum allowed measurement in units, component-wise.
|
||||
/// </summary>
|
||||
public Vector3 Max
|
||||
{
|
||||
readonly get => new Vector3(X.Max, Y.Max, Z.Max);
|
||||
set
|
||||
{
|
||||
X.Max = value.x;
|
||||
Y.Max = value.y;
|
||||
Z.Max = value.z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Access each component by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="MinMax"/> for the given index.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public MinMax this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
case 2:
|
||||
return Z;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
case 2:
|
||||
Z = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamps <paramref name="value"/> to the range defined by <see cref="Min"/> and <see cref="Max"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to clamp.</param>
|
||||
/// <returns><paramref name="value"/> clamped to the range defined by <see cref="Min"/> and <see cref="Max"/>.</returns>
|
||||
public Vector3 Clamp(Vector3 value)
|
||||
{
|
||||
return new Vector3(X.Clamp(value.x), Y.Clamp(value.y), Z.Clamp(value.z));
|
||||
}
|
||||
|
||||
/// <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"/>.Min == <paramref name="rhs"/>.Min && <paramref name="lhs"/>.Max == <paramref name="rhs"/>.Max</c>.</returns>
|
||||
public static bool operator ==(MinMax3 lhs, MinMax3 rhs)
|
||||
{
|
||||
return lhs.Min == rhs.Min && lhs.Max == rhs.Max;
|
||||
}
|
||||
|
||||
|
||||
/// <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"/>.Min != <paramref name="rhs"/>.Min || <paramref name="lhs"/>.Max != <paramref name="rhs"/>.Max</c>.</returns>
|
||||
public static bool operator !=(MinMax3 lhs, MinMax3 rhs)
|
||||
{
|
||||
return lhs.X != rhs.X || lhs.Y != rhs.Y || lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMax3"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is MinMax3 MinMax3)
|
||||
{
|
||||
return this == MinMax3;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMax3"/> to compare to.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(MinMax3 other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="MinMax3"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + X.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Y.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Z.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="MinMax3"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"MinMax3({X}, {Y}, {Z})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new <see cref="MinMax3"/>.
|
||||
/// </summary>
|
||||
/// <param name="x">The <see cref="MinMax"/> to assign to <see cref="X"/>.</param>
|
||||
/// <param name="y">The <see cref="MinMax"/> to assign to <see cref="Y"/>.</param>
|
||||
/// <param name="z">The <see cref="MinMax"/> to assign to <see cref="Z"/>.</param>
|
||||
public MinMax3(MinMax x, MinMax y, MinMax z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
||||
XY = new MinMax2(x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMax3"/> where <see cref="Min"/> == <c>float.NegativeInfinity</c> and <see cref="Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static MinMax3 Unclamped = new MinMax3()
|
||||
{
|
||||
X = MinMax.Unclamped,
|
||||
Y = MinMax.Unclamped,
|
||||
Z = MinMax.Unclamped,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMax3"/> where <see cref="Min"/> == 0 and <see cref="Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static MinMax3 Positive = new MinMax3()
|
||||
{
|
||||
X = MinMax.Positive,
|
||||
Y = MinMax.Positive,
|
||||
Z = MinMax.Positive,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 600aed8e6da114441ad025dc11c124a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,309 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A min/max range, per 3D face (Left, Right, Top, Bottom, Front, and Back) offset.
|
||||
/// </summary>
|
||||
/// <seealso cref="LengthBounds"/>
|
||||
/// <seealso cref="LengthBounds.Calculated"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = 3 * MinMax2.InternalField_3024)]
|
||||
public struct MinMaxBounds : IEquatable<MinMaxBounds>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Left offset.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(0 * MinMax.InternalField_3025)]
|
||||
public MinMax Left;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Right offset.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(1 * MinMax.InternalField_3025)]
|
||||
public MinMax Right;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Bottom offset.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(2 * MinMax.InternalField_3025)]
|
||||
public MinMax Bottom;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Top offset.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(3 * MinMax.InternalField_3025)]
|
||||
public MinMax Top;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Front offset.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(4 * MinMax.InternalField_3025)]
|
||||
public MinMax Front;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp the Back offset.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[FieldOffset(5 * MinMax.InternalField_3025)]
|
||||
public MinMax Back;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax2"/> used to clamp the X offsets, <see cref="Left"/> and <see cref="Right"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * MinMax2.InternalField_3024)]
|
||||
public MinMax2 X;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax2"/> used to clamp the Y offsets, <see cref="Bottom"/> and <see cref="Top"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(1 * MinMax2.InternalField_3024)]
|
||||
public MinMax2 Y;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax2"/> used to clamp the Z offsets, <see cref="Front"/> and <see cref="Back"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(2 * MinMax2.InternalField_3024)]
|
||||
public MinMax2 Z;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMaxRect"/> used to clamp the 2D edge offsets, <see cref="Left"/>, <see cref="Right"/>, <see cref="Bottom"/>, and <see cref="Top"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * MinMaxRect.InternalField_3022)]
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
public MinMaxRect XY;
|
||||
|
||||
/// <summary>
|
||||
/// Access each <see cref="MinMax2"/> by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>
|
||||
/// <value>2 => <see cref="Z"/></value><br/>
|
||||
/// </param>
|
||||
/// <returns>The <see cref="MinMax2"/> for the given <paramref name="axis"/>.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 2</exception>
|
||||
public MinMax2 this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
case 2:
|
||||
return Z;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
case 2:
|
||||
Z = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 2].");
|
||||
}
|
||||
}
|
||||
|
||||
internal bool InternalMethod_2415()
|
||||
{
|
||||
return XY.InternalMethod_2411() || Left.Min != Front.Min || Left.Min != Back.Min;
|
||||
}
|
||||
|
||||
internal bool InternalMethod_2414()
|
||||
{
|
||||
return XY.InternalMethod_2410() || Left.Max != Front.Max || Left.Max != Back.Max;
|
||||
}
|
||||
|
||||
/// <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"/>.Left == <paramref name="rhs"/>.Left && <paramref name="lhs"/>.Right == <paramref name="rhs"/>.Right
|
||||
/// && <paramref name="lhs"/>.Bottom == <paramref name="rhs"/>.Bottom && <paramref name="lhs"/>.Top == <paramref name="rhs"/>.Top
|
||||
/// && <paramref name="lhs"/>.Front == <paramref name="rhs"/>.Front && <paramref name="lhs"/>.Back == <paramref name="rhs"/>.Back
|
||||
/// </c>.
|
||||
/// </returns>
|
||||
public static bool operator ==(MinMaxBounds lhs, MinMaxBounds rhs)
|
||||
{
|
||||
return lhs.XY == rhs.XY && lhs.Z == rhs.Z;
|
||||
}
|
||||
|
||||
/// <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"/>.Left != <paramref name="rhs"/>.Left || <paramref name="lhs"/>.Right != <paramref name="rhs"/>.Right
|
||||
/// || <paramref name="lhs"/>.Bottom != <paramref name="rhs"/>.Bottom || <paramref name="lhs"/>.Top != <paramref name="rhs"/>.Top
|
||||
/// || <paramref name="lhs"/>.Front != <paramref name="rhs"/>.Front || <paramref name="lhs"/>.Back != <paramref name="rhs"/>.Back</c>.</returns>
|
||||
public static bool operator !=(MinMaxBounds lhs, MinMaxBounds rhs)
|
||||
{
|
||||
return lhs.XY != rhs.XY || lhs.Z != rhs.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="LengthBounds"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is MinMaxBounds MinMaxBounds)
|
||||
{
|
||||
return this == MinMaxBounds;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="MinMaxBounds"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Top.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Bottom.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Front.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Back.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="MinMaxBounds"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Left == Right)
|
||||
{
|
||||
if (Left == Bottom && Left == Top &&
|
||||
Left == Front && Left == Back)
|
||||
{
|
||||
return $"MinMaxBoundsBounds(All: {Left})";
|
||||
}
|
||||
|
||||
if (Bottom == Top && Front == Back)
|
||||
{
|
||||
return $"MinMaxBoundsBounds(X: {Left}, Y: {Bottom}, Z: {Front})";
|
||||
}
|
||||
}
|
||||
|
||||
return $"MinMaxBounds(L: {Left}, R: {Right}, B: {Bottom}, T: {Top}], F: {Front}, B: {Back})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="MinMaxBounds"/>, specified per face.
|
||||
/// </summary>
|
||||
/// <param name="left">The length assigned to <see cref="Left">Left</see>.</param>
|
||||
/// <param name="right">The length assigned to <see cref="Right">Right</see>.</param>
|
||||
/// <param name="bottom">The length assigned to <see cref="Bottom">Bottom</see>.</param>
|
||||
/// <param name="top">The length assigned to <see cref="Top">Top</see>.</param>
|
||||
/// <param name="front">The length assigned to <see cref="Front">Front</see>.</param>
|
||||
/// <param name="back">The length assigned to <see cref="Back">Back</see>.</param>
|
||||
public MinMaxBounds(MinMax left, MinMax right, MinMax bottom, MinMax top, MinMax front, MinMax back)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
Top = top;
|
||||
Front = front;
|
||||
Back = back;
|
||||
|
||||
X = new MinMax2(left, right);
|
||||
Y = new MinMax2(bottom, top);
|
||||
Z = new MinMax2(front, back);
|
||||
|
||||
XY = new MinMaxRect()
|
||||
{
|
||||
X = X,
|
||||
Y = Y,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="MinMaxBounds"/>, specified per axis.
|
||||
/// </summary>
|
||||
/// <param name="x">The lengths assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The lengths assigned to <see cref="Y">Y</see>.</param>
|
||||
/// <param name="z">The lengths assigned to <see cref="Z">Z</see>.</param>
|
||||
public MinMaxBounds(MinMax2 x, MinMax2 y, MinMax2 z)
|
||||
{
|
||||
Left = x.First;
|
||||
Right = x.Second;
|
||||
Bottom = y.First;
|
||||
Top = y.Second;
|
||||
Front = z.First;
|
||||
Back = z.Second;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
||||
XY = new MinMaxRect()
|
||||
{
|
||||
X = x,
|
||||
Y = y
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMaxBounds"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(MinMaxBounds other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMaxBounds"/> where <see cref="MinMax.Min"/> == <c>0</c> and <see cref="MinMax.Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMaxBounds Positive = new MinMaxBounds()
|
||||
{
|
||||
Left = MinMax.Positive,
|
||||
Right = MinMax.Positive,
|
||||
Bottom = MinMax.Positive,
|
||||
Top = MinMax.Positive,
|
||||
Front = MinMax.Positive,
|
||||
Back = MinMax.Positive,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMaxBounds"/> where <see cref="MinMax.Min"/> == <c>float.NegativeInfinity</c> and <see cref="MinMax.Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMaxBounds Unclamped = new MinMaxBounds()
|
||||
{
|
||||
Left = MinMax.Unclamped,
|
||||
Right = MinMax.Unclamped,
|
||||
Bottom = MinMax.Unclamped,
|
||||
Top = MinMax.Unclamped,
|
||||
Front = MinMax.Unclamped,
|
||||
Back = MinMax.Unclamped,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6623a874ddd78ac499228bd083dd0b85
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,229 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A min/max range, per 2D edge (Left, Right, Top, and Bottom) offset.
|
||||
/// </summary>
|
||||
/// <seealso cref="LengthRect"/>
|
||||
/// <seealso cref="LengthRect.Calculated"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Explicit, Size = InternalField_3022)]
|
||||
public struct MinMaxRect : IEquatable<MinMaxRect>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal const int InternalField_3022 = 2 * MinMax2.InternalField_3024;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp <see cref="LengthRect.Left"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(0 * MinMax.InternalField_3025)]
|
||||
public MinMax Left;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp <see cref="LengthRect.Right"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(1 * MinMax.InternalField_3025)]
|
||||
public MinMax Right;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp <see cref="LengthRect.Bottom"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(2 * MinMax.InternalField_3025)]
|
||||
public MinMax Bottom;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax"/> used to clamp <see cref="LengthRect.Top"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(3 * MinMax.InternalField_3025)]
|
||||
public MinMax Top;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax2"/> used to clamp <see cref="LengthRect.X"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(0 * MinMax2.InternalField_3024)]
|
||||
public MinMax2 X;
|
||||
/// <summary>
|
||||
/// The <see cref="MinMax2"/> used to clamp <see cref="LengthRect.Y"/>.
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
[FieldOffset(1 * MinMax2.InternalField_3024)]
|
||||
public MinMax2 Y;
|
||||
|
||||
/// <summary>
|
||||
/// Access each <see cref="MinMax2"/> by <paramref name="axis"/> index.
|
||||
/// </summary>
|
||||
/// <param name="axis">The axis index to read or write<br/>
|
||||
/// <value>0 => <see cref="X"/></value><br/>
|
||||
/// <value>1 => <see cref="Y"/></value><br/>.
|
||||
/// </param>
|
||||
/// <returns>The <see cref="MinMax2"/> for the given <paramref name="axis"/>.</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">if <paramref name="axis"/> < 0 || <paramref name="axis"/> > 1</exception>
|
||||
public MinMax2 this[int axis]
|
||||
{
|
||||
readonly get
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return X;
|
||||
case 1:
|
||||
return Y;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
X = value;
|
||||
return;
|
||||
case 1:
|
||||
Y = value;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException($"Invalid {nameof(axis)}, [{axis}]. Expected within range [0, 1].");
|
||||
}
|
||||
}
|
||||
|
||||
internal bool InternalMethod_2411()
|
||||
{
|
||||
return Left.Min != Right.Min || Left.Min != Bottom.Min || Left.Min != Top.Min;
|
||||
}
|
||||
|
||||
internal bool InternalMethod_2410()
|
||||
{
|
||||
return Left.Max != Right.Max || Left.Max != Bottom.Max || Left.Max != Top.Max;
|
||||
}
|
||||
|
||||
/// <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"/>.Left == <paramref name="rhs"/>.Left && <paramref name="lhs"/>.Right == <paramref name="rhs"/>.Right
|
||||
/// && <paramref name="lhs"/>.Bottom == <paramref name="rhs"/>.Bottom && <paramref name="lhs"/>.Top == <paramref name="rhs"/>.Top</c>.</returns>
|
||||
public static bool operator ==(MinMaxRect lhs, MinMaxRect rhs)
|
||||
{
|
||||
return lhs.X == rhs.X && lhs.Y == rhs.Y;
|
||||
}
|
||||
|
||||
/// <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"/>.Left != <paramref name="rhs"/>.Left || <paramref name="lhs"/>.Right != <paramref name="rhs"/>.Right
|
||||
/// || <paramref name="lhs"/>.Bottom != <paramref name="rhs"/>.Bottom || <paramref name="lhs"/>.Top != <paramref name="rhs"/>.Top</c>.</returns>
|
||||
public static bool operator !=(MinMaxRect lhs, MinMaxRect rhs)
|
||||
{
|
||||
return lhs.X != rhs.X && lhs.Y != rhs.Y;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMaxRect"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is MinMaxRect MinMaxRect)
|
||||
{
|
||||
return this == MinMaxRect;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="MinMaxRect"/>.</summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Top.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Bottom.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="MinMaxRect"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (Left == Right)
|
||||
{
|
||||
if (Left == Bottom && Left == Top)
|
||||
{
|
||||
return $"MinMaxRectRect(All: {Left})";
|
||||
}
|
||||
|
||||
if (Bottom == Top)
|
||||
{
|
||||
return $"MinMaxRectRect(X: {Left}, Y: {Bottom})";
|
||||
}
|
||||
}
|
||||
|
||||
return $"MinMaxRect(L: {Left}, R: {Right}], B: {Bottom}, T: {Top})";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="MinMaxRect"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(MinMaxRect other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="MinMaxRect"/> where <see cref="MinMax.Min"/> == 0 and <see cref="MinMax.Max"/> == <c>float.PositiveInfinity</c>.
|
||||
/// </summary>
|
||||
public static readonly MinMaxRect Positive = new MinMaxRect()
|
||||
{
|
||||
Left = MinMax.Positive,
|
||||
Right = MinMax.Positive,
|
||||
Bottom = MinMax.Positive,
|
||||
Top = MinMax.Positive,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="MinMaxRect"/>, specified per face.
|
||||
/// </summary>
|
||||
/// <param name="left">The length assigned to <see cref="Left">Left</see>.</param>
|
||||
/// <param name="right">The length assigned to <see cref="Right">Right</see>.</param>
|
||||
/// <param name="bottom">The length assigned to <see cref="Bottom">Bottom</see>.</param>
|
||||
/// <param name="top">The length assigned to <see cref="Top">Top</see>.</param>
|
||||
public MinMaxRect(MinMax left, MinMax right, MinMax bottom, MinMax top)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
Top = top;
|
||||
|
||||
X = new MinMax2(left, right);
|
||||
Y = new MinMax2(bottom, top);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="MinMaxRect"/>. specified per axis.
|
||||
/// </summary>
|
||||
/// <param name="x">The lengths assigned to <see cref="X">X</see>.</param>
|
||||
/// <param name="y">The lengths assigned to <see cref="Y">Y</see>.</param>
|
||||
public MinMaxRect(MinMax2 x, MinMax2 y)
|
||||
{
|
||||
Left = x.First;
|
||||
Right = x.Second;
|
||||
Bottom = y.First;
|
||||
Top = y.Second;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23fa0ec60d4c55643baec1c37477753c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,174 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a type of <see cref="NavLink"/>.
|
||||
/// </summary>
|
||||
public enum NavLinkType
|
||||
{
|
||||
/// <summary>
|
||||
/// Navigation is determined based on the navigation direction.
|
||||
/// </summary>
|
||||
Auto,
|
||||
/// <summary>
|
||||
/// Manually configure a navigation target for each direction.
|
||||
/// </summary>
|
||||
Manual,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the fallback behavior when a navigation target isn't found.
|
||||
/// </summary>
|
||||
public enum NavLinkFallback
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform a navigation query for the nearest navigable
|
||||
/// element outside the active navigation scope.
|
||||
/// </summary>
|
||||
NavigateOutsideScope,
|
||||
|
||||
/// <summary>
|
||||
/// Don't fire any additional events, and don't try
|
||||
/// to navigate outside the active navigation scope.
|
||||
/// </summary>
|
||||
DoNothing,
|
||||
|
||||
/// <summary>
|
||||
/// Fire events to allow event handlers to choose
|
||||
/// how the current state should be handled.
|
||||
/// </summary>
|
||||
FireDirectionEvent,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the navigation <see cref="Target"/> for a navigation direction. If <c><see cref="Type"/> == <see cref="NavLinkType.Auto"/></c>,
|
||||
/// then the system will attempt to find the nearest navigable element in the designated direction.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct NavLink : IEquatable<NavLink>
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="NavLink"/> configured for automatic navigation.
|
||||
/// </summary>
|
||||
public static readonly NavLink Auto = null;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="NavLink"/> configured to not navigate to anything nor fire any events.
|
||||
/// </summary>
|
||||
public static readonly NavLink Empty = new NavLink() { Target = null, Type = NavLinkType.Manual, Fallback = NavLinkFallback.DoNothing };
|
||||
|
||||
/// <summary>
|
||||
/// The type of navigation associated with this link.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLinkType Type;
|
||||
|
||||
/// <summary>
|
||||
/// Designates the fallback behavior in the event a navigation target isn't found or is not configured to be navigable.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLinkFallback Fallback;
|
||||
|
||||
/// <summary>
|
||||
/// The navigation target to use when <c><see cref="Type"/> == <see cref="NavLinkType.Manual"/></c>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public GestureRecognizer Target;
|
||||
|
||||
/// <summary>
|
||||
/// Implicit operator.
|
||||
/// </summary>
|
||||
/// <param name="target">The <see cref="GestureRecognizer"/> to use for manual navigation. If <c>null</c>, then the <see cref="NavLink"/> will be <see cref="NavLink.Auto"/>.</param>
|
||||
public static implicit operator NavLink(GestureRecognizer target)
|
||||
{
|
||||
bool InternalVar_1 = target != null;
|
||||
|
||||
return new NavLink()
|
||||
{
|
||||
Target = target,
|
||||
Type = InternalVar_1 ? NavLinkType.Manual : NavLinkType.Auto,
|
||||
Fallback = InternalVar_1 ? NavLinkFallback.DoNothing : NavLinkFallback.NavigateOutsideScope
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns><c>true</c> if all fields of <paramref name="lhs"/> are equal to their respective fields of <paramref name="rhs"/>.</returns>
|
||||
public static bool operator ==(NavLink lhs, NavLink rhs)
|
||||
{
|
||||
return lhs.Type == rhs.Type &&
|
||||
lhs.Fallback == rhs.Fallback &&
|
||||
lhs.Target == rhs.Target;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inequality operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns><c>true</c> if any fields of <paramref name="lhs"/> are <b>not</b> equal to their respective fields of <paramref name="rhs"/>.</returns>
|
||||
public static bool operator !=(NavLink lhs, NavLink rhs)
|
||||
{
|
||||
return lhs.Type != rhs.Type ||
|
||||
lhs.Fallback != rhs.Fallback ||
|
||||
lhs.Target != rhs.Target;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="NavLink"/> to compare.</param>
|
||||
/// <returns><c>true</c> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(NavLink other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="NavLink"/> to compare.</param>
|
||||
/// <returns><c>true</c> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
return other is NavLink link && Equals(link);
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="NavLink"/></summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Type.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Fallback.GetHashCode();
|
||||
|
||||
if (Target != null)
|
||||
{
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Target.GetHashCode();
|
||||
}
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
internal static class InternalType_740
|
||||
{
|
||||
public static bool InternalMethod_2716(ref this NavLink InternalParameter_3170, out UIBlock InternalParameter_3171)
|
||||
{
|
||||
InternalParameter_3171 = null;
|
||||
|
||||
if (InternalParameter_3170.Type == NavLinkType.Auto || InternalParameter_3170.Target == null || !InternalParameter_3170.Target.InternalProperty_164)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
InternalParameter_3171 = InternalParameter_3170.Target.UIBlock;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 598feca891d521048a4d2806f3299b45
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,236 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the behavior of an element when it's selected.
|
||||
/// </summary>
|
||||
public enum SelectBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Treat Select events as click events.
|
||||
/// </summary>
|
||||
Click,
|
||||
|
||||
/// <summary>
|
||||
/// Push the selected element onto the selection stack and convert
|
||||
/// subsequent navigation move input into corresponding directed input
|
||||
/// events until the element is deselected.
|
||||
/// </summary>
|
||||
FireEvents,
|
||||
|
||||
/// <summary>
|
||||
/// Push the selected element onto the selection stack and scope
|
||||
/// subsequent navigation events to this element's descendant hierarchy
|
||||
/// until it's deselected.
|
||||
/// </summary>
|
||||
ScopeNavigation
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a <see cref="NavLink"/> for each axis-aligned direction.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct NavNode : IEquatable<NavNode>
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="NavNode"/> where all X/Y <see cref="NavLink"/>s are set to <see cref="NavLink.Auto"/> and Z <see cref="NavLink"/>s are set to <see cref="NavLink.Empty"/>.
|
||||
/// </summary>
|
||||
public static readonly NavNode TwoD = new NavNode()
|
||||
{
|
||||
Left = NavLink.Auto,
|
||||
Right = NavLink.Auto,
|
||||
Down = NavLink.Auto,
|
||||
Up = NavLink.Auto,
|
||||
Forward = NavLink.Empty,
|
||||
Back = NavLink.Empty
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="NavLink"/> to use when navigating to the left of this <see cref="NavNode"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLink Left;
|
||||
/// <summary>
|
||||
/// The <see cref="NavLink"/> to use when navigating to the right of this <see cref="NavNode"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLink Right;
|
||||
/// <summary>
|
||||
/// The <see cref="NavLink"/> to use when navigating downward from this <see cref="NavNode"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLink Down;
|
||||
/// <summary>
|
||||
/// The <see cref="NavLink"/> to use when navigating upward from this <see cref="NavNode"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLink Up;
|
||||
/// <summary>
|
||||
/// The <see cref="NavLink"/> to use when navigating forward from this <see cref="NavNode"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLink Forward;
|
||||
/// <summary>
|
||||
/// The <see cref="NavLink"/> to use when navigating backward from this <see cref="NavNode"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public NavLink Back;
|
||||
|
||||
/// <summary>
|
||||
/// Converts the provided <paramref name="direction"/> into the nearest axis-aligned
|
||||
/// direction (e.g. Left, Down, Forward, etc.) and returns the <see cref="NavLink"/>
|
||||
/// corresponding to that axis-aligned direction.
|
||||
/// </summary>
|
||||
/// <param name="direction">The approximate direction vector of the desired <see cref="NavLink"/> to retrieve.</param>
|
||||
/// <returns>The <see cref="NavLink"/> in the given <paramref name="direction"/>.</returns>
|
||||
public NavLink GetLink(Vector3 direction)
|
||||
{
|
||||
NavLink InternalVar_1 = default;
|
||||
|
||||
if (direction == Vector3.left)
|
||||
{
|
||||
InternalVar_1 = Left;
|
||||
}
|
||||
else if (direction == Vector3.down)
|
||||
{
|
||||
InternalVar_1 = Down;
|
||||
}
|
||||
else if (direction == Vector3.back)
|
||||
{
|
||||
InternalVar_1 = Back;
|
||||
}
|
||||
else if (direction == Vector3.right)
|
||||
{
|
||||
InternalVar_1 = Right;
|
||||
}
|
||||
else if (direction == Vector3.up)
|
||||
{
|
||||
InternalVar_1 = Up;
|
||||
}
|
||||
else if (direction == Vector3.forward)
|
||||
{
|
||||
InternalVar_1 = Forward;
|
||||
}
|
||||
else
|
||||
{
|
||||
float InternalVar_2 = Mathf.Atan(direction.y / direction.z) * Mathf.Rad2Deg;
|
||||
|
||||
if (InternalVar_2 <= 45 && InternalVar_2 >= -45)
|
||||
{
|
||||
InternalVar_1 = Forward;
|
||||
}
|
||||
else if (InternalVar_2 >= 135 || InternalVar_2 <= -135)
|
||||
{
|
||||
InternalVar_1 = Back;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Mathf.Atan(direction.y / direction.x) * Mathf.Rad2Deg)
|
||||
{
|
||||
case float angle when angle < 45 && angle >= -45:
|
||||
InternalVar_1 = Right;
|
||||
break;
|
||||
case float angle when angle < 135 && angle >= 45:
|
||||
InternalVar_1 = Up;
|
||||
break;
|
||||
case float angle when angle < -135 || angle >= 135:
|
||||
InternalVar_1 = Left;
|
||||
break;
|
||||
case float angle when angle < -45 && angle >= -135:
|
||||
InternalVar_1 = Down;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns><c>true</c> if all fields of <paramref name="lhs"/> are equal to their respective fields of <paramref name="rhs"/>.</returns>
|
||||
public static bool operator ==(NavNode lhs, NavNode rhs)
|
||||
{
|
||||
return lhs.Left == rhs.Left &&
|
||||
lhs.Right == rhs.Right &&
|
||||
lhs.Down == rhs.Down &&
|
||||
lhs.Up == rhs.Up &&
|
||||
lhs.Forward == rhs.Forward &&
|
||||
lhs.Back == rhs.Back;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inequality operator.
|
||||
/// </summary>
|
||||
/// <param name="lhs">Left hand side.</param>
|
||||
/// <param name="rhs">Right hand side.</param>
|
||||
/// <returns><c>true</c> if any fields of <paramref name="lhs"/> are <b>not</b> equal to their respective fields of <paramref name="rhs"/>.</returns>
|
||||
public static bool operator !=(NavNode lhs, NavNode rhs)
|
||||
{
|
||||
return lhs.Left != rhs.Left ||
|
||||
lhs.Right != rhs.Right ||
|
||||
lhs.Down != rhs.Down ||
|
||||
lhs.Up != rhs.Up ||
|
||||
lhs.Forward != rhs.Forward ||
|
||||
lhs.Back != rhs.Back;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="NavNode"/> to compare.</param>
|
||||
/// <returns><c>true</c> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public bool Equals(NavNode other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="NavNode"/> to compare.</param>
|
||||
/// <returns><c>true</c> if <c>this == <paramref name="other"/></c>.</returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
return other is NavNode node && Equals(node);
|
||||
}
|
||||
|
||||
/// <summary>The hashcode for this <see cref="NavNode"/></summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Left.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Right.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Down.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Up.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Forward.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Back.GetHashCode();
|
||||
|
||||
return InternalVar_1;
|
||||
}
|
||||
}
|
||||
|
||||
internal static class InternalType_741
|
||||
{
|
||||
public static bool InternalMethod_2715(ref this NavNode InternalParameter_3172, Vector3 InternalParameter_3173, out InternalType_5 InternalParameter_3174)
|
||||
{
|
||||
InternalParameter_3174 = null;
|
||||
|
||||
NavLink InternalVar_1 = InternalParameter_3172.GetLink(InternalParameter_3173);
|
||||
|
||||
if (InternalVar_1.InternalMethod_2716(out UIBlock InternalVar_2))
|
||||
{
|
||||
InternalParameter_3174 = InternalVar_2;
|
||||
}
|
||||
|
||||
return InternalVar_1.Type == NavLinkType.Manual;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea1266cf8d64c6c4db4c26779ff75dc4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,984 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
|
||||
using Nova.Compat;
|
||||
using Nova.InternalNamespace_0;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_4;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_2;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_11;
|
||||
using Nova.InternalNamespace_0.InternalNamespace_5.InternalNamespace_6;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static Nova.Interaction;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A callback to invoke whenever navigation focus for a particular <paramref name="controlID"/> moves to a new <see cref="UIBlock"/>, <paramref name="focused"/>.
|
||||
/// </summary>
|
||||
/// <param name="controlID">The unique identifier of the input control whose navigation focus is now set on <paramref name="focused"/>.</param>
|
||||
/// <param name="focused">The <see cref="UIBlock"/> which will now receive subsequent <see cref="Navigate.OnSelect"/> events. Can be <c>null</c>.</param>
|
||||
public delegate void NavigationFocusChangedCallback(uint controlID, UIBlock focused);
|
||||
|
||||
/// <summary>
|
||||
/// The static access point to provide input navigation and selection events.
|
||||
/// </summary>
|
||||
/// <seealso cref="Navigate.OnMoveTo"/>
|
||||
/// <seealso cref="Navigate.OnMoveFrom"/>
|
||||
/// <seealso cref="Navigate.OnDirection"/>
|
||||
/// <seealso cref="Navigate.OnSelect"/>
|
||||
/// <seealso cref="Navigate.OnDeselect"/>
|
||||
public static class Navigation
|
||||
{
|
||||
/// <summary>
|
||||
/// Event fired after the navigation queue has been processed, if a new <see cref="UIBlock"/>
|
||||
/// with an attached <see cref="GestureRecognizer"/> component receives navigation focus
|
||||
/// from a particular controlID.
|
||||
/// </summary>
|
||||
public static event NavigationFocusChangedCallback OnNavigationFocusChanged = null;
|
||||
|
||||
/// <summary>
|
||||
/// Moves navigation focus to <paramref name="uiBlock"/>.
|
||||
/// </summary>
|
||||
/// <param name="uiBlock">The <see cref="UIBlock"/> used as the starting point for subsequent navigation events.</param>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.</param>
|
||||
/// <param name="userData">Any additional data to pass along to the receiver of the current interaction. See <see cref="Update.UserData"/>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <exception cref="System.ArgumentException">If <paramref name="controlID"/> is out of range or if <paramref name="uiBlock"/> is not navigable.</exception>
|
||||
public static void Focus(UIBlock uiBlock, uint controlID = 0, object userData = null, int layerMask = AllLayers)
|
||||
{
|
||||
if (controlID < 0 || controlID >= InternalType_89.InternalField_2940)
|
||||
{
|
||||
throw new System.ArgumentException($"Invalid Control ID [{controlID}]. Expected within range [0, {InternalType_89.InternalField_2940}).");
|
||||
}
|
||||
|
||||
UIBlock InternalVar_1 = InternalType_757<UIBlock>.InternalMethod_3568(controlID);
|
||||
|
||||
if (InternalVar_1 == uiBlock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Ray InternalVar_2 = InternalMethod_2947(InternalVar_1, uiBlock);
|
||||
|
||||
if (uiBlock != null)
|
||||
{
|
||||
if ((layerMask & (1 << uiBlock.gameObject.layer)) == 0)
|
||||
{
|
||||
throw new System.ArgumentException($"{uiBlock.name} not on focusable layer provided by {nameof(layerMask)}.");
|
||||
}
|
||||
|
||||
if (!uiBlock.TryGetComponent(out GestureRecognizer InternalVar_3))
|
||||
{
|
||||
throw new System.ArgumentException($"{uiBlock.name} not navigable. Navigation starting point must have an {nameof(Interactable)} or {nameof(Scroller)} component attached, enabled, and configured to be navigable.");
|
||||
}
|
||||
|
||||
if (!InternalVar_3.enabled)
|
||||
{
|
||||
throw new System.ArgumentException($"{uiBlock.name} not navigable. Attached {InternalVar_3.GetType().Name} must be enabled and configured to be navigable.");
|
||||
}
|
||||
|
||||
if (!InternalVar_3.Navigable)
|
||||
{
|
||||
throw new System.ArgumentException($"{uiBlock.name} not navigable. Attached {InternalVar_3.GetType().Name} must have {nameof(GestureRecognizer.Navigable)} set to \"True\".");
|
||||
}
|
||||
}
|
||||
|
||||
InternalMethod_2689(InternalProperty_1085, InternalType_738.InternalMethod_2888(InternalVar_1, uiBlock, new Update(InternalVar_2, controlID, userData), layerMask, InternalParameter_3134: uiBlock != null));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queues an attempt to move navigation focus to the next navigable <see cref="UIBlock"/> in the approximate local
|
||||
/// space direction to be processed at the start of the next frame, after the Nova Engine
|
||||
/// update has run for the current frame.
|
||||
/// </summary>
|
||||
/// <param name="direction">The direction to navigate in the local space of the current focused element.</param>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.</param>
|
||||
/// <param name="userData">Any additional data to pass along to the receiver of the current interaction. See <see cref="Update.UserData"/>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <exception cref="System.ArgumentException">If <paramref name="controlID"/> is out of range.</exception>
|
||||
/// <exception cref="System.InvalidOperationException">
|
||||
/// If <see cref="Focus(UIBlock, uint, object, int)"/> has not been called for the given <paramref name="controlID"/>.
|
||||
/// </exception>
|
||||
public static void Move(Vector3 direction, uint controlID = 0, object userData = null, int layerMask = AllLayers)
|
||||
{
|
||||
if (controlID < 0 || controlID >= InternalType_89.InternalField_2940)
|
||||
{
|
||||
throw new System.ArgumentException($"Invalid Control ID [{controlID}]. Expected within range [0, {InternalType_89.InternalField_2940})");
|
||||
}
|
||||
|
||||
UIBlock InternalVar_1 = InternalType_757<UIBlock>.InternalMethod_3568(controlID);
|
||||
|
||||
if (InternalVar_1 == null)
|
||||
{
|
||||
throw new System.InvalidOperationException($"Unable to move navigation focus. Must call {nameof(Focus)} with a navigable {nameof(UIBlock)} and matching {nameof(controlID)} before any calls to {nameof(Move)}.");
|
||||
}
|
||||
|
||||
direction.Normalize();
|
||||
|
||||
GestureRecognizer InternalVar_2 = InternalVar_1.InternalProperty_23.InternalProperty_1150 as GestureRecognizer;
|
||||
bool InternalVar_3 = InternalVar_2 != null && InternalVar_2.Navigation.GetLink(direction).Fallback == NavLinkFallback.NavigateOutsideScope;
|
||||
|
||||
int InternalVar_4 = InternalType_757<UIBlock>.InternalMethod_3620(controlID);
|
||||
|
||||
if (!InternalVar_3)
|
||||
{
|
||||
InternalVar_4 = Mathf.Min(1, InternalVar_4);
|
||||
}
|
||||
|
||||
InternalType_5 InternalVar_5 = null;
|
||||
InternalType_764 InternalVar_6 = InternalType_764.InternalField_1157;
|
||||
|
||||
if (InternalVar_4 == 0)
|
||||
{
|
||||
InternalVar_6 = InternalType_757<UIBlock>.InternalMethod_3613(InternalVar_1, null, direction, layerMask, out InternalVar_5);
|
||||
}
|
||||
|
||||
for (int InternalVar_7 = 0; InternalVar_7 < InternalVar_4; ++InternalVar_7)
|
||||
{
|
||||
UIBlock InternalVar_8 = InternalType_757<UIBlock>.InternalMethod_3571(controlID, InternalVar_7);
|
||||
bool InternalVar_9 = InternalVar_8 != null;
|
||||
bool InternalVar_10 = InternalVar_9 && InternalVar_8.InternalProperty_23.InternalProperty_1152;
|
||||
|
||||
if (InternalVar_10)
|
||||
{
|
||||
Update InternalVar_11 = new Update(InternalType_757<UIBlock>.InternalMethod_3583(direction, InternalVar_8, InternalParameter_3305: true), controlID, userData);
|
||||
InternalVar_8.InternalMethod_91(Navigate.InternalMethod_461(InternalVar_11, InternalVar_8, direction));
|
||||
return;
|
||||
}
|
||||
|
||||
InternalVar_6 = InternalType_757<UIBlock>.InternalMethod_3613(InternalVar_1, InternalVar_8, direction, layerMask, out InternalVar_5);
|
||||
|
||||
if (InternalVar_6 != InternalType_764.InternalField_1157)
|
||||
{
|
||||
InternalType_5 InternalVar_11 = InternalVar_5 != null ? InternalVar_5 : InternalVar_1;
|
||||
InternalType_757<UIBlock>.InternalMethod_3637(InternalVar_11, controlID, InternalVar_7);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!InternalVar_9)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((InternalVar_8.InternalProperty_23.InternalProperty_1150 is GestureRecognizer gr) && gr.Navigation.GetLink(direction).Fallback != NavLinkFallback.NavigateOutsideScope)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InternalType_738 InternalVar_12 = InternalVar_6 == InternalType_764.InternalField_1557 ? InternalType_738.InternalMethod_2801(InternalVar_1, InternalVar_5 as UIBlock, new Update(InternalType_757<UIBlock>.InternalMethod_3583(direction, InternalVar_1), controlID, userData), direction, layerMask) :
|
||||
InternalType_738.InternalMethod_2815(controlID, direction, userData, layerMask);
|
||||
|
||||
InternalProperty_1082.Add(InternalVar_12);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the currently focused <see cref="UIBlock"/>.
|
||||
/// </summary>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.</param>
|
||||
/// <param name="userData">Any additional data to pass along to the receiver of the current interaction. See <see cref="Update.UserData"/>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <exception cref="System.ArgumentException">If <paramref name="controlID"/> is out of range.</exception>
|
||||
public static void Select(uint controlID = 0, object userData = null, int layerMask = AllLayers)
|
||||
{
|
||||
if (controlID < 0 || controlID >= InternalType_89.InternalField_2940)
|
||||
{
|
||||
throw new System.ArgumentException($"Invalid Control ID [{controlID}]. Expected within range [0, {InternalType_89.InternalField_2940})");
|
||||
}
|
||||
|
||||
UIBlock InternalVar_1 = InternalType_757<UIBlock>.InternalMethod_3568(controlID);
|
||||
|
||||
if (InternalVar_1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GestureRecognizer InternalVar_2 = InternalVar_1.InternalProperty_23.InternalProperty_1150 as GestureRecognizer;
|
||||
|
||||
if (InternalVar_2 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((layerMask & (1 << InternalVar_1.gameObject.layer)) == 0)
|
||||
{
|
||||
Debug.LogWarning($"Unable to select. Focused {nameof(UIBlock)}, {InternalVar_1.name}, not on selectable layer provided by {nameof(layerMask)}.", InternalVar_1);
|
||||
return;
|
||||
}
|
||||
|
||||
bool InternalVar_3 = InternalType_757<UIBlock>.InternalMethod_3570(controlID) != InternalVar_1;
|
||||
|
||||
if (!InternalVar_3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Ray InternalVar_4 = new Ray(InternalVar_1.transform.position, -InternalVar_1.transform.forward);
|
||||
Update InternalVar_5 = new Update(InternalVar_4, controlID, userData);
|
||||
|
||||
switch (InternalVar_2.OnSelect)
|
||||
{
|
||||
case SelectBehavior.Click:
|
||||
{
|
||||
InternalVar_1.InternalMethod_91(Gesture.InternalMethod_3226(InternalVar_5, InternalVar_1));
|
||||
break;
|
||||
}
|
||||
case SelectBehavior.FireEvents:
|
||||
{
|
||||
InternalType_757<UIBlock>.InternalMethod_3572(controlID, InternalVar_1, layerMask);
|
||||
InternalVar_1.InternalMethod_91(Navigate.InternalMethod_460(InternalVar_5, InternalVar_1));
|
||||
break;
|
||||
}
|
||||
case SelectBehavior.ScopeNavigation:
|
||||
{
|
||||
InternalType_757<UIBlock>.InternalMethod_3572(controlID, InternalVar_1, layerMask);
|
||||
InternalVar_1.InternalMethod_91(Navigate.InternalMethod_460(InternalVar_5, InternalVar_1));
|
||||
|
||||
if (InternalVar_1.ChildCount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
InternalProperty_1082.Add(InternalType_738.InternalMethod_2796(controlID, InternalVar_1, userData, layerMask));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deselects the currently selected <see cref="UIBlock"/>.
|
||||
/// </summary>
|
||||
/// <param name="controlID">The unique identifier of the input control generating this <see cref="Update"/>.</param>
|
||||
/// <param name="userData">Any additional data to pass along to the receiver of the current interaction. See <see cref="Update.UserData"/>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <exception cref="System.ArgumentException">If <paramref name="controlID"/> is out of range.</exception>
|
||||
public static void Deselect(uint controlID = 0, object userData = null, int layerMask = AllLayers)
|
||||
{
|
||||
if (controlID < 0 || controlID >= InternalType_89.InternalField_2940)
|
||||
{
|
||||
throw new System.ArgumentException($"Invalid Control ID [{controlID}]. Expected within range [0, {InternalType_89.InternalField_2940})");
|
||||
}
|
||||
|
||||
UIBlock InternalVar_1 = InternalType_757<UIBlock>.InternalMethod_3568(controlID);
|
||||
UIBlock InternalVar_2 = InternalType_757<UIBlock>.InternalMethod_3574(controlID);
|
||||
|
||||
if (InternalVar_2 != null)
|
||||
{
|
||||
Ray InternalVar_3 = InternalMethod_2947(InternalVar_1, InternalVar_2);
|
||||
|
||||
Update InternalVar_4 = new Update(InternalVar_3, controlID, userData);
|
||||
|
||||
InternalMethod_2689(InternalProperty_1085, InternalType_738.InternalMethod_2888(InternalVar_1, InternalVar_2, InternalVar_4, layerMask));
|
||||
|
||||
InternalVar_2.InternalMethod_91(Navigate.InternalMethod_2058(InternalVar_4, InternalVar_2));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the <see cref="UIBlock"/> which was most recently navigated to from the provided <paramref name="controlID"/>.
|
||||
/// </summary>
|
||||
/// <param name="controlID">The unique identifier of the input control.</param>
|
||||
/// <param name="focused">The <see cref="UIBlock"/> most recently navigated to with the given <paramref name="controlID"/>.</param>
|
||||
/// <returns>If a navigated <see cref="UIBlock"/> is found and actively navigable, returns <c>true</c>. If the <see cref="UIBlock"/> was not found or is no longer navigable, returns <c>false</c>.</returns>
|
||||
public static bool TryGetFocusedUIBlock(uint controlID, out UIBlock focused)
|
||||
{
|
||||
focused = null;
|
||||
if (controlID < 0 || controlID >= InternalType_89.InternalField_2940)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
focused = InternalType_757<UIBlock>.InternalMethod_3568(controlID);
|
||||
|
||||
if (focused != null && focused.InternalProperty_23.InternalProperty_1150 != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
focused = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the actively selected <see cref="UIBlock"/> for the provided <paramref name="controlID"/>, if it exists.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the <see cref="SelectBehavior"/> of the focused element is set to <see cref="SelectBehavior.Click"/>,
|
||||
/// it will not be considered "selected" after it's clicked. Only elements whose <see cref="SelectBehavior"/> is set
|
||||
/// to <see cref="SelectBehavior.ScopeNavigation"/> or <see cref="SelectBehavior.FireEvents"/> are "selectable".
|
||||
/// </remarks>
|
||||
/// <param name="controlID">The unique identifier of the input control.</param>
|
||||
/// <param name="selected">The actively selected <see cref="UIBlock"/> for the given <paramref name="controlID"/>.</param>
|
||||
/// <returns>If a selected <see cref="UIBlock"/> is found and actively navigable, returns <c>true</c>. If the <see cref="UIBlock"/> was not found or is no longer navigable, returns <c>false</c>.</returns>
|
||||
public static bool TryGetSelectedUIBlock(uint controlID, out UIBlock selected)
|
||||
{
|
||||
selected = null;
|
||||
if (controlID < 0 || controlID >= InternalType_89.InternalField_2940)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
selected = InternalType_757<UIBlock>.InternalMethod_3570(controlID);
|
||||
|
||||
if (selected != null && selected.InternalProperty_23.InternalProperty_1150 != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
selected = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a navigation-specific raycast against all navigable <see cref="UIBlock"/>s under <paramref name="scope"/> and retrieves a <see cref="UIBlockHit"/> for the nearest navigable <see cref="UIBlock"/> in the general direction of the provided <paramref name="ray"/>.
|
||||
/// </summary>
|
||||
/// <param name="ray">A ray, in worldspace, to use for the navigation-specific raycast.</param>
|
||||
/// <param name="blockHit">A <see cref="UIBlockHit"/> for the top-most-rendered navigable <see cref="UIBlock"/> in the provided <paramref name="ray"/>'s general direction.</param>
|
||||
/// <param name="ignore">The <see cref="UIBlock"/> to exclude from the results, defaults to <c>null</c>. Useful for when a specific <see cref="UIBlock"/> should be filtered out.</param>
|
||||
/// <param name="scope">The root of <see cref="UIBlock"/>s to test against, defaults to <c>null</c>. All <see cref="UIBlock"/>s in the scene are tested when <c><paramref name="scope"/> == null</c>.</param>
|
||||
/// <param name="navigablesOnly">Only include results with navigable elements? Defaults to <c>true</c>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
/// <returns><c>true</c> if <i>any</i> <see cref="UIBlock"/> (on the <paramref name="layerMask"/>) is in the general direction of the provided <paramref name="ray"/>.</returns>
|
||||
public static bool NavCast(Ray ray, out UIBlockHit blockHit, UIBlock ignore = null, UIBlock scope = null, bool navigablesOnly = true, int layerMask = AllLayers)
|
||||
{
|
||||
InternalType_131 InternalVar_1 = scope == null ? InternalType_131.InternalField_415 : scope.InternalProperty_29;
|
||||
InternalType_131 InternalVar_2 = ignore == null ? InternalType_131.InternalField_415 : ignore.InternalProperty_29;
|
||||
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3581(ray, layerMask, InternalVar_1, InternalVar_2, navigablesOnly, out InternalType_428 InternalVar_3))
|
||||
{
|
||||
blockHit = InternalMethod_2889(InternalVar_3);
|
||||
return true;
|
||||
}
|
||||
|
||||
blockHit = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a navigation-specific raycast against all navigable <see cref="UIBlock"/>s under <paramref name="scope"/> and populates the provided list of <see cref="UIBlockHit"/>s for all navigable <see cref="UIBlock"/>s in the general direction of the provided <paramref name="ray"/>.
|
||||
/// </summary>
|
||||
/// <param name="ray">A ray, in worldspace, to use for the navigation-specific raycast.</param>
|
||||
/// <param name="hitsToPopulate">The list to populate with all <see cref="UIBlockHit"/> collisions, sorted by closest to the ray origin and top-most-rendered (at index 0).</param>
|
||||
/// <param name="ignore">The <see cref="UIBlock"/> to exclude from the results, defaults to <c>null</c>. Useful for when a specific <see cref="UIBlock"/> should be filtered out.</param>
|
||||
/// <param name="scope">The root of <see cref="UIBlock"/>s to test against, defaults to <c>null</c>. All <see cref="UIBlock"/>s in the scene are tested when <c><paramref name="scope"/> == null</c>.</param>
|
||||
/// <param name="navigablesOnly">Only include results with navigable elements? Defaults to <c>true</c>.</param>
|
||||
/// <param name="layerMask">The gameobject layers to include, defaults to "All Layers".</param>
|
||||
public static void NavCastAll(Ray ray, List<UIBlockHit> hitsToPopulate, UIBlock ignore = null, UIBlock scope = null, bool navigablesOnly = true, int layerMask = AllLayers)
|
||||
{
|
||||
hitsToPopulate.Clear();
|
||||
|
||||
InternalType_131 InternalVar_1 = scope == null ? InternalType_131.InternalField_415 : scope.InternalProperty_29;
|
||||
InternalType_131 InternalVar_2 = ignore == null ? InternalType_131.InternalField_415 : ignore.InternalProperty_29;
|
||||
|
||||
InternalType_521<InternalType_428> InternalVar_3 = InternalType_757<UIBlock>.InternalMethod_3582(ray, layerMask, InternalVar_1, InternalVar_2, navigablesOnly);
|
||||
|
||||
for (int InternalVar_4 = 0; InternalVar_4 < InternalVar_3.InternalProperty_433; ++InternalVar_4)
|
||||
{
|
||||
hitsToPopulate.Add(InternalMethod_2889(InternalVar_3[InternalVar_4]));
|
||||
}
|
||||
}
|
||||
|
||||
#region
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static List<InternalType_738> InternalProperty_1082 => InternalField_303[1];
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static List<InternalType_738> InternalProperty_1083 => InternalField_303[0];
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static InternalType_95 InternalProperty_1084 => InternalField_3233[0];
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static InternalType_95 InternalProperty_1085 => InternalField_3233[1];
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static List<InternalType_738>[] InternalField_303 = null;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private static InternalType_95[] InternalField_3233 = null;
|
||||
|
||||
internal static void InternalMethod_3015()
|
||||
{
|
||||
if (!NovaApplication.IsPlaying)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_303 = new List<InternalType_738>[] { new List<InternalType_738>(), new List<InternalType_738>() };
|
||||
InternalField_3233 = new InternalType_95[] { new InternalType_95(), new InternalType_95() };
|
||||
|
||||
InternalType_757<UIBlock>.InternalEvent_12 -= InternalMethod_2687;
|
||||
InternalType_757<UIBlock>.InternalEvent_12 += InternalMethod_2687;
|
||||
|
||||
InternalType_429.InternalEvent_13 -= InternalMethod_2688;
|
||||
InternalType_429.InternalEvent_13 += InternalMethod_2688;
|
||||
|
||||
OnNavigationFocusChanged = null;
|
||||
}
|
||||
|
||||
private static void InternalMethod_2688()
|
||||
{
|
||||
if (!NovaApplication.IsPlaying || !InternalType_64.InternalProperty_200.InternalProperty_742)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalMethod_2690();
|
||||
|
||||
List<InternalType_738> InternalVar_1 = InternalProperty_1083;
|
||||
InternalType_95 InternalVar_2 = InternalProperty_1084;
|
||||
|
||||
if (InternalVar_1.Count == 0 && InternalVar_2.InternalProperty_1086 == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int InternalVar_3 = 0; InternalVar_3 < InternalVar_1.Count; ++InternalVar_3)
|
||||
{
|
||||
InternalType_738 InternalVar_4 = InternalVar_1[InternalVar_3];
|
||||
|
||||
if (InternalVar_4.InternalField_3182 == InternalType_739.InternalField_3438)
|
||||
{
|
||||
InternalVar_4 = InternalMethod_2891(InternalVar_4);
|
||||
}
|
||||
|
||||
if (InternalVar_4.InternalField_3182 == InternalType_739.InternalField_3437)
|
||||
{
|
||||
InternalVar_4 = InternalMethod_2823(InternalVar_4);
|
||||
}
|
||||
|
||||
if (InternalVar_4.InternalField_3182 == InternalType_739.InternalField_2216)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
InternalMethod_2689(InternalVar_2, InternalVar_4);
|
||||
}
|
||||
|
||||
InternalVar_1.Clear();
|
||||
|
||||
InternalType_95 InternalVar_5 = InternalProperty_1085;
|
||||
|
||||
InternalType_521<uint> InternalVar_6 = InternalVar_5.InternalProperty_1087;
|
||||
|
||||
for (int InternalVar_7 = InternalVar_6.InternalProperty_433 - 1; InternalVar_7 >= 0; --InternalVar_7)
|
||||
{
|
||||
uint InternalVar_8 = InternalVar_6[InternalVar_7];
|
||||
|
||||
if (InternalVar_5.InternalMethod_2822(InternalVar_8, out UIBlock InternalVar_9))
|
||||
{
|
||||
InternalVar_2.InternalMethod_2797(InternalVar_8, InternalVar_9);
|
||||
InternalVar_5.InternalMethod_2890(InternalVar_8);
|
||||
}
|
||||
}
|
||||
|
||||
InternalVar_6 = InternalVar_2.InternalProperty_1087;
|
||||
|
||||
for (int InternalVar_7 = 0; InternalVar_7 < InternalVar_6.InternalProperty_433; ++InternalVar_7)
|
||||
{
|
||||
uint InternalVar_8 = InternalVar_6[InternalVar_7];
|
||||
|
||||
if (InternalVar_2.InternalMethod_2822(InternalVar_8, out UIBlock InternalVar_9))
|
||||
{
|
||||
if (InternalVar_9 != null)
|
||||
{
|
||||
InternalType_757<UIBlock>.InternalMethod_3637(InternalVar_9, InternalVar_8, 0);
|
||||
}
|
||||
|
||||
InternalMethod_2799(InternalVar_8, InternalVar_9);
|
||||
}
|
||||
}
|
||||
|
||||
InternalVar_2.InternalMethod_2817();
|
||||
}
|
||||
|
||||
private static void InternalMethod_2690()
|
||||
{
|
||||
List<InternalType_738> InternalVar_1 = InternalField_303[0];
|
||||
InternalField_303[0] = InternalField_303[1];
|
||||
InternalField_303[1] = InternalVar_1;
|
||||
|
||||
InternalType_95 InternalVar_2 = InternalField_3233[0];
|
||||
InternalField_3233[0] = InternalField_3233[1];
|
||||
InternalField_3233[1] = InternalVar_2;
|
||||
}
|
||||
|
||||
private static void InternalMethod_2687(uint InternalParameter_3022, UIBlock InternalParameter_3021, UIBlock InternalParameter_3020, int InternalParameter_2911)
|
||||
{
|
||||
if (InternalParameter_3020 == null)
|
||||
{
|
||||
InternalMethod_2818(InternalProperty_1085, InternalParameter_3021, InternalParameter_3020, InternalParameter_3022);
|
||||
return;
|
||||
}
|
||||
|
||||
UIBlock InternalVar_1 = InternalType_757<UIBlock>.InternalMethod_3570(InternalParameter_3022);
|
||||
|
||||
if (InternalVar_1 == InternalParameter_3020 && InternalType_757<UIBlock>.InternalMethod_3584(InternalVar_1, out Vector3 InternalVar_2, out Ray InternalVar_3, InternalParameter_2911, out UIBlock InternalVar_4))
|
||||
{
|
||||
InternalMethod_2689(InternalProperty_1085, InternalType_738.InternalMethod_2801(InternalParameter_3021, InternalVar_4, new Update(InternalVar_3, InternalParameter_3022), InternalVar_2, InternalParameter_2911));
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalMethod_2689(InternalProperty_1085, InternalType_738.InternalMethod_2888(InternalParameter_3021, InternalParameter_3020, new Update(InternalMethod_2947(InternalParameter_3021, InternalParameter_3020), InternalParameter_3022), InternalParameter_2911));
|
||||
}
|
||||
}
|
||||
|
||||
private static void InternalMethod_2689(InternalType_95 InternalParameter_2910, InternalType_738 InternalParameter_2459)
|
||||
{
|
||||
UIBlock InternalVar_1 = InternalParameter_2459.InternalField_2411;
|
||||
UIBlock InternalVar_2 = InternalParameter_2459.InternalField_2412;
|
||||
Update InternalVar_3 = InternalParameter_2459.InternalField_2414;
|
||||
Vector3 InternalVar_4 = InternalParameter_2459.InternalField_2410;
|
||||
int InternalVar_5 = InternalParameter_2459.InternalField_2395;
|
||||
|
||||
if (InternalVar_2 == null && InternalVar_1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalVar_1 = InternalVar_1 != null && InternalVar_1.InternalProperty_23.InternalProperty_1150 != null ? InternalVar_1 : null;
|
||||
|
||||
bool InternalVar_6 = InternalParameter_2459.InternalField_3182 == InternalType_739.InternalField_2217;
|
||||
|
||||
if (!InternalVar_6 && InternalVar_2 != null && InternalVar_1 == null)
|
||||
{
|
||||
InternalType_754 InternalVar_7 = InternalVar_2.InternalProperty_23.InternalProperty_1150;
|
||||
|
||||
if (InternalVar_7 == null || !InternalVar_7.InternalMethod_3559(InternalVar_4))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GestureRecognizer InternalVar_8 = InternalVar_7 as GestureRecognizer;
|
||||
NavLink InternalVar_9 = InternalVar_8.Navigation.GetLink(InternalVar_4);
|
||||
|
||||
switch (InternalVar_9.Fallback)
|
||||
{
|
||||
case NavLinkFallback.DoNothing:
|
||||
return;
|
||||
case NavLinkFallback.FireDirectionEvent:
|
||||
InternalVar_2.InternalMethod_91(Navigate.InternalMethod_461(InternalVar_3, InternalVar_2, InternalVar_4));
|
||||
return;
|
||||
case NavLinkFallback.NavigateOutsideScope:
|
||||
int InternalVar_10 = 0;
|
||||
UIBlock InternalVar_11 = InternalType_757<UIBlock>.InternalMethod_3571(InternalVar_3.ControlID, InternalVar_10++);
|
||||
|
||||
while (InternalVar_1 == null)
|
||||
{
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3577(InternalVar_11, InternalVar_4, out InternalType_5 InternalVar_12))
|
||||
{
|
||||
InternalVar_1 = InternalVar_12 as UIBlock;
|
||||
break;
|
||||
}
|
||||
|
||||
if (InternalVar_11 == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
UIBlock InternalVar_13 = InternalType_757<UIBlock>.InternalMethod_3571(InternalVar_3.ControlID, InternalVar_10++);
|
||||
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3579(InternalVar_3.Ray, InternalVar_2, InternalVar_13, InternalVar_5, InternalParameter_3280: true, out InternalType_428 InternalVar_14))
|
||||
{
|
||||
InternalVar_1 = InternalVar_14.InternalField_1642 as UIBlock;
|
||||
break;
|
||||
}
|
||||
|
||||
InternalVar_11 = InternalVar_13;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (InternalVar_1 == null && !InternalVar_6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalMethod_2818(InternalParameter_2910, InternalVar_2, InternalVar_1, InternalVar_3.ControlID);
|
||||
|
||||
InternalType_521<UIBlock> InternalVar_15 = InternalType_757<UIBlock>.InternalMethod_3636(InternalVar_1, InternalType_757<UIBlock>.InternalMethod_3570(InternalVar_3.ControlID), InternalVar_5);
|
||||
|
||||
UIBlock InternalVar_16 = InternalVar_15.InternalProperty_433 > 0 ? InternalVar_15[0] : InternalVar_1;
|
||||
|
||||
while (!InternalType_757<UIBlock>.InternalMethod_3575(InternalVar_3.ControlID, InternalVar_16))
|
||||
{
|
||||
UIBlock InternalVar_17 = InternalType_757<UIBlock>.InternalMethod_3574(InternalVar_3.ControlID);
|
||||
InternalVar_17.InternalMethod_91(Navigate.InternalMethod_2058(InternalVar_3, InternalVar_17));
|
||||
}
|
||||
|
||||
for (int InternalVar_17 = 0; InternalVar_17 < InternalVar_15.InternalProperty_433; ++InternalVar_17)
|
||||
{
|
||||
InternalType_757<UIBlock>.InternalMethod_3569(InternalVar_3.ControlID, InternalVar_15[InternalVar_17], InternalVar_5);
|
||||
Select(InternalVar_3.ControlID, InternalVar_3.UserData, InternalVar_5);
|
||||
}
|
||||
|
||||
InternalType_757<UIBlock>.InternalMethod_3569(InternalVar_3.ControlID, InternalVar_1, InternalVar_5);
|
||||
|
||||
Ray InternalVar_18 = InternalVar_3.Ray;
|
||||
|
||||
if (InternalVar_2 != null)
|
||||
{
|
||||
Vector3 InternalVar_19 = InternalVar_2.transform.InverseTransformDirection(InternalVar_18.direction);
|
||||
InternalVar_2.InternalMethod_91(Navigate.InternalMethod_1883(InternalVar_3, InternalVar_2, InternalVar_1, InternalVar_19));
|
||||
}
|
||||
|
||||
if (InternalVar_1 != null)
|
||||
{
|
||||
Vector3 InternalVar_19 = InternalVar_1.transform.InverseTransformDirection(InternalVar_18.direction);
|
||||
InternalVar_1.InternalMethod_91(Navigate.InternalMethod_507(InternalVar_3, InternalVar_1, InternalVar_2, InternalVar_19));
|
||||
|
||||
if (InternalParameter_2459.InternalField_3340 && InternalVar_1.InternalProperty_23.InternalProperty_1150 is GestureRecognizer recognizer && recognizer.AutoSelect)
|
||||
{
|
||||
Select(InternalVar_3.ControlID, InternalVar_3.UserData, InternalVar_5);
|
||||
|
||||
if (InternalVar_2 != null)
|
||||
{
|
||||
InternalVar_3.Ray = InternalType_757<UIBlock>.InternalMethod_3583(InternalVar_4, InternalVar_2);
|
||||
}
|
||||
|
||||
if (recognizer.OnSelect == SelectBehavior.ScopeNavigation && InternalType_757<UIBlock>.InternalMethod_3579(InternalVar_3.Ray, InternalVar_1, InternalVar_1, InternalVar_5, InternalParameter_3280: true, out InternalType_428 InternalVar_20, InternalParameter_3283: true))
|
||||
{
|
||||
InternalMethod_2689(InternalParameter_2910, InternalType_738.InternalMethod_2801(InternalVar_1, InternalVar_20.InternalField_1642 as UIBlock, InternalVar_3, InternalVar_19, InternalVar_5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static InternalType_738 InternalMethod_2891(InternalType_738 InternalParameter_2458)
|
||||
{
|
||||
UIBlock InternalVar_1 = InternalParameter_2458.InternalField_2412;
|
||||
|
||||
if (InternalVar_1.ChildCount == 0)
|
||||
{
|
||||
return InternalType_738.InternalField_2218;
|
||||
}
|
||||
|
||||
uint InternalVar_2 = InternalParameter_2458.InternalField_2409;
|
||||
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3568(InternalVar_2) != InternalVar_1)
|
||||
{
|
||||
return InternalType_738.InternalField_2218;
|
||||
}
|
||||
|
||||
object InternalVar_3 = InternalParameter_2458.InternalField_2413;
|
||||
int InternalVar_4 = InternalParameter_2458.InternalField_2395;
|
||||
|
||||
bool InternalVar_5 = true;
|
||||
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3584(InternalVar_1, out Vector3 InternalVar_6, out Ray InternalVar_7, InternalVar_4, out UIBlock InternalVar_8))
|
||||
{
|
||||
InternalVar_5 = false;
|
||||
|
||||
if (((1 << InternalVar_8.gameObject.layer) & InternalVar_4) != 0)
|
||||
{
|
||||
return InternalType_738.InternalMethod_2801(InternalVar_1, InternalVar_8, new Update(InternalVar_7, InternalVar_2, InternalVar_3), InternalVar_6, InternalVar_4);
|
||||
}
|
||||
}
|
||||
|
||||
if (InternalVar_5)
|
||||
{
|
||||
AutoLayout InternalVar_9 = InternalVar_1.InternalMethod_79();
|
||||
|
||||
if (!InternalVar_9.Enabled)
|
||||
{
|
||||
return InternalType_738.InternalField_2218;
|
||||
}
|
||||
|
||||
InternalVar_6 = Vector3.zero;
|
||||
InternalVar_6[InternalVar_9.Axis.Index()] = InternalVar_9.InternalProperty_13;
|
||||
|
||||
InternalVar_7 = InternalType_757<UIBlock>.InternalMethod_3583(InternalVar_6, InternalVar_1, InternalParameter_3305: true);
|
||||
}
|
||||
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3579(InternalVar_7, InternalVar_1, InternalVar_1, InternalVar_4, InternalParameter_3280: true, out InternalType_428 InternalVar_10))
|
||||
{
|
||||
return InternalType_738.InternalMethod_2801(InternalVar_1, InternalVar_10.InternalField_1642 as UIBlock, new Update(InternalVar_7, InternalVar_2, InternalVar_3), InternalVar_6, InternalVar_4);
|
||||
}
|
||||
|
||||
return InternalType_738.InternalField_2218;
|
||||
}
|
||||
|
||||
|
||||
private static InternalType_738 InternalMethod_2823(InternalType_738 InternalParameter_2457)
|
||||
{
|
||||
uint InternalVar_1 = InternalParameter_2457.InternalField_2409;
|
||||
Vector3 InternalVar_2 = InternalParameter_2457.InternalField_2410;
|
||||
object InternalVar_3 = InternalParameter_2457.InternalField_2413;
|
||||
int InternalVar_4 = InternalParameter_2457.InternalField_2395;
|
||||
|
||||
UIBlock InternalVar_5 = InternalType_757<UIBlock>.InternalMethod_3568(InternalVar_1);
|
||||
|
||||
if (InternalVar_5 == null)
|
||||
{
|
||||
return InternalType_738.InternalField_2218;
|
||||
}
|
||||
|
||||
UIBlock InternalVar_6 = InternalType_757<UIBlock>.InternalMethod_3570(InternalVar_1);
|
||||
|
||||
UIBlock InternalVar_7 = null;
|
||||
|
||||
bool InternalVar_8 = InternalVar_5 == InternalVar_6;
|
||||
Ray InternalVar_9 = InternalType_757<UIBlock>.InternalMethod_3583(InternalVar_2, InternalVar_5, InternalParameter_3305: InternalVar_8);
|
||||
|
||||
if (InternalType_757<UIBlock>.InternalMethod_3579(InternalVar_9, InternalVar_5, InternalVar_6, InternalVar_4, InternalParameter_3280: true, out InternalType_428 InternalVar_10))
|
||||
{
|
||||
InternalVar_7 = InternalVar_10.InternalField_1642 as UIBlock;
|
||||
}
|
||||
else if (InternalVar_8)
|
||||
{
|
||||
InternalVar_9 = InternalType_757<UIBlock>.InternalMethod_3583(InternalVar_2, InternalVar_5, InternalParameter_3305: false);
|
||||
}
|
||||
|
||||
return InternalParameter_2457.InternalMethod_2986(InternalVar_5, InternalVar_7, new Update(InternalVar_9, InternalVar_1, InternalVar_3));
|
||||
}
|
||||
|
||||
private static void InternalMethod_2818(InternalType_95 InternalParameter_2456, UIBlock InternalParameter_2450, UIBlock InternalParameter_2449, uint InternalParameter_2448)
|
||||
{
|
||||
if (InternalParameter_2450 == InternalParameter_2449)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalParameter_2456.InternalMethod_2797(InternalParameter_2448, InternalParameter_2449);
|
||||
}
|
||||
|
||||
private static void InternalMethod_2799(uint InternalParameter_2447, UIBlock InternalParameter_2446)
|
||||
{
|
||||
try
|
||||
{
|
||||
OnNavigationFocusChanged?.Invoke(InternalParameter_2447, InternalParameter_2446);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Ray InternalMethod_2947(UIBlock InternalParameter_2484, UIBlock InternalParameter_120)
|
||||
{
|
||||
bool InternalVar_1 = InternalParameter_2484 != null;
|
||||
bool InternalVar_2 = InternalParameter_120 != null;
|
||||
|
||||
if (!InternalVar_1 && !InternalVar_2)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!InternalVar_1)
|
||||
{
|
||||
return new Ray(InternalParameter_120.transform.position, InternalParameter_120.transform.forward);
|
||||
}
|
||||
|
||||
if (!InternalVar_2)
|
||||
{
|
||||
return new Ray(InternalParameter_2484.transform.position, InternalParameter_2484.transform.forward);
|
||||
}
|
||||
|
||||
return new Ray(InternalParameter_2484.transform.position, (InternalParameter_120.transform.position - InternalParameter_2484.transform.position).normalized);
|
||||
}
|
||||
|
||||
private static UIBlockHit InternalMethod_2889(InternalType_428 InternalParameter_121)
|
||||
{
|
||||
return new UIBlockHit()
|
||||
{
|
||||
UIBlock = InternalParameter_121.InternalField_1642 as UIBlock,
|
||||
Position = InternalParameter_121.InternalField_1643,
|
||||
Normal = InternalParameter_121.InternalField_1644
|
||||
};
|
||||
}
|
||||
|
||||
private enum InternalType_739
|
||||
{
|
||||
InternalField_2216,
|
||||
InternalField_2217,
|
||||
InternalField_2924,
|
||||
InternalField_3437,
|
||||
InternalField_3438,
|
||||
}
|
||||
|
||||
private readonly struct InternalType_738
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly InternalType_739 InternalField_3182;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly bool InternalField_3340;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly UIBlock InternalField_2412;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly UIBlock InternalField_2411;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Update InternalField_2414;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly uint InternalField_2409;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Vector3 InternalField_2410;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly object InternalField_2413;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly int InternalField_2395;
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public static readonly InternalType_738 InternalField_2218 = new InternalType_738(InternalType_739.InternalField_2216);
|
||||
|
||||
public static InternalType_738 InternalMethod_2888(UIBlock InternalParameter_2668, UIBlock InternalParameter_2667, Update InternalParameter_3132, int InternalParameter_3133, bool InternalParameter_3134 = false) => new InternalType_738(InternalParameter_2668, InternalParameter_2667, InternalParameter_3132, InternalParameter_3133, InternalParameter_3134);
|
||||
public static InternalType_738 InternalMethod_2801(UIBlock InternalParameter_3135, UIBlock InternalParameter_3136, Update InternalParameter_3137, Vector3 InternalParameter_3138, int InternalParameter_3139) => new InternalType_738(InternalParameter_3135, InternalParameter_3136, InternalParameter_3137, InternalParameter_3138, InternalParameter_3139);
|
||||
public static InternalType_738 InternalMethod_2815(uint InternalParameter_3140, Vector3 InternalParameter_3141, object InternalParameter_3142, int InternalParameter_3143) => new InternalType_738(InternalParameter_3140, InternalParameter_3141, InternalParameter_3142, InternalParameter_3143);
|
||||
public static InternalType_738 InternalMethod_2796(uint InternalParameter_3144, UIBlock InternalParameter_3145, object InternalParameter_3146, int InternalParameter_3147) => new InternalType_738(InternalParameter_3145, InternalParameter_3144, InternalParameter_3146, InternalParameter_3147);
|
||||
|
||||
public InternalType_738 InternalMethod_2986(UIBlock InternalParameter_3148, UIBlock InternalParameter_3149, Update InternalParameter_3150)
|
||||
{
|
||||
return new InternalType_738(InternalParameter_3148, InternalParameter_3149, InternalParameter_3150, InternalField_2410, InternalField_2395);
|
||||
}
|
||||
|
||||
private InternalType_738(InternalType_739 InternalParameter_3151)
|
||||
{
|
||||
InternalField_3182 = InternalParameter_3151;
|
||||
InternalField_2412 = null;
|
||||
InternalField_2411 = null;
|
||||
InternalField_2414 = Update.Uninitialized;
|
||||
InternalField_3340 = false;
|
||||
|
||||
InternalField_2409 = uint.MaxValue;
|
||||
InternalField_2410 = Vector3.zero;
|
||||
InternalField_2413 = null;
|
||||
InternalField_2395 = 0;
|
||||
}
|
||||
|
||||
private InternalType_738(UIBlock InternalParameter_3152, UIBlock InternalParameter_3153, Update InternalParameter_3154, int InternalParameter_3155, bool InternalParameter_3156)
|
||||
{
|
||||
InternalField_3182 = InternalType_739.InternalField_2217;
|
||||
InternalField_2412 = InternalParameter_3152;
|
||||
InternalField_2411 = InternalParameter_3153;
|
||||
InternalField_2414 = InternalParameter_3154;
|
||||
InternalField_2395 = InternalParameter_3155;
|
||||
InternalField_3340 = InternalParameter_3156;
|
||||
|
||||
InternalField_2409 = uint.MaxValue;
|
||||
InternalField_2410 = Vector3.zero;
|
||||
InternalField_2413 = null;
|
||||
}
|
||||
|
||||
private InternalType_738(UIBlock InternalParameter_3157, UIBlock InternalParameter_3158, Update InternalParameter_3159, Vector3 InternalParameter_3160, int InternalParameter_3161)
|
||||
{
|
||||
InternalField_3182 = InternalType_739.InternalField_2924;
|
||||
InternalField_2412 = InternalParameter_3157;
|
||||
InternalField_2411 = InternalParameter_3158;
|
||||
InternalField_2414 = InternalParameter_3159;
|
||||
InternalField_3340 = true;
|
||||
|
||||
InternalField_2409 = InternalParameter_3159.ControlID;
|
||||
InternalField_2410 = InternalParameter_3160;
|
||||
InternalField_2413 = InternalParameter_3159.UserData;
|
||||
InternalField_2395 = InternalParameter_3161;
|
||||
}
|
||||
|
||||
private InternalType_738(UIBlock InternalParameter_3162, uint InternalParameter_3163, object InternalParameter_3164, int InternalParameter_3165)
|
||||
{
|
||||
InternalField_3182 = InternalType_739.InternalField_3438;
|
||||
|
||||
InternalField_2409 = InternalParameter_3163;
|
||||
InternalField_2413 = InternalParameter_3164;
|
||||
InternalField_2395 = InternalParameter_3165;
|
||||
InternalField_2412 = InternalParameter_3162;
|
||||
InternalField_3340 = true;
|
||||
|
||||
InternalField_2411 = null;
|
||||
InternalField_2414 = Update.Uninitialized;
|
||||
InternalField_2410 = Vector3.zero;
|
||||
}
|
||||
|
||||
private InternalType_738(uint InternalParameter_3166, Vector3 InternalParameter_3167, object InternalParameter_3168, int InternalParameter_3169)
|
||||
{
|
||||
InternalField_3182 = InternalType_739.InternalField_3437;
|
||||
|
||||
InternalField_2409 = InternalParameter_3166;
|
||||
InternalField_2410 = InternalParameter_3167;
|
||||
InternalField_2413 = InternalParameter_3168;
|
||||
InternalField_2395 = InternalParameter_3169;
|
||||
InternalField_3340 = true;
|
||||
|
||||
InternalField_2412 = null;
|
||||
InternalField_2411 = null;
|
||||
InternalField_2414 = Update.Uninitialized;
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalType_95
|
||||
{
|
||||
private struct InternalType_727 : System.IEquatable<InternalType_727>
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly bool InternalField_3163;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly UIBlock InternalField_3177;
|
||||
|
||||
public static implicit operator InternalType_727(UIBlock InternalParameter_2648) => new InternalType_727(InternalParameter_2648);
|
||||
|
||||
private InternalType_727(UIBlock InternalParameter_2669)
|
||||
{
|
||||
InternalField_3177 = InternalParameter_2669;
|
||||
InternalField_3163 = InternalParameter_2669 == null;
|
||||
}
|
||||
|
||||
public bool Equals(InternalType_727 other)
|
||||
{
|
||||
return this.InternalField_3177 == other.InternalField_3177 && this.InternalField_3163 == other.InternalField_3163;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public int InternalProperty_1086 => InternalField_3168.Count;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public InternalType_521<uint> InternalProperty_1087 => InternalField_3168.InternalMethod_2043();
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private List<uint> InternalField_3168 = new List<uint>();
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
private Dictionary<uint, InternalType_727> InternalField_3093 = new Dictionary<uint, InternalType_727>();
|
||||
|
||||
public void InternalMethod_2797(uint InternalParameter_122, UIBlock InternalParameter_2652)
|
||||
{
|
||||
bool InternalVar_2 = InternalField_3093.TryGetValue(InternalParameter_122, out InternalType_727 InternalVar_1);
|
||||
bool InternalVar_3 = !InternalVar_2 || !InternalVar_1.Equals(InternalParameter_2652);
|
||||
|
||||
if (!InternalVar_3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!InternalVar_2)
|
||||
{
|
||||
InternalField_3168.Add(InternalParameter_122);
|
||||
}
|
||||
|
||||
InternalField_3093[InternalParameter_122] = InternalParameter_2652;
|
||||
}
|
||||
|
||||
public void InternalMethod_2890(uint InternalParameter_2651)
|
||||
{
|
||||
if (!InternalField_3093.Remove(InternalParameter_2651))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InternalField_3168.Remove(InternalParameter_2651);
|
||||
}
|
||||
|
||||
public bool InternalMethod_2822(uint InternalParameter_2650, out UIBlock InternalParameter_2649)
|
||||
{
|
||||
bool InternalVar_2 = InternalField_3093.TryGetValue(InternalParameter_2650, out InternalType_727 InternalVar_1);
|
||||
InternalParameter_2649 = InternalVar_2 ? InternalVar_1.InternalField_3177 : null;
|
||||
return InternalVar_2;
|
||||
}
|
||||
|
||||
public void InternalMethod_2817()
|
||||
{
|
||||
InternalField_3168.Clear();
|
||||
InternalField_3093.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f89541271720f4544a54a146dfe607bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,121 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
public struct RadialFill : IEquatable<RadialFill>
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="Length2"/> configuration for the center position/origin of the radial fill.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length2 Center;
|
||||
/// <summary>
|
||||
/// The angle (in degrees from the positive x-axis) that serves as the basis rotation from which
|
||||
/// <see cref="FillAngle">FillAngle</see> will apply.<br/>
|
||||
/// - Positive => counter-clockwise<br/>
|
||||
/// - Negative => clockwise
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The value is clamped between <c>-360</c> and <c>360</c>.
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
[Range(-360f, 360f)]
|
||||
public float Rotation;
|
||||
/// <summary>
|
||||
/// The arc angle (in degrees) of the fill.<br/>
|
||||
/// - Positive => counter-clockwise<br/>
|
||||
/// - Negative => clockwise
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The value is clamped between <c>-360</c> and <c>360</c>.
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
[Range(-360f, 360f)]
|
||||
public float FillAngle;
|
||||
/// <summary>
|
||||
/// A flag to enable/disable the radial fill.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool Enabled;
|
||||
|
||||
/// <summary>
|
||||
/// The end angle of the visible arc (where <see cref="Rotation">Rotation</see> is the start angle). Mathematically: <br/>
|
||||
/// <see cref="EndAngle">EndAngle</see> = <see cref="Rotation">Rotation</see> + <see cref="FillAngle">FillAngle</see>
|
||||
/// </summary>
|
||||
public float EndAngle => Rotation + FillAngle;
|
||||
|
||||
public bool Equals(RadialFill other)
|
||||
{
|
||||
return
|
||||
Center.Equals(other.Center) &&
|
||||
Rotation.Equals(other.Rotation) &&
|
||||
FillAngle.Equals(other.FillAngle) &&
|
||||
Enabled.Equals(other.Enabled);
|
||||
}
|
||||
|
||||
public static bool operator ==(RadialFill lhs, RadialFill rhs) => lhs.Equals(rhs);
|
||||
public static bool operator !=(RadialFill lhs, RadialFill rhs) => !lhs.Equals(rhs);
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Center.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Rotation.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + FillAngle.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Enabled.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is RadialFill asType)
|
||||
{
|
||||
return this == asType;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (!Enabled)
|
||||
{
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
return $"Center = {Center}, Rotation = {Rotation}, FillAngle = {FillAngle}";
|
||||
}
|
||||
|
||||
internal Calculated InternalMethod_2153(Vector2 InternalParameter_141)
|
||||
{
|
||||
return new Calculated(this, InternalParameter_141);
|
||||
}
|
||||
|
||||
[Obfuscation]
|
||||
internal readonly struct Calculated
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length2.Calculated Center;
|
||||
|
||||
internal Calculated(RadialFill fill, Vector2 relativeTo)
|
||||
{
|
||||
var InternalVar_1 = InternalNamespace_0.InternalType_48.InternalMethod_365(fill.Center.InternalMethod_2(), InternalNamespace_0.InternalType_48.InternalType_49.InternalField_161, relativeTo);
|
||||
Center = InternalVar_1.InternalMethod_19();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal static readonly RadialFill InternalField_3393 = new RadialFill()
|
||||
{
|
||||
FillAngle = 90f,
|
||||
Enabled = false,
|
||||
Center = Length2.Percentage(0, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6aa618146c6f3a848a9fb09af6bd6131
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,149 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A radial gradient to blend with the body color of a parent element.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.Gradient"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
public struct RadialGradient : IEquatable<RadialGradient>
|
||||
{
|
||||
/// <summary>
|
||||
/// The color of the gradient to blend with the body color of its parent element.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Color Color;
|
||||
/// <summary>
|
||||
/// The <see cref="Length2"/> configuration for the center position of the gradient in its parent element's local space.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length2 Center;
|
||||
/// <summary>
|
||||
/// A <see cref="Length2"/> configuration for the radii along the gradient's X and Y axes, determines the gradient's size.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Setting a radius to <c>0</c> is equivalent to setting the radius to <c>float.PositiveInfinity</c> and
|
||||
/// can be used to achieve a linear-style gradient.
|
||||
/// </remarks>
|
||||
[SerializeField]
|
||||
public Length2 Radius;
|
||||
/// <summary>
|
||||
/// The counter-clockwise rotation of the gradient (in degrees) around its <see cref="Center"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public float Rotation;
|
||||
/// <summary>
|
||||
/// A flag to toggle the gradient's visibility.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool Enabled;
|
||||
|
||||
public static bool operator ==(RadialGradient lhs, RadialGradient rhs)
|
||||
{
|
||||
return
|
||||
lhs.Color.Equals(rhs.Color) &&
|
||||
lhs.Center.Equals(rhs.Center) &&
|
||||
lhs.Radius.Equals(rhs.Radius) &&
|
||||
lhs.Rotation.Equals(rhs.Rotation) &&
|
||||
lhs.Enabled.Equals(rhs.Enabled);
|
||||
}
|
||||
public static bool operator !=(RadialGradient lhs, RadialGradient rhs) => !(rhs == lhs);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="RadialGradient"/>.
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="center"></param>
|
||||
/// <param name="radius"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="enabled"></param>
|
||||
public RadialGradient(Color color, Length2 center, Length2 radius, float rotation = 0f, bool enabled = true)
|
||||
{
|
||||
Color = color;
|
||||
Center = center;
|
||||
Radius = radius;
|
||||
Rotation = rotation;
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Color.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Center.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Radius.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Rotation.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Enabled.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is RadialGradient asType)
|
||||
{
|
||||
return this == asType;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="RadialGradient"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(RadialGradient other) => this == other;
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="RadialGradient"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (!Enabled)
|
||||
{
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
return $"Color = {Color}, Radius = {Radius}";
|
||||
}
|
||||
|
||||
internal Calculated InternalMethod_145(Vector2 InternalParameter_86)
|
||||
{
|
||||
return new Calculated(this, InternalParameter_86);
|
||||
}
|
||||
|
||||
[Obfuscation]
|
||||
internal readonly struct Calculated
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length2.Calculated Center;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length2.Calculated Radius;
|
||||
|
||||
internal Calculated(RadialGradient gradient, Vector2 relativeTo)
|
||||
{
|
||||
var InternalVar_1 = InternalNamespace_0.InternalType_48.InternalMethod_365(gradient.Center.InternalMethod_2(), InternalNamespace_0.InternalType_48.InternalType_49.InternalField_161, relativeTo);
|
||||
Center = InternalVar_1.InternalMethod_19();
|
||||
|
||||
var InternalVar_2 = InternalNamespace_0.InternalType_48.InternalMethod_365(gradient.Radius.InternalMethod_2(), InternalNamespace_0.InternalType_48.InternalType_49.InternalField_162, relativeTo);
|
||||
Radius = InternalVar_2.InternalMethod_19();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal static readonly RadialGradient InternalField_57 = new RadialGradient()
|
||||
{
|
||||
Enabled = false,
|
||||
Color = Color.white,
|
||||
Center = new Length2(Length.Percentage(0f), Length.Percentage(0f)),
|
||||
Radius = new Length2(Length.Percentage(0.5f), Length.Percentage(0.5f)),
|
||||
Rotation = 0f,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bd5e4c85fabcac4d9d2aa9be94b3d20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,177 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the direction for a shadow to expand.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.Shadow"/>
|
||||
/// <seealso cref="Shadow"/>
|
||||
public enum ShadowDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// The shadow expands outward from the edge of the body as a drop shadow.
|
||||
/// </summary>
|
||||
Out = InternalNamespace_0.InternalType_114.InternalField_368,
|
||||
/// <summary>
|
||||
/// The shadow expands inward from the edge of the body as an inner shadow.
|
||||
/// </summary>
|
||||
In = InternalNamespace_0.InternalType_114.InternalField_369,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A drop shadow, inner shadow, or glow effect.
|
||||
/// </summary>
|
||||
/// <seealso cref="UIBlock2D.Shadow"/>
|
||||
[Serializable]
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)]
|
||||
public struct Shadow : IEquatable<Shadow>
|
||||
{
|
||||
/// <summary>
|
||||
/// The color of the shadow. Darker colors create a more shadow-like effect, whereas brighter colors create a more glow-like effect.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Color Color;
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration for the width of the shadow <i>before</i> the <see cref="Blur"/> is applied.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length Width;
|
||||
/// <summary>
|
||||
/// The <see cref="Length"/> configuration for the blur of the shadow. A larger blur leads to a softer effect, whereas a smaller blur leads to a sharper effect.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length Blur;
|
||||
/// <summary>
|
||||
/// The <see cref="Length2"/> configuration for the center offset of the shadow in its parent element's local space.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public Length2 Offset;
|
||||
/// <summary>
|
||||
/// A flag to toggle the visibility of the shadow.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public bool Enabled;
|
||||
/// <summary>
|
||||
/// The direction the shadow will expand as <see cref="Width"/> or <see cref="Blur"/> increases. Either <see cref="ShadowDirection.In"/> or <see cref="ShadowDirection.Out"/>.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
public ShadowDirection Direction;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Shadow"/>
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="blur"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="shadowDirection"></param>
|
||||
/// <param name="enabled"></param>
|
||||
public Shadow(Color color, Length width, Length blur, Length2 offset, ShadowDirection shadowDirection = ShadowDirection.Out, bool enabled = true)
|
||||
{
|
||||
Color = color;
|
||||
Width = width;
|
||||
Blur = blur;
|
||||
Offset = offset;
|
||||
Direction = shadowDirection;
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public static bool operator ==(Shadow lhs, Shadow rhs)
|
||||
{
|
||||
return
|
||||
lhs.Color.Equals(rhs.Color) &&
|
||||
lhs.Width.Equals(rhs.Width) &&
|
||||
lhs.Blur.Equals(rhs.Blur) &&
|
||||
lhs.Offset.Equals(rhs.Offset) &&
|
||||
lhs.Enabled.Equals(rhs.Enabled) &&
|
||||
lhs.Direction == rhs.Direction;
|
||||
}
|
||||
public static bool operator !=(Shadow lhs, Shadow rhs) => !(rhs == lhs);
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Color.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Width.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Blur.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Offset.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Enabled.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Direction.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Shadow asType)
|
||||
{
|
||||
return this == asType;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Shadow"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
if (!Enabled)
|
||||
{
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
return $"Color = {Color}, Width = {Width}, Blur = {Blur}, Direction = {Direction}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Shadow"/> to compare.</param>
|
||||
/// <returns><see langword="true"/> if <c>this == <paramref name="other"/></c></returns>
|
||||
public bool Equals(Shadow other) => this == other;
|
||||
|
||||
internal Calculated InternalMethod_147(Vector2 InternalParameter_88)
|
||||
{
|
||||
return new Calculated(this, InternalParameter_88);
|
||||
}
|
||||
|
||||
[Obfuscation]
|
||||
internal readonly struct Calculated
|
||||
{
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length.Calculated Width;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length.Calculated Blur;
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
public readonly Length2.Calculated Offset;
|
||||
|
||||
internal Calculated(Shadow shadow, Vector2 relativeTo)
|
||||
{
|
||||
float InternalVar_1 = math.cmin(relativeTo) * 0.5f;
|
||||
var InternalVar_2 = new InternalNamespace_0.InternalType_45.InternalType_47(shadow.Width.InternalMethod_1(), InternalNamespace_0.InternalType_45.InternalType_46.InternalField_150, InternalVar_1);
|
||||
Width = InternalVar_2.InternalMethod_18();
|
||||
var InternalVar_3 = new InternalNamespace_0.InternalType_45.InternalType_47(shadow.Blur.InternalMethod_1(), InternalNamespace_0.InternalType_45.InternalType_46.InternalField_151, InternalVar_1);
|
||||
Blur = InternalVar_3.InternalMethod_18();
|
||||
var InternalVar_4 = InternalNamespace_0.InternalType_48.InternalMethod_365(shadow.Offset.InternalMethod_2(), InternalNamespace_0.InternalType_48.InternalType_49.InternalField_161, relativeTo);
|
||||
Offset = InternalVar_4.InternalMethod_19();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
|
||||
internal readonly static Shadow InternalField_59 = new Shadow()
|
||||
{
|
||||
Enabled = false,
|
||||
Color = new Color(0, 0, 0, 0.5f),
|
||||
Direction = ShadowDirection.Out,
|
||||
Offset = Length2.FixedValue(0, -1),
|
||||
Width = Length.Zero,
|
||||
Blur = Length.FixedValue(2),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bed1fca9eef618d44ad687fd1a2187e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,138 @@
|
||||
// Copyright (c) Supernova Technologies LLC
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nova
|
||||
{
|
||||
/// <summary>
|
||||
/// A sphere represented by a center position and radius.
|
||||
/// </summary>
|
||||
/// <seealso cref="Interaction.Point(Sphere, uint, object, int, InputAccuracy)"/>
|
||||
public struct Sphere : System.IEquatable<Sphere>
|
||||
{
|
||||
/// <summary>
|
||||
/// The center position of the sphere.
|
||||
/// </summary>
|
||||
public Vector3 Center;
|
||||
|
||||
/// <summary>
|
||||
/// The radius of the sphere.
|
||||
/// </summary>
|
||||
public float Radius;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new sphere from a center position and radius.
|
||||
/// </summary>
|
||||
/// <param name="center">The center position of the sphere, <see cref="Center"/>.</param>
|
||||
/// <param name="radius">The radius of the sphere, <see cref="Radius"/>.</param>
|
||||
public Sphere(Vector3 center, float radius)
|
||||
{
|
||||
Center = center;
|
||||
Radius = radius;
|
||||
}
|
||||
|
||||
#if PHYSICS
|
||||
/// <summary>
|
||||
/// Create a <see cref="Sphere"/> in world space from a <see cref="SphereCollider"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Because the new <see cref="Sphere"/> is in world space, this constructor reads from <paramref name="collider"/>.<see cref="Collider.bounds">bounds</see>.</remarks>
|
||||
/// <param name="collider">The collider to read from.</param>
|
||||
public Sphere(SphereCollider collider)
|
||||
{
|
||||
if (collider == null)
|
||||
{
|
||||
Center = Vector3.zero;
|
||||
Radius = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Bounds bounds = collider.bounds;
|
||||
Center = bounds.center;
|
||||
Radius = Unity.Mathematics.math.cmax(bounds.extents);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a <see cref="Sphere"/> in world space from a <see cref="SphereCollider"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Because the new <see cref="Sphere"/> is in world space, this operator reads from <paramref name="collider"/>.<see cref="Collider.bounds">bounds</see>.</remarks>
|
||||
/// <param name="collider">The collider to read from.</param>
|
||||
public static implicit operator Sphere(SphereCollider collider)
|
||||
{
|
||||
return new Sphere(collider);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <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"/>.Center == <paramref name="rhs"/>.Center && <paramref name="lhs"/>.Radius == <paramref name="rhs"/>.Radius</c>.
|
||||
/// </returns>
|
||||
public static bool operator ==(Sphere lhs, Sphere rhs)
|
||||
{
|
||||
return lhs.Center == rhs.Center && lhs.Radius == rhs.Radius;
|
||||
}
|
||||
|
||||
/// <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"/>.Center != <paramref name="rhs"/>.Center || <paramref name="lhs"/>.Radius != <paramref name="rhs"/>.Radius</c>.
|
||||
/// </returns>
|
||||
public static bool operator !=(Sphere lhs, Sphere rhs)
|
||||
{
|
||||
return lhs.Center != rhs.Center || lhs.Radius != rhs.Radius;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The hashcode for this <see cref="Sphere"/>.
|
||||
/// </summary>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int InternalVar_1 = 13;
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Center.GetHashCode();
|
||||
InternalVar_1 = (InternalVar_1 * 7) + Radius.GetHashCode();
|
||||
return InternalVar_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Sphere"/> to compare.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if <c>this == <paramref name="other"/>.</c>
|
||||
/// </returns>
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if (other is Sphere sphere)
|
||||
{
|
||||
return this == sphere;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality compare.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Sphere"/> to compare.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if <c>this == <paramref name="other"/></c>.
|
||||
/// </returns>
|
||||
public bool Equals(Sphere other)
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string representation of this <see cref="Sphere"/>.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Center = {Center}, Radius = {Radius}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user