forked from Simnation/Main
ed
This commit is contained in:
parent
f57a27b8df
commit
4b4bb3b0ab
76 changed files with 6389 additions and 0 deletions
BIN
resources/[carscripts]/jg-textui/.fxap
Normal file
BIN
resources/[carscripts]/jg-textui/.fxap
Normal file
Binary file not shown.
1
resources/[carscripts]/jg-textui/.gitignore
vendored
Normal file
1
resources/[carscripts]/jg-textui/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
21
resources/[carscripts]/jg-textui/LICENSE
Normal file
21
resources/[carscripts]/jg-textui/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 JG Scripts
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
13
resources/[carscripts]/jg-textui/README.md
Normal file
13
resources/[carscripts]/jg-textui/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# jg-textui
|
||||
|
||||
Show text UI:
|
||||
|
||||
```lua
|
||||
exports['jg-textui']:DrawText(text)
|
||||
```
|
||||
|
||||
Hide text UI:
|
||||
|
||||
```lua
|
||||
exports['jg-textui']:HideText()
|
||||
```
|
16
resources/[carscripts]/jg-textui/client.lua
Normal file
16
resources/[carscripts]/jg-textui/client.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
function DrawText(text)
|
||||
SendNUIMessage({
|
||||
type = 'show',
|
||||
text = text
|
||||
})
|
||||
end
|
||||
|
||||
exports('DrawText', DrawText)
|
||||
|
||||
function HideText()
|
||||
SendNUIMessage({
|
||||
type = 'hide'
|
||||
})
|
||||
end
|
||||
|
||||
exports('HideText', HideText)
|
18
resources/[carscripts]/jg-textui/fxmanifest.lua
Normal file
18
resources/[carscripts]/jg-textui/fxmanifest.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
|
||||
description "Simple text UI library"
|
||||
version "1.0"
|
||||
author "JG Scripts"
|
||||
|
||||
client_script "client.lua"
|
||||
|
||||
ui_page "web/index.html"
|
||||
|
||||
files {"web/*"}
|
||||
|
||||
escrow_ignore {"**/*"}
|
||||
|
||||
lua54 "yes"
|
||||
|
||||
dependency '/assetpacks'
|
13
resources/[carscripts]/jg-textui/web/index.html
Normal file
13
resources/[carscripts]/jg-textui/web/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>jg-textui-web</title>
|
||||
<link rel="stylesheet" href="main.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="text-ui">This is some text</div>
|
||||
|
||||
<script src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
38
resources/[carscripts]/jg-textui/web/main.css
Normal file
38
resources/[carscripts]/jg-textui/web/main.css
Normal file
|
@ -0,0 +1,38 @@
|
|||
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap");
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Plus Jakarta Sans", sans-serif;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.text-ui {
|
||||
background: #212529;
|
||||
border: 1px solid #42484e;
|
||||
padding: 8px 10px;
|
||||
border-radius: 7px;
|
||||
color: white;
|
||||
position: absolute;
|
||||
left: -100%;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
transition: 0.5s ease-in-out;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.text-ui kbd {
|
||||
padding: 1px 8px;
|
||||
background: #ccc;
|
||||
color: #212529;
|
||||
font-weight: bold;
|
||||
border-radius: 5px;
|
||||
border-bottom: 3px solid #777;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: 3px;
|
||||
font-size: 17px;
|
||||
}
|
19
resources/[carscripts]/jg-textui/web/main.js
Normal file
19
resources/[carscripts]/jg-textui/web/main.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function () {
|
||||
const textUI = document.querySelector(".text-ui");
|
||||
|
||||
window.addEventListener("message", (evt) => {
|
||||
const { data } = evt;
|
||||
|
||||
if (!data) return false;
|
||||
|
||||
if (data.type === "show") {
|
||||
// If the string contains a key in square brackets (like [E]), then style it differently!
|
||||
let str = data.text.replaceAll(/\[(.*?)\]/g, "<kbd>$1</kbd>");
|
||||
|
||||
textUI.style.left = "20px";
|
||||
textUI.innerHTML = str;
|
||||
} else if (data.type === "hide") {
|
||||
textUI.style.left = "-100%";
|
||||
}
|
||||
});
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue