protected virtual void RunAreaWithCurrentDisplay(bool isReload) { currentDisplay.ClearOutput(); //first the buttons. currentDisplay.AddButton(0, new ButtonData(ExploreString(), true, DoExplore)); currentDisplay.AddButton(1, new ButtonData(PlaceString(), placeMenuUnlocked, DoPlaceMenu)); currentDisplay.AddButton(2, new ButtonData(InventoryString(), true, DoInventory)); currentDisplay.AddButton(3, new ButtonData(StashString(), anyStashesUnlocked, DoStashMenu)); currentDisplay.AddButton(4, new ButtonData(CampActionString(), true, DoCampActions)); if (anyLoversUnlocked) { currentDisplay.AddButton(5, new ButtonData(LoversString(), true, DoLoversMenu)); } if (anyFollowersUnlocked) { currentDisplay.AddButton(6, new ButtonData(FollowersString(), true, DoFollowersMenu)); } if (anySlavesUnlocked) { currentDisplay.AddButton(7, new ButtonData(SlavesString(), true, DoSlavesMenu)); } //add the m********e button. //add the sleep button. //then the display data. currentDisplay.OutputText(CampDescription(isReload)); }
private void CreateButtonsPrivate(ButtonData returnButton, ButtonData cancelButton) { int maxButtonsPerPage = rowCount * columnCount; if (!(returnButton is null)) { maxButtonsPerPage--; } if (!(cancelButton is null)) { maxButtonsPerPage--; } if (numberOfButtons > maxButtonsPerPage) { ButtonData[][] buttonGroups = new ButtonData[(int)Math.Ceiling(numberOfButtons * 1.0 / maxButtonsPerPage)][]; int remainingButtons = numberOfButtons; for (int x = 0; x < buttonGroups.Length; x++) { var iter = numberOfButtons - remainingButtons; if (remainingButtons >= maxButtonsPerPage) { buttonGroups[x] = new ButtonData[rowCount * columnCount]; remainingButtons -= maxButtonsPerPage; } else { buttonGroups[x] = new ButtonData[remainingButtons]; } for (int y = 0; y < buttonGroups[x].Length; y++) { buttonGroups[x][y] = buttons[iter]; iter++; } } generatePageCallback = new Action[buttonGroups.Length]; for (int x = 0; x < generatePageCallback.Length; x++) { int q = x; generatePageCallback[q] = () => { GenerateButtons(buttonGroups[q], returnButton, cancelButton); if (x > 0) { display.AddButton((byte)((rowCount - 1) * columnCount), new ButtonData(GlobalStrings.PREVIOUS_PAGE(), true, () => GenerateButtons(buttonGroups[q - 1], returnButton, cancelButton)), true); } if (x < generatePageCallback.Length - 1) { display.AddButton((byte)((rowCount - 1) * columnCount + 1), new ButtonData(GlobalStrings.NEXT_PAGE(), true, () => GenerateButtons(buttonGroups[q + 1], returnButton, cancelButton)), true); } }; } } else { GenerateButtons(buttons, returnButton, cancelButton); } }