void PrintSection(HelpSection section) { if (section != null) { formatter.AddSection(section.Name, section.Topic); formatter.AddDescription(section.Description); if (section.HasLink) { formatter.AddLink(section.Link); } } }
public void UnlockPage(HelpSection s, string name) { for (int i = 0; i < helpData.Length; i++) { if (helpData[i].section == s) { for (int ii = 0; ii < helpData[i].pages.Length; ii++) { if (helpData[i].pages[ii].name == name) { helpData[i].pages[ii].unlocked = true; FindObjectOfType <HelpManager>().helpData[i].pages[ii].unlocked = true; return; } } return; } } }
public void ShowHelpMenu(HelpSection hs) { //Clear the help menu foreach (Transform child in navigationTab.transform) { if (child.tag == "Option") { Destroy(child.gameObject); } } foreach (Transform child in pageContainer.transform) { Destroy(child.gameObject); } anim.SetBool("OnHelpMenu", true); nameToPage = new Dictionary <string, GameObject>(); currentHelpMenu = sectionToHelpdata[hs]; foreach (HelpPage p in currentHelpMenu.pages) { if (p.unlocked) { GameObject btn = Instantiate(navigationButton, navigationTab.transform); btn.transform.Find("Text").GetComponent <Text>().text = p.name; btn.GetComponent <Button>().onClick.AddListener(() => OpenPage(p.name)); GameObject page = Instantiate(p.page, pageContainer.transform); page.SetActive(false); nameToPage.Add(p.name, page); } } OpenPage(currentHelpMenu.pages[0].name); }
public HelpViewModel(HelpSection entry, IDialogManager dialogs) { _help = entry; _icon = IconFactory.GetLowImage(entry.Topic); _show = new RelayCommand(x => dialogs.Open(Dialog.Help, _help)); }
public void UnlockEction(HelpSection s) { }
public ActionResult HelpSection([FromContentRoute] HelpSection content) { return(Json(content)); }
/// <summary> /// Constructor. /// </summary> public Help(Game game) : base(game) { Content = game.Content; current = HelpSection.General; }
public HelpMessage CreateCommandsIndexHelp(CommandCollection commandCollection, IReadOnlyList <CommandDescriptor> subCommandStack) { var help = new HelpMessage(); // Usage var usageSection = new HelpSection(HelpSectionId.Usage); var subCommandParams = (subCommandStack.Count > 0) ? string.Join(" ", subCommandStack.Select(x => x.Name)) + " " : ""; if (commandCollection.All.Count != 1) { usageSection.Children.Add(new HelpUsage($"Usage: {_applicationMetadataProvider.GetExecutableName()} {subCommandParams}[command]")); } if (commandCollection.Primary != null && (commandCollection.All.Count == 1 || commandCollection.Primary.Options.Any() || commandCollection.Primary.Arguments.Any())) { usageSection.Children.Add(new HelpUsage($"Usage: {CreateUsageCommandOptionsAndArgs(commandCollection.Primary, subCommandStack)}")); } help.Children.Add(usageSection); // Description var description = !string.IsNullOrWhiteSpace(commandCollection.Description) ? commandCollection.Description : !string.IsNullOrWhiteSpace(commandCollection.Primary?.Description) ? commandCollection.Primary?.Description : !string.IsNullOrWhiteSpace(_applicationMetadataProvider.GetDescription()) ? _applicationMetadataProvider.GetDescription() : string.Empty; if (!string.IsNullOrWhiteSpace(description)) { help.Children.Add(new HelpSection(HelpSectionId.Description, new HelpDescription(description !))); } // Commands var commandsExceptPrimary = commandCollection.All.Where(x => !x.IsPrimaryCommand && !x.IsHidden).ToArray(); if (commandsExceptPrimary.Any()) { help.Children.Add(new HelpSection(HelpSectionId.Commands, new HelpHeading("Commands:"), new HelpSection( new HelpLabelDescriptionList( commandsExceptPrimary .Select((x, i) => new HelpLabelDescriptionListItem(x.Name, x.Description) ) .ToArray() ) ) )); } // Show helps for primary command. if (commandCollection.Primary != null) { // Arguments AddHelpForCommandArguments(help, commandCollection.Primary.Arguments); // Options AddHelpForCommandOptions(help, commandCollection.Primary.Options.OfType <ICommandOptionDescriptor>().Concat(commandCollection.Primary.OptionLikeCommands)); } // Transform help document if (commandCollection.Primary != null) { var transformers = FilterHelper.GetFilters <ICoconaHelpTransformer>(commandCollection.Primary.Method, _serviceProvider); // TODO: This is ad-hoc workaround for default primary command. if (BuiltInPrimaryCommand.IsBuiltInCommand(commandCollection.Primary)) { transformers = commandCollection.All .Select(x => x.CommandType) .Distinct() .SelectMany(x => FilterHelper.GetFilters <ICoconaHelpTransformer>(x, _serviceProvider)) .ToArray(); } foreach (var transformer in transformers) { transformer.TransformHelp(help, commandCollection.Primary); } } return(help); }