Commit 08c58924 authored by NukeKitty's avatar NukeKitty
Browse files

Added 'say appends'

Non blocking appends that allow input while they are printing to the screen.
Use < for non-blocking, and the old > for blocking

Updated 'stranger says' and 'stranger appears' text to use non-blocking.
parent 44a8ca8e
......@@ -508,7 +508,7 @@ namespace MomentaryMeeting.Game
else
{
string content = command.Substring(verb.Length + 1);
string message = $">The Stranger says: {content}";
string message = $"<The Stranger says: {content}";
Meeting meeting = _interactionManager.FindMeeting(player);
foreach (UserModel other in meeting._users)
{
......
......@@ -50,7 +50,7 @@ namespace MomentaryMeeting.Game
meeting._users.Add(otherUser);
_meetings.Add(meeting);
// let them know someone has entered their room
await _gameInstance.SendPromptToPlayer(otherUser, ">" + _entryText);
await _gameInstance.SendPromptToPlayer(otherUser, "<" + _entryText);
await _gameInstance.SyncPlayerMusic(_gameInstance.GetConnection(otherUser.DiscordId));
_logger.LogInformation("User(" + player.DiscordId + ":" + player.Username +
......
......@@ -12,6 +12,7 @@ let authenticated = window.authenticated;
let ws = null;
let textSpeedModifier = 1;
let textSpeedToggle = 0;
let sayAppend = false;
let pendingMusicChange = null;
let currentTrackId, currentMeetingTrackId;
......@@ -180,7 +181,9 @@ function typeNextCharacter() {
if (currentText !== targetText) {
currentText += takeNextCharacter(targetText, currentText.length);
// turn of input display
$("#input_bar").hide();
if (!sayAppend) {
$("#input_bar").hide();
}
let fadedCount = -1;
let processingPosition = 0;
......@@ -338,7 +341,7 @@ function typeNextCharacter() {
};
window.addEventListener("keydown", function (ev) {
if (currentText !== targetText) {
if (currentText !== targetText && !sayAppend) { //additionally checks if currently writing an append for say command so input is only hiding in other circumstances
return; // do not want player typing while description is writing itself
}
//console.log("Key code: " + ev.keyCode); // for checking key codes when debugging input stuff
......@@ -505,7 +508,11 @@ if (authenticated) {
};
} else {
// if append mode (starts with '>') append instead of replace target text
if (event.data[0] === '>') {
if (event.data[0] === '>' || event.data[0] === '<') {
sayAppend = false; // not a say append event
if (event.data[0] === '<') { // using < as 'say append' character
sayAppend = true;
}
// this pending music change needs to happen once the target text has been typed out, pre-append
if (pendingMusicChange !== null) {
pendingMusicChange.targetCharacterCount = targetText.length;
......@@ -514,6 +521,7 @@ if (authenticated) {
targetText += "\n\n" + event.data.substr(1);
}
else {
sayAppend = false; // not a say append event
if (pendingMusicChange !== null) {
changeTrack(pendingMusicChange.track, pendingMusicChange.inMeeting);
pendingMusicChange = null;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment