private IEnumerator AddPageRoutine() { PopulateScrollBoxForOwnScrolls(); UpdateDescriptionForSelectedScroll(); Result <InputManager.Command> selectResult = new Result <InputManager.Command>(); yield return(scrollBox.SelectRoutine(selectResult, (int selection) => { UpdateDescriptionForSelectedScroll(); })); if (selectResult.canceled) { UpdateDescriptionForSelectedBook(); } else { Scroll scroll = pc.scrolls[scrollBox.selection]; Spellbook book = pc.books[bookBox.selection]; if (scroll.skill.pageCost + book.pagesFilled > book.totalPages) { textbox.textbox.text = "That scroll is too many pages long."; } else { descriptionNameBox.text = "Really?"; textbox.textbox.text = "Add scroll of " + scroll.skill.skillName + " to \"" + pc.books[bookBox.selection].bookName + "\"? This is not easily reversible."; Result <bool> confirmResult = new Result <bool>(); yield return(ConfirmRoutine(confirmResult)); if (confirmResult.value) { pc.scrolls.Remove(scroll); book.AddScroll(scroll); UpdateDescriptionForSelectedBook(); PopulateBookData(); } else { UpdateDescriptionForSelectedBook(); } } } }