try taxifahrer & add new Inputdesign(noch nicht ready)
This commit is contained in:
@@ -1,49 +1,131 @@
|
|||||||
* {
|
html {
|
||||||
box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
margin: 0;
|
box-sizing: border-box;
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#black {
|
*, *::before, *::after {
|
||||||
position: fixed;
|
-webkit-box-sizing: inherit;
|
||||||
top: 0;
|
box-sizing: inherit;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: -1;
|
|
||||||
background-color: rgba(0, 0, 0, .3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-main {
|
body {
|
||||||
display: block;
|
display: -webkit-box;
|
||||||
width: 70%;
|
display: -ms-flexbox;
|
||||||
position: absolute;
|
display: flex;
|
||||||
top: 50%;
|
-webkit-box-orient: vertical;
|
||||||
left: 50%;
|
-webkit-box-direction: normal;
|
||||||
transform: translate(-50%, -50%);
|
-ms-flex-direction: column;
|
||||||
|
flex-direction: column;
|
||||||
background-color: rgba(0, 0, 0, .8);
|
-webkit-box-pack: center;
|
||||||
padding: 10px;
|
-ms-flex-pack: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
width: -webkit-fit-content;
|
||||||
|
width: -moz-fit-content;
|
||||||
|
width: fit-content;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 1em .5em;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #FFF;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-main h1 {
|
main {
|
||||||
color: white;
|
height: auto;
|
||||||
font-size: 24px;
|
position: relative;
|
||||||
font-family: "Arial";
|
min-width: 50ch;
|
||||||
font-weight: lighter;
|
max-width: 35vw;
|
||||||
margin-bottom: 5px;
|
padding: 1em;
|
||||||
|
border-radius: .25em;
|
||||||
|
font-size: 1em;
|
||||||
|
line-height: 1.25;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-main input {
|
main a#close {
|
||||||
width: 100%;
|
position: absolute;
|
||||||
background-color: black;
|
right: 1em;
|
||||||
outline: 0;
|
top: 1em;
|
||||||
border: grey 1px solid;
|
height: 1em;
|
||||||
color: white;
|
width: 1em;
|
||||||
padding: 5px;
|
opacity: 0.25;
|
||||||
font-size: 20px;
|
|
||||||
font-family: "Arial";
|
}
|
||||||
font-weight: lighter;
|
|
||||||
}
|
main a#close:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
main a#close:before, main a#close:after {
|
||||||
|
content: ' ';
|
||||||
|
position: absolute;
|
||||||
|
left: .5em;
|
||||||
|
height: 1em;
|
||||||
|
width: 2px;
|
||||||
|
background-color: #FFF;
|
||||||
|
border-radius: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
main a#close:before {
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
main a#close:after {
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
main h1, main p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
main h1 {
|
||||||
|
font-size: 1.5em;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: .125em;
|
||||||
|
padding-right: 1em;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
main p {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
line-height: 1.125;
|
||||||
|
}
|
||||||
|
|
||||||
|
main .form {
|
||||||
|
margin-top: .25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
main .form input {
|
||||||
|
width: 100%;
|
||||||
|
padding: .5em;
|
||||||
|
font-family: "Roboto Mono";
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 1em;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.125);
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
main .form input:focus {
|
||||||
|
outline-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,30 @@
|
|||||||
<html>
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<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/inputhelper/style.css" />
|
<link rel="stylesheet" href="package://assets/css/inputhelper/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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="black"></div>
|
|
||||||
<div class="input-main">
|
<main>
|
||||||
<h1></h1>
|
<div class="input-main">
|
||||||
<input id="input-value" autofocus>
|
<h1></h1>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="package://assets/js/jquery-3.3.1.min.js"></script>
|
<div id="content" class="form" role="form">
|
||||||
<script type="text/javascript">
|
<input type="text" name="input" id="input-value" autofocus>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a target="_blank" id="close"></a>
|
||||||
|
</main>
|
||||||
|
<script type="text/javascript" src="package://assets/js/jquery-3.3.1.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
mp.trigger('cef_request_title');
|
mp.trigger('cef_request_title');
|
||||||
|
|
||||||
@@ -19,7 +33,7 @@
|
|||||||
var currentValue = $('#input-value').val();
|
var currentValue = $('#input-value').val();
|
||||||
|
|
||||||
mp.trigger('submitText', currentValue);
|
mp.trigger('submitText', currentValue);
|
||||||
|
|
||||||
if (currentValue) {
|
if (currentValue) {
|
||||||
mp.trigger('cef_inputhelper_sendvalue', currentValue);
|
mp.trigger('cef_inputhelper_sendvalue', currentValue);
|
||||||
console.log("triggered event: " + currentValue);
|
console.log("triggered event: " + currentValue);
|
||||||
@@ -30,6 +44,8 @@
|
|||||||
function setTitle(title) {
|
function setTitle(title) {
|
||||||
$('.input-main h1').text(title);
|
$('.input-main h1').text(title);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
|
||||||
|
<script src="package://assets/js/inputhelper/application.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
73
ReallifeGamemode.Client/assets/js/inputhelper/application.js
Normal file
73
ReallifeGamemode.Client/assets/js/inputhelper/application.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
let content = document.getElementById('content');
|
||||||
|
|
||||||
|
let heading = document.getElementById('heading');
|
||||||
|
let description = document.getElementById('description');
|
||||||
|
|
||||||
|
let input = document.getElementById('input');
|
||||||
|
let close = document.getElementById('close');
|
||||||
|
|
||||||
|
function setInputFieldType(value) {
|
||||||
|
if (input.type == value) return;
|
||||||
|
|
||||||
|
var field = document.createElement('input');
|
||||||
|
field.type = value;
|
||||||
|
field.id = input.id;
|
||||||
|
field.name = input.name;
|
||||||
|
input.parentNode.replaceChild(field, input);
|
||||||
|
|
||||||
|
input = field;
|
||||||
|
input.focus();
|
||||||
|
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setText(heading, description) {
|
||||||
|
setHeading(heading);
|
||||||
|
setDescription(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHeading(value) {
|
||||||
|
heading.innerText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDescription(value) {
|
||||||
|
if (value.length <= 5) {
|
||||||
|
description.remove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
description.innerText = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeDescription() {
|
||||||
|
document.removeChild(description);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInput() {
|
||||||
|
return input.value.length != 0 ? input.value : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeWindow() {
|
||||||
|
// TODO: Fenster schließen
|
||||||
|
console.log('Fenster geschlossen!');
|
||||||
|
}
|
||||||
|
|
||||||
|
setInputFieldType('text');
|
||||||
|
setText("Überschrift", "Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores laboriosam atque ut voluptates molestiae ab autem? Est consectetur voluptatem quia, commodi sint a omnis consequuntur. Tempora dolores ullam natus in?");
|
||||||
|
|
||||||
|
/* Enter wird im Input-Feld gedrückt */
|
||||||
|
input.onkeyup = e => {
|
||||||
|
let code = e.keyCode ? e.keyCode : e.which;
|
||||||
|
if (code === 13) {
|
||||||
|
// TODO: Wert entgegennehmen
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ESC wird gedrückt */
|
||||||
|
document.onkeyup = e => {
|
||||||
|
let code = e.keyCode ? e.keyCode : e.which;
|
||||||
|
if (code === 27) { closeWindow(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
close.onclick = e => { closeWindow(); }
|
||||||
@@ -23,13 +23,16 @@ export default class InputHelper {
|
|||||||
this.getValue = this.getValue.bind(this);
|
this.getValue = this.getValue.bind(this);
|
||||||
|
|
||||||
this.value = undefined;
|
this.value = undefined;
|
||||||
|
const disableInput = [157, 158, 159, 32, 33, 34, 35];
|
||||||
|
|
||||||
mp.events.add('render', this.disableControls);
|
mp.events.add("render", () => {
|
||||||
|
mp.game.controls.disableAllControlActions(0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private disableControls() {
|
private disableControls() {
|
||||||
for (var x = 0; x < 358; x++) {
|
for (var x = 0; x < 358; x++) {
|
||||||
mp.game.controls.disableControlAction(32, x, true);
|
mp.game.controls.disableControlAction(1, x, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -573,6 +573,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
driver.ResetData("Passager");
|
driver.ResetData("Passager");
|
||||||
driver.ResetData("hasPassager");
|
driver.ResetData("hasPassager");
|
||||||
driver.SetData<float>("FareKm", 0);
|
driver.SetData<float>("FareKm", 0);
|
||||||
|
driver.TriggerEvent("CLIENT:canelFare");
|
||||||
|
driver.TriggerEvent("CLIENT:StartFare");
|
||||||
|
|
||||||
foreach (Player occupant in veh.Occupants)
|
foreach (Player occupant in veh.Occupants)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user