Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //C#
- // -----------------------------------------------------------------------------
- // GLOBAL VARIABLES
- // -----------------------------------------------------------------------------
- string myMessage = "Hello !";
- // -----------------------------------------------------------------------------
- // FUNCTIONS / CLASS / STRUCTURES
- // -----------------------------------------------------------------------------
- class MyClass
- {
- // test d'une méthode utilisant des arguments de types integer du LSL
- public LSL_Types.LSLInteger Calc( LSL_Types.LSLInteger x, LSL_Types.LSLInteger y )
- {
- return x + y;
- }
- // test d'une méthode static avec le type int comme argument
- public static string Test( int test )
- {
- // switch
- switch( test )
- {
- case 0:
- return "aucun";
- case 1:
- return "un seul !";
- case 2:
- return "seulement deux !";
- case 3:
- return "trois !";
- default:
- return "trop grand";
- }
- }
- }
- // structure
- public struct OSAvatar
- {
- public int Number;
- public string Name;
- }
- // méthode de la class default du script
- public void MySay( string message )
- {
- llSay( 0, "/me (OS-C# Test): " + message );
- }
- // -----------------------------------------------------------------------------
- // LSL EVENTS
- // -----------------------------------------------------------------------------
- public void default_event_state_entry()
- {
- // on crée 2 integer du LSL
- LSL_Types.LSLInteger lslint1 = 12;
- LSL_Types.LSLInteger lslint2 = 6;
- // instance de la class MyClass
- MyClass ob = new MyClass();
- // test de la méthode Calc de la class MyClass
- LSL_Types.LSLInteger result = ob.Calc( lslint1, lslint2 );
- // on utilise la fonction llSay du LSL pour afficher le résultat de notre opération
- llSay( 0, "Le resultat de la methode Calc est : " + result.ToString() );
- // type int du C#
- int myInt = 2;
- // test de la méthode static Test de MyClass
- llSay( 0, "description de notre int : " + MyClass.Test(myInt) );
- // test d'une structure
- OSAvatar BlackShade = new OSAvatar();
- BlackShade.Number = 6;
- BlackShade.Name = "Time Paradox";
- // fonction MySay
- MySay( "nom de l'avatar : " + BlackShade.Name + ". numero : " + BlackShade.Number.ToString() );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement