mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Updated settings UI, started work on UI JS
This commit is contained in:
@@ -566,7 +566,7 @@ button:focus { outline: none; }
|
|||||||
|
|
||||||
#uiSettingsBox {
|
#uiSettingsBox {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 250px;
|
height: 300px;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@@ -576,7 +576,8 @@ button:focus { outline: none; }
|
|||||||
left: 0;
|
left: 0;
|
||||||
|
|
||||||
/* background-color: rgb( 0, 255, 55 ); */
|
/* background-color: rgb( 0, 255, 55 ); */
|
||||||
background-color: transparent;
|
/* background-color: transparent; */
|
||||||
|
background-color: rgb( 50, 54, 45 );
|
||||||
|
|
||||||
/* display: grid;
|
/* display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
@@ -610,7 +611,7 @@ button:focus { outline: none; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
#uiSettingsBox .radar_settings {
|
#uiSettingsBox .radar_settings {
|
||||||
background-color: rgb(50, 54, 45);
|
/* background-color: rgb( 50, 54, 45 ); */
|
||||||
}
|
}
|
||||||
#uiSettingsBox .radar_settings .alignment {
|
#uiSettingsBox .radar_settings .alignment {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
@@ -620,7 +621,7 @@ button:focus { outline: none; }
|
|||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
padding: 5px;
|
/* padding: 5px; */
|
||||||
}
|
}
|
||||||
#uiSettingsBox .radar_settings .alignment .aligner {
|
#uiSettingsBox .radar_settings .alignment .aligner {
|
||||||
width: 55px;
|
width: 55px;
|
||||||
@@ -686,4 +687,25 @@ button:focus { outline: none; }
|
|||||||
width: 55px;
|
width: 55px;
|
||||||
height: 55px;
|
height: 55px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#uiSettingsBox .close {
|
||||||
|
width: 80px;
|
||||||
|
height: 20px;
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
margin: 20px auto;
|
||||||
|
|
||||||
|
border-radius: 10px;
|
||||||
|
border: none;
|
||||||
|
background-color: rgb( 225, 225, 225 );
|
||||||
|
}
|
||||||
|
#uiSettingsBox .close:hover {
|
||||||
|
background-color: rgb( 255, 255, 255 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#uiSettingsBox .close:active {
|
||||||
|
background-color: rgb( 190, 190, 190 );
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
@@ -186,6 +186,8 @@
|
|||||||
<div class="aligner"><div class="arrow bottom_right"></div><button></button></div>
|
<div class="aligner"><div class="arrow bottom_right"></div><button></button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button id="closeUiSettings" class="close">CLOSE</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Load JavaScript files -->
|
<!-- Load JavaScript files -->
|
||||||
|
|||||||
24
nui/radar.js
24
nui/radar.js
@@ -28,6 +28,10 @@ const elements =
|
|||||||
toggleDisplay: $( "#toggleDisplay" ),
|
toggleDisplay: $( "#toggleDisplay" ),
|
||||||
pwrBtn: $( "#pwrBtn" ),
|
pwrBtn: $( "#pwrBtn" ),
|
||||||
|
|
||||||
|
uiSettingsBtn: $( "#uiSettings" ),
|
||||||
|
uiSettingsBox: $( "#uiSettingsBox" ),
|
||||||
|
closeUiBtn: $( "#closeUiSettings" ),
|
||||||
|
|
||||||
patrolSpeed: $( "#patrolSpeed" ),
|
patrolSpeed: $( "#patrolSpeed" ),
|
||||||
|
|
||||||
antennas: {
|
antennas: {
|
||||||
@@ -97,6 +101,11 @@ const dirs =
|
|||||||
// Hide the radar and remote, this way we can bypass setting a style of 'display: none;' in the HTML file
|
// Hide the radar and remote, this way we can bypass setting a style of 'display: none;' in the HTML file
|
||||||
elements.radar.hide();
|
elements.radar.hide();
|
||||||
elements.remote.hide();
|
elements.remote.hide();
|
||||||
|
elements.uiSettingsBox.hide();
|
||||||
|
|
||||||
|
elements.uiSettingsBtn.click( function() {
|
||||||
|
toggleUISettings();
|
||||||
|
} )
|
||||||
|
|
||||||
elements.pwrBtn.click( function() {
|
elements.pwrBtn.click( function() {
|
||||||
togglePower();
|
togglePower();
|
||||||
@@ -301,6 +310,19 @@ function sendData( name, data ) {
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UI stuff
|
||||||
|
function toggleUISettings()
|
||||||
|
{
|
||||||
|
elements.uiSettingsBox.fadeToggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideUISettings()
|
||||||
|
{
|
||||||
|
if ( !elements.uiSettingsBox.is( ":hidden" ) ) {
|
||||||
|
elements.uiSettingsBox.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This runs when the JS file is loaded, loops through all of the remote buttons and assigns them an onclick function
|
// This runs when the JS file is loaded, loops through all of the remote buttons and assigns them an onclick function
|
||||||
elements.remote.find( "button" ).each( function( i, obj ) {
|
elements.remote.find( "button" ).each( function( i, obj ) {
|
||||||
if ( $( this ).attr( "data-nuitype" ) ) {
|
if ( $( this ).attr( "data-nuitype" ) ) {
|
||||||
@@ -321,6 +343,7 @@ document.onkeyup = function( event )
|
|||||||
{
|
{
|
||||||
sendData( "closeRemote", null );
|
sendData( "closeRemote", null );
|
||||||
toggleRemote();
|
toggleRemote();
|
||||||
|
hideUISettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,6 +351,7 @@ window.oncontextmenu = function()
|
|||||||
{
|
{
|
||||||
sendData( "closeRemote", null );
|
sendData( "closeRemote", null );
|
||||||
toggleRemote();
|
toggleRemote();
|
||||||
|
hideUISettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The main event listener, this is what the NUI messages sent by the LUA side arrive at, they are
|
// The main event listener, this is what the NUI messages sent by the LUA side arrive at, they are
|
||||||
|
|||||||
Reference in New Issue
Block a user