public void CursorIn() { if (isConstructed) { InArrow.Blink(3); MyList Submenu = SubmenusDictionary.GetValueOrDefault(CurrentOption, null); if (Submenu == null) { Action AssignedAction = ActionsDictionary.GetValueOrDefault(CurrentOption, null); if (AssignedAction != null) { AssignedAction(); } } else { MenuCurrentOptionsDictionary[CurrentMenu] = CurrentOption; CurrentMenu.isVisible = false; CurrentMenu = Submenu; CurrentMenu.isVisible = true; CurrentOption = CurrentMenu.SelectFirstItem(); SetTitle(MenuTitlesDictionary[CurrentMenu]); } } else { throw new InvalidOperationException("Please call the End() method before operating the OSD menu"); } }
public MyOsdMenu WithIconOption(string text, MySprite[] Frames, int floatingIconPosition) { MyIconLabel IconLabel = new MyIconLabel(0, 0, text, Frames); IconLabel.WithFloatingIconPosition(floatingIconPosition); CurrentOption = IconLabel; CurrentMenu.AddChild(CurrentOption); return(this); }
public MyOsdMenu WithPictureOption(MySprite[] AnimationFrames) { CurrentOption = new MyStatefulAnimatedSprite(0, 0) .WithState("Default", new MyStatefulAnimatedSpriteState(AnimationFrames)); CurrentMenu.AddChild(CurrentOption); return(this); }
public void CursorDown() { if (isConstructed) { if (CurrentMenu != null) { DownArrow.Blink(3); CurrentOption = CurrentMenu.SelectNextItem(); } } else { throw new InvalidOperationException("Please call the End() method before operating the OSD menu"); } }
public MyOsdMenu End() { if (TopLevelMenu.GetItems().Count() == 0) { throw new InvalidOperationException("The top level menu must have at least one item"); } CurrentMenu = TopLevelMenu; CurrentOption = TopLevelMenu.GetItems()[0]; SetTitle(MenuTitlesDictionary[CurrentMenu]); isConstructed = true; return(this); }
public MyOsdMenu WithSubMenu(string title) { if (title == null) { throw new ArgumentException("The title must not be null"); } MenuCurrentOptionsDictionary[CurrentMenu] = CurrentOption; MyList ParentMenu = CurrentMenu; CurrentMenu = CreateNewInvisibleList(); AddChild(CurrentMenu); SubmenusDictionary[CurrentOption] = CurrentMenu; ParentMenusDictionary[CurrentMenu] = ParentMenu; CurrentOption = null; MenuTitlesDictionary[CurrentMenu] = title; return(this); }
public void CursorOut() { if (isConstructed) { OutArrow.Blink(3); MyList ParentMenu = ParentMenusDictionary.GetValueOrDefault(CurrentMenu, null); if (ParentMenu != null) { CurrentMenu.isVisible = false; CurrentMenu = ParentMenu; CurrentMenu.isVisible = true; CurrentOption = CurrentMenu.GetSelectedItem(); MenuCurrentOptionsDictionary[CurrentMenu] = CurrentOption; SetTitle(MenuTitlesDictionary[CurrentMenu]); } } else { throw new InvalidOperationException("Please call the End() method before operating the OSD menu"); } }
public MyOsdMenu EndSubMenu() { CurrentMenu = ParentMenusDictionary.GetValueOrDefault(CurrentMenu, null); CurrentOption = MenuCurrentOptionsDictionary.GetValueOrDefault(CurrentMenu, null); return(this); }
public MyOsdMenu WithTextOption(string text) { CurrentOption = new MyTextLabel(text, 0, 0); CurrentMenu.AddChild(CurrentOption); return(this); }