loading state work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-28 12:44:37 -04:00
parent 48de5f0af0
commit a0795caa13
4 changed files with 43 additions and 0 deletions

View File

@ -2016,6 +2016,7 @@ Fix memory leaks
(05/28/2025) (05/28/2025)
Server entities without collidables deactivate gravity trees Server entities without collidables deactivate gravity trees
Fix texture map for lod human model Fix texture map for lod human model
Properly show loading state when waiting on character list

View File

@ -10,6 +10,11 @@ public class ClientCharacterManager {
*/ */
ClientCharacterListDTO characterList; ClientCharacterListDTO characterList;
/**
* Tracks whether we're waiting on the character list or not
*/
private boolean waitingOnList = true;
/** /**
* Gets the character list * Gets the character list
* @return The character list * @return The character list
@ -26,5 +31,24 @@ public class ClientCharacterManager {
this.characterList = characterList; this.characterList = characterList;
} }
/**
* Checks whether we're waiting on the character list or not
* @return true if we're waiting, false otherwise
*/
public boolean isWaitingOnList() {
return waitingOnList;
}
/**
* Sets whether we're waiting on the character list or not
* @param waitingOnList true if we're waiting, false otherwise
*/
public void setWaitingOnList(boolean waitingOnList) {
this.waitingOnList = waitingOnList;
}
} }

View File

@ -90,6 +90,20 @@ public class ClientLoading {
} catch (InterruptedException ex) {} } catch (InterruptedException ex) {}
framesWaited++; framesWaited++;
} }
WindowUtils.updateLoadingWindow("Waiting on characters");
framesWaited = 0;
while(Globals.clientState.clientCharacterManager.isWaitingOnList()){
if(framesWaited % LORE_RESEND_FRAMES == (LORE_RESEND_FRAMES - 1)){
//request playable races
Globals.clientState.clientConnection.queueOutgoingMessage(LoreMessage.constructRequestRacesMessage());
//request characters available to this player
Globals.clientState.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestCharacterListMessage());
}
try {
TimeUnit.MILLISECONDS.sleep(5);
} catch (InterruptedException ex) {}
framesWaited++;
}
//once we have them, bring up the character creation interface //once we have them, bring up the character creation interface
//init character creation window //init character creation window
//eventually should replace with at ui to select an already created character or create a new one //eventually should replace with at ui to select an already created character or create a new one
@ -107,6 +121,9 @@ public class ClientLoading {
} }
/**
* Loads the client's world data
*/
protected static void loadClientWorld(Object[] params){ protected static void loadClientWorld(Object[] params){
Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> { Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
WindowUtils.closeWindow(WindowStrings.WINDOW_MENU_MAIN); WindowUtils.closeWindow(WindowStrings.WINDOW_MENU_MAIN);

View File

@ -35,6 +35,7 @@ public class CharacterProtocol implements ClientProtocolTemplate<CharacterMessag
} break; } break;
case RESPONSECHARACTERLIST: { case RESPONSECHARACTERLIST: {
Globals.clientState.clientCharacterManager.setCharacterList(new Gson().fromJson(message.getdata(), ClientCharacterListDTO.class)); Globals.clientState.clientCharacterManager.setCharacterList(new Gson().fromJson(message.getdata(), ClientCharacterListDTO.class));
Globals.clientState.clientCharacterManager.setWaitingOnList(false);
Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION,() -> { Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION,() -> {
WindowUtils.replaceMainMenuContents(MenuCharacterCreation.createCharacterSelectionWindow()); WindowUtils.replaceMainMenuContents(MenuCharacterCreation.createCharacterSelectionWindow());
}); });