示例#1
0
 /// <summary>
 ///     Programmatically "click" the outer arc in a RadialMenuButton
 /// </summary>
 /// <remarks>
 ///     This method is useful when implementing keyboard navigation.
 ///     RadialMenuButtons do not automatically generate AccessKeys - if you whish to enable keyboard navigation,
 ///     please consult the RadialMenuButton documentation and the "Access Keys" scenario documentation.
 /// </remarks>
 /// <param name="rmb">The RadialMenuButton to programmatically click.</param>
 public void ClickOuterRadialMenuButton(RadialMenuButton rmb)
 {
     foreach (var ps in Pie.PieSlices.Where(ps => ps.OriginalRadialMenuButton == rmb))
     {
         ps.ClickOuter();
     }
 }
示例#2
0
    // Control Robot
    public void resetState()
    {
        // Go to the default state, with no playing, recording, and where servos are free

        // Reset Recording
        isRecording  = false;
        currentState = 0;

        // Reset Playing
        isPlaying = false;
        detachServos();

        // Reset all Buttons
        RadialMenuButton recordBtn = radMenu.GetButton(0);

        recordBtn.ButtonIcon = Resources.Load <Sprite>("Sprites/button_record_start");

        RadialMenuButton playBtn = radMenu.GetButton(1);

        playBtn.ButtonIcon = Resources.Load <Sprite>("Sprites/button_replay_play");
        radMenu.RegenerateButtons();

        // Reset Mesh Renderer for the end effector grabbing object
        grabSphere.enabled = false;
    }
示例#3
0
        /*
         * Menu Prefabs
         */

        internal void MainMenuPrefab()
        {
            _menuPath.Clear();
            var buttons = new RadialMenuItem[3];

            if (!_module.Editing.State)
            {
                buttons[0] = new RadialMenuButton(OptionMainMenuPrefab, "Options", ModuleVrc3Styles.Option);
            }
            else
            {
                buttons[0] = RadialMenuUtility.Buttons.ToggleFromParam(this, "Exit Edit-Mode", _module.Editing);
            }

            if (_module.Editing.State || !_menu)
            {
                buttons[1] = new RadialMenuButton(_module.NoExpressionRefresh, "Expressions", ModuleVrc3Styles.NoExpressions, Color.gray);
            }
            else
            {
                buttons[1] = new RadialMenuButton(ExpressionsMenu, "Expressions", ModuleVrc3Styles.Expressions);
            }

            buttons[2] = new RadialMenuButton(SupporterMenuPrefab, "Thanks to...", ModuleVrc3Styles.Emojis);

            SetButtons(buttons);
        }
示例#4
0
        /// <summary>
        /// Called when the Framework <see cref="M:OnApplyTemplate" /> is called. Inheritors should override this method should they have some custom template-related logic.
        /// This is done to ensure that the <see cref="P:IsTemplateApplied" /> property is properly initialized.
        /// </summary>
        protected override bool ApplyTemplateCore()
        {
            this.panel             = this.GetTemplatePartField <RadialPanel>("PART_Panel");
            this.menuButton        = this.GetTemplatePartField <RadialMenuButton>("PART_Button");
            this.menuButton.Click += this.OnMainButtonPressed;

            return(base.ApplyTemplateCore() && this.panel != null && this.menuButton != null);
        }
示例#5
0
 /// <summary>
 /// Helper method performing a manual lookup of the currently selected item (a radio button)
 /// by checking all PieSices.
 /// </summary>
 public void FindSelectedPieSlice()
 {
     foreach (var ps in PieSlices)
     {
         var ormb = ps.OriginalRadialMenuButton;
         if (ormb.Type == RadialMenuButton.ButtonType.Radio && ormb.MenuSelected)
         {
             SelectedItem = ps.OriginalRadialMenuButton;
         }
     }
 }
示例#6
0
    public void startPlaying()
    {
        resetState();
        isPlaying = true;
        attachServos();

        // Set the Play icon to the "Stop" icon
        RadialMenuButton playBtn = radMenu.GetButton(1);

        playBtn.ButtonIcon = Resources.Load <Sprite>("Sprites/button_replay_stop");
        radMenu.RegenerateButtons();
    }
 private void SetupRadialMenu()
 {
     List<RadialMenuButton> groupButtons = new List<RadialMenuButton>();
     groupButtons.AddRange(GetSharedTacticsButtons());
     RadialMenuButton button = new RadialMenuButton(
         Main.wireUITexture[0],
         cancelTexture,
         radialOffsets[MinionTacticsPlayer.TACTICS_GROUPS_COUNT]);
     groupButtons.Add(button);
     radialMenu = new TacticQuickSelectRadialMenu(groupButtons);
     radialMenu.Width.Pixels = 100;
     radialMenu.Height.Pixels = 100;
 }
 private List<RadialMenuButton> GetSharedTacticsButtons()
 {
     List<RadialMenuButton> groupButtons = new List<RadialMenuButton>();
     for(int i = 0; i< MinionTacticsPlayer.TACTICS_GROUPS_COUNT; i++)
     {
         RadialMenuButton button = new RadialMenuButton(
             Main.wireUITexture[0],
             TargetSelectionTacticHandler.GroupTextures[i],
             radialOffsets[i]);
         groupButtons.Add(button);
     }
     return groupButtons;
 }
