Ejemplo n.º 1
0
            public static ScriptInfo DeclareScript(string path, MainDelegate main)
            {
                int index = EnsureScriptIndex(ref path);
                var info  = new ScriptInfo(index, path, main);

                DeclareScript(info);
                return(info);
            }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //Создаем объект делегата и инициализируем методом, возвращающим нового кота
            MainDelegate mainDelegate = () => new Cat();

            //Через mainDelegate создается экземпляр кота, и из этого экземпляра вызывается делегат meowDelegate, ссылающийся на метод мяукания
            mainDelegate().meowDelegate();
        }
Ejemplo n.º 3
0
        private void demoDelegateExtensions()
        {
            MainDelegate  mainDelegate  = new MainDelegate(Main);        // static
            LogicDelegate logicDelegate = new LogicDelegate(this.logic); // instance, cannot call this from a static method without having an instance

            mainDelegate.DelegateSignature().DebugLog();
            logicDelegate.DelegateSignature().DebugLog();
        }
Ejemplo n.º 4
0
            public static List <MainDelegate> Fill(int count)
            {
                List <MainDelegate> list = new List <MainDelegate>();
                MainDelegate        m1   = new MainDelegate(MainDelegateMethod);

                for (int i = 0; i < count; i++)
                {
                    list.Add(m1);
                }
                return(list);
            }
Ejemplo n.º 5
0
    void Awake()
    {
        // Add Pick up behaviour to the delegate if true.
        if (_pickUp)
        {
            MyDelegate += PickupRay;
        }

        // Add Interaction behaviour to the delegate if true.
        if (_interact)
        {
            MyDelegate += InteractRay;
        }
    }
Ejemplo n.º 6
0
 internal static extern void CSharpResourceImpl_SetMainDelegate(IntPtr resource,
                                                                MainDelegate @delegate);
Ejemplo n.º 7
0
 internal ScriptInfo(int index, string path, MainDelegate method)
 {
     Index      = index;
     Path       = path;
     MainMethod = method;
 }
Ejemplo n.º 8
0
 internal ScriptInfo(int index, string path, TypeInfo script)
 {
     Index      = index;
     Path       = path;
     MainMethod = CreateMain(script);
 }
Ejemplo n.º 9
0
 public ScriptInfo(int index, string path, TypeInfo script)
 {
     Index      = index;
     Path       = CurrentPlatform.NormalizeSlashes(path);
     MainMethod = CreateMain(script);
 }
Ejemplo n.º 10
0
 private void Zaloguj_Click(object sender, RoutedEventArgs e)
 {
     MD = AuthorizeUser;
     MD.Invoke();
 }
Ejemplo n.º 11
0
 public Window1()
 {
     InitializeComponent();
     MD = InitializeUsers;
     MD.Invoke();
 }
Ejemplo n.º 12
0
 public static void DeclareScript(string relpath, MainDelegate main) => ScriptsMap.DeclareScript(relpath, main);
Ejemplo n.º 13
0
            public static void DeclareScript(string path, MainDelegate main)
            {
                int index = EnsureScriptIndex(ref path);

                DeclareScript(index, new ScriptInfo(index, path, main));
            }
Ejemplo n.º 14
0
 internal static extern void CSharpResource_SetMain(IntPtr resourcePointer, MainDelegate mainDelegate,
                                                    StopDelegate stopDelegate,
                                                    TickDelegate tickDelegate, ServerEventDelegate serverEventDelegate,
                                                    CheckpointDelegate checkpointDelegate,
                                                    ClientEventDelegate clientEventDelegate, PlayerDamageDelegate playerDamageDelegate,
                                                    PlayerConnectDelegate playerConnectDelegate, PlayerDeathDelegate playerDeathDelegate,
                                                    PlayerDisconnectDelegate playerDisconnectDelegate, PlayerRemoveDelegate playerRemoveDelegate,
                                                    VehicleRemoveDelegate vehicleRemoveDelegate,
                                                    PlayerChangeVehicleSeatDelegate playerChangeVehicleSeatDelegate,
                                                    PlayerEnterVehicleDelegate playerEnterVehicleDelegate,
                                                    PlayerLeaveVehicleDelegate playerLeaveVehicleDelegate,
                                                    CreatePlayerDelegate createPlayerDelegate, RemovePlayerDelegate removePlayerDelegate,
                                                    CreateVehicleDelegate createVehicleDelegate, RemoveVehicleDelegate removeVehicleDelegate,
                                                    CreateBlipDelegate createBlipDelegate, RemoveBlipDelegate removeBlipDelegate,
                                                    CreateCheckpointDelegate createCheckpointDelegate, RemoveCheckpointDelegate removeCheckpointDelegate,
                                                    CreateVoiceChannelDelegate createVoiceChannelDelegate,
                                                    RemoveVoiceChannelDelegate removeVoiceChannelDelegate,
                                                    ConsoleCommandDelegate consoleCommandDelegate,
                                                    MetaDataChange metaDataChange,
                                                    MetaDataChange syncedMetaDataChange,
                                                    CreateColShapeDelegate createColShapeDelegate,
                                                    RemoveColShapeDelegate removeColShapeDelegate,
                                                    ColShapeDelegate colShapeDelegate
                                                    );