Пример #1
0
        private void load(MatchIPCInfo ipc)
        {
            currentMatch.BindValueChanged(matchChanged);
            currentMatch.BindTo(LadderInfo.CurrentMatch);

            ipc.Beatmap.BindValueChanged(beatmapChanged);
        }
Пример #2
0
        private void load(LadderInfo ladder, MatchIPCInfo ipc)
        {
            score1.BindValueChanged(_ => updateScores());
            score1.BindTo(ipc.Score1);

            score2.BindValueChanged(_ => updateScores());
            score2.BindTo(ipc.Score2);
        }
Пример #3
0
        private void load(MatchIPCInfo ipc, IAPIProvider api)
        {
            if (ipc != null)
            {
                chatChannel.BindTo(ipc.ChatChannel);
                chatChannel.BindValueChanged(c =>
                {
                    if (string.IsNullOrWhiteSpace(c.NewValue))
                    {
                        return;
                    }

                    int id = int.Parse(c.NewValue);

                    if (id <= 0)
                    {
                        return;
                    }

                    if (manager == null)
                    {
                        AddInternal(manager = new ChannelManager(api)
                        {
                            HighPollRate = { Value = true }
                        });
                        Channel.BindTo(manager.CurrentChannel);
                    }

                    foreach (var ch in manager.JoinedChannels.ToList())
                    {
                        manager.LeaveChannel(ch);
                    }

                    var channel = new Channel
                    {
                        Id   = id,
                        Type = ChannelType.Public
                    };

                    manager.JoinChannel(channel);
                    manager.CurrentChannel.Value = channel;
                }, true);
            }
        }
Пример #4
0
 private void load(MatchIPCInfo ipc)
 {
     ipc.Beatmap.BindValueChanged(beatmapChanged, true);
     ipc.Mods.BindValueChanged(modsChanged, true);
 }
Пример #5
0
 private void load(MatchIPCInfo ipc)
 {
     ipc.Beatmap.BindValueChanged(beatmapChanged);
 }
Пример #6
0
        private void load(LadderInfo ladder, MatchIPCInfo ipc)
        {
            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 TournamentMatchScoreDisplay
                {
                    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",
                            Current      = LadderInfo.ChromaKeyWidth,
                            KeyboardStep = 1,
                        },
                        new SettingsSlider <int>
                        {
                            LabelText    = "Players per team",
                            Current      = LadderInfo.PlayersPerTeam,
                            KeyboardStep = 1,
                        }
                    }
                }
            });

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

            warmup.BindValueChanged(w =>
            {
                warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
                header.ShowScores  = !w.NewValue;
            }, true);
        }
Пример #7
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);
        }
Пример #8
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
                {
                    ShowLogo = false
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Y        = 110,
                    Anchor   = Anchor.TopCentre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        chroma = new Box
                        {
                            // chroma key area for stable gameplay
                            Name   = "chroma",
                            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; }
                        },
                        new SettingsSlider <int>
                        {
                            LabelText    = "Chroma Width",
                            Bindable     = LadderInfo.ChromaKeyWidth,
                            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);
        }