Ejemplo n.º 1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
        private void EraserButtonFlyoutClosed(object sender, object e)
        {
            VisualStateManager.GoToState(EraserButton, "ShowExtensionGlyph", false);
            if (sender is FlyoutBase flyoutBase)
            {
                flyoutBase.Closed -= EraserButtonFlyoutClosed;
            }

            if (CurrentRadialSelection == ColoringBookRadialController.EraserTool)
            {
                CurrentRadialSelection = ColoringBookRadialController.InkingTool;
                EraserButton.Focus(FocusState.Keyboard);
            }
        }
Ejemplo n.º 3
0
        public override void LoadContent()
        {
            selectedLayer = "_layer1";

            components = new List <UIElement>();
            Texture2D navbarBG = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, GlobalParameters.screenWidth, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE);
            Container navbar   = new Container(navbarBG, new Vector2(0, 0), new Vector2(GlobalParameters.screenWidth, 32));

            // Create Navbar child components
            Texture2D      menuButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 100, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE);
            RedirectButton menuButton        = new RedirectButton("Menu Scene", menuButtonTexture, new Vector2(0, 0), new Vector2(100, 32), "MENU", Color.White);

            Texture2D   helpButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(100, 100, 200), Shapes.RECTANGLE);
            Overlay     helpOverlay       = new Overlay("Static\\SettingsScene/button_export", new Vector2(500, 500), new Vector2(32, 32));
            PopupButton helpButton        = new PopupButton(helpOverlay, "Static\\DrawingScene/help", new Vector2(menuButton.position.X + menuButton.dimensions.X, 0), new Vector2(32, 32));

            //Texture2D settingsButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 255, 0), Shapes.RECTANGLE);
            Overlay     settingsOverlay = new Overlay("Static\\SettingsScene/button_export", new Vector2(600, 500), new Vector2(32, 32));
            PopupButton settingsButton  = new PopupButton(settingsOverlay, "Static\\DrawingScene/gear", new Vector2(helpButton.position.X + helpButton.dimensions.X, 0), new Vector2(32, 32));

            Texture2D   colorButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(200, 0, 255), Shapes.CIRCLE);
            Overlay     colorOverlay       = new Overlay(colorButtonTexture, new Vector2(1100, 500), new Vector2(32, 32));
            PopupButton colorButton        = new PopupButton(colorOverlay, colorButtonTexture, new Vector2(GlobalParameters.screenWidth - colorButtonTexture.Width, 0), new Vector2(32, 32));

            Texture2D   layerButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 0, 255), Shapes.RECTANGLE);
            Overlay     layerOverlay       = new Overlay(layerButtonTexture, new Vector2(732, 500), new Vector2(32, 32));
            PopupButton layerButton        = new PopupButton(layerOverlay, "Static\\DrawingScene/layers", new Vector2(colorButton.position.X - colorButton.dimensions.X, 0), new Vector2(32, 32));

            List <RadioButton> buttons = new List <RadioButton>();

            Texture2D eraserSelectedTexture   = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 0, 0), Shapes.RECTANGLE);
            Texture2D eraserUnselectedTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 255, 0), Shapes.RECTANGLE);

            EraserButton eraser = new EraserButton("Static\\DrawingScene/eraser_selected", "Static\\DrawingScene/eraser", false, new Vector2(layerButton.position.X - layerButton.dimensions.X, 0), new Vector2(32, 32));
            DrawButton   draw   = new DrawButton("Static\\DrawingScene/brush_selected", "Static\\DrawingScene/brush", true, new Vector2(eraser.position.X - eraser.dimensions.X, 0), new Vector2(32, 32));

            buttons.Add(draw);
            buttons.Add(eraser);

            ButtonGroup toolButtons = new ButtonGroup(buttons);
            // TODO ADD Clickable Buttons
            // +1 Frame, Last Frame, -1 Frame, First Frame, Play

            Texture2D frameCounterTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 132, 32, pixel => new Color(0, 0, 0), Shapes.RECTANGLE);
            UIElement frameCounter        = new FrameCounterComponent(frameCounterTexture, new Vector2(settingsButton.position.X + settingsButton.dimensions.X, 0), new Vector2(frameCounterTexture.Width, frameCounterTexture.Height));

            navbar.uiElements.Add(menuButton);
            navbar.uiElements.Add(helpButton);
            navbar.uiElements.Add(settingsButton);
            navbar.uiElements.Add(colorButton);
            navbar.uiElements.Add(layerButton);
            navbar.uiElements.Add(frameCounter);
            navbar.buttonGroups.Add(toolButtons);

            // Add the navbar to this scene
            components.Add(navbar);

            // Load Frame
            frames        = new List <Frame>();
            frameSize     = new Vector2(200, 200);
            framePosition = new Vector2(GlobalParameters.screenWidth / 2 - (int)frameSize.X / 2, GlobalParameters.screenHeight / 2 - (int)frameSize.Y / 2 + menuButton.dimensions.Y / 2);
            frames.Add(new Frame(framePosition, frameSize));
        }