Overlaying a niftygui over existing observer-appstate

Good Evening everybody,
Im working on a Project, where you programm parts of a multiplayer-boardgame as a group. We have entered a second Stage of the Project, where you get a part, that was programmed by another group and get to implement new functionalities into it.
We received an Observer and get to implement new Events and a UI so a Player can play the game.
My current problem is that I struggle to find the Point, where I need to start up my GUI.

The Structure right now is about:
mainGame(simpleapplication):
Startscreen(Appstate with niftyGUI) ->Loginscreen(Appstate with niftyGui) → Observer(Appstate)

The Networkthread makes a new Observer once the login to server was successful. It creates a map and displays Events sent by the server.

I already wrote up a niftyGui, but I just cant get it to appear on Screen. According to prints it works correctly in the background
I currently try to attach it to the observer via

initializedApp.getStateManager().attach(userUI);
inside the enabled(boolean) @overload of the Observer,
since the "source"group does the same for an appstate that shows the current ranking in pictures on nodes
where it gets added to the GUInode of the Observer

and alternatively
iMainApp.getStateManager().attach(userUI);
in the networkthread where i attach it to the current Appstate after
Main.switchAppState(Main.lobbyScreen, mainApp.gameField);

Both of those activate the ui in the background somewhere and print the tests for the methods of the controller, but dont show up on screen.

This is the first time I post about codeproblems Im having, and I´m not sure what part of my code would be needed in the Post, so feel free to ask about it.

Sorry if the post looks bad, but after the two weeks frustration I spent on finding the correct insertpoint for the gui and my inexpeerience with forums, I already struggled with this.

Thank you for your time, Apoc

1 Like

My guess is that you have double instances of something. Maybe you create two nifty instances or it’s how you load the nifty XML-files, the fromXML/addXML have different behaviour.

1 Like

Thank you for your help. I found out that I make a new Userui() in the simpleinitApp of the main as well as inside the Networkthread. Ill see if that helps

1 Like