Пример #1
0
            private void load(GameConfigManager config, TextureStore textures, CirclesColour colour)
            {
                Children = new Drawable[]
                {
                    cursorContainer = new Container
                    {
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new Sprite
                            {
                                Texture = textures.Get(@"Cursor/menu-cursor"),
                            },
                            AdditiveLayer = new Sprite
                            {
                                Blending = BlendingParameters.Additive,
                                Colour   = colour.Pink,
                                Alpha    = 0,
                                Texture  = textures.Get(@"Cursor/menu-cursor-additive"),
                            },
                        }
                    }
                };

                cursorScale = config.GetBindable <float>(CirclesSetting.MenuCursorSize);
                cursorScale.BindValueChanged(scale => cursorContainer.Scale = new Vector2(scale.NewValue * base_scale), true);
            }
Пример #2
0
        private void updateSize()
        {
            const float fade_time = 500;

            if (targetMode == ScalingMode.Everything)
            {
                // the top level scaling container manages the background to be displayed while scaling.
                if (requiresBackgroundVisible)
                {
                    if (backgroundStack == null)
                    {
                        AddInternal(backgroundStack = new BackgroundScreenStack
                        {
                            Colour = CirclesColour.Gray(0.1f),
                            Alpha  = 0,
                            Depth  = float.MaxValue
                        });

                        backgroundStack.Push(new ScalingBackgroundScreen());
                    }

                    backgroundStack.FadeIn(fade_time);
                }
                else
                {
                    backgroundStack?.FadeOut(fade_time);
                }
            }

            bool scaling = targetMode == null || scalingMode.Value == targetMode;

            var  targetSize      = scaling ? new Vector2(sizeX.Value, sizeY.Value) : Vector2.One;
            var  targetPosition  = scaling ? new Vector2(posX.Value, posY.Value) * (Vector2.One - targetSize) : Vector2.Zero;
            bool requiresMasking = scaling && targetSize != Vector2.One;

            if (requiresMasking)
            {
                sizableContainer.Masking = true;
            }

            sizableContainer.MoveTo(targetPosition, 500, Easing.OutQuart);
            sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; });
        }