示例#9
0
    /// <summary>
    /// The AddButton method is used to add a new button to the menu.
    /// </summary>
    /// <param name="newButton">The button to add.</param>
    public void AddButton(RadialMenuButton newButton, Color color)
    {
        Debug.Log("New Button: " + color);
        buttons.Add(newButton);
        buttonColors.Add(color);
        if (buttons.Count > maxButtonCount)
        {
            buttons.RemoveAt(0);
            buttonColors.RemoveAt(0);
        }

        RegenerateButtons();
    }
示例#10
0
    void findButton()
    {
        GameObject resizer = GameObject.FindGameObjectWithTag("Resizer");

        if (resizer != null && resizer.activeSelf)
        {
            resizeMenu = resizer.GetComponent <RadialMenu>();
            if (resizeMenu != null)
            {
                resizeButton = resizeMenu.GetButton(0);
            }
        }
    }
示例#11
0
        /// <summary>
        /// Event handler for a value change on a radio button on this pie.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="slice"></param>
        private void PieSlice_ChangeSelectedEvent(object sender, PieSlice slice)
        {
            if (slice != null && slice.OriginalRadialMenuButton.Type == RadialMenuButton.ButtonType.Radio)
            {
                SelectedItem = slice.OriginalRadialMenuButton;
            }

            foreach (var ps in PieSlices.Where(ps => ps.OriginalRadialMenuButton.Type == RadialMenuButton.ButtonType.Radio &&
                                               ps.OriginalRadialMenuButton.MenuSelected && ps.StartAngle != slice.StartAngle))
            {
                ps.OriginalRadialMenuButton.MenuSelected = false;
                ps.UpdateSliceForRadio();
            }
        }
示例#12
0
    public void startRecording()
    {
        resetState();

        isRecording = true;
        recording.Clear();

        // Set the Recording Button to the correct state
        RadialMenuButton recordBtn = radMenu.GetButton(0);

        recordBtn.ButtonIcon = Resources.Load <Sprite>("Sprites/button_record_end");
        radMenu.RegenerateButtons();

        // Show a sphere around the end effector, indicating it can be grabbed
        grabSphere.enabled = true;
    }
示例#13
0
文件: Petal.cs 项目: xTheLifex/SS3D
 public void Awake()
 {
     button         = transform.GetChild(0).GetChild(0).GetComponent <RadialMenuButton>();
     parentAnimator = transform.parent.parent.GetComponent <Animator>();
     rect           = GetComponent <RectTransform>();
 }
