Ejemplo n.º 1
0
        private void load()
        {
            ParticipantCount.BindValueChanged(_ => setParticipantCount());
            MaxParticipants.BindValueChanged(_ => setParticipantCount());

            setParticipantCount();
        }
Ejemplo n.º 2
0
        private void load()
        {
            OsuSpriteText count;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes   = Axes.Both,
                Direction      = FillDirection.Horizontal,
                LayoutDuration = transition_duration,
                Children       = new[]
                {
                    count = new OsuSpriteText
                    {
                        Font = OsuFont.GetFont(weight: FontWeight.Bold, size: text_size)
                    },
                    slash = new OsuSpriteText
                    {
                        Text = @"/",
                        Font = OsuFont.GetFont(weight: FontWeight.Light, size: text_size)
                    },
                    maxText = new OsuSpriteText
                    {
                        Font = OsuFont.GetFont(weight: FontWeight.Light, size: text_size)
                    },
                }
            };

            MaxParticipants.BindValueChanged(_ => updateMax(), true);
            ParticipantCount.BindValueChanged(c => count.Text = c.NewValue.ToString("#,0"), true);
        }
Ejemplo n.º 3
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            RecentParticipants.BindCollectionChanged(onParticipantsChanged, true);
            ParticipantCount.BindValueChanged(_ =>
            {
                updateHiddenUsers();
                totalCount.Text = ParticipantCount.Value.ToString();
            }, true);
        }
Ejemplo n.º 4
0
        private void AddCustomIntProject_Click(object sender, RoutedEventArgs e)
        {
            ThemeTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            ParticipantCount.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            InternationalProject proj_ref = FindResource("key_DummyProject") as InternationalProject;

            foreach (FrameworkElement child in NewProjDataInput.Children)
            {
                if (Validation.GetHasError(child))
                {
                    return;
                }
            }
            researcher.AddCustomInternationalProject(new InternationalProject(proj_ref));
        }
Ejemplo n.º 5
0
        private void load(OsuColour colours)
        {
            OsuSpriteText     summary;
            Container         flagContainer;
            LinkFlowContainer hostText;

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes     = Axes.X,
                    RelativeSizeAxes = Axes.Y,
                    Direction        = FillDirection.Horizontal,
                    Spacing          = new Vector2(5f, 0f),
                    Children         = new Drawable[]
                    {
                        flagContainer = new Container
                        {
                            Width            = 22f,
                            RelativeSizeAxes = Axes.Y,
                        },
                        hostText = new LinkFlowContainer
                        {
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.CentreLeft,
                            AutoSizeAxes = Axes.Both
                        }
                    },
                },
                new FillFlowContainer
                {
                    Anchor       = Anchor.CentreRight,
                    Origin       = Anchor.CentreRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Colour       = colours.Gray9,
                    Children     = new[]
                    {
                        summary = new OsuSpriteText
                        {
                            Text = "0 participants",
                            Font = OsuFont.GetFont(size: 14)
                        }
                    },
                },
            };

            Host.BindValueChanged(host =>
            {
                hostText.Clear();
                flagContainer.Clear();

                if (host.NewValue != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(Typeface.Torus, weight: FontWeight.Bold, italics: true));

                    flagContainer.Child = new UpdateableFlag(host.NewValue.Country)
                    {
                        RelativeSizeAxes = Axes.Both
                    };
                }
            }, true);

            ParticipantCount.BindValueChanged(count => summary.Text = "participant".ToQuantity(count.NewValue), true);
        }
