2015-12-01 12:50:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using MultiTheftAuto;
|
|
|
|
|
using MultiTheftAuto.EventArgs;
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
2015-12-12 19:50:24 +00:00
|
|
|
|
static void MonoCommandHandler( Player player, string command, string[] args )
|
|
|
|
|
{
|
|
|
|
|
Debug.Info( player.GetName() + " executed command '" + command + "' with args: " + string.Join( " ", args ) );
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-01 12:50:50 +00:00
|
|
|
|
static void Main( string[] args )
|
|
|
|
|
{
|
2015-12-12 19:50:24 +00:00
|
|
|
|
Server.AddCommandHandler( "mono", new CommandHandler( MonoCommandHandler ) );
|
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
Element.Root.OnPlayerJoin += Root_OnPlayerJoin;
|
2015-12-01 12:50:50 +00:00
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
//Element.Root.OnElementDestroy += ( Element sender, ElementEventArgs e ) =>
|
|
|
|
|
//{
|
|
|
|
|
// Debug.Info( "lambda " + sender.GetType() + " " + e.This.GetType() );
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
Element vehicle = new Vehicle( VehicleModel.ADMIRAL, Vector3.Zero, Vector3.Zero );
|
|
|
|
|
|
|
|
|
|
Debug.Info( vehicle.GetType().ToString() );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
|
|
|
|
|
vehicle.OnElementDestroy += Root_ElementDestroy;
|
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
//Event.Add( "onTest", true );
|
|
|
|
|
|
|
|
|
|
//Event.AddHandler( "onTest", vehicle, new Action<Element, string, bool, bool>( testEvent_OnTrigger ) );
|
|
|
|
|
|
|
|
|
|
//Event.Trigger( "onTest", vehicle, "test", true, false, 123, 456.7f, 1337.01d, null, vehicle );
|
|
|
|
|
|
|
|
|
|
vehicle.Destroy();
|
2015-12-20 20:54:20 +00:00
|
|
|
|
|
|
|
|
|
Debug.Info( Color.Aquamarine.ToString() );
|
2015-12-12 10:10:23 +00:00
|
|
|
|
}
|
2015-12-05 10:26:07 +00:00
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
static void Root_OnPlayerJoin( Element sender, ElementEventArgs e )
|
|
|
|
|
{
|
|
|
|
|
Player player = sender as Player;
|
2015-12-05 10:26:07 +00:00
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
Debug.Info( "Player '" + player.GetName() + "' joined" );
|
2015-12-20 20:54:20 +00:00
|
|
|
|
|
|
|
|
|
player.FadeCamera( true, 1.0f, Color.Black );
|
2015-12-12 10:10:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Root_OnPlayerConnect( Element sender, PlayerConnectEventArgs e )
|
|
|
|
|
{
|
|
|
|
|
//Player player = sender as Player;
|
2015-12-05 10:26:07 +00:00
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
Debug.Info( "Player '" + sender.GetType() + "' connected" );
|
2015-12-05 10:26:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-12 10:10:23 +00:00
|
|
|
|
static void testEvent_OnTrigger( Element sender, string a, bool b, bool c )
|
2015-12-05 10:26:07 +00:00
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|