private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
        {
            this.ipc = ipc;

            AddRangeInternal(new Drawable[]
            {
                new TourneyVideo("gameplay")
                {
                    Loop             = true,
                    RelativeSizeAxes = Axes.Both,
                },
                header = new MatchHeader
                {
                    ShowLogo = false
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Y        = 110,
                    Anchor   = Anchor.TopCentre,
                    Origin   = Anchor.TopCentre,
                    Children = new[]
                    {
                        chroma = new Container
                        {
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                            Height   = 512,
                            Children = new Drawable[]
                            {
                                new ChromaArea
                                {
                                    Name             = "Left chroma",
                                    RelativeSizeAxes = Axes.Both,
                                    Width            = 0.5f,
                                },
                                new ChromaArea
                                {
                                    Name             = "Right chroma",
                                    RelativeSizeAxes = Axes.Both,
                                    Anchor           = Anchor.TopRight,
                                    Origin           = Anchor.TopRight,
                                    Width            = 0.5f,
                                }
                            }
                        },
                    }
                },
                scoreDisplay = new MatchScoreDisplay
                {
                    Y      = -147,
                    Anchor = Anchor.BottomCentre,
                    Origin = Anchor.TopCentre,
                },
                new ControlPanel
                {
                    Children = new Drawable[]
                    {
                        warmupButton = new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle warmup",
                            Action           = () => warmup.Toggle()
                        },
                        new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle chat",
                            Action           = () => { State.Value = State.Value == TourneyState.Idle ? TourneyState.Playing : TourneyState.Idle; }
                        },
                        new SettingsSlider <int>
                        {
                            LabelText    = "Chroma width",
                            Bindable     = LadderInfo.ChromaKeyWidth,
                            KeyboardStep = 1,
                        },
                        new SettingsSlider <int>
                        {
                            LabelText    = "Players per team",
                            Bindable     = LadderInfo.PlayersPerTeam,
                            KeyboardStep = 1,
                        }
                    }
                }
            });

            State.BindTo(ipc.State);
            State.BindValueChanged(stateChanged, true);

            ladder.ChromaKeyWidth.BindValueChanged(width => chroma.Width = width.NewValue, true);

            currentMatch.BindValueChanged(m =>
            {
                warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0;
                scheduledOperation?.Cancel();
            });

            currentMatch.BindTo(ladder.CurrentMatch);

            warmup.BindValueChanged(w =>
            {
                warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
                header.ShowScores  = !w.NewValue;
            }, true);
        }
Ejemplo n.º 2
0
        private void load(LadderInfo ladder, MatchIPCInfo ipc)
        {
            this.ipc = ipc;

            AddRangeInternal(new Drawable[]
            {
                new MatchHeader(),
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Y        = 5,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            // chroma key area for stable gameplay
                            Name             = "chroma",
                            RelativeSizeAxes = Axes.X,
                            Height           = 512,
                            Colour           = new Color4(0, 255, 0, 255),
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Y        = -4,
                            Children = new Drawable[]
                            {
                                new Circle
                                {
                                    Name             = "top bar red",
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 8,
                                    Width            = 0.5f,
                                    Colour           = red,
                                },
                                new Circle
                                {
                                    Name             = "top bar blue",
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 8,
                                    Width            = 0.5f,
                                    Colour           = blue,
                                    Anchor           = Anchor.TopRight,
                                    Origin           = Anchor.TopRight,
                                },
                            }
                        },
                    }
                },
                scoreDisplay = new MatchScoreDisplay
                {
                    Y      = -60,
                    Scale  = new Vector2(0.8f),
                    Anchor = Anchor.BottomCentre,
                    Origin = Anchor.BottomCentre,
                },
                new ControlPanel
                {
                    Children = new Drawable[]
                    {
                        warmupButton = new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle warmup",
                            Action           = () => warmup.Toggle()
                        },
                        new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle chat",
                            Action           = () => { State.Value = State.Value == TourneyState.Idle ? TourneyState.Playing : TourneyState.Idle; }
                        }
                    }
                }
            });

            State.BindTo(ipc.State);
            State.BindValueChanged(stateChanged, true);

            currentMatch.BindValueChanged(m =>
            {
                warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0;
                scheduledOperation?.Cancel();
            });

            currentMatch.BindTo(ladder.CurrentMatch);

            warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true);
        }
Ejemplo n.º 3
0
        private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
        {
            this.ipc = ipc;

            AddRangeInternal(new Drawable[]
            {
                new TourneyVideo("gameplay")
                {
                    Loop             = true,
                    RelativeSizeAxes = Axes.Both,
                },
                header = new MatchHeader(),
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Y        = 110,
                    Anchor   = Anchor.TopCentre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            // chroma key area for stable gameplay
                            Name             = "chroma",
                            RelativeSizeAxes = Axes.X,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Height           = 512,
                            Colour           = new Color4(0, 255, 0, 255),
                        },
                    }
                },
                scoreDisplay = new MatchScoreDisplay
                {
                    Y      = -147,
                    Anchor = Anchor.BottomCentre,
                    Origin = Anchor.TopCentre,
                },
                new ControlPanel
                {
                    Children = new Drawable[]
                    {
                        warmupButton = new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle warmup",
                            Action           = () => warmup.Toggle()
                        },
                        new TourneyButton
                        {
                            RelativeSizeAxes = Axes.X,
                            Text             = "Toggle chat",
                            Action           = () => { State.Value = State.Value == TourneyState.Idle ? TourneyState.Playing : TourneyState.Idle; }
                        }
                    }
                }
            });

            State.BindTo(ipc.State);
            State.BindValueChanged(stateChanged, true);

            currentMatch.BindValueChanged(m =>
            {
                warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0;
                scheduledOperation?.Cancel();
            });

            currentMatch.BindTo(ladder.CurrentMatch);

            warmup.BindValueChanged(w =>
            {
                warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
                header.ShowScores  = !w.NewValue;
            }, true);
        }