private void TryModifySubobject() { ISaveable subobject = fieldParser.SubObject(objectToModify); if (subobject == null) { User.sendMessage("Error: The referenced object has been removed since last checked."); CheckOptions(); } else { // Modify the subobject. // Return to the current subobject (previous prompt) instead of the current field (this prompt) // when done modifying the subobject. NextPrompt = new AdminSelectModify(ReturnTo, User, subobject); } }
protected void SetUpOptions() { ClearOptions(); AddOption("Create a new character.", () => { NextPrompt = new NewCharacterPrompt(this); }, "New"); AddOption("Delete a character.", () => { NextPrompt = new DeleteCharacterPrompt(this); }, "Delete"); AddOption("Log out to log into another account.", () => { User.LogOut(); Cancel(false); }, "Log"); AddOption("Disconnect from the MUD.", () => { User.Disconnect(); }, "Disconnect"); if (User.LoggedInAccount.IsAdmin) { AddOption("Modify MUD-wide settings", () => { NextPrompt = new AdminSelectModify(this, User, new GlobalValues()); }, "Modify"); } MOB[] characters = User.LoggedInAccount.Characters; for (int i = 0; i < characters.Length; i++) { MOB nextMob = characters[i]; AddOption(nextMob.Name, () => { NextPrompt = new GameplayPrompt(this.User, nextMob); Cancel(false); }); } }
private void ModifyField() { if (SelectedValue.ModifyAsList) { //TODO: New prompt that handles lists. } else if (!SelectedValue.CanOverwrite) { //Implies the only action that can be done is to modify the subobject ISaveable subobject = SelectedValue.SubObject(objectToModify); if (subobject != null) { NextPrompt = new AdminSelectModify(this, User, subobject); } else { User.sendMessage("Error: No subobject found for a modify-only field."); } } else { NextPrompt = new AdminModifyField(this, User, objectToModify, SelectedValue); } }