Esempio n. 1
0
 private void AddActiveButton(ComboMenuButton button)
 {
     activeCombo = button;
     activeCombo.SetText("Press New Key");
     activeCombo.SetTextColor(Color.Red);
     state = ActionState.WaitingKeyPress;
 }
Esempio n. 2
0
 private void RemoveActiveButton()
 {
     if (activeCombo != null)
     {
         KeyMap keyMap = (KeyMap)activeCombo.referenceObject;
         activeCombo.SetText(EngineController.keyMapList[keyMap].ToString());
         activeCombo.SetTextColor(Color.White);
         activeCombo = null;
     }
 }
Esempio n. 3
0
        private void UpdateButtons()
        {
            foreach (KeyMap keyMap in (KeyMap[])Enum.GetValues(typeof(KeyMap)))
            {
                string name = keyMap.ToString();

                ComboMenuButton combo = (ComboMenuButton)GetUiControl(name);

                if (combo != null && combo.IsEitherPress())
                {
                    RemoveActiveButton();
                    AddActiveButton(combo);
                }
            }
        }
Esempio n. 4
0
        private void AddButtons()
        {
            int             count = 0;
            ComboMenuButton combo;

            foreach (KeyMap keyMap in (KeyMap[])Enum.GetValues(typeof(KeyMap)))
            {
                string name        = keyMap.ToString();
                string displayText = AddSpacesToSentence(keyMap.ToString());
                string displayName = EngineController.keyMapList[keyMap].ToString();
                Keys   key         = EngineController.keyMapList[keyMap];

                combo = new ComboMenuButton(name, displayText, new CycleObject(displayName, key), new Point(50, 60 + (count * 100)), keyMap);
                AddUiControl(combo);
                count++;
            }
        }
Esempio n. 5
0
        private void Init()
        {
            container = CreateChild <UguiObject>("container");
            {
                container.Anchor = AnchorType.TopStretch;
                container.Pivot  = PivotType.Top;
                container.SetOffsetHorizontal(0f);
                container.Height = ContainerHeight;
                container.Y      = 0f;

                backgroundSprite = container.CreateChild <BackgroundSprite>("background");
                {
                    backgroundSprite.Anchor  = AnchorType.Fill;
                    backgroundSprite.RawSize = Vector2.zero;
                    backgroundSprite.SetOffsetVertical(0f);
                }

                comboMenuButton = container.CreateChild <ComboMenuButton>("combo-menu");
                {
                    comboMenuButton.Anchor = AnchorType.LeftStretch;
                    comboMenuButton.Pivot  = PivotType.Left;
                    comboMenuButton.SetOffsetVertical(0f);
                    comboMenuButton.X     = 0f;
                    comboMenuButton.Width = 80f;
                }
                profileButton = container.CreateChild <ProfileMenuButton>("profile-menu");
                {
                    profileButton.Anchor = AnchorType.LeftStretch;
                    profileButton.Pivot  = PivotType.Left;
                    profileButton.SetOffsetVertical(0f);
                    profileButton.X     = comboMenuButton.Width;
                    profileButton.Width = 220f;
                }
                modeButton = container.CreateChild <ModeMenuButton>("mode-menu");
                {
                    modeButton.Anchor = AnchorType.LeftStretch;
                    modeButton.Pivot  = PivotType.Left;
                    modeButton.SetOffsetVertical(0f);
                    modeButton.X     = profileButton.X + profileButton.Width;
                    modeButton.Width = 80f;
                }

                notificationMenuButton = container.CreateChild <NotificationMenuButton>("notification-menu");
                {
                    notificationMenuButton.Anchor = AnchorType.RightStretch;
                    notificationMenuButton.Pivot  = PivotType.Right;
                    notificationMenuButton.SetOffsetVertical(0f);
                    notificationMenuButton.X     = 0f;
                    notificationMenuButton.Width = 80f;
                }
                settingsMenuButton = container.CreateChild <SettingsMenuButton>("settings-menu");
                {
                    settingsMenuButton.Anchor = AnchorType.RightStretch;
                    settingsMenuButton.Pivot  = PivotType.Right;
                    settingsMenuButton.SetOffsetVertical(0f);
                    settingsMenuButton.X     = -notificationMenuButton.Width;
                    settingsMenuButton.Width = 80f;
                }
                musicButton = container.CreateChild <MusicButton>("music-menu");
                {
                    musicButton.Anchor = AnchorType.RightStretch;
                    musicButton.Pivot  = PivotType.Right;
                    musicButton.SetOffsetVertical(0f);
                    musicButton.X     = settingsMenuButton.X - settingsMenuButton.Width;
                    musicButton.Width = 80f;
                }
            }

            menuButtons = GetComponentsInChildren <BaseMenuButton>(true);

            OnEnableInited();
        }