2015-12-01 12:50:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using MultiTheftAuto;
|
|
|
|
|
using MultiTheftAuto.EventArgs;
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main( string[] args )
|
|
|
|
|
{
|
2015-12-05 10:26:07 +00:00
|
|
|
|
Element.Root.OnElementDestroy += ( Element sender, ElementEventArgs e ) =>
|
|
|
|
|
{
|
|
|
|
|
Debug.Info( "lambda " + sender.GetType() + " " + e.This.GetType() );
|
|
|
|
|
};
|
2015-12-01 12:50:50 +00:00
|
|
|
|
|
|
|
|
|
Vehicle vehicle = new Vehicle( VehicleModel.ADMIRAL, Vector3.Zero, Vector3.Zero );
|
|
|
|
|
|
|
|
|
|
vehicle.OnElementDestroy += Root_ElementDestroy;
|
|
|
|
|
|
2015-12-05 10:26:07 +00:00
|
|
|
|
Event.Add( "onTest", true );
|
|
|
|
|
|
|
|
|
|
Event.AddHandler( "onTest", vehicle, new Action<Element, string, char, bool>( testEvent_OnTrigger ) );
|
|
|
|
|
|
|
|
|
|
Event.Trigger( "onTest", vehicle, "test", 'a', true, false, 123, 456.7f, 1337.01d, null, vehicle );
|
|
|
|
|
|
|
|
|
|
//vehicle.Destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void testEvent_OnTrigger( Element sender, string a, char b, bool c )
|
|
|
|
|
{
|
|
|
|
|
Debug.Info( "testEvent_OnTrigger " + sender.GetType() + " " + a + " " + b + " " + c );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-05 10:26:07 +00:00
|
|
|
|
static void Root_ElementDestroy( Element sender, ElementEventArgs e )
|
2015-12-01 12:50:50 +00:00
|
|
|
|
{
|
2015-12-05 10:26:07 +00:00
|
|
|
|
Debug.Info( "Root_ElementDestroy " + sender.GetType() + " " + e.This.GetType() );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|