private CharacterCreationSubState RegressState(CharacterCreationSubState current) { if (current is ConfirmPasswordState) { // If password confirmation failed, try selecting a new password. return(new GetPasswordState(Session)); } throw new InvalidOperationException("The character state machine does not know how to calculate the next step after '" + current.GetType().Name + "' fails"); }
private CharacterCreationSubState RegressState(CharacterCreationSubState current) { if (current is ConfirmPasswordState) { // If password confirmation failed, try selecting a new password. return new GetPasswordState(this.Session); } throw new InvalidOperationException("The character state machine does not know how to calculate the next step after '" + current.GetType().Name + "' fails"); }
private CharacterCreationSubState AdvanceState(CharacterCreationSubState current) { // This character creation state machine can return actual creation state objects - if someone // were to expand and add new creation state(s) that are not MUD-agnostic, then they should also // add and use their own CreationStateMachine handling those states instead of this default one; // they could of course reuse some/all of the states below in addition to their own. if (current is ConfirmCreationEntryState) { return(new GetNameState(Session)); } else if (current is GetNameState) { return(new GetPasswordState(Session)); } else if (current is GetPasswordState) { return(new ConfirmPasswordState(Session)); } else if (current is ConfirmPasswordState) { return(new GetDescriptionState(Session)); } else if (current is GetDescriptionState) { // We are done with character creation! return(null); } throw new InvalidOperationException("The character state machine does not know how to calculate the next step after '" + current.GetType().Name + "' succeeds"); }
private CharacterCreationSubState AdvanceState(CharacterCreationSubState current) { // This character creation state machine can return actual creation state objects - if someone // were to expand and add new creation state(s) that are not MUD-agnostic, then they should also // add and use their own CreationStateMachine handling those states instead of this default one; // they could of course reuse some/all of the states below in addition to their own. if (current is ConfirmCreationEntryState) { return new GetNameState(this.Session); } else if (current is GetNameState) { return new GetDescriptionState(this.Session); } else if (current is GetDescriptionState) { return new GetPasswordState(this.Session); } else if (current is GetPasswordState) { return new ConfirmPasswordState(this.Session); } else if (current is ConfirmPasswordState) { // We are done with character creation! return null; } throw new InvalidOperationException("The character state machine does not know how to calculate the next step after '" + current.GetType().Name + "' succeeds"); }