Example #1
0
 public ShellView()
 {
     InitializeComponent();
     HamburgerMenuButton.AddHandler(MaterialIconButton.IsOpenedEvent, new RoutedPropertyChangedEventHandler <bool>(OnHamburgerMenuClicked));
     NotificationMenuButton.AddHandler(MaterialIconButton.IsOpenedEvent, new RoutedPropertyChangedEventHandler <bool>(OnNotificationMenuClicked));
     EventManager.RegisterClassHandler(typeof(Window), Window.PreviewMouseDownEvent, new MouseButtonEventHandler(OnPreviewMouseDown));
 }
Example #2
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();
        }