converted jobs to same system as businesses, add option to choose job at cityhall
This commit is contained in:
47
ReallifeGamemode.Server/Job/JobBase.cs
Normal file
47
ReallifeGamemode.Server/Job/JobBase.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Entities;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
public abstract class JobBase
|
||||
{
|
||||
protected delegate void JobStartHandler();
|
||||
protected delegate void JobStopHandler();
|
||||
|
||||
protected event JobStartHandler JobStart;
|
||||
protected event JobStopHandler JobStop;
|
||||
|
||||
private readonly List<Client> _inJob = new List<Client>();
|
||||
|
||||
public abstract int Id { get; }
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public void StartJob(Client player)
|
||||
{
|
||||
_inJob.Add(player);
|
||||
JobStart();
|
||||
}
|
||||
|
||||
public void StopJob(Client player)
|
||||
{
|
||||
_inJob.Remove(player);
|
||||
JobStop();
|
||||
}
|
||||
|
||||
public List<JobVehicle> GetJobVehicles()
|
||||
{
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Client> GetUsersInJob() => _inJob;
|
||||
}
|
||||
}
|
||||
13
ReallifeGamemode.Server/Job/PilotJob.cs
Normal file
13
ReallifeGamemode.Server/Job/PilotJob.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
class PilotJob : JobBase
|
||||
{
|
||||
public override int Id => 3;
|
||||
|
||||
public override string Name => "Pilot";
|
||||
}
|
||||
}
|
||||
13
ReallifeGamemode.Server/Job/RefuseCollectorJob.cs
Normal file
13
ReallifeGamemode.Server/Job/RefuseCollectorJob.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
public class RefuseCollectorJob : JobBase
|
||||
{
|
||||
public override int Id => 2;
|
||||
|
||||
public override string Name => "Müllmann";
|
||||
}
|
||||
}
|
||||
14
ReallifeGamemode.Server/Job/TaxiDriverJob.cs
Normal file
14
ReallifeGamemode.Server/Job/TaxiDriverJob.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
class TaxiDriverJob : JobBase
|
||||
{
|
||||
public override int Id => 1;
|
||||
|
||||
public override string Name => "Taxifahrer";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user