From d87bbd5a9c4d82b841f53e6675863dfd0b4e883e Mon Sep 17 00:00:00 2001 From: hydrant Date: Mon, 13 May 2019 12:51:30 +0200 Subject: [PATCH] start job system --- ReallifeGamemode.Client/Gui/cityhall.ts | 11 ++++++++--- ReallifeGamemode.Server/Entities/Job.cs | 17 +++++++++++++++++ .../Entities/JobVehicle.cs | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 ReallifeGamemode.Server/Entities/Job.cs create mode 100644 ReallifeGamemode.Server/Entities/JobVehicle.cs diff --git a/ReallifeGamemode.Client/Gui/cityhall.ts b/ReallifeGamemode.Client/Gui/cityhall.ts index bf963fcb..9a1e6284 100644 --- a/ReallifeGamemode.Client/Gui/cityhall.ts +++ b/ReallifeGamemode.Client/Gui/cityhall.ts @@ -42,6 +42,11 @@ export default function (globalData: GlobalData) { globalData.InMenu = true; mp.gui.chat.show(false); + var jobItem = new UIMenuItem("Jobs", "Jobcenter"); + menu.AddItem(jobItem); + + var jobMenu = new Menu("Jobcenter", "Hartz 4 und der Tag gehoert dir.", new Point(50, 50), null, null); + var groupCreateItem = new UIMenuItem("Gruppe erstellen", "Erstelle eine neue Gruppe"); groupCreateItem.SetRightLabel("~g~50.000$"); menu.AddItem(groupCreateItem); @@ -51,15 +56,15 @@ export default function (globalData: GlobalData) { cancelItem.HighlightedBackColor = new Color(229, 57, 53); menu.AddItem(cancelItem); - menu.ItemSelect.on((item, index) => { - if (index === 0) { // Gruppe + menu.ItemSelect.on((item: NativeUI.UIMenuItem, index) => { + if (item === groupCreateItem) { // Gruppe var input = new InputHelper("Wie soll die Gruppe heißen?", globalData); input.show(); input.getValue((name: string) => { mp.events.callRemote("CLIENT:CityHall_CreateGroup", name); + menu.Close(); }); } - menu.Close(); }); menu.MenuClose.on(() => { diff --git a/ReallifeGamemode.Server/Entities/Job.cs b/ReallifeGamemode.Server/Entities/Job.cs new file mode 100644 index 00000000..8d64331c --- /dev/null +++ b/ReallifeGamemode.Server/Entities/Job.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace ReallifeGamemode.Server.Entities +{ + public class Job + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + + public string Name { get; set; } + } +} diff --git a/ReallifeGamemode.Server/Entities/JobVehicle.cs b/ReallifeGamemode.Server/Entities/JobVehicle.cs new file mode 100644 index 00000000..ce93899d --- /dev/null +++ b/ReallifeGamemode.Server/Entities/JobVehicle.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using ReallifeGamemode.Server.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ReallifeGamemode.Server.Entities +{ + public class JobVehicle : ServerVehicle + { + public virtual Job Job { get; set; } + public override string ToString() + { + using (var dbContext = new DatabaseContext()) + return "Job Fahrzeug | Job: " + dbContext.JobVehicles.Include(j => j.Job).First(j => j.Id == this.Id).Job.Name; + } + } +}