Skip to content

Commit

Permalink
Merge pull request #34 from manups4e/master
Browse files Browse the repository at this point in the history
Update to 3.0
  • Loading branch information
manups4e authored Aug 23, 2021
2 parents 4cad605 + 4341253 commit 2265969
Show file tree
Hide file tree
Showing 25 changed files with 1,380 additions and 185 deletions.
462 changes: 456 additions & 6 deletions MenuExample/MenuExample.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion MenuExample/MenuExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="CitizenFX.Core.Client, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CitizenFX.Core.Client.1.0.4075\lib\net45\CitizenFX.Core.Client.dll</HintPath>
<HintPath>..\packages\CitizenFX.Core.Client.1.0.4207\lib\net45\CitizenFX.Core.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion MenuExample/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CitizenFX.Core.Client" version="1.0.4075" targetFramework="net452" />
<package id="CitizenFX.Core.Client" version="1.0.4207" targetFramework="net452" />
</packages>
114 changes: 0 additions & 114 deletions NativeUI/Elements/TimerBars.cs

This file was deleted.

81 changes: 81 additions & 0 deletions NativeUI/Hud/Markers/Marker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using CitizenFX.Core;
using System.Drawing;
using static CitizenFX.Core.Native.API;

namespace NativeUI
{
public class Marker
{
public MarkerType MarkerType { get; set; }
public float Distance { get; set; }
public Vector3 Position { get; set; }

// this is optional and default to 0
public Vector3 Direction { get; set; } = Vector3.Zero;
// this is optional and default to 0
public Vector3 Rotation { get; set; } = Vector3.Zero;

public Vector3 Scale { get; set; } = new Vector3(1.5f);
public Color Color { get; set; }
public bool BobUpDown { get; set; }
public bool Rotate { get; set; }
public bool FaceCamera { get; set; }
public bool IsInMarker { get; private set; }
public bool IsInRange { get => MenuPool.PlayerPed.IsInRangeOf(Position, Distance); }

/// <summary>
/// Creates a Marker in a world position
/// </summary>
/// <param name="type">The type of marker</param>
/// <param name="position">Position in world coords of the marker</param>
/// <param name="distance">Drawing distance, if you're more distant than this value the marker won't be drawn </param>
/// <param name="color">Color of the marker</param>
/// <param name="bobUpDown">The marker will bounce up and down</param>
/// <param name="rotate">The marker will rotate on its Z axiz</param>
/// <param name="faceCamera">The marker will face camera</param>
public Marker(MarkerType type, Vector3 position, float distance, Color color, bool bobUpDown = false, bool rotate = false, bool faceCamera = false)
{
MarkerType = type;
Position = position;
Distance = distance;
Color = color;
BobUpDown = bobUpDown;
Rotate = rotate;
FaceCamera = faceCamera;
if (Rotate && FaceCamera)
Rotate = false;
}

/// <summary>
/// Creates a Marker in a world position
/// </summary>
/// <param name="type">The type of marker</param>
/// <param name="position">Position in world coords of the marker</param>
/// <param name="scale">Dimensions of the marker</param>
/// <param name="distance">Drawing distance, if you're more distant than this value the marker won't be drawn </param>
/// <param name="color">Color of the marker</param>
/// <param name="bobUpDown">The marker will bounce up and down</param>
/// <param name="rotate">The marker will rotate on its Z axiz</param>
/// <param name="faceCamera">The marker will face camera</param>
public Marker(MarkerType type, Vector3 position, Vector3 scale, float distance, Color color, bool bobUpDown = false, bool rotate = false, bool faceCamera = false)
{
MarkerType = type;
Position = position;
Scale = scale;
Distance = distance;
Color = color;
BobUpDown = bobUpDown;
Rotate = rotate;
FaceCamera = faceCamera;
if (Rotate && FaceCamera)
Rotate = false;
}

public void Draw()
{
World.DrawMarker(MarkerType, Position, Direction, Rotation, Scale, Color, BobUpDown, FaceCamera, Rotate);
var dist = Vector3.Distance(Position, MenuPool.PlayerPed.Position);
IsInMarker = dist <= (Scale / 2).X || dist <= (Scale / 2).Y || dist <= (Scale / 2).Z;
}
}
}
52 changes: 52 additions & 0 deletions NativeUI/Hud/Markers/MarkersHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using CitizenFX.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static CitizenFX.Core.Native.API;

