fix convention

This commit is contained in:
hydrant
2019-09-12 19:40:36 +02:00
parent 063ced7b47
commit df82f8f291
4 changed files with 32 additions and 34 deletions

View File

@@ -2907,7 +2907,6 @@ namespace ReallifeGamemode.Server.Commands
business.Update(); business.Update();
return; return;
} }
break;
} }
player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]"); player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]");

View File

@@ -14,6 +14,17 @@ namespace ReallifeGamemode.Server.Job
public override bool NeedVehicleToStart => true; public override bool NeedVehicleToStart => true;
private readonly IReadOnlyCollection<Vector3> list = new List<Vector3>
{
new Vector3(-105.5951, -1684.548, 29.23948),
new Vector3(-1056.246, -2552.576, 13.66063),
new Vector3(200.3088, -1978.828, 19.3329),
new Vector3(358.6138, -1785.821, 28.92113),
new Vector3(281.8594, -1462.503, 29.13148),
new Vector3(77.72239, -1212.086, 29.12294),
new Vector3(218.1398, -850.9549, 30.16619)
}.AsReadOnly();
public BusDriverJob() public BusDriverJob()
{ {
JobStart += BusDriverJob_JobStart; JobStart += BusDriverJob_JobStart;
@@ -21,15 +32,7 @@ namespace ReallifeGamemode.Server.Job
private void BusDriverJob_JobStart(Client player) private void BusDriverJob_JobStart(Client player)
{ {
List<Vector3> list = new List<Vector3>(); CheckPointHandle.StartCheckPointRoute(player, list);
list.Add(new Vector3(-105.5951, -1684.548, 29.23948));
list.Add(new Vector3(-1056.246, -2552.576, 13.66063));
list.Add(new Vector3(200.3088, -1978.828, 19.3329));
list.Add(new Vector3(358.6138, -1785.821, 28.92113));
list.Add(new Vector3(281.8594, -1462.503, 29.13148));
list.Add(new Vector3(77.72239, -1212.086, 29.12294));
list.Add(new Vector3(218.1398, -850.9549, 30.16619));
CheckPointHandle.startCheckPointRoute(player, list);
} }
} }
} }

View File

@@ -1,15 +1,9 @@
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Server.Entities; using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Util;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using ReallifeGamemode.Server.Util;
using System.Collections;
namespace ReallifeGamemode.Server.Job namespace ReallifeGamemode.Server.Job
{ {

View File

@@ -14,17 +14,17 @@ namespace ReallifeGamemode.Server.Util
{ {
public class CheckPointHandle : Script public class CheckPointHandle : Script
{ {
public static List<checkPointListForPlayer> listHandle = new List<checkPointListForPlayer>(); public static List<CheckPointListForPlayer> listHandle = new List<CheckPointListForPlayer>();
public static void startCheckPointRoute(Client player, List<Vector3> nListCps) public static void StartCheckPointRoute(Client player, IEnumerable<Vector3> nListCps)
{ {
checkPointListForPlayer playerHandle = new checkPointListForPlayer(player, nListCps); CheckPointListForPlayer playerHandle = new CheckPointListForPlayer(player, nListCps);
listHandle.Add(playerHandle); listHandle.Add(playerHandle);
playerHandle.startRoute(); playerHandle.StartRoute();
} }
public static void removePlayerHandlerFromList(Client player) public static void RemovePlayerHandlerFromList(Client player)
{ {
checkPointListForPlayer temp = null; CheckPointListForPlayer temp = null;
for (int a = 0; a < listHandle.Count; a++) for (int a = 0; a < listHandle.Count; a++)
{ {
temp = listHandle[a]; temp = listHandle[a];
@@ -36,9 +36,9 @@ namespace ReallifeGamemode.Server.Util
} }
[RemoteEvent("playerInCheckpoint")] [RemoteEvent("playerInCheckpoint")]
public void playerInCheckpoint(Client user) public void PlayerInCheckpoint(Client user)
{ {
checkPointListForPlayer temp = null; CheckPointListForPlayer temp = null;
for (int a = 0; a < listHandle.Count; a++) for (int a = 0; a < listHandle.Count; a++)
{ {
temp = listHandle[a]; temp = listHandle[a];
@@ -48,43 +48,45 @@ namespace ReallifeGamemode.Server.Util
} }
} }
temp.nextCheckpoint(); temp.NextCheckpoint();
ChatService.Broadcast("neuer cp"); ChatService.Broadcast("neuer cp");
} }
} }
public class checkPointListForPlayer
public class CheckPointListForPlayer
{ {
public List<Vector3> list = new List<Vector3>(); public IEnumerable<Vector3> list = new List<Vector3>();
public Client player; public Client player;
Vector3 checkPoint; Vector3 checkPoint;
Boolean done; bool done;
int checkPointsDone = 0; int checkPointsDone = 0;
public checkPointListForPlayer(Client nPlayer, List<Vector3> nList) public CheckPointListForPlayer(Client nPlayer, IEnumerable<Vector3> nList)
{ {
this.player = nPlayer; this.player = nPlayer;
this.list = nList; this.list = nList;
} }
public void startRoute() public void StartRoute()
{ {
player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player); player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player);
} }
public void nextCheckpoint() public void NextCheckpoint()
{ {
this.checkPointsDone++; this.checkPointsDone++;
if (this.list.Count > checkPointsDone) if (this.list.Count() > checkPointsDone)
{ {
Vector3 nextCp = list.ElementAt(checkPointsDone); Vector3 nextCp = list.ElementAt(checkPointsDone);
ChatService.SendMessage(this.player, "cp set at " + nextCp.ToString()); ChatService.SendMessage(this.player, "cp set at " + nextCp.ToString());
this.player.TriggerEvent("setCheckPoint", nextCp, player); this.player.TriggerEvent("setCheckPoint", nextCp, player);
} }
if (this.list.Count == checkPointsDone) if (this.list.Count() == checkPointsDone)
{ {
ChatService.SendMessage(this.player, "Du hast alle Checkpoints abgefahren!"); ChatService.SendMessage(this.player, "Du hast alle Checkpoints abgefahren!");
CheckPointHandle.removePlayerHandlerFromList(this.player); CheckPointHandle.RemovePlayerHandlerFromList(this.player);
} }
} }
} }