MarcusCZ.AltV.VZones.Client.VTargetAPI 1.1.0

dotnet add package MarcusCZ.AltV.VZones.Client.VTargetAPI --version 1.1.0                
NuGet\Install-Package MarcusCZ.AltV.VZones.Client.VTargetAPI -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MarcusCZ.AltV.VZones.Client.VTargetAPI" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MarcusCZ.AltV.VZones.Client.VTargetAPI --version 1.1.0                
#r "nuget: MarcusCZ.AltV.VZones.Client.VTargetAPI, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MarcusCZ.AltV.VZones.Client.VTargetAPI as a Cake Addin
#addin nuget:?package=MarcusCZ.AltV.VZones.Client.VTargetAPI&version=1.1.0

// Install MarcusCZ.AltV.VZones.Client.VTargetAPI as a Cake Tool
#tool nuget:?package=MarcusCZ.AltV.VZones.Client.VTargetAPI&version=1.1.0                

VTarget implementation

Integration for my other VTarget Resource.

CLIENT SIDE ONLY

Usage

  1. Include both VZones and VTarget into your resource from Nuget
  2. Include this API package from Nuget to your Client resource
  3. Create and init both modules
  4. Register this API
    class YourResource : AsyncResource // Important
    {
         private VZonesClient _zones;
         private Target _vtarget;
    
         public void OnStart()
         {
             _zones = new VZonesClient();
             _target = new Target();
             _zones.OnStart(); // Init order is not important
             _target.OnStart();
    
             Target.RegisterProvider<VZoneOption>(new VZonesProvider()); // Register this API
         }
    }
    

NOTE Your resource must implement AsyncResource, because this API uses AltAsync.Do( ... ) calls.

Register Options for Zones

Example

// 1. Create zone
var zone = new Zone2("VT test", new (902.31494f, -1068.6606f), new (898.2343f, -1068.6318f), 31.82809f, 5f); // some zone

// 2. Register VTarget options
// NOTE this is an extension method, available only because of this API.
zone.AddVTarget([
   new VZoneOption("fas fa-lock", "Zone option")
   {
       Background = Background.PURPLE,
       OnClick = (zone, alert) =>
       {
           alert(Background.INFO, "You clicked on option!"); // Show some alert
           return false; // do not refresh the menu
       },
       // See VZoneOption.cs for all properties
   },
   new VZoneOption( .... ) // another option
]);

// 3. Register zone
VZonesClient.Zones += zone;

You can register options for any type of zone.

Zones can be both Active (can trigger events) and have VTarget options.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 88 1/4/2025