コード例 #1
0
 public override void ForEach(IBaseObjectCallback <IVehicle> baseObjectCallback)
 {
     foreach (var entity in GetAllEntities())
     {
         using var entityRef = new VehicleRef(entity);
         if (!entityRef.Exists)
         {
             continue;
         }
         entityRef.DebugCountUp();
         baseObjectCallback.OnBaseObject(entity);
         entityRef.DebugCountDown();
     }
 }
コード例 #2
0
ファイル: AsyncModule.cs プロジェクト: so-lar/coreclr-module
        public override void OnVehicleDestroyEvent(IVehicle vehicle)
        {
            base.OnVehicleDestroyEvent(vehicle);
            if (!VehicleDestroyAsyncDelegateHandlers.HasEvents())
            {
                return;
            }
            var vehicleReference = new VehicleRef(vehicle);

            Task.Run(async() =>
            {
                vehicleReference.DebugCountUp();
                await VehicleDestroyAsyncDelegateHandlers.CallAsync(@delegate =>
                                                                    @delegate(vehicle));
                vehicleReference.DebugCountDown();
                vehicleReference.Dispose();
            });
        }
コード例 #3
0
ファイル: AsyncModule.cs プロジェクト: so-lar/coreclr-module
        public override void OnPlayerLeaveVehicleEvent(IVehicle vehicle, IPlayer player, byte seat)
        {
            base.OnPlayerLeaveVehicleEvent(vehicle, player, seat);
            if (!PlayerLeaveVehicleAsyncEventHandler.HasEvents())
            {
                return;
            }
            var playerReference  = new PlayerRef(player);
            var vehicleReference = new VehicleRef(vehicle);

            Task.Run(async() =>
            {
                playerReference.DebugCountUp();
                vehicleReference.DebugCountUp();
                await PlayerLeaveVehicleAsyncEventHandler.CallAsync(@delegate =>
                                                                    @delegate(vehicle, player, seat));
                vehicleReference.DebugCountDown();
                playerReference.DebugCountDown();
                playerReference.Dispose();
                vehicleReference.Dispose();
            });
        }