public ActionResult IndexPOST(IList <MenuItemEntry> menuItemEntries) { if (!_services.Authorizer.Authorize(Permissions.ManageMainMenu, T("Couldn't manage the main menu"))) { return(new HttpUnauthorizedResult()); } // See http://orchard.codeplex.com/workitem/17116 if (menuItemEntries != null) { foreach (var menuItemEntry in menuItemEntries) { MenuPart menuPart = _menuService.Get(menuItemEntry.MenuItemId); menuPart.MenuText = menuItemEntry.Text; menuPart.MenuPosition = menuItemEntry.Position; if (menuPart.Is <MenuItemPart>()) { menuPart.As <MenuItemPart>().Url = menuItemEntry.Url; } } } return(RedirectToAction("Index")); }
public void HighScoreButton() { mainMenu.SetActive(false); highScoresMenu.SetActive(true); currentMenuPart = MenuPart.HighScore; string hst = ""; for (int i = 0; i < 4; i++) { hst += "Level " + (i + 1).ToString() + ". "; string nick = PlayerPrefs.GetString("Level" + (i + 1).ToString() + "Nick"); int points = PlayerPrefs.GetInt("Level" + (i + 1).ToString() + "Points"); if (nick != null && points != 0) { hst += nick + " " + points.ToString(); } else { hst += "-"; } hst += "\n"; } highScoreText.text = hst; }
private void ButtonPart_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { MenuPart.Show((Button)sender, new Point(ButtonPart.Left - ButtonPart.Width + 20, ButtonPart.Top + ButtonPart.Height)); } }
public void Back() { mainMenu.SetActive(true); levelSelectMenu.SetActive(false); highScoresMenu.SetActive(false); currentMenuPart = MenuPart.Regular; }
public ActionResult Delete(int id) { if (!Services.Authorizer.Authorize(Permissions.ManageMainMenu, T("Couldn't manage the main menu"))) { return(new HttpUnauthorizedResult()); } MenuPart menuPart = _menuService.Get(id); int? menuId = null; if (menuPart != null) { menuId = menuPart.Menu.Id; // if the menu item is a concrete content item, don't delete it, just unreference the menu if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype") || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") { menuPart.Menu = null; } else { _menuService.Delete(menuPart); } } return(RedirectToAction("Index", new { menuId })); }
private void ButtonPart_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { MenuPart.Show((Button)sender, new Point(ButtonPart.Location.X - ButtonPart.Left, ButtonPart.Location.Y + ButtonPart.Height)); } }
public void Handle(DockWindowLoadedMessage message) { var manager = IoC.Get <IDockScreenManager>(); syncer = new CollectionSyncer <IDockScreen, IMenuPart>(manager.Documents, (item) => { return(new MenuPart(item.Name, (i) => { MenuPart menu = i as MenuPart; menu.IsChecked = !menu.IsChecked; if (menu.IsChecked) { IoC.Get <IDockScreenManager>()[menu.Name].Show(); } else { IoC.Get <IDockScreenManager>()[menu.Name].Close(); } }) { IsCheckable = true }); }); merger = new CollectionMerger <IMenuPart>((this as IObservableParent <IMenuPart>).Items, syncer.SyncCollection); }
public ActionResult IndexPOST(IList <MenuItemEntry> menuItemEntries, int?menuId) { if (!Services.Authorizer.Authorize(Permissions.ManageMenus, T("Couldn't manage the main menu"))) { return(new HttpUnauthorizedResult()); } // See https://github.com/OrchardCMS/Orchard/issues/948 if (menuItemEntries != null) { foreach (var menuItemEntry in menuItemEntries) { MenuPart menuPart = _menuService.Get(menuItemEntry.MenuItemId); if (menuPart.MenuPosition != menuItemEntry.Position) { var context = new UpdateContentContext(menuPart.ContentItem); _handlers.Invoke(handler => handler.Updating(context), Logger); menuPart.MenuPosition = menuItemEntry.Position; _handlers.Invoke(handler => handler.Updated(context), Logger); } } } return(RedirectToAction("Index", new { menuId })); }
private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart) { return new MenuItemEntry { MenuItemId = menuPart.Id, IsMenuItem = menuPart.Is<MenuItemPart>(), Text = menuPart.MenuText, Position = menuPart.MenuPosition, Url = menuPart.Is<MenuItemPart>() ? menuPart.As<MenuItemPart>().Url : _navigationManager.GetUrl(null, Services.ContentManager.GetItemMetadata(menuPart).DisplayRouteValues), ContentItem = menuPart.ContentItem, }; }
private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart) { return(new MenuItemEntry { MenuItemId = menuPart.Id, IsMenuItem = menuPart.Is <MenuItemPart>(), Text = menuPart.MenuText, Position = menuPart.MenuPosition, Url = menuPart.Is <MenuItemPart>() ? menuPart.As <MenuItemPart>().Url : _navigationManager.GetUrl(null, _services.ContentManager.GetItemMetadata(menuPart).DisplayRouteValues), }); }
private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart, string parentUrl) { var pluralService = PluralizationService.CreateService(new CultureInfo("en-US")); string urlFormat = parentUrl+"/{0}"; string pluralContentTypeName = pluralService.Pluralize(menuPart.MenuText); string url = string.Format(urlFormat, pluralContentTypeName); return new MenuItemEntry { MenuItemId = menuPart.Id, IsMenuItem = menuPart.Is<MenuItemPart>(), Text = menuPart.MenuText, Position = menuPart.MenuPosition, Url = url, ContentItem = menuPart.ContentItem, }; }
protected void PropertySetHandlers(ActivatedContentContext context, MenuPart menuPart) { menuPart.MenuField.Setter(menu => { if(menu == null || menu.ContentItem == null) { menuPart.Record.MenuId = 0; } else { menuPart.Record.MenuId = menu.ContentItem.Id; } return menu; }); menuPart.MenuField.Loader(ctx => _contentManager.Get(menuPart.Record.MenuId, menuPart.IsPublished() ? VersionOptions.Published : VersionOptions.Latest) ); }
private MenuItemEntry CreateMenuItemEntries(MenuPart menuPart, string parentUrl) { var pluralService = PluralizationService.CreateService(new CultureInfo("en-US")); string urlFormat = parentUrl + "/{0}"; string pluralContentTypeName = pluralService.Pluralize(menuPart.MenuText); string url = string.Format(urlFormat, pluralContentTypeName); return(new MenuItemEntry { MenuItemId = menuPart.Id, IsMenuItem = menuPart.Is <MenuItemPart>(), Text = menuPart.MenuText, Position = menuPart.MenuPosition, Url = url, ContentItem = menuPart.ContentItem, }); }
// ####################################################################################################################################### Methods /// <summary> /// Show specific menu panel /// </summary> /// <param name="Menu"></param> public void Show(MenuPart Menu) { // Hide all //HUD.SetActive(false); hud.HideButtons(false); Conversation.SetActive(false); Options.SetActive(false); Items.SetActive(false); Status.SetActive(false); Equipment.SetActive(false); MenuHUD.SetActive(false); // Show switch (Menu) { case MenuPart.HUD: StartCoroutine(CloseMenu()); break; case MenuPart.Conversation: Conversation.SetActive(true); HUD.SetActive(false); if (!Pausing.Paused()) Pausing.Pause(); break; case MenuPart.Options: Options.SetActive(true); HUD.SetActive(false); if (!Pausing.Paused()) Pausing.Pause(); break; case MenuPart.Items: Items.SetActive(true); ShowMenuHUD(); if (!Pausing.Paused()) Pausing.Pause(); break; case MenuPart.Status: Status.SetActive(true); ShowMenuHUD(); if (!Pausing.Paused()) Pausing.Pause(); break; case MenuPart.Equipment: Equipment.SetActive(true); ShowMenuHUD(); break; } }
public ActionResult IndexPOST(IList <MenuItemEntry> menuItemEntries, int?menuId) { if (!Services.Authorizer.Authorize(Permissions.ManageMenus, T("Couldn't manage the main menu"))) { return(new HttpUnauthorizedResult()); } // See https://github.com/OrchardCMS/Orchard/issues/948 if (menuItemEntries != null) { foreach (var menuItemEntry in menuItemEntries) { MenuPart menuPart = _menuService.Get(menuItemEntry.MenuItemId); menuPart.MenuPosition = menuItemEntry.Position; } } return(RedirectToAction("Index", new { menuId })); }
protected void PropertySetHandlers(ActivatedContentContext context, MenuPart menuPart) { menuPart.MenuField.Setter(menu => { if (menu == null || menu.ContentItem == null) { menuPart.Record.MenuId = 0; } else { menuPart.Record.MenuId = menu.ContentItem.Id; } return(menu); }); menuPart.MenuField.Loader(ctx => _contentManager.Get(menuPart.Record.MenuId, menuPart.IsPublished() ? VersionOptions.Published : VersionOptions.Latest) ); }
private void EvictMenuWidgetCaches(ContentContextBase context, MenuPart part) { if (context.Id == 0) { return; } // Get all the menu widgets who's menu contains this Menu Item, but only if the Output Cache Part has been bound to that Content Type var menuWidgetOutputCacheParts = _contentManager.Query <OutputCachePart>().ForType("MenuWidget").List(); foreach (var outputCachePart in menuWidgetOutputCacheParts) { var menuWidgetPart = outputCachePart.ContentItem.As <MenuWidgetPart>(); if (menuWidgetPart != null && menuWidgetPart.MenuContentItemId == part.Menu.Id) { _signals.Trigger(OutputCachePart.ContentSignalName(menuWidgetPart.Id)); } } }
public ActionResult Delete(int id) { if (!_services.Authorizer.Authorize(Permissions.ManageMainMenu, T("Couldn't manage the main menu"))) { return(new HttpUnauthorizedResult()); } MenuPart menuPart = _menuService.Get(id); if (menuPart != null) { if (menuPart.Is <MenuItemPart>()) { _menuService.Delete(menuPart); } else { menuPart.OnMainMenu = false; } } return(RedirectToAction("Index")); }
public void Delete(int id) { MenuPart menuPart = _menuService.Get(id); if (menuPart != null) { var menuItems = _menuService.GetMenuParts(menuPart.Menu.Id) .Where(x => x.MenuPosition.StartsWith(menuPart.MenuPosition + ".")) .Select(x => x.As <MenuPart>()) .ToList(); foreach (var menuItem in menuItems.Concat(new[] { menuPart })) { if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype") || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") { menuPart.Menu = null; } else { _menuService.Delete(menuItem); } } } }
public override void OnAttached() { syncer = new CollectionSyncer <IDockScreen, IMenuPart>(IoC.Get <IDockScreenManager>().Screens, (item) => { return(new MenuPart(item.Name, (i) => { MenuPart menu = i as MenuPart; menu.IsChecked = !menu.IsChecked; if (menu.IsChecked) { IoC.Get <IDockScreenManager>()[menu.Name].Show(); } else { IoC.Get <IDockScreenManager>()[menu.Name].Close(); } }) { DisplayName = item.DisplayName, IsCheckable = true, IsChecked = true }); }); merger = new CollectionMerger <IMenuPart>((this as IObservableParent <IMenuPart>).Items, syncer.SyncCollection); }
public ActionResult Delete(int id) { if (!Services.Authorizer.Authorize(Permissions.ManageMenus, T("Couldn't manage the main menu"))) { return(new HttpUnauthorizedResult()); } MenuPart menuPart = _menuService.Get(id); int? menuId = null; if (menuPart != null) { menuId = menuPart.Menu.Id; // get all sub-menu items from the same menu var menuItems = _menuService.GetMenuParts(menuPart.Menu.Id) .Where(x => x.MenuPosition.StartsWith(menuPart.MenuPosition + ".")) .Select(x => x.As <MenuPart>()) .ToList(); foreach (var menuItem in menuItems.Concat(new [] { menuPart })) { // if the menu item is a concrete content item, don't delete it, just unreference the menu if (!menuPart.ContentItem.TypeDefinition.Settings.ContainsKey("Stereotype") || menuPart.ContentItem.TypeDefinition.Settings["Stereotype"] != "MenuItem") { menuPart.Menu = null; } else { _menuService.Delete(menuItem); } } } return(RedirectToAction("Index", new { menuId })); }
public void Delete(MenuPart menuPart) { _contentManager.Remove(menuPart.ContentItem); }
void NavigateTo(MenuPart mp) { currentPage = mp; }
public MenuItem(string _itemName, Alignment _alignment = Alignment.LeftAligned, MenuPart _menuPart = MenuPart.MenuItem) { itemName = _itemName; menuPart = _menuPart; alignment = _alignment; }
public void Select() { menuPart = MenuPart.MenuItemSelected; }
public void Unselect() { menuPart = MenuPart.MenuItem; }
public void PlayButton() { mainMenu.SetActive(false); levelSelectMenu.SetActive(true); currentMenuPart = MenuPart.LevelSelect; }
private void SetParameters(MenuPart part, int state) { Renderer.SetParameters(MenuClassName, (int)(part), state); }
public void Delete(MenuPart menuPart) { _contentManager.Remove(menuPart.ContentItem); }
public void changeStatus(int index, MenuPart part) { menuItems[index].menuPart = part; }