Added in key lock

This commit is contained in:
Dan
2019-12-23 00:24:18 +00:00
parent 96ea422c22
commit 67897dcdcb
7 changed files with 77 additions and 19 deletions

View File

@@ -765,4 +765,19 @@ button:focus { outline: none; }
#uiSettingsBox .close:active {
background-color: rgb( 190, 190, 190 );
padding: 0;
}
}
#keyLockLabel {
position: absolute;
left: 0;
right: 0;
bottom: 300px;
text-align: center;
font-size: 30px;
color: rgb( 200, 200, 200 );
text-shadow: 3px 2px 5px rgb( 0, 0, 0 );
z-index: 4;
}

View File

@@ -232,7 +232,9 @@
</div>
<button id="closeUiSettings" class="close">CLOSE</button>
</div>
</div>
<p id="keyLockLabel">Radar key lock toggled</p>
<!-- Load JavaScript files -->
<script src="nui://game/ui/jquery.js"></script>

View File

@@ -56,7 +56,9 @@ const elements =
increase: $( "#increaseScale" ),
decrease: $( "#decreaseScale" ),
display: $( "#scaleDisplay" )
},
},
keyLock: $( "#keyLockLabel" ),
patrolSpeed: $( "#patrolSpeed" ),
@@ -128,6 +130,7 @@ const dirs =
elements.radar.hide();
elements.remote.hide();
elements.uiSettingsBox.hide();
elements.keyLock.hide();
elements.uiSettingsBtn.click( function() {
setUISettingsVisible( true, true );
@@ -320,6 +323,15 @@ function settingUpdate( ants )
}
}
function displayKeyLock()
{
elements.keyLock.fadeIn();
setTimeout( function() {
elements.keyLock.fadeOut();
}, 2000 );
}
function playAudio( name, vol )
{
let audio = new Audio( "sounds/" + audioNames[name] );
@@ -480,6 +492,9 @@ window.addEventListener( "message", function( event ) {
break;
case "lockAudio":
playLockAudio( item.ant, item.dir, item.vol );
break;
case "displayKeyLock":
displayKeyLock();
break;
default:
break;