mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-27 00:18:12 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
49 lines
846 B
C#
49 lines
846 B
C#
using Sandbox;
|
|
using System;
|
|
|
|
[AttributeUsage( AttributeTargets.Property )]
|
|
[CodeGenerator( CodeGeneratorFlags.WrapPropertyGet | CodeGeneratorFlags.Instance, "OnWrapGet" )]
|
|
[CodeGenerator( CodeGeneratorFlags.WrapPropertyGet | CodeGeneratorFlags.Static, "WrapGet.OnWrapGetStatic" )]
|
|
public class WrapGet : Attribute
|
|
{
|
|
public static T OnWrapGetStatic<T>( WrappedPropertyGet<T> p )
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public class MyTestClass
|
|
{
|
|
|
|
}
|
|
|
|
public partial class TestWrapGet
|
|
{
|
|
[WrapGet]
|
|
public static bool StaticProperty { get; set; }
|
|
|
|
[WrapGet]
|
|
public bool InstanceProperty { get; set; } = true;
|
|
|
|
[WrapGet]
|
|
public bool Test
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
set
|
|
{
|
|
InstanceProperty = true;
|
|
}
|
|
}
|
|
|
|
[WrapGet]
|
|
public MyTestClass InstanceProperty2 { get; }
|
|
|
|
internal T OnWrapGet<T>( WrappedPropertyGet<T> p )
|
|
{
|
|
return p.Value;
|
|
}
|
|
}
|