loading state work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
48de5f0af0
commit
a0795caa13
@ -2016,6 +2016,7 @@ Fix memory leaks
|
||||
(05/28/2025)
|
||||
Server entities without collidables deactivate gravity trees
|
||||
Fix texture map for lod human model
|
||||
Properly show loading state when waiting on character list
|
||||
|
||||
|
||||
|
||||
|
||||
@ -10,6 +10,11 @@ public class ClientCharacterManager {
|
||||
*/
|
||||
ClientCharacterListDTO characterList;
|
||||
|
||||
/**
|
||||
* Tracks whether we're waiting on the character list or not
|
||||
*/
|
||||
private boolean waitingOnList = true;
|
||||
|
||||
/**
|
||||
* Gets the character list
|
||||
* @return The character list
|
||||
@ -25,6 +30,25 @@ public class ClientCharacterManager {
|
||||
public void setCharacterList(ClientCharacterListDTO 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -90,6 +90,20 @@ public class ClientLoading {
|
||||
} catch (InterruptedException ex) {}
|
||||
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
|
||||
//init character creation window
|
||||
//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){
|
||||
Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
||||
WindowUtils.closeWindow(WindowStrings.WINDOW_MENU_MAIN);
|
||||
|
||||
@ -35,6 +35,7 @@ public class CharacterProtocol implements ClientProtocolTemplate<CharacterMessag
|
||||
} break;
|
||||
case RESPONSECHARACTERLIST: {
|
||||
Globals.clientState.clientCharacterManager.setCharacterList(new Gson().fromJson(message.getdata(), ClientCharacterListDTO.class));
|
||||
Globals.clientState.clientCharacterManager.setWaitingOnList(false);
|
||||
Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION,() -> {
|
||||
WindowUtils.replaceMainMenuContents(MenuCharacterCreation.createCharacterSelectionWindow());
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user