示例#14
0
        public MainPage()
        {
            var button1 = new RadialMenuButton
            {
                Label = "Melbourne",
                Icon  = "🌏",
                Type  = RadialMenuButton.ButtonType.Simple
            };

            button1.InnerArcPressed += Button1InnerArcPressed;

            button1.Submenu = new RadialMenu {
                CenterButtonIcon = ""
            };

            var button11 = new RadialMenuButton
            {
                Label = "Radio #1",
                Icon  = "🌍",
                Type  = RadialMenuButton.ButtonType.Radio
            };
            var button12 = new RadialMenuButton
            {
                Label = "Radio #2",
                Icon  = "🌞",
                Type  = RadialMenuButton.ButtonType.Radio
            };
            var button13 = new RadialMenuButton
            {
                Label = "Radio #3",
                Icon  = "🍁",
                Type  = RadialMenuButton.ButtonType.Radio
            };
            var button14 = new RadialMenuButton
            {
                Label   = "Radio #4",
                Icon    = "🍱",
                Type    = RadialMenuButton.ButtonType.Radio,
                Submenu = new RadialMenu()
            };

            button1.Submenu.AddButton(button11);
            button1.Submenu.AddButton(button12);
            button1.Submenu.AddButton(button13);
            button1.Submenu.AddButton(button14);

            var button2 = new RadialMenuButton
            {
                Label     = "Image",
                IconImage = new BitmapImage(new Uri("ms-appx:///Assets/button_blue_stop.png")),
                Type      = RadialMenuButton.ButtonType.Simple
            };

            List <MeterRangeInterval> fontRanges = new List <MeterRangeInterval>();

            fontRanges.Add((new MeterRangeInterval
            {
                StartValue = 5,
                EndValue = 11,
                TickInterval = 1,
                StartDegree = 0,
                EndDegree = 90
            }));
            fontRanges.Add((new MeterRangeInterval
            {
                StartValue = 11,
                EndValue = 12,
                TickInterval = 1,
                StartDegree = 90,
                EndDegree = 110
            }));
            fontRanges.Add((new MeterRangeInterval
            {
                StartValue = 12,
                EndValue = 28,
                TickInterval = 2,
                StartDegree = 110,
                EndDegree = 250
            }));
            fontRanges.Add((new MeterRangeInterval
            {
                StartValue = 28,
                EndValue = 36,
                TickInterval = 8,
                StartDegree = 250,
                EndDegree = 280
            }));
            fontRanges.Add((new MeterRangeInterval
            {
                StartValue = 36,
                EndValue = 48,
                TickInterval = 12,
                StartDegree = 280,
                EndDegree = 300
            }));
            fontRanges.Add((new MeterRangeInterval
            {
                StartValue = 48,
                EndValue = 72,
                TickInterval = 24,
                StartDegree = 300,
                EndDegree = 320
            }));
            var button3 = new RadialMenuButton
            {
                Label      = "Meter",
                Icon       = "🍜",
                CustomMenu = new MeterSubMenu()
                {
                    MeterEndValue      = 72,
                    MeterStartValue    = 5,
                    MeterRadius        = 70,
                    StartAngle         = -90,
                    MeterPointerLength = 70,
                    RoundSelectValue   = true,
                    OuterEdgeBrush     = new SolidColorBrush(Colors.DarkGreen),
                    Intervals          = fontRanges
                }
            };



            (button3.CustomMenu as MeterSubMenu).ValueSelected += MeterMenu_ValueSelected;
            (button3.CustomMenu as MeterSubMenu).LockedValue    = 60;
            button3.CustomMenu.CenterButtonIcon = "";

            var button4 = new RadialMenuButton
            {
                Label = "Radio",
                Icon  = "🐙",
                Type  = RadialMenuButton.ButtonType.Radio
            };

            var button5 = new RadialMenuButton
            {
                Label = "Radio #1",
                Icon  = "🐉",
                Type  = RadialMenuButton.ButtonType.Radio
            };

            var button6 = new RadialMenuButton
            {
                Label = "Toggle #1",
                Icon  = "🎉",
                Type  = RadialMenuButton.ButtonType.Toggle
            };

            RadialMenuButton button7 = new RadialMenuButton
            {
                Label = "Custom",
                Icon  = "💸",
                Type  = RadialMenuButton.ButtonType.Custom,
                Value = "12"
            };

            button7.ValueChanged += Button7_ValueChanged;

            var button8 = new RadialMenuButton
            {
                Label = "List",
                Icon  = "💸"
            };

            button8.CustomMenu = new ListSubMenu();
            (button8.CustomMenu as ListSubMenu).ValueSelected += ListSubMenu_ValueSelected;
            button8.CustomMenu.CenterButtonIcon = "";
            List <RadialMenuButton> listMenuItems = new List <RadialMenuButton>();
            var button81 = new RadialMenuButton
            {
                Label = "Arial",
                Type  = RadialMenuButton.ButtonType.Radio,
                Value = "Arial"
            };
            var button82 = new RadialMenuButton
            {
                Label = "Calibri",
                Type  = RadialMenuButton.ButtonType.Radio,
                Value = "Calibri"
            };
            var button83 = new RadialMenuButton
            {
                Label = "Courier",
                Type  = RadialMenuButton.ButtonType.Radio,
                Value = "Courier"
            };
            var button84 = new RadialMenuButton
            {
                Label = "Times New Roman",
                Type  = RadialMenuButton.ButtonType.Radio,
                Value = "Times New Roman"
            };

            listMenuItems.Add(button81);
            listMenuItems.Add(button82);
            listMenuItems.Add(button83);
            listMenuItems.Add(button84);
            (button8.CustomMenu as ListSubMenu).ListMenuItems = listMenuItems;

            InitializeComponent();
            MyRadialMenu.AddButton(button1);
            MyRadialMenu.AddButton(button2);
            MyRadialMenu.AddButton(button3);
            MyRadialMenu.AddButton(button4);
            MyRadialMenu.AddButton(button5);
            MyRadialMenu.AddButton(button6);
            MyRadialMenu.AddButton(button7);
            MyRadialMenu.AddButton(button8);

            LayoutRoot.DataContext        = this;
            MyRadialMenu.PropertyChanged += RadialMenu_PropertyChanged;
        }
示例#15
0
 public void AddButton(RadialMenuButton newButton)
 {
     Buttons.Add(newButton);
     RegenerateButtons();
 }
 public void AddButton(RadialMenuButton newButton)
 {
     Buttons.Add(newButton);
     RegenerateButtons();
 }
示例#17
0
 /// <summary>
 ///     Adds a RadialMenuButton to the current pie
 /// </summary>
 /// <param name="button">RadialMenuButton to add to the current pie</param>
 /// <remarks>If you add a button to the currently visible Radial Menu, the menu will be redrawn.</remarks>
 public void AddButton(RadialMenuButton button)
 {
     Pie.Slices.Add(button);
 }