Exemple #1
0
        internal Plugin(IntPtr multiplayer)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            MP.Setup(this);

            NativeMultiplayer = multiplayer;
            _mainThreadId     = Thread.CurrentThread.ManagedThreadId;
            _taskScheduler    = new RageTaskScheduler();
            _resourceLoader   = new ResourceLoader(this);

            ArgumentConverter = new ArgumentConverter(this);

            Logger         = new Logger(this);
            EventScripting = new EventScripting(this);
            Commands       = new Commands(this);
            Utility        = new Utility(this);

            PlayerPool     = CreateNativeManager <PlayerPool>(Rage.Multiplayer.Multiplayer_GetPlayerPool);
            VehiclePool    = CreateNativeManager <VehiclePool>(Rage.Multiplayer.Multiplayer_GetVehiclePool);
            BlipPool       = CreateNativeManager <BlipPool>(Rage.Multiplayer.Multiplayer_GetBlipPool);
            CheckpointPool = CreateNativeManager <CheckpointPool>(Rage.Multiplayer.Multiplayer_GetCheckpointPool);
            ColshapePool   = CreateNativeManager <ColshapePool>(Rage.Multiplayer.Multiplayer_GetColshapePool);
            MarkerPool     = CreateNativeManager <MarkerPool>(Rage.Multiplayer.Multiplayer_GetMarkerPool);
            ObjectPool     = CreateNativeManager <ObjectPool>(Rage.Multiplayer.Multiplayer_GetObjectPool);
            TextLabelPool  = CreateNativeManager <TextLabelPool>(Rage.Multiplayer.Multiplayer_GetLabelPool);

            Config = CreateNativeManager <Config>(Rage.Multiplayer.Multiplayer_GetConfig);
            World  = CreateNativeManager <World>(Rage.Multiplayer.Multiplayer_GetWorld);

            _entityPoolMapping = new Dictionary <EntityType, IInternalPool>
            {
                { EntityType.Player, PlayerPool },
                { EntityType.Vehicle, VehiclePool },
                { EntityType.Blip, BlipPool },
                { EntityType.Checkpoint, CheckpointPool },
                { EntityType.Colshape, ColshapePool },
                { EntityType.Marker, MarkerPool },
                { EntityType.Object, ObjectPool },
                { EntityType.TextLabel, TextLabelPool }
            };
        }