continue Gangwar System
This commit is contained in:
44
ReallifeGamemode.Server/Gangwar/Gangwar.cs
Normal file
44
ReallifeGamemode.Server/Gangwar/Gangwar.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using System.Linq;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ReallifeGamemode.Server.Gangwar
|
||||
{
|
||||
public class Gangwar
|
||||
{
|
||||
public static Turf[] _loadedTurfs;
|
||||
private static List<Turfs> turfs;
|
||||
|
||||
public static void loadTurfs()
|
||||
{
|
||||
_loadedTurfs = null;
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
turfs = context.Turfs.Select(t => t).ToList();
|
||||
List<Turf> turfing = new List<Turf>();
|
||||
foreach (var t in turfs)
|
||||
{
|
||||
Turf newTurf = new Turf(t.Id, t.Name, t.Color, t.Owner);
|
||||
turfing.Add(newTurf);
|
||||
}
|
||||
_loadedTurfs = turfing.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadClient(Client client)
|
||||
{
|
||||
client.TriggerEvent("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
|
||||
}
|
||||
|
||||
public Turf[] getTurfs()
|
||||
{
|
||||
return _loadedTurfs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user