public InGameMenuWiring(ScriptClient client, InGameMenu inGameMenu, ExitMenu exitMenu, WaitScreen waitScreen, Login.Login login, CharacterList characterList, LeaveGameSender leaveMsgSender) { inGameMenu.BackToMainMenu += sender => { leaveMsgSender.SendLeaveGameMessage(); waitScreen.Message = "Lade Charakterliste..."; waitScreen.Open(); sender.Close(); characterList.RefreshFromServer(); }; inGameMenu.BackToLoginSelected += sender => { sender.Close(); waitScreen.Message = "Logout läuft..."; waitScreen.Open(); login.StartLogout(); }; inGameMenu.ExitGameSelected += sender => { sender.Close(); exitMenu.Open(); }; inGameMenu.OnEscape += sender => sender.Close(); }
public CharCreationMenuEventWiring( CharCreationMenu charCreationMenu, MainMenu mainMenu, CharacterCreation characterCreation, WaitScreen waitScreen, CharacterList characterList, ErrorScreenManager errorScreenManager) { charCreationMenu.CharacterCreationCompleted += (sender, args) => { sender.Close(); characterCreation.StartCharacterCreation(args.CharCreationInfo); waitScreen.Message = "Charaktererstellung läuft..."; waitScreen.Open(); }; characterCreation.CharacterCreationFailed += (sender, args) => { charCreationMenu.SetHelpText(args.ReasonText); waitScreen.Close(); errorScreenManager.ShowError(args.ReasonText, charCreationMenu.Open); }; characterCreation.CharacterCreationSuccessful += sender => { waitScreen.Message = "Lade Charakterliste..."; waitScreen.Open(); characterList.RefreshFromServer(); }; charCreationMenu.OnEscape += sender => { sender.Close(); mainMenu.Open(); }; }
public AccountCreationMenuEventWiring(AccountCreationMenu accountCreationMenu, LoginMenu loginMenu, AccountCreation accountCreation, WaitScreen waitScreen) { //Escape was pressed accountCreationMenu.OnEscape += sender => { loginMenu.Open(); accountCreationMenu.Close(); }; //Account creation canceled. accountCreationMenu.ChancelSelected += sender => { loginMenu.Open(); accountCreationMenu.Close(); }; //Account creation started. accountCreationMenu.CreationInformationEntered += sender => { waitScreen.Open(); waitScreen.Message = "Accounterstellung läuft..."; sender.Close(); accountCreation.StartAccountCreation(accountCreationMenu.UserName, accountCreationMenu.Password); }; //Account creation successful return to login menu accountCreation.AccountCreationSuccessful += sender => { loginMenu.UserName = accountCreationMenu.UserName; loginMenu.Password = accountCreationMenu.Password; loginMenu.Open(); accountCreationMenu.Close(); waitScreen.Close(); }; //Account creation failed. Display error. accountCreation.AccountCreationFailed += (sender, args) => { accountCreationMenu.SetErrorText(args.ReasonText); accountCreationMenu.Open(); waitScreen.Close(); }; }
public LoginMenuWiring( LoginMenu loginMenu, WaitScreen waitScreen, Login.Login login, IEnumerable <IClosableMenu> closableMenus, CharacterList characterList, AccountCreationMenu accountCreationMenu, ErrorScreenManager errorScreenManager) { var menus = closableMenus.ToArray(); //Login credentials have been entered. Switch to the waiting screen and try to login an the server. loginMenu.CredentialsEntered += (sender, args) => { //Missing parts of the login information, show an error message. if (string.IsNullOrWhiteSpace(args.UserName) || string.IsNullOrWhiteSpace(args.Password)) { errorScreenManager.ShowError("Accountname und Password eingeben!", loginMenu.Open); return; } waitScreen.Message = "Login läuft..."; waitScreen.Open(); loginMenu.Close(); login.StartLogin(args.UserName, args.Password); }; //Login got denied for some reason. Show an error message and the go back to the login screen. login.LoginDenied += (sender, args) => { waitScreen.Close(); errorScreenManager.ShowError($"Login fehlgeschlagen: {args.ReasonText}", loginMenu.Open); }; //Login successful. Go to the main menu. login.LoginAcknowledged += (sender, args) => { waitScreen.Message = "Lade Charakterliste..."; waitScreen.Open(); characterList.RefreshFromServer(); }; //Open the account creation menu. loginMenu.CreateAccountSelected += sender => { accountCreationMenu.Open(); loginMenu.Close(); }; login.LoggedOut += sender => { //CGameManager.ExitSession(); //Close all menus on logout(its somewhat of a cleanup). foreach (var closableMenu in menus) { closableMenu.Close(); } loginMenu.Open(); }; }
public MainMenuEventWiring( MainMenu mainMenu, CharCreationMenu charCreationMenu, ExitMenu exitMenu, ScriptClient client, LoginMenu loginMenu, Login.Login login, WaitScreen waitScreen, CharacterSelectionMenu selectionMenu, JoinGameSender joinGameSender, CharacterList characterList, ErrorScreenManager errorScreenManager) { mainMenu.CharacterCreationSelected += sender => { sender.Close(); charCreationMenu.Open(); }; mainMenu.JoinGameSelected += sender => { if (!characterList.TryGetActiveCharacter(out Character.Character character)) { mainMenu.Close(); errorScreenManager.ShowError("Kein Character gewählt!", mainMenu.Open); return; } joinGameSender.StartJoinGame(character); waitScreen.Message = "Trete Spiel bei..."; waitScreen.Open(); mainMenu.Close(); //client.SendSpectateMessage(); }; mainMenu.BackToLoginSelected += sender => { sender.Close(); waitScreen.Message = "Logout läuft..."; waitScreen.Open(); login.StartLogout(); }; mainMenu.CharacterSelectionSelected += sender => { selectionMenu.Open(); sender.Close(); }; mainMenu.ExitGameSelected += sender => { sender.Close(); exitMenu.Open(); }; joinGameSender.JoinGameRequestSuccessful += sender => { //The server accepted the join request, close the ui, from here on the server does most of the controlling. waitScreen.Close(); }; joinGameSender.JoinGameFailed += (sender, args) => { //Something went wrong show an error message to the player and then return to the main menu. waitScreen.Close(); errorScreenManager.ShowError(args.ReasonText, mainMenu.Open); }; }