Exemplo n.º 1
0
        private void Init()
        {
            var bg = CreateChild <UguiSprite>("bg");

            {
                bg.Anchor     = AnchorType.Fill;
                bg.SpriteName = "circle-320";
                bg.Color      = ColorPreset.DarkBackground;
                bg.Offset     = Offset.Zero;
            }
            meterSprite = CreateChild <UguiSprite>("meter");
            {
                meterSprite.Anchor     = AnchorType.Fill;
                meterSprite.Offset     = Offset.Zero;
                meterSprite.SpriteName = "circle-320";
                meterSprite.ImageType  = Image.Type.Filled;
                meterSprite.SetRadial360Fill(Image.Origin360.Top);

                meterGradient = meterSprite.AddEffect(new GradientEffect());
                meterGradient.Component.direction = UIGradient.Direction.Vertical;
                meterGradient.Component.color1    = Color.white;
                meterGradient.Component.color2    = HexColor.Create("A0A0A0");
                meterGradient.Component.offset    = 0.75f;
            }
            rangeDisplay = CreateChild <RankCircleRange>("ranges");
            {
                rangeDisplay.Anchor = AnchorType.Fill;
                rangeDisplay.Offset = new Offset(18f);
            }
            var mask = CreateChild <UguiSprite>("mask");

            {
                mask.Anchor     = AnchorType.Fill;
                mask.Offset     = new Offset(28f);
                mask.Color      = ColorPreset.DarkBackground;
                mask.SpriteName = "circle-320";
                mask.AddEffect(new MaskEffect());

                mapThumb = mask.CreateChild <MapImageDisplay>("thumb");
                {
                    mapThumb.Anchor = AnchorType.Fill;
                    mapThumb.Offset = Offset.Zero;
                    mapThumb.Color  = new Color(1f, 1f, 1f, 0.25f);
                }
            }
            rankGlowSprite = CreateChild <UguiSprite>("rank-glow");
            {
                rankGlowSprite.Size       = new Vector2(256f, 256f);
                rankGlowSprite.SpriteName = "glow-128";
                rankGlowSprite.Alpha      = 0.625f;
            }
            rankLabel = CreateChild <Label>("rank");
            {
                rankLabel.IsBold   = true;
                rankLabel.FontSize = 128;

                rankShadowEffect = rankLabel.AddEffect(new ShadowEffect());
                rankShadowEffect.Component.style = ShadowStyle.Outline8;
            }
            var accBg = CreateChild <UguiSprite>("acc-bg");

            {
                accBg.Position   = new Vector3(0f, -84f);
                accBg.Size       = new Vector2(280f, 64f);
                accBg.SpriteName = "glow-128";
                accBg.Color      = Color.black;
            }
            accuracyLabel = CreateChild <Label>("accuracy");
            {
                accuracyLabel.Position = accBg.Position;
                accuracyLabel.FontSize = 22;
            }

            OnEnableInited();
        }
Exemplo n.º 2
0
        private void Init()
        {
            hoverSprite.Depth      = 1;
            hoverSprite.Anchor     = AnchorType.Fill;
            hoverSprite.RawSize    = new Vector2(28f, 30f);
            hoverSprite.Color      = Color.black;
            hoverSprite.SpriteName = "glow-parallel-64";
            hoverSprite.ImageType  = Image.Type.Sliced;
            hoverSprite.AddEffect(new FlipEffect()).Component.horizontal = true;

            mask = CreateChild <UguiSprite>("mask", 0);
            {
                mask.Anchor     = AnchorType.Fill;
                mask.RawSize    = Vector2.zero;
                mask.Color      = HexColor.Create("2A313A");
                mask.SpriteName = "parallel-64";
                mask.ImageType  = Image.Type.Sliced;

                mask.AddEffect(new MaskEffect());
                mask.AddEffect(new FlipEffect()).Component.horizontal = true;

                imageDisplay = mask.CreateChild <MapImageDisplay>("imageDisplay", 0);
                {
                    imageDisplay.Anchor  = AnchorType.Fill;
                    imageDisplay.RawSize = Vector2.zero;

                    imageGradient = imageDisplay.CreateChild <UguiSprite>("gradient", 100);
                    {
                        imageGradient.Anchor     = AnchorType.Fill;
                        imageGradient.RawSize    = Vector2.zero;
                        imageGradient.SpriteName = "gradation-left";
                        imageGradient.Color      = new Color(0f, 0f, 0f, 0.5f);
                    }
                }
                progressBar = mask.CreateChild <UguiProgressBar>("progress", 1);
                {
                    progressBar.Anchor = AnchorType.BottomStretch;
                    progressBar.Pivot  = PivotType.Bottom;
                    progressBar.SetOffsetHorizontal(22f, 0f);
                    progressBar.Height = 6f;
                    progressBar.Y      = 0f;

                    progressBar.Background.Color = new Color(0f, 0f, 0f, 0.5f);
                    progressBar.Foreground.SetOffsetTop(2f);
                }
                titleLabel = mask.CreateChild <Label>("title", 2);
                {
                    titleLabel.Anchor = AnchorType.TopStretch;
                    titleLabel.Pivot  = PivotType.Top;
                    titleLabel.SetOffsetHorizontal(20f, 32f);
                    titleLabel.Y         = -8f;
                    titleLabel.Height    = 30f;
                    titleLabel.IsBold    = true;
                    titleLabel.FontSize  = 22;
                    titleLabel.Alignment = TextAnchor.UpperLeft;
                    titleLabel.WrapText  = true;

                    var shadow = titleLabel.AddEffect(new ShadowEffect()).Component;
                    shadow.style          = ShadowStyle.Outline;
                    shadow.effectDistance = Vector2.one;
                    shadow.effectColor    = new Color(0f, 0f, 0f, 0.5f);
                }
                artistLabel = mask.CreateChild <Label>("artist", 3);
                {
                    artistLabel.Anchor = AnchorType.BottomStretch;
                    artistLabel.Pivot  = PivotType.Bottom;
                    artistLabel.SetOffsetHorizontal(32f, 20f);
                    artistLabel.Y         = 8f;
                    artistLabel.Height    = 30f;
                    artistLabel.Alignment = TextAnchor.LowerLeft;
                    artistLabel.WrapText  = true;

                    var shadow = artistLabel.AddEffect(new ShadowEffect()).Component;
                    shadow.style          = ShadowStyle.Outline;
                    shadow.effectDistance = Vector2.one;
                    shadow.effectColor    = new Color(0f, 0f, 0f, 0.5f);
                }
            }

            hoverInAni = new Anime();
            hoverInAni.AnimateColor(color => hoverSprite.Color = color)
            .AddTime(0f, () => hoverSprite.Color)
            .AddTime(0.25f, () => MapSelection.Background.Value.Highlight)
            .Build();
            hoverInAni.AnimateFloat(alpha => imageGradient.Alpha = alpha)
            .AddTime(0f, () => imageGradient.Alpha)
            .AddTime(0.25f, 0f)
            .Build();

            hoverOutAni = new Anime();
            hoverOutAni.AnimateColor(color => hoverSprite.Color = color)
            .AddTime(0f, () => hoverSprite.Color)
            .AddTime(0.25f, Color.black)
            .Build();
            hoverOutAni.AnimateFloat(alpha => imageGradient.Alpha = alpha)
            .AddTime(0f, () => imageGradient.Alpha)
            .AddTime(0.25f, 0.5f)
            .Build();

            OnEnableInited();
        }