This commit is contained in:
VegaZ
2018-10-15 17:07:48 +02:00
12 changed files with 414 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<!--
* @overview Life of German Reallife - Client Gui playerlist.html
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" />
<script src="playerlist.js"></script>
</head>
<body>
<div class="playerlist">
<div id="testDiv"></div>
<table>
<thead>
<tr>
<th><center>ID</center></th>
<th>Name</th>
<th><center>Ping</center></th>
</tr>
</thead>
<tbody id="playerData"></tbody>
</table>
</div>
<script src="jquery-3.3.1.min.js"></script>
<script>
$(document).ready(function () {
//var table;
for (var player in pList) {
$("#playerData").append("<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td></tr>");
//table =+ tableRow;
}
//document.getElementById("testDiv").innerHTML = table;
});
</script>
</body>
</html>

35
Client/Gui/playerlist.js Normal file
View File

@@ -0,0 +1,35 @@
/**
* @overview Life of German Reallife - Gui Playerlist playerlist.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
var playerlistBrowser
var pList;
mp.events.add("showPlayerlist", () => {
if (!playerlistBrowser) {
playerlistBrowser = mp.browsers.new('package://Gui/playerlist.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
}
});
mp.events.add("fetchPlayerList", (playersJson) => {
pList = JSON.parse(playersJson);
pList.forEach((player) => {
mp.gui.chat.push(player.Id + ", " + player.Name + ", " + player.Ping);
});
});
//function getTable() {
// var table = "";
// pList.forEach((player) => {
// var tableRow = "<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td>";
// table = table + tableRow;
// })
// return document.write(table);
//}

8
Client/Gui/script.js Normal file
View File

@@ -0,0 +1,8 @@
$(document).ready(function () {
mp.trig
for (var player in pList) {
$("#playerData").append("<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td></tr>");
}
});

38
Client/Gui/style.css Normal file
View File

@@ -0,0 +1,38 @@
/**
* @overview Life of German Reallife - Save CSS style.css
* @author Orangebox, hydrant, VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
.playerlist {
background-color: rgba(61, 68, 87, 0.50);
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
min-width: 60%;
text-align: center;
}
body {
font-family: "Roboto", sans-serif;
-webkit-font-smoothing: antialiased;
overflow: hidden;
}
td {
align-content: stretch;
padding-left: 10px;
padding-right: 10px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(0, 0, 0, 0.24);
border-top: 2px double gray;
border-bottom: 2px double gray;
border-width: 0.5px;
width: auto;
}
table {
margin: auto;
align-self:center;
width: 100%;
}

45
Client/Player/keys.js Normal file
View File

@@ -0,0 +1,45 @@
/**
* @overview Life of German Reallife - Player Keys keys.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
var chat = false;
//ENTER
mp.keys.bind(0x0D, false, function () {
if (chat === true) {
chat = false;
}
});
//I
mp.keys.bind(0x49, false, function () {
if (!chat) {
mp.events.callRemote("keyPress:I");
mp.events.call("showPlayerlist");
}
});
//N
mp.keys.bind(0x4E, false, function () {
if (!chat) {
mp.events.callRemote("keyPress:N");
}
});
//T
mp.keys.bind(0x54, false, function () {
if (chat === false) {
chat = true;
}
});
//X
mp.keys.bind(0x58, false, function () {
if (!chat) {
mp.events.callRemote("keyPress:X");
}
});

View File

@@ -10,7 +10,9 @@ require('./Save/main.js');
require('./Save/save.js');
require('./Gui/infobox.js');
require('./Gui/playerlist.js');
require('./Login/main.js');
require('./Player/keys.js');
require('./Save/main.js');
require('./FactionManagement/main.js');