add introduction at noobspawn

This commit is contained in:
michael.reiswich
2021-01-18 15:36:33 +01:00
parent f52c813514
commit f18c47c530
9 changed files with 291 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
/**
* @overview Life of German Reallife - Gui Introduction
* @author MichaPlays
* @copyright (c) 2008 - 2021 Life of German
*/
export default function Introduction(globalData: IGlobalData): void {
var IntroductionBrowser: BrowserMp = null;
mp.events.add("showIntroduction", () => {
if (IntroductionBrowser !== null) {
IntroductionBrowser.destroy();
IntroductionBrowser = null;
globalData.InInput = false;
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
}
else if (!globalData.InInput) {
globalData.InInput = true;
IntroductionBrowser = mp.browsers.new('package://assets/html/Introduction/Introduciton.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
}
});
mp.events.add("removeIntroduction", () => {
if (IntroductionBrowser == null) {
return;
}
else if (globalData.InInput) {
IntroductionBrowser.destroy();
IntroductionBrowser = null;
globalData.InInput = false;
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
}
});
}

View File

@@ -0,0 +1,116 @@
html {
-webkit-box-sizing: border-box;
box-sizing: border-box;
user-select: none;
}
*, *::before, *::after {
-webkit-box-sizing: inherit;
box-sizing: inherit;
}
body {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-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;
}
main {
height: auto;
position: relative;
min-width: 50ch;
max-width: 35vw;
padding: 1em;
border-radius: .25em;
font-size: 1em;
line-height: 1.25;
background-color: rgba(0, 0, 0, 0.5);
}
main a#close {
position: absolute;
right: 1em;
top: 1em;
height: 1em;
width: 1em;
opacity: 0.25;
}
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;
}

View File

@@ -0,0 +1,37 @@
<!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>Willkommen auf Life of German</h1>
</div>
<div id="content" class="form" role="form">
In dieser Info findest du alles wichtige zum Thema Steuerung und Funktionen.<br /> <br />
Steuerung: <br />
T - Chat öffnen <br />
M - Interaktionsmenü öffnen und schließen <br />
X - Fahrzeug auf-/abschließen sowie im Fahrzeuginteraktionsmenü öffnen <br />
N - Fahrzeugmotor Starten <br />
O - Onlineliste öffnen/schließen <br />
I - Inventar öffnen/schließen <br />
</div>
<a target="_blank" id="close"></a>
</main>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="package://assets/js/Introduction/application.js"></script>
</body>
</html>

View File

@@ -0,0 +1,25 @@

let close = document.getElementById('close');
close.onclick = function closeWindow() {
mp.trigger('removeIntroduction');
console.log('Fenster geschlossen!');
}
/* 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(); }

View File

@@ -234,6 +234,9 @@ import bankMenuHandle from './Interaction/bankmenu';
import InputHelper from './inputhelper'; import InputHelper from './inputhelper';
bankMenuHandle(globalData); bankMenuHandle(globalData);
import Introduction from './Gui/introduction';
Introduction(globalData);
require('./Gui/policedepartment'); require('./Gui/policedepartment');
interface VehicleData { interface VehicleData {

View File

@@ -1,7 +1,7 @@
/** /**
* @overview Life of German Reallife - Managers Interaction (InteractionManager.cs) * @overview Life of German Reallife - Managers Interaction (InteractionManager.cs)
* @author MichaPlays * @author MichaPlays
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2021 Life of German
*/ */
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;

View File

@@ -17,6 +17,7 @@ using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Services; using ReallifeGamemode.Services;
using System.Threading; using System.Threading;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Server.newbie;
/** /**
* @overview Life of German Reallife - Main Class (Main.cs) * @overview Life of German Reallife - Main Class (Main.cs)
@@ -130,6 +131,7 @@ namespace ReallifeGamemode.Server
PlaneSchool.Setup(); PlaneSchool.Setup();
Gangwar.Gangwar.loadTurfs(); Gangwar.Gangwar.loadTurfs();
Bank.bank.Setup(); Bank.bank.Setup();
Introduction.Setup();
TempBlip tempBlip = new TempBlip() TempBlip tempBlip = new TempBlip()
{ {

View File

@@ -0,0 +1,17 @@
using System.Linq;
using GTANetworkAPI;
using ReallifeGamemode.Database;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Entities.Logs;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Managers
{
class NewbieManager : Script
{
}
}

View File

@@ -0,0 +1,46 @@
using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Services;
using System;
/**
* @overview Life of German Reallife - Managers Interaction (InteractionManager.cs)
* @author MichaPlays
* @copyright (c) 2008 - 2021 Life of German
*/
namespace ReallifeGamemode.Server.newbie
{
class Introduction : Script
{
private static TextLabel informationLabel;
private static Marker marker;
private static ColShape _colShape;
public static Vector3 Position { get; }
public static void Setup()
{
informationLabel = NAPI.TextLabel.CreateTextLabel("Einführung", new Vector3(-1025.57, -2732.15, 13.75), 20.0f, 1.3f, 0, new Color(255, 255, 255));
marker = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-1025.57, -2732.15, 12.75), new Vector3(), new Vector3(), 2f, new Color(107, 0, 0));
_colShape = NAPI.ColShape.CreateSphereColShape(new Vector3(-1025.57, -2732.15, 13.75), 2f);
_colShape.OnEntityEnterColShape += EntityEnterBankColShape;
_colShape.OnEntityExitColShape += EntityExitBankColShape;
}
private static void EntityEnterBankColShape(ColShape colShape, Player client)
{
if (client.IsInVehicle || !client.IsLoggedIn()) return;
client.TriggerEvent("showIntroduction");
}
private static void EntityExitBankColShape(ColShape colShape, Player client)
{
client.TriggerEvent("removeIntroduction");
}
}
}