namespace NativeUI
{
public class MarkersHandler : BaseScript
{

private static List<Marker> _markerList = new List<Marker>();

public MarkersHandler()
{
Tick += MainHandler;
}

public async Task MainHandler()
{
if (_markerList.Count == 0) return;

for(int i=0; i<FilterMarkers().Count; i++)
FilterMarkers()[i].Draw();
await Task.FromResult(0);
}

private List<Marker> FilterMarkers() => _markerList.Where(x => MenuPool.PlayerPed.IsInRangeOf(x.Position, x.Distance)).ToList();

/// <summary>
/// Adds a marker to the list
/// </summary>
/// <param name="marker"></param>
public static void AddMarker(Marker marker)
{
if (!_markerList.Contains(marker))
_markerList.Add(marker);
}

/// <summary>
/// Removes the marker from the list
/// </summary>
/// <param name="marker"></param>
public static void RemoveMarker(Marker marker)
{
if (_markerList.Contains(marker))
_markerList.Remove(marker);
}
}
}
104 changes: 104 additions & 0 deletions NativeUI/Hud/Notifications/NotificationChars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
namespace NativeUI
{
public static class NotificationChar
{
public static string Abigail = "CHAR_ABIGAIL";
public static string Amanda = "CHAR_AMANDA";
public static string Ammunation = "CHAR_AMMUNATION";
public static string Andreas = "CHAR_ANDREAS";
public static string Antonia = "CHAR_ANTONIA";
public static string Ashley = "CHAR_ASHLEY";
public static string BankOfLiberty = "CHAR_BANK_BOL";
public static string BankFleeca = "CHAR_BANK_FLEECA";
public static string BankMaze = "CHAR_BANK_MAZE";
public static string Barry = "CHAR_BARRY";
public static string Beverly = "CHAR_BEVERLY";
public static string BikeSite = "CHAR_BIKESITE";
public static string BlankEntry = "CHAR_BLANK_ENTRY";
public static string Blimp = "CHAR_BLIMP";
public static string Blocked = "CHAR_BLOCKED";
public static string BoatSite = "CHAR_BOATSITE";
public static string BrokenDownGirl = "CHAR_BROKEN_DOWN_GIRL";
public static string BugStars = "CHAR_BUGSTARS";
public static string Call911 = "CHAR_CALL911";
public static string LegendaryMotorsport = "CHAR_CARSITE";
public static string SSASuperAutos = "CHAR_CARSITE2";
public static string Castro = "CHAR_CASTRO";
public static string ChatCall = "CHAR_CHAT_CALL";
public static string Chef = "CHAR_CHEF";
public static string Cheng = "CHAR_CHENG";
public static string ChengSenior = "CHAR_CHENGSR";
public static string Chop = "CHAR_CHOP";
public static string Cris = "CHAR_CRIS";
public static string Dave = "CHAR_DAVE";
public static string Default = "CHAR_DEFAULT";
public static string Denise = "CHAR_DENISE";
public static string DetonateBomb = "CHAR_DETONATEBOMB";
public static string DetonatePhone = "CHAR_DETONATEPHONE";
public static string Devin = "CHAR_DEVIN";
public static string SubMarine = "CHAR_DIAL_A_SUB";
public static string Dom = "CHAR_DOM";
public static string DomesticGirl = "CHAR_DOMESTIC_GIRL";
public static string Dreyfuss = "CHAR_DREYFUSS";
public static string DrFriedlander = "CHAR_DR_FRIEDLANDER";
public static string Epsilon = "CHAR_EPSILON";
public static string EstateAgent = "CHAR_ESTATE_AGENT";
public static string Facebook = "CHAR_FACEBOOK";
public static string FilmNoire = "CHAR_FILMNOIR";
public static string Floyd = "CHAR_FLOYD";
public static string Franklin = "CHAR_FRANKLIN";
public static string FranklinTrevor = "CHAR_FRANK_TREV_CONF";
public static string GayMilitary = "CHAR_GAYMILITARY";
public static string Hao = "CHAR_HAO";
public static string HitcherGirl = "CHAR_HITCHER_GIRL";
public static string Hunter = "CHAR_HUNTER";
public static string Jimmy = "CHAR_JIMMY";
public static string JimmyBoston = "CHAR_JIMMY_BOSTON";
public static string Joe = "CHAR_JOE";
public static string Josef = "CHAR_JOSEF";
public static string Josh = "CHAR_JOSH";
public static string LamarDog = "CHAR_LAMAR";
public static string Lester = "CHAR_LESTER";
public static string Skull = "CHAR_LESTER_DEATHWISH";
public static string LesterFranklin = "CHAR_LEST_FRANK_CONF";
public static string LesterMichael = "CHAR_LEST_MIKE_CONF";
public static string LifeInvader = "CHAR_LIFEINVADER";
public static string LsCustoms = "CHAR_LS_CUSTOMS";
public static string LSTI = "CHAR_LS_TOURIST_BOARD";
public static string Manuel = "CHAR_MANUEL";
public static string Marnie = "CHAR_MARNIE";
public static string Martin = "CHAR_MARTIN";
public static string MaryAnn = "CHAR_MARY_ANN";
public static string Maude = "CHAR_MAUDE";
public static string Mechanic = "CHAR_MECHANIC";
public static string Michael = "CHAR_MICHAEL";
public static string MichaelFranklin = "CHAR_MIKE_FRANK_CONF";
public static string MichaelTrevor = "CHAR_MIKE_TREV_CONF";
public static string WarStock = "CHAR_MILSITE";
public static string Minotaur = "CHAR_MINOTAUR";
public static string Molly = "CHAR_MOLLY";
public static string MorsMutual = "CHAR_MP_MORS_MUTUAL";
public static string ArmyContact = "CHAR_MP_ARMY_CONTACT";
public static string Brucie = "CHAR_MP_BRUCIE";
public static string FibContact = "CHAR_MP_FIB_CONTACT";
public static string RockStarLogo = "CHAR_MP_FM_CONTACT";
public static string Gerald = "CHAR_MP_GERALD";
public static string Julio = "CHAR_MP_JULIO";
public static string MechanicChinese = "CHAR_MP_MECHANIC";
public static string MerryWeather = "CHAR_MP_MERRYWEATHER";
public static string Unicorn = "CHAR_MP_STRIPCLUB_PR";
public static string Mom = "CHAR_MRS_THORNHILL";
public static string MrsThornhill = "CHAR_MRS_THORNHILL";
public static string PatriciaTrevor = "CHAR_PATRICIA";
public static string PegasusDelivery = "CHAR_PEGASUS_DELIVERY";
public static string ElitasTravel = "CHAR_PLANESITE";
public static string Sasquatch = "CHAR_SASQUATCH";
public static string Simeon = "CHAR_SIMEON";
public static string SocialClub = "CHAR_SOCIAL_CLUB";
public static string Solomon = "CHAR_SOLOMON";
public static string Taxi = "CHAR_TAXI";
public static string Trevor = "CHAR_TREVOR";
public static string YouTube = "CHAR_YOUTUBE";
public static string Wade = "CHAR_WADE";
}
}
Loading

0 comments on commit 2265969

Please sign in to comment.