Ejemplo n.º 6
0
        private void load(OsuColour colours)
        {
            OsuSpriteText     summary;
            OsuSpriteText     levelRangeHigher;
            OsuSpriteText     levelRangeLower;
            Container         flagContainer;
            LinkFlowContainer hostText;

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes     = Axes.X,
                    RelativeSizeAxes = Axes.Y,
                    Direction        = FillDirection.Horizontal,
                    Spacing          = new Vector2(5f, 0f),
                    Children         = new Drawable[]
                    {
                        flagContainer = new Container
                        {
                            Width            = 22f,
                            RelativeSizeAxes = Axes.Y,
                        },

                        /*new Container //todo: team banners
                         * {
                         *  Width = 38f,
                         *  RelativeSizeAxes = Axes.Y,
                         *  CornerRadius = 2f,
                         *  Masking = true,
                         *  Children = new[]
                         *  {
                         *      new Box
                         *      {
                         *          RelativeSizeAxes = Axes.Both,
                         *          Colour = OsuColour.FromHex(@"ad387e"),
                         *      },
                         *  },
                         * },*/
                        hostText = new LinkFlowContainer
                        {
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.CentreLeft,
                            AutoSizeAxes = Axes.Both
                        }
                    },
                },
                new FillFlowContainer
                {
                    Anchor       = Anchor.CentreRight,
                    Origin       = Anchor.CentreRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Colour       = colours.Gray9,
                    Children     = new[]
                    {
                        summary = new OsuSpriteText
                        {
                            Text     = "0 participants",
                            TextSize = 14,
                        }
                    },
                },
            };

            Host.BindValueChanged(v =>
            {
                hostText.Clear();
                flagContainer.Clear();

                if (v != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic");
                    flagContainer.Child = new DrawableFlag(v.Country)
                    {
                        RelativeSizeAxes = Axes.Both
                    };
                }
            }, true);

            ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}", true);

            /*Participants.BindValueChanged(v =>
             * {
             *  var ranks = v.Select(u => u.Statistics.Ranks.Global);
             *  levelRangeLower.Text = ranks.Min().ToString();
             *  levelRangeHigher.Text = ranks.Max().ToString();
             * });*/
        }
Ejemplo n.º 7
0
        private void load(OsuColour colours)
        {
            OsuSpriteText     summary;
            OsuSpriteText     levelRangeHigher;
            OsuSpriteText     levelRangeLower;
            Container         flagContainer;
            LinkFlowContainer hostText;

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes     = Axes.X,
                    RelativeSizeAxes = Axes.Y,
                    Direction        = FillDirection.Horizontal,
                    Spacing          = new Vector2(5f, 0f),
                    Children         = new Drawable[]
                    {
                        flagContainer = new Container
                        {
                            Width            = 22f,
                            RelativeSizeAxes = Axes.Y,
                        },

                        /*new Container //todo: team banners
                         * {
                         *  Width = 38f,
                         *  RelativeSizeAxes = Axes.Y,
                         *  CornerRadius = 2f,
                         *  Masking = true,
                         *  Children = new[]
                         *  {
                         *      new Box
                         *      {
                         *          RelativeSizeAxes = Axes.Both,
                         *          Colour = OsuColour.FromHex(@"ad387e"),
                         *      },
                         *  },
                         * },*/
                        hostText = new LinkFlowContainer
                        {
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.CentreLeft,
                            AutoSizeAxes = Axes.Both
                        }
                    },
                },
                new FillFlowContainer
                {
                    Anchor       = Anchor.CentreRight,
                    Origin       = Anchor.CentreRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Colour       = colours.Gray9,
                    Children     = new[]
                    {
                        summary = new OsuSpriteText
                        {
                            Text = "0 participants",
                            Font = OsuFont.GetFont(size: 14)
                        }
                    },
                },
            };

            Host.BindValueChanged(host =>
            {
                hostText.Clear();
                flagContainer.Clear();

                if (host.NewValue != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));

                    flagContainer.Child = new DrawableFlag(host.NewValue.Country)
                    {
                        RelativeSizeAxes = Axes.Both
                    };
                }
            }, true);

            ParticipantCount.BindValueChanged(count => summary.Text = "participant".ToQuantity(count.NewValue), true);

            /*Participants.BindValueChanged(e =>
             * {
             *  var ranks = v.Select(u => u.Statistics.Ranks.Global);
             *  levelRangeLower.Text = ranks.Min().ToString();
             *  levelRangeHigher.Text = ranks.Max().ToString();
             * });*/
        }