added editorconfig and formatted code
This commit is contained in:
@@ -4,12 +4,12 @@ using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
class BusDriverJob : JobBase
|
||||
{
|
||||
public override int Id => 4;
|
||||
class BusDriverJob : JobBase
|
||||
{
|
||||
public override int Id => 4;
|
||||
|
||||
public override string Name => "Busfahrer";
|
||||
public override string Name => "Busfahrer";
|
||||
|
||||
public override bool NeedVehicleToStart => true;
|
||||
}
|
||||
public override bool NeedVehicleToStart => true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,53 +11,53 @@ using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
public abstract class JobBase
|
||||
public abstract class JobBase
|
||||
{
|
||||
public delegate void JobStartHandler(Client player);
|
||||
public delegate void JobStopHandler(Client player);
|
||||
|
||||
public event JobStartHandler JobStart;
|
||||
public event JobStopHandler JobStop;
|
||||
|
||||
private readonly List<Client> _inJob = new List<Client>();
|
||||
|
||||
public abstract int Id { get; }
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract bool NeedVehicleToStart { get; }
|
||||
|
||||
public void StartJob(Client player)
|
||||
{
|
||||
public delegate void JobStartHandler(Client player);
|
||||
public delegate void JobStopHandler(Client player);
|
||||
if (_inJob.Contains(player)) return;
|
||||
_inJob.Add(player);
|
||||
|
||||
public event JobStartHandler JobStart;
|
||||
public event JobStopHandler JobStop;
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
||||
|
||||
private readonly List<Client> _inJob = new List<Client>();
|
||||
|
||||
public abstract int Id { get; }
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract bool NeedVehicleToStart { get; }
|
||||
|
||||
public void StartJob(Client player)
|
||||
{
|
||||
if (_inJob.Contains(player)) return;
|
||||
_inJob.Add(player);
|
||||
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
||||
|
||||
JobStart?.Invoke(player);
|
||||
}
|
||||
|
||||
public void StopJob(Client player, bool quit = false)
|
||||
{
|
||||
if (!_inJob.Contains(player)) return;
|
||||
_inJob.Remove(player);
|
||||
|
||||
if (quit)
|
||||
{
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
||||
}
|
||||
|
||||
JobStop?.Invoke(player);
|
||||
}
|
||||
|
||||
public List<JobVehicle> GetJobVehicles()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Client> GetUsersInJob() => _inJob;
|
||||
JobStart?.Invoke(player);
|
||||
}
|
||||
|
||||
public void StopJob(Client player, bool quit = false)
|
||||
{
|
||||
if (!_inJob.Contains(player)) return;
|
||||
_inJob.Remove(player);
|
||||
|
||||
if (quit)
|
||||
{
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
||||
}
|
||||
|
||||
JobStop?.Invoke(player);
|
||||
}
|
||||
|
||||
public List<JobVehicle> GetJobVehicles()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Client> GetUsersInJob() => _inJob;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
class PilotJob : JobBase
|
||||
{
|
||||
public override int Id => 3;
|
||||
class PilotJob : JobBase
|
||||
{
|
||||
public override int Id => 3;
|
||||
|
||||
public override string Name => "Pilot";
|
||||
public override string Name => "Pilot";
|
||||
|
||||
public override bool NeedVehicleToStart => true;
|
||||
}
|
||||
public override bool NeedVehicleToStart => true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
public class RefuseCollectorJob : JobBase
|
||||
{
|
||||
public override int Id => 2;
|
||||
public class RefuseCollectorJob : JobBase
|
||||
{
|
||||
public override int Id => 2;
|
||||
|
||||
public override string Name => "Müllmann";
|
||||
public override string Name => "Müllmann";
|
||||
|
||||
public override bool NeedVehicleToStart => false;
|
||||
}
|
||||
public override bool NeedVehicleToStart => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,30 +6,30 @@ using ReallifeGamemode.Server.Util;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
class TaxiDriverJob : JobBase
|
||||
class TaxiDriverJob : JobBase
|
||||
{
|
||||
public List<TaxiContract> TaxiContracts { get; set; } = new List<TaxiContract>();
|
||||
|
||||
public override int Id => 1;
|
||||
|
||||
public override string Name => "Taxifahrer";
|
||||
|
||||
public override bool NeedVehicleToStart => true;
|
||||
|
||||
public TaxiDriverJob()
|
||||
{
|
||||
public List<TaxiContract> TaxiContracts { get; set; } = new List<TaxiContract>();
|
||||
|
||||
public override int Id => 1;
|
||||
|
||||
public override string Name => "Taxifahrer";
|
||||
|
||||
public override bool NeedVehicleToStart => true;
|
||||
|
||||
public TaxiDriverJob()
|
||||
{
|
||||
JobStart += TaxiDriverJobJobStart;
|
||||
JobStop += TaxiDriverJobJobStop;
|
||||
}
|
||||
|
||||
private void TaxiDriverJobJobStart(Client player)
|
||||
{
|
||||
player.Vehicle.SetSharedData("vehicleTaxiLight", true);
|
||||
}
|
||||
|
||||
private void TaxiDriverJobJobStop(Client player)
|
||||
{
|
||||
player.Vehicle.SetSharedData("vehicleTaxiLight", false);
|
||||
}
|
||||
JobStart += TaxiDriverJobJobStart;
|
||||
JobStop += TaxiDriverJobJobStop;
|
||||
}
|
||||
|
||||
private void TaxiDriverJobJobStart(Client player)
|
||||
{
|
||||
player.Vehicle.SetSharedData("vehicleTaxiLight", true);
|
||||
}
|
||||
|
||||
private void TaxiDriverJobJobStop(Client player)
|
||||
{
|
||||
player.Vehicle.SetSharedData("vehicleTaxiLight", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user