converted jobs to same system as businesses, add option to choose job at cityhall

This commit is contained in:
hydrant
2019-05-16 14:52:19 +02:00
parent 8fd4041b3c
commit aa81fa95a4
18 changed files with 1422 additions and 59 deletions

View 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;
}
}