Merge branch 'feature/look' into develop
This commit is contained in:
@@ -9,6 +9,44 @@ var screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
|||||||
|
|
||||||
export default function vehicleMenu(globalData: IGlobalData) {
|
export default function vehicleMenu(globalData: IGlobalData) {
|
||||||
let menuBrowser: BrowserMp = null;
|
let menuBrowser: BrowserMp = null;
|
||||||
|
var lastDriversBrowser: BrowserMp = null;
|
||||||
|
|
||||||
|
var lastDrivers = null;
|
||||||
|
|
||||||
|
mp.events.add('lookLastDrivers', (lastDriversParam) => {
|
||||||
|
lastDrivers = JSON.parse(lastDriversParam);
|
||||||
|
|
||||||
|
if (lastDriversBrowser !== null) {
|
||||||
|
lastDriversBrowser.destroy();
|
||||||
|
lastDriversBrowser = null;
|
||||||
|
globalData.InMenu = false;
|
||||||
|
mp.gui.cursor.show(false, false);
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
}
|
||||||
|
else if (!globalData.InMenu) {
|
||||||
|
globalData.InMenu = true;
|
||||||
|
lastDriversBrowser = mp.browsers.new('package://assets/vehicle/lastPlayers.html');
|
||||||
|
mp.gui.chat.activate(false);
|
||||||
|
mp.gui.cursor.show(true, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("CEF:VehicleLook_Loaded", () => {
|
||||||
|
lastDriversBrowser.execute(`setDrivers('${JSON.stringify(lastDrivers)}');`);
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("removeLookMenu", () => {
|
||||||
|
if (lastDriversBrowser == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (globalData.InMenu) {
|
||||||
|
lastDriversBrowser.destroy();
|
||||||
|
lastDriversBrowser = null;
|
||||||
|
globalData.InMenu = false;
|
||||||
|
mp.gui.cursor.show(false, false);
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mp.events.add('ToggleVehicleMenu', () => {
|
mp.events.add('ToggleVehicleMenu', () => {
|
||||||
if (menuBrowser !== null) {
|
if (menuBrowser !== null) {
|
||||||
|
|||||||
16
ReallifeGamemode.Client/assets/html/vehiclemenu/script.js
Normal file
16
ReallifeGamemode.Client/assets/html/vehiclemenu/script.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function ad_row(id, name, faction, ping) {
|
||||||
|
var table_id = "t1";
|
||||||
|
var table = document.getElementById(table_id);
|
||||||
|
var rows = table.getElementsByTagName('tr').length;
|
||||||
|
var tr = table.insertRow(rows);
|
||||||
|
var td1 = document.createElement('td');
|
||||||
|
var td2 = document.createElement('td');
|
||||||
|
var td3 = document.createElement('td');
|
||||||
|
var td4 = document.createElement('td');
|
||||||
|
var test = faction;
|
||||||
|
td1.innerHTML = ''+driver;
|
||||||
|
tr.appendChild(td1);
|
||||||
|
}
|
||||||
67
ReallifeGamemode.Client/assets/html/vehiclemenu/style.css
Normal file
67
ReallifeGamemode.Client/assets/html/vehiclemenu/style.css
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/* style.css für Tabliste */
|
||||||
|
.greyFont {
|
||||||
|
color: gray;
|
||||||
|
font-size: 14px;
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #222;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 18px;
|
||||||
|
color: white;
|
||||||
|
margin:5px;
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #808080;
|
||||||
|
width: 20.75em;
|
||||||
|
}
|
||||||
|
.TabWrapper {
|
||||||
|
background: rgba(0,0,0,0.6);
|
||||||
|
height: 600px;
|
||||||
|
width: 600px;
|
||||||
|
display: block;
|
||||||
|
padding: 5px;
|
||||||
|
position: absolute;
|
||||||
|
left: 32%;
|
||||||
|
top: 10%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
color: white;
|
||||||
|
font-size: 18px;
|
||||||
|
width:10%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.scroll {
|
||||||
|
height: 600px;
|
||||||
|
width: 600px;
|
||||||
|
font-size: 12px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.force-overflow {
|
||||||
|
min-height: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#style1::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
#style1::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #FF0040;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
26
ReallifeGamemode.Client/assets/vehicle/application.js
Normal file
26
ReallifeGamemode.Client/assets/vehicle/application.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
let close = document.getElementById('close');
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
mp.trigger("CEF:VehicleLook_Loaded");
|
||||||
|
});
|
||||||
|
|
||||||
|
function setDrivers(driversJson) {
|
||||||
|
var drivers = JSON.parse(driversJson);
|
||||||
|
var listTag = $("#drivers-list");
|
||||||
|
drivers.forEach(driver => {
|
||||||
|
var name = driver.Name;
|
||||||
|
var dateTime = new Date(driver.Time);
|
||||||
|
|
||||||
|
var date = `${dateTime.getDay()}.${dateTime.getMonth()}.${dateTime.getFullYear()}`;
|
||||||
|
var time = `${dateTime.getHours()}:${dateTime.getMinutes()}:${dateTime.getSeconds()}`;
|
||||||
|
|
||||||
|
var infoLine = `${name} am ${date} um ${time} Uhr`;
|
||||||
|
var listItemTag = `<li>${infoLine}</li>`;
|
||||||
|
listTag.append(listItemTag);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
close.onclick = function closeWindow() {
|
||||||
|
mp.trigger('removeLookMenu');
|
||||||
|
}
|
||||||
29
ReallifeGamemode.Client/assets/vehicle/lastPlayers.html
Normal file
29
ReallifeGamemode.Client/assets/vehicle/lastPlayers.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<title>Eingabe | Life of German</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="package://assets/css/Introduction/style.css" />
|
||||||
|
<link rel="stylesheet" href="../../font/font-awesome/css/fontawesome.min.css">
|
||||||
|
<link rel="stylesheet" href="../../font/font-awesome/css/regular.min.css">
|
||||||
|
<link rel="stylesheet" href="../../font/roboto-mono/include_500.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<div class="input-main">
|
||||||
|
<h1>Letze Fahrer</h1>
|
||||||
|
</div>
|
||||||
|
<div id="content" class="form" role="form">
|
||||||
|
<ul id="drivers-list">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a id="close" href="#"></a>
|
||||||
|
</main>
|
||||||
|
<script src="../js/jquery-3.3.1.min.js"></script>
|
||||||
|
<script src="./application.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
67
ReallifeGamemode.Client/assets/vehicle/style.css
Normal file
67
ReallifeGamemode.Client/assets/vehicle/style.css
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/* style.css für Tabliste */
|
||||||
|
.greyFont {
|
||||||
|
color: gray;
|
||||||
|
font-size: 14px;
|
||||||
|
width: 250px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #222;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 18px;
|
||||||
|
color: white;
|
||||||
|
margin:5px;
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #808080;
|
||||||
|
width: 20.75em;
|
||||||
|
}
|
||||||
|
.TabWrapper {
|
||||||
|
background: rgba(0,0,0,0.6);
|
||||||
|
height: 600px;
|
||||||
|
width: 600px;
|
||||||
|
display: block;
|
||||||
|
padding: 5px;
|
||||||
|
position: absolute;
|
||||||
|
left: 32%;
|
||||||
|
top: 10%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
color: white;
|
||||||
|
font-size: 18px;
|
||||||
|
width:10%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.scroll {
|
||||||
|
height: 600px;
|
||||||
|
width: 600px;
|
||||||
|
font-size: 12px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.force-overflow {
|
||||||
|
min-height: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#style1::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
#style1::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #FF0040;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
@@ -16,6 +17,42 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
internal class UserCommands : Script
|
internal class UserCommands : Script
|
||||||
{
|
{
|
||||||
|
[Command("look", "~m~look")]
|
||||||
|
public void CmdUserLook(Player player)
|
||||||
|
{
|
||||||
|
if (!player.IsLoggedIn()) return;
|
||||||
|
|
||||||
|
Vehicle veh = NAPI.Pools.GetAllVehicles()
|
||||||
|
.Where(v => v.Position.DistanceTo(player.Position) <= 5)
|
||||||
|
.OrderBy(v => v.Position.DistanceTo(player.Position))
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (veh == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastDriverDic = new Dictionary<string, DateTime>();
|
||||||
|
|
||||||
|
if(VehicleManager.lastDriversInVehicle.ContainsKey(veh))
|
||||||
|
{
|
||||||
|
lastDriverDic = VehicleManager.lastDriversInVehicle[veh];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.SendNotification("~r~Mit diesem Fahrzeug ist noch niemand gefahren");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = lastDriverDic.Select(v => new
|
||||||
|
{
|
||||||
|
Name = v.Key,
|
||||||
|
Time = v.Value
|
||||||
|
}).OrderByDescending(v => v.Time).ToList();
|
||||||
|
|
||||||
|
player.TriggerEvent("lookLastDrivers", JsonConvert.SerializeObject(list));
|
||||||
|
}
|
||||||
|
|
||||||
[Command("id", "~m~Benutzung: ~s~/id [Name]")]
|
[Command("id", "~m~Benutzung: ~s~/id [Name]")]
|
||||||
public void CmdUserId(Player player, String targetname)
|
public void CmdUserId(Player player, String targetname)
|
||||||
{
|
{
|
||||||
@@ -61,7 +98,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault();
|
pVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).OrderBy(v => v.Position.DistanceTo(player.Position)).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pVeh == null)
|
if (pVeh == null)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
using ReallifeGamemode.Server.WeaponDeal;
|
using ReallifeGamemode.Server.WeaponDeal;
|
||||||
|
|
||||||
@@ -20,6 +22,13 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
if (vehicle.HasMarkerBehind())
|
if (vehicle.HasMarkerBehind())
|
||||||
vehicle.RemoveMarkerBehind();
|
vehicle.RemoveMarkerBehind();
|
||||||
|
|
||||||
|
if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle))
|
||||||
|
{
|
||||||
|
VehicleManager.lastDriversInVehicle.Add(vehicle, new Dictionary<string, DateTime>());
|
||||||
|
}
|
||||||
|
|
||||||
|
VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now;
|
||||||
|
|
||||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||||
{
|
{
|
||||||
User u = client.GetUser();
|
User u = client.GetUser();
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
public class VehicleManager : Script
|
public class VehicleManager : Script
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static Dictionary<Vehicle, Dictionary<string, DateTime>> lastDriversInVehicle = new Dictionary<Vehicle, Dictionary<string, DateTime>>();
|
||||||
|
|
||||||
private static readonly List<string> _enabledMods = new List<string>()
|
private static readonly List<string> _enabledMods = new List<string>()
|
||||||
{
|
{
|
||||||
"ninef",
|
"ninef",
|
||||||
|
|||||||
Reference in New Issue
Block a user