Пример #1
0
 protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
 {
     if (args.Key == Key.ControlLeft)
     {
         legendContainer.FadeOut(100);
         processFrames = true;
     }
     return(base.OnKeyUp(state, args));
 }
Пример #2
0
 protected override void OnHoverLost(InputState state)
 {
     HoverBackground.FadeOut(200);
     tooltipContainer.FadeOut(100);
 }
Пример #3
0
        public override void Load()
        {
            base.Load();

            Container timeBarContainer;

            Children = new Drawable[] {
                new SpriteText
                {
                    Text     = Name,
                    Origin   = Anchor.BottomCentre,
                    Anchor   = Anchor.CentreLeft,
                    Rotation = -90,
                },
                new MaskingContainer
                {
                    Children = new [] {
                        timeBarContainer = new LargeContainer(),
                        legendContainer  = new FlowContainer {
                            Anchor   = Anchor.TopRight,
                            Origin   = Anchor.TopRight,
                            Padding  = new Vector2(5, 1),
                            Children = new [] {
                                new Box {
                                    SizeMode = InheritMode.XY,
                                    Colour   = Color4.Gray,
                                    Alpha    = 0.2f,
                                }
                            }
                        },
                        new SpriteText
                        {
                            Text = $@"{visible_range}ms",
                        },
                        new SpriteText
                        {
                            Text   = @"0ms",
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft
                        },
                    }
                },
            };

            for (int i = 0; i < timeBars.Length; ++i)
            {
                timeBars[i] = new Sprite(new Texture(WIDTH, HEIGHT));
                timeBarContainer.Add(
                    timeBarContainers[i] = new Container
                {
                    Children = new [] { timeBars[i] },
                    Width    = WIDTH,
                    Height   = HEIGHT,
                }
                    );
            }

            foreach (PerformanceCollectionType t in Enum.GetValues(typeof(PerformanceCollectionType)))
            {
                if (t >= PerformanceCollectionType.Empty)
                {
                    continue;
                }

                legendContainer.Add(legendMapping[(int)t] = new SpriteText()
                {
                    Colour = getColour(t),
                    Text   = t.ToString(),
                    Alpha  = 0
                });

                legendContainer.FadeOut(2000, EasingTypes.InExpo);
            }

            // Initialize background
            for (int i = 0; i < WIDTH * timeBars.Length; ++i)
            {
                currentX = i;
                Sprite timeBar = timeBars[TimeBarIndex];

                TextureUpload upload = new TextureUpload(HEIGHT * 4, textureBufferStack)
                {
                    Bounds = new Rectangle(TimeBarX, 0, 1, HEIGHT)
                };

                addArea(null, PerformanceCollectionType.Empty, HEIGHT, upload.Data);
                timeBar.Texture.SetData(upload);
            }
        }