add Flugschule and Change Pilotjob
This commit is contained in:
67
ReallifeGamemode.Client/Jobs/PilotRouteSelect.ts
Normal file
67
ReallifeGamemode.Client/Jobs/PilotRouteSelect.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import * as NativeUI from 'NativeUI';
|
||||
|
||||
const Menu = NativeUI.Menu;
|
||||
const UIMenuItem = NativeUI.UIMenuItem;
|
||||
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||
const BadgeStyle = NativeUI.BadgeStyle;
|
||||
const Point = NativeUI.Point;
|
||||
const ItemsCollection = NativeUI.ItemsCollection;
|
||||
const Color = NativeUI.Color;
|
||||
|
||||
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||
|
||||
let sendItem = new UIMenuItem("Starten", "Route starten");
|
||||
sendItem.BackColor = new Color(13, 71, 161);
|
||||
sendItem.HighlightedBackColor = new Color(25, 118, 210);
|
||||
|
||||
let cancelItem = new UIMenuItem("Abbrechen", "");
|
||||
cancelItem.BackColor = new Color(213, 0, 0);
|
||||
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||
|
||||
|
||||
export default function PilotRouteList(globalData: GlobalData) {
|
||||
|
||||
var routeMenu: NativeUI.Menu;
|
||||
var routeTexts;
|
||||
var routeText;
|
||||
|
||||
mp.events.add('showPilotRouteMenu', (listRoutes) => {
|
||||
if (!globalData.InMenu) {
|
||||
|
||||
globalData.InMenu = true;
|
||||
routeTexts = JSON.parse(listRoutes);
|
||||
|
||||
routeMenu = new Menu("Pilot Job", "", new Point(50, 50), null, null);
|
||||
routeMenu.AddItem(new UIMenuListItem("Route", "", new ItemsCollection(routeTexts)));
|
||||
|
||||
routeMenu.AddItem(sendItem);
|
||||
routeMenu.AddItem(cancelItem);
|
||||
routeMenu.Visible = true;
|
||||
routeText = "Kurz 1";
|
||||
|
||||
routeMenu.ListChange.on((item, index) => {
|
||||
switch (item.Text) {
|
||||
case "Route":
|
||||
routeText = String(item.SelectedItem.DisplayText);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
routeMenu.ItemSelect.on((item) => {
|
||||
if (item.Text === "Starten") {
|
||||
mp.events.callRemote("startPilotRoute", routeText);
|
||||
routeMenu.Close();
|
||||
globalData.InMenu = false;
|
||||
} else if (item.Text === "Abbrechen") {
|
||||
routeMenu.Close();
|
||||
globalData.InMenu = false;
|
||||
}
|
||||
});
|
||||
|
||||
routeMenu.MenuClose.on(() => {
|
||||
globalData.InMenu = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -170,3 +170,9 @@ drivingSchoolHandle(globalData);
|
||||
|
||||
import notificationUtil from './util/notification';
|
||||
notificationUtil();
|
||||
|
||||
import planeSchoolHandle from './util/planeschool';
|
||||
planeSchoolHandle(globalData);
|
||||
|
||||
import PilotRouteList from './Jobs/PilotRouteSelect';
|
||||
PilotRouteList(globalData);
|
||||
71
ReallifeGamemode.Client/util/planeschool.ts
Normal file
71
ReallifeGamemode.Client/util/planeschool.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import * as NativeUI from 'NativeUI';
|
||||
const Menu = NativeUI.Menu;
|
||||
const UIMenuItem = NativeUI.UIMenuItem;
|
||||
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
|
||||
const BadgeStyle = NativeUI.BadgeStyle;
|
||||
const Point = NativeUI.Point;
|
||||
const ItemsCollection = NativeUI.ItemsCollection;
|
||||
const Color = NativeUI.Color;
|
||||
const ListItem = NativeUI.ListItem;
|
||||
|
||||
export default function planeSchoolHandle(globalData: GlobalData) {
|
||||
|
||||
var keyBound = false;
|
||||
var mainMenu: NativeUI.Menu;
|
||||
let send = new UIMenuItem("Pruefung starten", "");
|
||||
var timer;
|
||||
var timerCheckpoint;
|
||||
var timerSet = false;
|
||||
var Player;
|
||||
var timeToWait = 0;
|
||||
var checkPoint;
|
||||
var counter = 0;
|
||||
var waitFinished = false;
|
||||
|
||||
mp.events.add('planeSchoolMenu', () => {
|
||||
mp.game.ui.setTextComponentFormat('STRING');
|
||||
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Flugschulmenü zu öffnen');
|
||||
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
|
||||
|
||||
mp.keys.bind(0x45, false, keyPressHandler);
|
||||
keyBound = true;
|
||||
});
|
||||
|
||||
mp.events.add('removeplaneSchoolMenu', (unbind) => {
|
||||
mp.game.ui.clearHelp(true);
|
||||
mp.gui.chat.show(true);
|
||||
|
||||
if (keyBound && unbind) {
|
||||
if (mainMenu) mainMenu.Close();
|
||||
|
||||
mp.keys.unbind(0x45, false, keyPressHandler);
|
||||
keyBound = false;
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('waitPlayerEntersVehicle1', () => {
|
||||
mp.game.ui.setNewWaypoint(-1114.39, -2333.09);
|
||||
timerSet = true;
|
||||
timer = setInterval(timerPlayerInVehicle1, 3000);
|
||||
});
|
||||
|
||||
|
||||
mp.events.add('stopTimer', () => {
|
||||
timerSet = false;
|
||||
clearInterval(timer);
|
||||
});
|
||||
function timerPlayerInVehicle1() {
|
||||
if (timerSet) {
|
||||
mp.events.callRemote('timerCheckVehicle1');
|
||||
}
|
||||
};
|
||||
|
||||
function keyPressHandler() {
|
||||
if (globalData.InChat || globalData.InInput || globalData.InMenu) return;
|
||||
|
||||
mp.events.call('removeplaneSchoolMenu', false);
|
||||
mp.events.callRemote('startplaneSchool');
|
||||
}
|
||||
}
|
||||
1337
ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.Designer.cs
generated
Normal file
1337
ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class gtavdevdb : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
95
ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs
Normal file
95
ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.DrivingSchool
|
||||
{
|
||||
class PlaneSchool : Script
|
||||
{
|
||||
private static TextLabel informationLabel1;
|
||||
private static Marker marker1;
|
||||
private static ColShape _colShape1;
|
||||
public static Vector3 Position { get; }
|
||||
|
||||
private readonly IReadOnlyCollection<Vector3> planeRoute = new List<Vector3>
|
||||
{
|
||||
new Vector3(-1114.39, -2333.09, 14.87),
|
||||
new Vector3(-1133.06, -2287.62, 14.89),
|
||||
new Vector3(-1185.63, -2303.45, 14.86),
|
||||
new Vector3(-1168.78, -2349.79, 14.88),
|
||||
new Vector3(-1118.74, -2340.85, 14.87),
|
||||
new Vector3(-1219.9, -2239.5, 14.87),
|
||||
new Vector3(-1355.84, -2245.06, 14.87),
|
||||
new Vector3(-1427.14, -2368.96, 14.87),
|
||||
new Vector3(-872.5, -1820.64, 172.57),
|
||||
new Vector3(786.55, 2309.85, 426.1),
|
||||
new Vector3(1261.85, 3950.07, 301.3),
|
||||
new Vector3(2133.83, 4803.55, 41.99),
|
||||
new Vector3(2134.13, 4782.7, 41.9),
|
||||
new Vector3(2098.9, 4792.94, 41.98),
|
||||
new Vector3(-869.77, -1424.05, 133),
|
||||
new Vector3(-1164.29, -2351.52, 14.88),
|
||||
}.AsReadOnly();
|
||||
|
||||
public static void Setup()
|
||||
{
|
||||
|
||||
informationLabel1 = NAPI.TextLabel.CreateTextLabel("Flugschule", new Vector3(-1083.96, -2476.96, 14.07), 20.0f, 1.3f, 0, new Color(255, 255, 255));
|
||||
marker1 = NAPI.Marker.CreateMarker(434, new Vector3(-1083.96, -2476.96, 14.07), new Vector3(), new Vector3(), 1f, new Color(111, 111, 111));
|
||||
|
||||
_colShape1 = NAPI.ColShape.CreateSphereColShape(new Vector3(-1083.96, -2476.96, 14.07), 3f);
|
||||
_colShape1.OnEntityEnterColShape += EntityEnterBusinessColShape;
|
||||
_colShape1.OnEntityExitColShape += EntityExitBusinessColShape;
|
||||
}
|
||||
private static void EntityEnterBusinessColShape(ColShape colShape, Client client)
|
||||
{
|
||||
if (client.IsInVehicle || !client.IsLoggedIn()) return;
|
||||
|
||||
client.TriggerEvent("planeSchoolMenu");
|
||||
}
|
||||
|
||||
private static void EntityExitBusinessColShape(ColShape colShape, Client client)
|
||||
{
|
||||
client.TriggerEvent("removeplaneSchoolMenu");
|
||||
}
|
||||
|
||||
[RemoteEvent("startplaneSchool")]
|
||||
public void StartplaneSchool(Client user)
|
||||
{
|
||||
ChatService.SendMessage(user, "Du hast die Führerscheinprüfung gestartet.");
|
||||
ChatService.SendMessage(user, "Steige nun in eines der Flugzeuge ein.");
|
||||
|
||||
user.TriggerEvent("waitPlayerEntersVehicle1");
|
||||
}
|
||||
|
||||
[RemoteEvent("timerCheckVehicle1")]
|
||||
public void TimerCheckVehicle1(Client user)
|
||||
{
|
||||
Vehicle veh = user.Vehicle;
|
||||
|
||||
if (veh == null || veh.DisplayName != "Velum")
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatService.SendMessage(user, "Gut nun kann die Prüfung losgehen");
|
||||
user.TriggerEvent("stopTimer");
|
||||
|
||||
CheckPointHandle.StartCheckPointRoute(user, planeRoute, 0, 6, "planeSchoolEvent");
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("planeSchoolEvent")]
|
||||
public void planeSchoolEvent(Client user, int checkpoint)
|
||||
{
|
||||
ChatService.Broadcast("CP " + checkpoint);
|
||||
float width = 22f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
private readonly IReadOnlyCollection<Vector3> RouteVeryLong = new List<Vector3>
|
||||
{
|
||||
|
||||
new Vector3(-571.7844, -2067.18, 6.177974),
|
||||
new Vector3(-562.68, -2203.85, 6.72),
|
||||
new Vector3(-889.0892, -2190.34, 8.100273),
|
||||
new Vector3(-695.8978, -1197.1, 10.07723),
|
||||
new Vector3(-1025.791, -788.746, 16.95118),
|
||||
@@ -85,7 +85,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
new Vector3(-2448.411, 3736.997, 16.20646),
|
||||
new Vector3(-2206.853, 4257.991, 47.13944),
|
||||
new Vector3(-1545.054, 4934.076, 61.29264),
|
||||
new Vector3(153.21, 6209.93, 32.03),
|
||||
new Vector3(-152.66, 6209.62, 32.03),
|
||||
new Vector3(2707.136, 3309.894, 55.37453),
|
||||
new Vector3(2554.981, 292.5191, 108.036),
|
||||
new Vector3(-740.3124, -1645.125, 26.10983),
|
||||
@@ -104,7 +104,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
listRouteTexts.Add("Kurz 2");
|
||||
listRouteTexts.Add("Mittel 1");
|
||||
listRouteTexts.Add("Lang 1");
|
||||
listRouteTexts.Add("Lang wie mein Lümmel");
|
||||
listRouteTexts.Add("Lang 2");
|
||||
|
||||
player.TriggerEvent("showBusRouteMenu", JsonConvert.SerializeObject(listRouteTexts));
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
CheckPointHandle.StartCheckPointRoute(player, RouteLong, 3000, 1, "");
|
||||
}
|
||||
else if (type == "Lang wie mein Lümmel")
|
||||
else if (type == "Lang 2")
|
||||
{
|
||||
CheckPointHandle.StartCheckPointRoute(player, RouteVeryLong, 3000, 1, "");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
class PilotJob : JobBase
|
||||
@@ -14,13 +15,50 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
private readonly IReadOnlyCollection<Vector3> Route1 = new List<Vector3>
|
||||
{
|
||||
new Vector3(-1059.862, -3100.353, 13.94444),
|
||||
new Vector3(1690.651, 3246.769, 40.87084),
|
||||
new Vector3(-2376.512, 3063.054, 32.82592),
|
||||
new Vector3(2056.1, 4774.556, 4106039),
|
||||
new Vector3(-1059.862, -3100.353, 13.94444),
|
||||
new Vector3(-322.61, 2613.05, 327.87),
|
||||
new Vector3(-81.03, 3685.12, 337.44),
|
||||
new Vector3(964.75, 4304.75, 322.26),
|
||||
new Vector3(1865.4, 4786.56, 265.71),
|
||||
new Vector3(2228.51, 5999.19, 264.56),
|
||||
new Vector3(1603.63, 6452.82, 224.97),
|
||||
new Vector3(515.21, 6555.43, 289.65),
|
||||
new Vector3( 9.61, 6409.95, 301.73),
|
||||
new Vector3(-558.94, 5571.06, 352.2),
|
||||
new Vector3(-1029.6, 4943.04, 398.4),
|
||||
new Vector3(-1030.29, 4446.83, 392.74),
|
||||
new Vector3(-219.31, 3689.86, 380.81),
|
||||
new Vector3(212.74, 3061.88, 395.36),
|
||||
}.AsReadOnly();
|
||||
|
||||
private readonly IReadOnlyCollection<Vector3> Route2 = new List<Vector3>
|
||||
{
|
||||
new Vector3(2760.91, 3606.83, 459.27),
|
||||
new Vector3(2663.72, 2532.03, 502.4),
|
||||
new Vector3(2513.93, 1096.15, 507.45),
|
||||
new Vector3(2532.33, 75.23, 491.21),
|
||||
new Vector3(2627.95, -1030.54, 395.27),
|
||||
new Vector3(1672.97, -1743.65, 421.86),
|
||||
new Vector3(637.9, -2011.36, 386.82),
|
||||
new Vector3(208.09, -1629.12, 322.08),
|
||||
new Vector3(-258.94, -930.23, 342.11),
|
||||
new Vector3(-610.22, 157.79, 350.23),
|
||||
new Vector3(-1275.95, 342.97, 326.71),
|
||||
}.AsReadOnly();
|
||||
|
||||
private readonly IReadOnlyCollection<Vector3> Route3 = new List<Vector3>
|
||||
{
|
||||
new Vector3(-850.61, 2181.98, 429.67),
|
||||
new Vector3(-675.89, 1709.52, 462.85),
|
||||
new Vector3(-1295.41, 1184.66, 489.47),
|
||||
new Vector3(-2452.89, 1760.76, 466.53),
|
||||
new Vector3(-2607.08, 2981.38, 454.81),
|
||||
new Vector3(-1771.7, 4241.02, 460.07),
|
||||
new Vector3(1158.77, 4573.67, 455.08),
|
||||
new Vector3(2028.63, 4842.29, 437.01),
|
||||
}.AsReadOnly();
|
||||
|
||||
|
||||
|
||||
public PilotJob()
|
||||
{
|
||||
JobStart += PilotJob_JobStart;
|
||||
@@ -28,7 +66,28 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
private void PilotJob_JobStart(Client player)
|
||||
{
|
||||
CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6, "");
|
||||
List<String> listRouteTexts = new List<string>();
|
||||
listRouteTexts.Add("Route 1");
|
||||
listRouteTexts.Add("Route 2");
|
||||
listRouteTexts.Add("Route 3");
|
||||
|
||||
player.TriggerEvent("showPilotRouteMenu", JsonConvert.SerializeObject(listRouteTexts));
|
||||
}
|
||||
[RemoteEvent("startPilotRoute")]
|
||||
public void StartPilotRoute(Client player, string type)
|
||||
{
|
||||
if (type == "Route 1")
|
||||
{
|
||||
CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6, "");
|
||||
}
|
||||
else if (type == "Route 2")
|
||||
{
|
||||
CheckPointHandle.StartCheckPointRoute(player, Route2, 0, 6, "");
|
||||
}
|
||||
else if (type == "Route 3")
|
||||
{
|
||||
CheckPointHandle.StartCheckPointRoute(player, Route3, 0, 6, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace ReallifeGamemode.Server
|
||||
JobManager.LoadJobs();
|
||||
HouseManager.LoadHouses();
|
||||
DrivingSchool.DrivingSchool.Setup();
|
||||
|
||||
PlaneSchool.Setup();
|
||||
|
||||
TempBlip tempBlip = new TempBlip()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user