using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using Unity.Profiling; using UnityEngine; using UnityEngine.Bindings; using UnityEngine.Rendering; using UnityEngine.Scripting; [assembly: InternalsVisibleTo("UnityEngine.UIElementsNativeModule")] [assembly: InternalsVisibleTo("UnityEngine.UIModule")] [assembly: InternalsVisibleTo("UnityEngine.TilemapModule")] [assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")] [assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")] [assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")] [assembly: InternalsVisibleTo("UnityEngine.TerrainModule")] [assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")] [assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")] [assembly: InternalsVisibleTo("UnityEngine.StreamingModule")] [assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")] [assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")] [assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")] [assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")] [assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")] [assembly: InternalsVisibleTo("UnityEngine.UmbraModule")] [assembly: InternalsVisibleTo("UnityEngine.UNETModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")] [assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")] [assembly: InternalsVisibleTo("UnityEngine.PS4Module")] [assembly: InternalsVisibleTo("UnityEngine.XboxOneModule")] [assembly: InternalsVisibleTo("UnityEngine.SwitchModule")] [assembly: InternalsVisibleTo("UnityEngine.WindModule")] [assembly: InternalsVisibleTo("UnityEngine.VRModule")] [assembly: InternalsVisibleTo("UnityEngine.XRModule")] [assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")] [assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")] [assembly: InternalsVisibleTo("UnityEngine.VFXModule")] [assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")] [assembly: InternalsVisibleTo("UnityEngine.VideoModule")] [assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")] [assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")] [assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")] [assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")] [assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")] [assembly: InternalsVisibleTo("UnityEngine.ARModule")] [assembly: InternalsVisibleTo("UnityEngine.InputModule")] [assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")] [assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")] [assembly: InternalsVisibleTo("UnityEngine.AnimationModule")] [assembly: InternalsVisibleTo("UnityEngine.AudioModule")] [assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")] [assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")] [assembly: InternalsVisibleTo("UnityEngine.CoreModule")] [assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")] [assembly: InternalsVisibleTo("UnityEngine")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: InternalsVisibleTo("UnityEngine.AIModule")] [assembly: InternalsVisibleTo("UnityEngine.PS5Module")] [assembly: InternalsVisibleTo("UnityEngine.ClothModule")] [assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")] [assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")] [assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")] [assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")] [assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")] [assembly: InternalsVisibleTo("UnityEngine.GridModule")] [assembly: InternalsVisibleTo("UnityEngine.GIModule")] [assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")] [assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")] [assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")] [assembly: InternalsVisibleTo("UnityEngine.DirectorModule")] [assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")] [assembly: InternalsVisibleTo("UnityEngine.TLSModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")] [assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")] [assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")] [assembly: InternalsVisibleTo("UnityEngine.Networking")] [assembly: InternalsVisibleTo("UnityEngine.Cloud")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")] [assembly: InternalsVisibleTo("Unity.Core")] [assembly: InternalsVisibleTo("Unity.Runtime")] [assembly: InternalsVisibleTo("Unity.Collections")] [assembly: InternalsVisibleTo("Unity.Entities.Tests")] [assembly: InternalsVisibleTo("Unity.Entities")] [assembly: InternalsVisibleTo("Unity.Logging")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")] [assembly: InternalsVisibleTo("Unity.Services.QoS")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")] [assembly: InternalsVisibleTo("Unity.Subsystem.Registration")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")] [assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")] [assembly: InternalsVisibleTo("Unity.ucg.QoS")] [assembly: InternalsVisibleTo("UnityEngine.UI")] [assembly: InternalsVisibleTo("Unity.RuntimeTests")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")] [assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")] [assembly: InternalsVisibleTo("Unity.IntegrationTests")] [assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")] [assembly: InternalsVisibleTo("Unity.Burst.Editor")] [assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")] [assembly: InternalsVisibleTo("Unity.Burst")] [assembly: InternalsVisibleTo("UnityEngine.TestRunner")] [assembly: InternalsVisibleTo("UnityEngine.Purchasing")] [assembly: InternalsVisibleTo("UnityEngine.Advertisements")] [assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")] [assembly: InternalsVisibleTo("UnityEngine.Analytics")] [assembly: InternalsVisibleTo("Unity.Analytics")] [assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")] [assembly: InternalsVisibleTo("Unity.Automation")] [assembly: InternalsVisibleTo("Unity.Networking.Transport")] [assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")] [assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")] [assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")] [assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")] [assembly: InternalsVisibleTo("Unity.UIElements.Editor")] [assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")] [assembly: InternalsVisibleTo("Unity.UIElements")] [assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")] [assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")] [assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")] [assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")] [assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")] [assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")] [assembly: InternalsVisibleTo("GoogleAR.UnityNative")] [assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")] [assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")] [assembly: InternalsVisibleTo("Assembly-CSharp-testable")] [assembly: InternalsVisibleTo("Unity.Timeline")] [assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")] [assembly: UnityEngineModuleAssembly] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace UnityEngine.Yoga { internal delegate float BaselineFunction(YogaNode node, float width, float height); internal delegate void Logger(YogaConfig config, YogaNode node, YogaLogLevel level, string message); internal delegate YogaSize MeasureFunction(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode); internal class MeasureOutput { public static YogaSize Make(float width, float height) { return new YogaSize { width = width, height = height }; } } internal enum YogaAlign { Auto, FlexStart, Center, FlexEnd, Stretch, Baseline, SpaceBetween, SpaceAround } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate float YogaBaselineFunc(IntPtr unmanagedNodePtr, float width, float height); internal class YogaConfig { internal static readonly YogaConfig Default = new YogaConfig(Native.YGConfigGetDefault()); private IntPtr _ygConfig; private Logger _logger; internal IntPtr Handle => _ygConfig; public Logger Logger { get { return _logger; } set { _logger = value; } } public bool UseWebDefaults { get { return Native.YGConfigGetUseWebDefaults(_ygConfig); } set { Native.YGConfigSetUseWebDefaults(_ygConfig, value); } } public float PointScaleFactor { get { return Native.YGConfigGetPointScaleFactor(_ygConfig); } set { Native.YGConfigSetPointScaleFactor(_ygConfig, value); } } private YogaConfig(IntPtr ygConfig) { _ygConfig = ygConfig; if (_ygConfig == IntPtr.Zero) { throw new InvalidOperationException("Failed to allocate native memory"); } } public YogaConfig() : this(Native.YGConfigNew()) { } ~YogaConfig() { if (Handle != Default.Handle) { Native.YGConfigFree(Handle); } } public void SetExperimentalFeatureEnabled(YogaExperimentalFeature feature, bool enabled) { Native.YGConfigSetExperimentalFeatureEnabled(_ygConfig, feature, enabled); } public bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature) { return Native.YGConfigIsExperimentalFeatureEnabled(_ygConfig, feature); } public static int GetInstanceCount() { return Native.YGConfigGetInstanceCount(); } public static void SetDefaultLogger(Logger logger) { Default.Logger = logger; } } internal static class YogaConstants { public const float Undefined = float.NaN; public static bool IsUndefined(float value) { return float.IsNaN(value); } public static bool IsUndefined(YogaValue value) { return value.Unit == YogaUnit.Undefined; } } internal enum YogaDimension { Width, Height } internal enum YogaDirection { Inherit, LTR, RTL } internal enum YogaDisplay { Flex, None } internal enum YogaEdge { Left, Top, Right, Bottom, Start, End, Horizontal, Vertical, All } internal enum YogaExperimentalFeature { WebFlexBasis } internal enum YogaFlexDirection { Column, ColumnReverse, Row, RowReverse } internal enum YogaJustify { FlexStart, Center, FlexEnd, SpaceBetween, SpaceAround } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void YogaLogger(IntPtr unmanagedConfigPtr, IntPtr unmanagedNotePtr, YogaLogLevel level, string message); internal enum YogaLogLevel { Error, Warn, Info, Debug, Verbose, Fatal } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate YogaSize YogaMeasureFunc(IntPtr unmanagedNodePtr, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode); internal enum YogaMeasureMode { Undefined, Exactly, AtMost } [NativeHeader("Modules/UIElementsNative/YogaNative.bindings.h")] internal static class Native { [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] private static extern IntPtr YGNodeNew(); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern IntPtr YGNodeNewWithConfig(IntPtr config); public static void YGNodeFree(IntPtr ygNode) { if (!(ygNode == IntPtr.Zero)) { YGNodeFreeInternal(ygNode); } } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(Name = "YGNodeFree", IsThreadSafe = true)] private static extern void YGNodeFreeInternal(IntPtr ygNode); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeReset(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGSetManagedObject(IntPtr ygNode, YogaNode node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeSetConfig(IntPtr ygNode, IntPtr config); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(IsThreadSafe = true)] public static extern IntPtr YGConfigGetDefault(); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern IntPtr YGConfigNew(); public static void YGConfigFree(IntPtr config) { if (!(config == IntPtr.Zero)) { YGConfigFreeInternal(config); } } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(Name = "YGConfigFree", IsThreadSafe = true)] private static extern void YGConfigFreeInternal(IntPtr config); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern int YGNodeGetInstanceCount(); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern int YGConfigGetInstanceCount(); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGConfigSetExperimentalFeatureEnabled(IntPtr config, YogaExperimentalFeature feature, bool enabled); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern bool YGConfigIsExperimentalFeatureEnabled(IntPtr config, YogaExperimentalFeature feature); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGConfigSetUseWebDefaults(IntPtr config, bool useWebDefaults); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern bool YGConfigGetUseWebDefaults(IntPtr config); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGConfigSetPointScaleFactor(IntPtr config, float pixelsInPoint); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGConfigGetPointScaleFactor(IntPtr config); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeInsertChild(IntPtr node, IntPtr child, uint index); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeRemoveChild(IntPtr node, IntPtr child); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeCalculateLayout(IntPtr node, float availableWidth, float availableHeight, YogaDirection parentDirection); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeMarkDirty(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern bool YGNodeIsDirty(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodePrint(IntPtr node, YogaPrintOptions options); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeCopyStyle(IntPtr dstNode, IntPtr srcNode); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(Name = "YogaCallback::SetMeasureFunc")] public static extern void YGNodeSetMeasureFunc(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(Name = "YogaCallback::RemoveMeasureFunc")] public static extern void YGNodeRemoveMeasureFunc(IntPtr node); [RequiredByNativeCode] public unsafe static void YGNodeMeasureInvoke(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode, IntPtr returnValueAddress) { *(YogaSize*)(void*)returnValueAddress = YogaNode.MeasureInternal(node, width, widthMode, height, heightMode); } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(Name = "YogaCallback::SetBaselineFunc")] public static extern void YGNodeSetBaselineFunc(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction(Name = "YogaCallback::RemoveBaselineFunc")] public static extern void YGNodeRemoveBaselineFunc(IntPtr node); [RequiredByNativeCode] public unsafe static void YGNodeBaselineInvoke(YogaNode node, float width, float height, IntPtr returnValueAddress) { *(float*)(void*)returnValueAddress = YogaNode.BaselineInternal(node, width, height); } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeSetHasNewLayout(IntPtr node, bool hasNewLayout); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern bool YGNodeGetHasNewLayout(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetDirection(IntPtr node, YogaDirection direction); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaDirection YGNodeStyleGetDirection(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexDirection(IntPtr node, YogaFlexDirection flexDirection); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaFlexDirection YGNodeStyleGetFlexDirection(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetJustifyContent(IntPtr node, YogaJustify justifyContent); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaJustify YGNodeStyleGetJustifyContent(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetAlignContent(IntPtr node, YogaAlign alignContent); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaAlign YGNodeStyleGetAlignContent(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetAlignItems(IntPtr node, YogaAlign alignItems); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaAlign YGNodeStyleGetAlignItems(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetAlignSelf(IntPtr node, YogaAlign alignSelf); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaAlign YGNodeStyleGetAlignSelf(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetPositionType(IntPtr node, YogaPositionType positionType); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaPositionType YGNodeStyleGetPositionType(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexWrap(IntPtr node, YogaWrap flexWrap); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaWrap YGNodeStyleGetFlexWrap(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetOverflow(IntPtr node, YogaOverflow flexWrap); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaOverflow YGNodeStyleGetOverflow(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetDisplay(IntPtr node, YogaDisplay display); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaDisplay YGNodeStyleGetDisplay(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlex(IntPtr node, float flex); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexGrow(IntPtr node, float flexGrow); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeStyleGetFlexGrow(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexShrink(IntPtr node, float flexShrink); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeStyleGetFlexShrink(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexBasis(IntPtr node, float flexBasis); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexBasisPercent(IntPtr node, float flexBasis); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetFlexBasisAuto(IntPtr node); [FreeFunction] public static YogaValue YGNodeStyleGetFlexBasis(IntPtr node) { YGNodeStyleGetFlexBasis_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeGetComputedFlexBasis(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetWidth(IntPtr node, float width); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetWidthPercent(IntPtr node, float width); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetWidthAuto(IntPtr node); [FreeFunction] public static YogaValue YGNodeStyleGetWidth(IntPtr node) { YGNodeStyleGetWidth_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetHeight(IntPtr node, float height); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetHeightPercent(IntPtr node, float height); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetHeightAuto(IntPtr node); [FreeFunction] public static YogaValue YGNodeStyleGetHeight(IntPtr node) { YGNodeStyleGetHeight_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMinWidth(IntPtr node, float minWidth); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMinWidthPercent(IntPtr node, float minWidth); [FreeFunction] public static YogaValue YGNodeStyleGetMinWidth(IntPtr node) { YGNodeStyleGetMinWidth_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMinHeight(IntPtr node, float minHeight); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMinHeightPercent(IntPtr node, float minHeight); [FreeFunction] public static YogaValue YGNodeStyleGetMinHeight(IntPtr node) { YGNodeStyleGetMinHeight_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMaxWidth(IntPtr node, float maxWidth); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMaxWidthPercent(IntPtr node, float maxWidth); [FreeFunction] public static YogaValue YGNodeStyleGetMaxWidth(IntPtr node) { YGNodeStyleGetMaxWidth_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMaxHeight(IntPtr node, float maxHeight); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMaxHeightPercent(IntPtr node, float maxHeight); [FreeFunction] public static YogaValue YGNodeStyleGetMaxHeight(IntPtr node) { YGNodeStyleGetMaxHeight_Injected(node, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetAspectRatio(IntPtr node, float aspectRatio); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeStyleGetAspectRatio(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetPosition(IntPtr node, YogaEdge edge, float position); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetPositionPercent(IntPtr node, YogaEdge edge, float position); [FreeFunction] public static YogaValue YGNodeStyleGetPosition(IntPtr node, YogaEdge edge) { YGNodeStyleGetPosition_Injected(node, edge, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMargin(IntPtr node, YogaEdge edge, float margin); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMarginPercent(IntPtr node, YogaEdge edge, float margin); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetMarginAuto(IntPtr node, YogaEdge edge); [FreeFunction] public static YogaValue YGNodeStyleGetMargin(IntPtr node, YogaEdge edge) { YGNodeStyleGetMargin_Injected(node, edge, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetPadding(IntPtr node, YogaEdge edge, float padding); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetPaddingPercent(IntPtr node, YogaEdge edge, float padding); [FreeFunction] public static YogaValue YGNodeStyleGetPadding(IntPtr node, YogaEdge edge) { YGNodeStyleGetPadding_Injected(node, edge, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern void YGNodeStyleSetBorder(IntPtr node, YogaEdge edge, float border); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeStyleGetBorder(IntPtr node, YogaEdge edge); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetLeft(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetTop(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetRight(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetBottom(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetWidth(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetHeight(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetMargin(IntPtr node, YogaEdge edge); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetPadding(IntPtr node, YogaEdge edge); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern float YGNodeLayoutGetBorder(IntPtr node, YogaEdge edge); [MethodImpl(MethodImplOptions.InternalCall)] [FreeFunction] public static extern YogaDirection YGNodeLayoutGetDirection(IntPtr node); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetFlexBasis_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetWidth_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetHeight_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetMinWidth_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetMinHeight_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetMaxWidth_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetMaxHeight_Injected(IntPtr node, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetPosition_Injected(IntPtr node, YogaEdge edge, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetMargin_Injected(IntPtr node, YogaEdge edge, out YogaValue ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void YGNodeStyleGetPadding_Injected(IntPtr node, YogaEdge edge, out YogaValue ret); } internal class YogaNode : IEnumerable, IEnumerable { internal IntPtr _ygNode; private YogaConfig _config; private WeakReference _parent; private List _children; private MeasureFunction _measureFunction; private BaselineFunction _baselineFunction; private object _data; internal YogaConfig Config { get { return _config; } set { _config = value ?? YogaConfig.Default; Native.YGNodeSetConfig(_ygNode, _config.Handle); } } public bool IsDirty => Native.YGNodeIsDirty(_ygNode); public bool HasNewLayout => Native.YGNodeGetHasNewLayout(_ygNode); public YogaNode Parent => (_parent != null) ? (_parent.Target as YogaNode) : null; public bool IsMeasureDefined => _measureFunction != null; public bool IsBaselineDefined => _baselineFunction != null; public YogaDirection StyleDirection { get { return Native.YGNodeStyleGetDirection(_ygNode); } set { Native.YGNodeStyleSetDirection(_ygNode, value); } } public YogaFlexDirection FlexDirection { get { return Native.YGNodeStyleGetFlexDirection(_ygNode); } set { Native.YGNodeStyleSetFlexDirection(_ygNode, value); } } public YogaJustify JustifyContent { get { return Native.YGNodeStyleGetJustifyContent(_ygNode); } set { Native.YGNodeStyleSetJustifyContent(_ygNode, value); } } public YogaDisplay Display { get { return Native.YGNodeStyleGetDisplay(_ygNode); } set { Native.YGNodeStyleSetDisplay(_ygNode, value); } } public YogaAlign AlignItems { get { return Native.YGNodeStyleGetAlignItems(_ygNode); } set { Native.YGNodeStyleSetAlignItems(_ygNode, value); } } public YogaAlign AlignSelf { get { return Native.YGNodeStyleGetAlignSelf(_ygNode); } set { Native.YGNodeStyleSetAlignSelf(_ygNode, value); } } public YogaAlign AlignContent { get { return Native.YGNodeStyleGetAlignContent(_ygNode); } set { Native.YGNodeStyleSetAlignContent(_ygNode, value); } } public YogaPositionType PositionType { get { return Native.YGNodeStyleGetPositionType(_ygNode); } set { Native.YGNodeStyleSetPositionType(_ygNode, value); } } public YogaWrap Wrap { get { return Native.YGNodeStyleGetFlexWrap(_ygNode); } set { Native.YGNodeStyleSetFlexWrap(_ygNode, value); } } public float Flex { set { Native.YGNodeStyleSetFlex(_ygNode, value); } } public float FlexGrow { get { return Native.YGNodeStyleGetFlexGrow(_ygNode); } set { Native.YGNodeStyleSetFlexGrow(_ygNode, value); } } public float FlexShrink { get { return Native.YGNodeStyleGetFlexShrink(_ygNode); } set { Native.YGNodeStyleSetFlexShrink(_ygNode, value); } } public YogaValue FlexBasis { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetFlexBasis(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetFlexBasisPercent(_ygNode, value.Value); } else if (value.Unit == YogaUnit.Auto) { Native.YGNodeStyleSetFlexBasisAuto(_ygNode); } else { Native.YGNodeStyleSetFlexBasis(_ygNode, value.Value); } } } public YogaValue Width { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetWidth(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetWidthPercent(_ygNode, value.Value); } else if (value.Unit == YogaUnit.Auto) { Native.YGNodeStyleSetWidthAuto(_ygNode); } else { Native.YGNodeStyleSetWidth(_ygNode, value.Value); } } } public YogaValue Height { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetHeight(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetHeightPercent(_ygNode, value.Value); } else if (value.Unit == YogaUnit.Auto) { Native.YGNodeStyleSetHeightAuto(_ygNode); } else { Native.YGNodeStyleSetHeight(_ygNode, value.Value); } } } public YogaValue MaxWidth { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMaxWidth(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetMaxWidthPercent(_ygNode, value.Value); } else { Native.YGNodeStyleSetMaxWidth(_ygNode, value.Value); } } } public YogaValue MaxHeight { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMaxHeight(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetMaxHeightPercent(_ygNode, value.Value); } else { Native.YGNodeStyleSetMaxHeight(_ygNode, value.Value); } } } public YogaValue MinWidth { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMinWidth(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetMinWidthPercent(_ygNode, value.Value); } else { Native.YGNodeStyleSetMinWidth(_ygNode, value.Value); } } } public YogaValue MinHeight { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMinHeight(_ygNode)); } set { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetMinHeightPercent(_ygNode, value.Value); } else { Native.YGNodeStyleSetMinHeight(_ygNode, value.Value); } } } public float AspectRatio { get { return Native.YGNodeStyleGetAspectRatio(_ygNode); } set { Native.YGNodeStyleSetAspectRatio(_ygNode, value); } } public float LayoutX => Native.YGNodeLayoutGetLeft(_ygNode); public float LayoutY => Native.YGNodeLayoutGetTop(_ygNode); public float LayoutRight => Native.YGNodeLayoutGetRight(_ygNode); public float LayoutBottom => Native.YGNodeLayoutGetBottom(_ygNode); public float LayoutWidth => Native.YGNodeLayoutGetWidth(_ygNode); public float LayoutHeight => Native.YGNodeLayoutGetHeight(_ygNode); public YogaDirection LayoutDirection => Native.YGNodeLayoutGetDirection(_ygNode); public YogaOverflow Overflow { get { return Native.YGNodeStyleGetOverflow(_ygNode); } set { Native.YGNodeStyleSetOverflow(_ygNode, value); } } public object Data { get { return _data; } set { _data = value; } } public YogaNode this[int index] => _children[index]; public int Count => (_children != null) ? _children.Count : 0; public YogaValue Left { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left)); } set { SetStylePosition(YogaEdge.Left, value); } } public YogaValue Top { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top)); } set { SetStylePosition(YogaEdge.Top, value); } } public YogaValue Right { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right)); } set { SetStylePosition(YogaEdge.Right, value); } } public YogaValue Bottom { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom)); } set { SetStylePosition(YogaEdge.Bottom, value); } } public YogaValue Start { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start)); } set { SetStylePosition(YogaEdge.Start, value); } } public YogaValue End { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End)); } set { SetStylePosition(YogaEdge.End, value); } } public YogaValue MarginLeft { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left)); } set { SetStyleMargin(YogaEdge.Left, value); } } public YogaValue MarginTop { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top)); } set { SetStyleMargin(YogaEdge.Top, value); } } public YogaValue MarginRight { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right)); } set { SetStyleMargin(YogaEdge.Right, value); } } public YogaValue MarginBottom { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom)); } set { SetStyleMargin(YogaEdge.Bottom, value); } } public YogaValue MarginStart { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start)); } set { SetStyleMargin(YogaEdge.Start, value); } } public YogaValue MarginEnd { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End)); } set { SetStyleMargin(YogaEdge.End, value); } } public YogaValue MarginHorizontal { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal)); } set { SetStyleMargin(YogaEdge.Horizontal, value); } } public YogaValue MarginVertical { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical)); } set { SetStyleMargin(YogaEdge.Vertical, value); } } public YogaValue Margin { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All)); } set { SetStyleMargin(YogaEdge.All, value); } } public YogaValue PaddingLeft { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left)); } set { SetStylePadding(YogaEdge.Left, value); } } public YogaValue PaddingTop { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top)); } set { SetStylePadding(YogaEdge.Top, value); } } public YogaValue PaddingRight { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right)); } set { SetStylePadding(YogaEdge.Right, value); } } public YogaValue PaddingBottom { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom)); } set { SetStylePadding(YogaEdge.Bottom, value); } } public YogaValue PaddingStart { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start)); } set { SetStylePadding(YogaEdge.Start, value); } } public YogaValue PaddingEnd { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End)); } set { SetStylePadding(YogaEdge.End, value); } } public YogaValue PaddingHorizontal { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal)); } set { SetStylePadding(YogaEdge.Horizontal, value); } } public YogaValue PaddingVertical { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical)); } set { SetStylePadding(YogaEdge.Vertical, value); } } public YogaValue Padding { get { return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All)); } set { SetStylePadding(YogaEdge.All, value); } } public float BorderLeftWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Left); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Left, value); } } public float BorderTopWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Top); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Top, value); } } public float BorderRightWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Right); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Right, value); } } public float BorderBottomWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Bottom); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Bottom, value); } } public float BorderStartWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.Start); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.Start, value); } } public float BorderEndWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.End); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.End, value); } } public float BorderWidth { get { return Native.YGNodeStyleGetBorder(_ygNode, YogaEdge.All); } set { Native.YGNodeStyleSetBorder(_ygNode, YogaEdge.All, value); } } public float LayoutMarginLeft => Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Left); public float LayoutMarginTop => Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Top); public float LayoutMarginRight => Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Right); public float LayoutMarginBottom => Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Bottom); public float LayoutMarginStart => Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.Start); public float LayoutMarginEnd => Native.YGNodeLayoutGetMargin(_ygNode, YogaEdge.End); public float LayoutPaddingLeft => Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Left); public float LayoutPaddingTop => Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Top); public float LayoutPaddingRight => Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Right); public float LayoutPaddingBottom => Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Bottom); public float LayoutBorderLeft => Native.YGNodeLayoutGetBorder(_ygNode, YogaEdge.Left); public float LayoutBorderTop => Native.YGNodeLayoutGetBorder(_ygNode, YogaEdge.Top); public float LayoutBorderRight => Native.YGNodeLayoutGetBorder(_ygNode, YogaEdge.Right); public float LayoutBorderBottom => Native.YGNodeLayoutGetBorder(_ygNode, YogaEdge.Bottom); public float LayoutPaddingStart => Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.Start); public float LayoutPaddingEnd => Native.YGNodeLayoutGetPadding(_ygNode, YogaEdge.End); public float ComputedFlexBasis => Native.YGNodeGetComputedFlexBasis(_ygNode); public YogaNode(YogaConfig config = null) { _config = ((config == null) ? YogaConfig.Default : config); _ygNode = Native.YGNodeNewWithConfig(_config.Handle); if (_ygNode == IntPtr.Zero) { throw new InvalidOperationException("Failed to allocate native memory"); } } public YogaNode(YogaNode srcNode) : this(srcNode._config) { CopyStyle(srcNode); } ~YogaNode() { Native.YGNodeFree(_ygNode); } public void Reset() { _measureFunction = null; _baselineFunction = null; _data = null; Native.YGSetManagedObject(_ygNode, null); Native.YGNodeReset(_ygNode); } public virtual void MarkDirty() { Native.YGNodeMarkDirty(_ygNode); } public void MarkHasNewLayout() { Native.YGNodeSetHasNewLayout(_ygNode, hasNewLayout: true); } public void CopyStyle(YogaNode srcNode) { Native.YGNodeCopyStyle(_ygNode, srcNode._ygNode); } public void MarkLayoutSeen() { Native.YGNodeSetHasNewLayout(_ygNode, hasNewLayout: false); } public bool ValuesEqual(float f1, float f2) { if (float.IsNaN(f1) || float.IsNaN(f2)) { return float.IsNaN(f1) && float.IsNaN(f2); } return Math.Abs(f2 - f1) < float.Epsilon; } public void Insert(int index, YogaNode node) { if (_children == null) { _children = new List(4); } _children.Insert(index, node); node._parent = new WeakReference(this); Native.YGNodeInsertChild(_ygNode, node._ygNode, (uint)index); } public void RemoveAt(int index) { YogaNode yogaNode = _children[index]; yogaNode._parent = null; _children.RemoveAt(index); Native.YGNodeRemoveChild(_ygNode, yogaNode._ygNode); } public void AddChild(YogaNode child) { Insert(Count, child); } public void RemoveChild(YogaNode child) { int num = IndexOf(child); if (num >= 0) { RemoveAt(num); } } public void Clear() { if (_children != null) { while (_children.Count > 0) { RemoveAt(_children.Count - 1); } } } public int IndexOf(YogaNode node) { return (_children != null) ? _children.IndexOf(node) : (-1); } public void SetMeasureFunction(MeasureFunction measureFunction) { _measureFunction = measureFunction; if (measureFunction == null) { if (!IsBaselineDefined) { Native.YGSetManagedObject(_ygNode, null); } Native.YGNodeRemoveMeasureFunc(_ygNode); } else { Native.YGSetManagedObject(_ygNode, this); Native.YGNodeSetMeasureFunc(_ygNode); } } public void SetBaselineFunction(BaselineFunction baselineFunction) { _baselineFunction = baselineFunction; if (baselineFunction == null) { if (!IsMeasureDefined) { Native.YGSetManagedObject(_ygNode, null); } Native.YGNodeRemoveBaselineFunc(_ygNode); } else { Native.YGSetManagedObject(_ygNode, this); Native.YGNodeSetBaselineFunc(_ygNode); } } public void CalculateLayout(float width = float.NaN, float height = float.NaN) { Native.YGNodeCalculateLayout(_ygNode, width, height, Native.YGNodeStyleGetDirection(_ygNode)); } public static YogaSize MeasureInternal(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { if (node == null || node._measureFunction == null) { throw new InvalidOperationException("Measure function is not defined."); } return node._measureFunction(node, width, widthMode, height, heightMode); } public static float BaselineInternal(YogaNode node, float width, float height) { if (node == null || node._baselineFunction == null) { throw new InvalidOperationException("Baseline function is not defined."); } return node._baselineFunction(node, width, height); } public string Print(YogaPrintOptions options = YogaPrintOptions.Layout | YogaPrintOptions.Style | YogaPrintOptions.Children) { StringBuilder sb = new StringBuilder(); Logger logger = _config.Logger; _config.Logger = delegate(YogaConfig config, YogaNode node, YogaLogLevel level, string message) { sb.Append(message); }; Native.YGNodePrint(_ygNode, options); _config.Logger = logger; return sb.ToString(); } public IEnumerator GetEnumerator() { return (_children != null) ? ((IEnumerable)_children).GetEnumerator() : Enumerable.Empty().GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return (_children != null) ? ((IEnumerable)_children).GetEnumerator() : Enumerable.Empty().GetEnumerator(); } public static int GetInstanceCount() { return Native.YGNodeGetInstanceCount(); } private void SetStylePosition(YogaEdge edge, YogaValue value) { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetPositionPercent(_ygNode, edge, value.Value); } else { Native.YGNodeStyleSetPosition(_ygNode, edge, value.Value); } } private void SetStyleMargin(YogaEdge edge, YogaValue value) { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetMarginPercent(_ygNode, edge, value.Value); } else if (value.Unit == YogaUnit.Auto) { Native.YGNodeStyleSetMarginAuto(_ygNode, edge); } else { Native.YGNodeStyleSetMargin(_ygNode, edge, value.Value); } } private void SetStylePadding(YogaEdge edge, YogaValue value) { if (value.Unit == YogaUnit.Percent) { Native.YGNodeStyleSetPaddingPercent(_ygNode, edge, value.Value); } else { Native.YGNodeStyleSetPadding(_ygNode, edge, value.Value); } } } internal enum YogaNodeType { Default, Text } internal enum YogaOverflow { Visible, Hidden, Scroll } internal enum YogaPositionType { Relative, Absolute } [Flags] internal enum YogaPrintOptions { Layout = 1, Style = 2, Children = 4 } internal struct YogaSize { public float width; public float height; } internal enum YogaUnit { Undefined, Point, Percent, Auto } internal struct YogaValue { private float value; private YogaUnit unit; public YogaUnit Unit => unit; public float Value => value; public static YogaValue Point(float value) { return new YogaValue { value = value, unit = ((!YogaConstants.IsUndefined(value)) ? YogaUnit.Point : YogaUnit.Undefined) }; } public bool Equals(YogaValue other) { return Unit == other.Unit && (Value.Equals(other.Value) || Unit == YogaUnit.Undefined); } public override bool Equals(object obj) { if (obj == null) { return false; } return obj is YogaValue && Equals((YogaValue)obj); } public override int GetHashCode() { return (Value.GetHashCode() * 397) ^ (int)Unit; } public static YogaValue Undefined() { return new YogaValue { value = float.NaN, unit = YogaUnit.Undefined }; } public static YogaValue Auto() { return new YogaValue { value = float.NaN, unit = YogaUnit.Auto }; } public static YogaValue Percent(float value) { return new YogaValue { value = value, unit = ((!YogaConstants.IsUndefined(value)) ? YogaUnit.Percent : YogaUnit.Undefined) }; } public static implicit operator YogaValue(float pointValue) { return Point(pointValue); } internal static YogaValue MarshalValue(YogaValue value) { return value; } } internal static class YogaValueExtensions { public static YogaValue Percent(this float value) { return YogaValue.Percent(value); } public static YogaValue Pt(this float value) { return YogaValue.Point(value); } public static YogaValue Percent(this int value) { return YogaValue.Percent(value); } public static YogaValue Pt(this int value) { return YogaValue.Point(value); } } internal enum YogaWrap { NoWrap, Wrap, WrapReverse } } namespace UnityEngine.UIElements { [StructLayout(LayoutKind.Sequential)] [NativeHeader("Modules/UIElementsNative/ImmediateStylePainter.h")] internal class ImmediateStylePainter { internal static void DrawRect(Rect screenRect, Color color, Vector4 borderWidths, Vector4 borderRadiuses) { DrawRect_Injected(ref screenRect, ref color, ref borderWidths, ref borderRadiuses); } internal static void DrawTexture(Rect screenRect, Texture texture, Rect sourceRect, Color color, Vector4 borderWidths, Vector4 borderRadiuses, int leftBorder, int topBorder, int rightBorder, int bottomBorder, bool usePremultiplyAlpha) { DrawTexture_Injected(ref screenRect, texture, ref sourceRect, ref color, ref borderWidths, ref borderRadiuses, leftBorder, topBorder, rightBorder, bottomBorder, usePremultiplyAlpha); } internal static void DrawText(Rect screenRect, string text, Font font, int fontSize, FontStyle fontStyle, Color fontColor, TextAnchor anchor, bool wordWrap, float wordWrapWidth, bool richText, TextClipping textClipping) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) DrawText_Injected(ref screenRect, text, font, fontSize, fontStyle, ref fontColor, anchor, wordWrap, wordWrapWidth, richText, textClipping); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void DrawRect_Injected(ref Rect screenRect, ref Color color, ref Vector4 borderWidths, ref Vector4 borderRadiuses); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void DrawTexture_Injected(ref Rect screenRect, Texture texture, ref Rect sourceRect, ref Color color, ref Vector4 borderWidths, ref Vector4 borderRadiuses, int leftBorder, int topBorder, int rightBorder, int bottomBorder, bool usePremultiplyAlpha); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void DrawText_Injected(ref Rect screenRect, string text, Font font, int fontSize, FontStyle fontStyle, ref Color fontColor, TextAnchor anchor, bool wordWrap, float wordWrapWidth, bool richText, TextClipping textClipping); } internal struct TextNativeSettings { public string text; public Font font; public int size; public float scaling; public FontStyle style; public Color color; public TextAnchor anchor; public bool wordWrap; public float wordWrapWidth; public bool richText; } internal struct TextVertex { public Vector3 position; public Color32 color; public Vector2 uv0; } [NativeHeader("Modules/UIElementsNative/TextNative.bindings.h")] internal static class TextNative { public static Vector2 GetCursorPosition(TextNativeSettings settings, Rect rect, int cursorIndex) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)settings.font == (Object)null) { Debug.LogError((object)"Cannot process a null font."); return Vector2.zero; } return DoGetCursorPosition(settings, rect, cursorIndex); } public static float ComputeTextWidth(TextNativeSettings settings) { if ((Object)(object)settings.font == (Object)null) { Debug.LogError((object)"Cannot process a null font."); return 0f; } if (string.IsNullOrEmpty(settings.text)) { return 0f; } return DoComputeTextWidth(settings); } public static float ComputeTextHeight(TextNativeSettings settings) { if ((Object)(object)settings.font == (Object)null) { Debug.LogError((object)"Cannot process a null font."); return 0f; } if (string.IsNullOrEmpty(settings.text)) { return 0f; } return DoComputeTextHeight(settings); } public unsafe static NativeArray GetVertices(TextNativeSettings settings) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) int vertexCount = 0; GetVertices(settings, IntPtr.Zero, UnsafeUtility.SizeOf(), ref vertexCount); NativeArray val = default(NativeArray); val..ctor(vertexCount, (Allocator)2, (NativeArrayOptions)0); if (vertexCount > 0) { GetVertices(settings, (IntPtr)NativeArrayUnsafeUtility.GetUnsafePtr(val), UnsafeUtility.SizeOf(), ref vertexCount); Debug.Assert(vertexCount == val.Length); } return val; } public static Vector2 GetOffset(TextNativeSettings settings, Rect screenRect) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)settings.font == (Object)null) { Debug.LogError((object)"Cannot process a null font."); return new Vector2(0f, 0f); } settings.text = settings.text ?? ""; return DoGetOffset(settings, screenRect); } public static float ComputeTextScaling(Matrix4x4 worldMatrix, float pixelsPerPoint) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(worldMatrix.m00, worldMatrix.m10, worldMatrix.m20); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(worldMatrix.m01, worldMatrix.m11, worldMatrix.m21); float num = (((Vector3)(ref val)).magnitude + ((Vector3)(ref val2)).magnitude) / 2f; return num * pixelsPerPoint; } [FreeFunction(Name = "TextNative::ComputeTextWidth")] private static float DoComputeTextWidth(TextNativeSettings settings) { return DoComputeTextWidth_Injected(ref settings); } [FreeFunction(Name = "TextNative::ComputeTextHeight")] private static float DoComputeTextHeight(TextNativeSettings settings) { return DoComputeTextHeight_Injected(ref settings); } [FreeFunction(Name = "TextNative::GetCursorPosition")] private static Vector2 DoGetCursorPosition(TextNativeSettings settings, Rect rect, int cursorPosition) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) DoGetCursorPosition_Injected(ref settings, ref rect, cursorPosition, out var ret); return ret; } [FreeFunction(Name = "TextNative::GetVertices")] private static void GetVertices(TextNativeSettings settings, IntPtr buffer, int vertexSize, ref int vertexCount) { GetVertices_Injected(ref settings, buffer, vertexSize, ref vertexCount); } [FreeFunction(Name = "TextNative::GetOffset")] private static Vector2 DoGetOffset(TextNativeSettings settings, Rect rect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) DoGetOffset_Injected(ref settings, ref rect, out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] private static extern float DoComputeTextWidth_Injected(ref TextNativeSettings settings); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float DoComputeTextHeight_Injected(ref TextNativeSettings settings); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void DoGetCursorPosition_Injected(ref TextNativeSettings settings, ref Rect rect, int cursorPosition, out Vector2 ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetVertices_Injected(ref TextNativeSettings settings, IntPtr buffer, int vertexSize, ref int vertexCount); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void DoGetOffset_Injected(ref TextNativeSettings settings, ref Rect rect, out Vector2 ret); } [VisibleToOtherModules(new string[] { "Unity.UIElements" })] [NativeHeader("Modules/UIElementsNative/UIElementsRuntimeUtilityNative.h")] internal static class UIElementsRuntimeUtilityNative { internal static Action RepaintOverlayPanelsCallback; internal static Action UpdateRuntimePanelsCallback; internal static Action RepaintOffscreenPanelsCallback; [RequiredByNativeCode] public static void RepaintOverlayPanels() { RepaintOverlayPanelsCallback?.Invoke(); } [RequiredByNativeCode] public static void UpdateRuntimePanels() { UpdateRuntimePanelsCallback?.Invoke(); } [RequiredByNativeCode] public static void RepaintOffscreenPanels() { RepaintOffscreenPanelsCallback?.Invoke(); } [MethodImpl(MethodImplOptions.InternalCall)] public static extern void RegisterPlayerloopCallback(); [MethodImpl(MethodImplOptions.InternalCall)] public static extern void UnregisterPlayerloopCallback(); [MethodImpl(MethodImplOptions.InternalCall)] public static extern void VisualElementCreation(); } } namespace UnityEngine.UIElements.UIR { internal struct GfxUpdateBufferRange { public uint offsetFromWriteStart; public uint size; public UIntPtr source; } internal struct DrawBufferRange { public int firstIndex; public int indexCount; public int minIndexVal; public int vertsReferenced; } [NativeHeader("Modules/UIElementsNative/UIRendererUtility.h")] [VisibleToOtherModules(new string[] { "Unity.UIElements" })] internal class Utility { [Flags] internal enum RendererCallbacks { RendererCallback_Init = 1, RendererCallback_Exec = 2, RendererCallback_Cleanup = 4 } internal enum GPUBufferType { Vertex, Index } public class GPUBuffer : IDisposable where T : struct { private IntPtr buffer; private int elemCount; private int elemStride; public int ElementStride => elemStride; public int Count => elemCount; internal IntPtr BufferPointer => buffer; public GPUBuffer(int elementCount, GPUBufferType type) { elemCount = elementCount; elemStride = UnsafeUtility.SizeOf(); buffer = AllocateBuffer(elementCount, elemStride, type == GPUBufferType.Vertex); } public void Dispose() { FreeBuffer(buffer); } public unsafe void UpdateRanges(NativeSlice ranges, int rangesMin, int rangesMax) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) UpdateBufferRanges(buffer, new IntPtr(NativeSliceUnsafeUtility.GetUnsafePtr(ranges)), ranges.Length, rangesMin, rangesMax); } } private static ProfilerMarker s_MarkerRaiseEngineUpdate = new ProfilerMarker("UIR.RaiseEngineUpdate"); public static event Action GraphicsResourcesRecreate; public static event Action EngineUpdate; public static event Action FlushPendingResources; public static event Action RegisterIntermediateRenderers; public static event Action RenderNodeAdd; public static event Action RenderNodeExecute; public static event Action RenderNodeCleanup; public unsafe static void SetVectorArray(MaterialPropertyBlock props, int name, NativeSlice vector4s) where T : struct { //IL_0016: Unknown result type (might be due to invalid IL or missing references) int count = vector4s.Length * vector4s.Stride / 16; SetVectorArray(props, name, new IntPtr(NativeSliceUnsafeUtility.GetUnsafePtr(vector4s)), count); } [RequiredByNativeCode] internal static void RaiseGraphicsResourcesRecreate(bool recreate) { Utility.GraphicsResourcesRecreate?.Invoke(recreate); } [RequiredByNativeCode] internal static void RaiseEngineUpdate() { if (Utility.EngineUpdate != null) { Utility.EngineUpdate(); } } [RequiredByNativeCode] internal static void RaiseFlushPendingResources() { Utility.FlushPendingResources?.Invoke(); } [RequiredByNativeCode] internal static void RaiseRegisterIntermediateRenderers(Camera camera) { Utility.RegisterIntermediateRenderers?.Invoke(camera); } [RequiredByNativeCode] internal static void RaiseRenderNodeAdd(IntPtr userData) { Utility.RenderNodeAdd?.Invoke(userData); } [RequiredByNativeCode] internal static void RaiseRenderNodeExecute(IntPtr userData) { Utility.RenderNodeExecute?.Invoke(userData); } [RequiredByNativeCode] internal static void RaiseRenderNodeCleanup(IntPtr userData) { Utility.RenderNodeCleanup?.Invoke(userData); } [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] private static extern IntPtr AllocateBuffer(int elementCount, int elementStride, bool vertexBuffer); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] private static extern void FreeBuffer(IntPtr buffer); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] private static extern void UpdateBufferRanges(IntPtr buffer, IntPtr ranges, int rangeCount, int writeRangeStart, int writeRangeEnd); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] private static extern void SetVectorArray(MaterialPropertyBlock props, int name, IntPtr vector4s, int count); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern IntPtr GetVertexDeclaration(VertexAttributeDescriptor[] vertexAttributes); public static void RegisterIntermediateRenderer(Camera camera, Material material, Matrix4x4 transform, Bounds aabb, int renderLayer, int shadowCasting, bool receiveShadows, int sameDistanceSortPriority, ulong sceneCullingMask, int rendererCallbackFlags, IntPtr userData, int userDataSize) { RegisterIntermediateRenderer_Injected(camera, material, ref transform, ref aabb, renderLayer, shadowCasting, receiveShadows, sameDistanceSortPriority, sceneCullingMask, rendererCallbackFlags, userData, userDataSize); } [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public unsafe static extern void DrawRanges(IntPtr ib, IntPtr* vertexStreams, int streamCount, IntPtr ranges, int rangeCount, IntPtr vertexDecl); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void SetPropertyBlock(MaterialPropertyBlock props); [ThreadSafe] public static void SetScissorRect(RectInt scissorRect) { SetScissorRect_Injected(ref scissorRect); } [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void DisableScissor(); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern bool IsScissorEnabled(); [ThreadSafe] public static IntPtr CreateStencilState(StencilState stencilState) { return CreateStencilState_Injected(ref stencilState); } [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void SetStencilState(IntPtr stencilState, int stencilRef); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern bool HasMappedBufferRange(); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern uint InsertCPUFence(); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern bool CPUFencePassed(uint fence); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void WaitForCPUFencePassed(uint fence); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void SyncRenderThread(); [ThreadSafe] public static RectInt GetActiveViewport() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) GetActiveViewport_Injected(out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void ProfileDrawChainBegin(); [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern void ProfileDrawChainEnd(); [MethodImpl(MethodImplOptions.InternalCall)] public static extern void NotifyOfUIREvents(bool subscribe); [ThreadSafe] public static Matrix4x4 GetUnityProjectionMatrix() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) GetUnityProjectionMatrix_Injected(out var ret); return ret; } [ThreadSafe] public static Matrix4x4 GetDeviceProjectionMatrix() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) GetDeviceProjectionMatrix_Injected(out var ret); return ret; } [MethodImpl(MethodImplOptions.InternalCall)] [ThreadSafe] public static extern bool DebugIsMainThread(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void RegisterIntermediateRenderer_Injected(Camera camera, Material material, ref Matrix4x4 transform, ref Bounds aabb, int renderLayer, int shadowCasting, bool receiveShadows, int sameDistanceSortPriority, ulong sceneCullingMask, int rendererCallbackFlags, IntPtr userData, int userDataSize); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void SetScissorRect_Injected(ref RectInt scissorRect); [MethodImpl(MethodImplOptions.InternalCall)] private static extern IntPtr CreateStencilState_Injected(ref StencilState stencilState); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetActiveViewport_Injected(out RectInt ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetUnityProjectionMatrix_Injected(out Matrix4x4 ret); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void GetDeviceProjectionMatrix_Injected(out Matrix4x4 ret); } }