mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-25 15:38:31 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
61 lines
1.0 KiB
C#
61 lines
1.0 KiB
C#
using Sandbox;
|
|
using System;
|
|
|
|
[AttributeUsage( AttributeTargets.Method )]
|
|
[CodeGenerator( CodeGeneratorFlags.WrapMethod | CodeGeneratorFlags.Instance, "OnMethodInvoked" )]
|
|
[CodeGenerator( CodeGeneratorFlags.WrapMethod | CodeGeneratorFlags.Static, "WrapCall.OnMethodInvokedStatic" )]
|
|
public class WrapCall : Attribute
|
|
{
|
|
public static void OnMethodInvokedStatic<T1>( WrappedMethod m, T1 arga )
|
|
{
|
|
m.Resume();
|
|
}
|
|
|
|
public static void OnMethodInvokedStatic( WrappedMethod m )
|
|
{
|
|
m.Resume();
|
|
}
|
|
}
|
|
|
|
public partial class TestWrapCall
|
|
{
|
|
[WrapCall]
|
|
public void TestPreprocessorWrappedMethod()
|
|
{
|
|
#if true
|
|
if ( true )
|
|
{
|
|
// Hello there!
|
|
}
|
|
#endif
|
|
}
|
|
|
|
[WrapCall]
|
|
public void AnotherTest()
|
|
{
|
|
#if true
|
|
if ( true )
|
|
{
|
|
// Hello there!
|
|
}
|
|
#endif
|
|
|
|
Log.Info( $"Another line - so the trivia is empty below" );
|
|
}
|
|
|
|
internal bool OnMethodInvoked<T1>( WrappedMethod<bool> m, T1 arga )
|
|
{
|
|
|
|
}
|
|
|
|
internal void OnMethodInvoked<T1>( WrappedMethod m, T1 arga )
|
|
{
|
|
|
|
}
|
|
|
|
internal void OnMethodInvoked( WrappedMethod m )
|
|
{
|
|
m.Resume();
|
|
}
|
|
}
|