コード例 #1
0
        private void load(TextureStore textures, Storage storage)
        {
            RelativeSizeAxes = Axes.Both;

            this.storage = storage;

            if (TeamList == null)
            {
                TeamList = new StorageBackedTeamList(storage);
            }

            if (!TeamList.Teams.Any())
            {
                return;
            }

            drawingsConfig = new DrawingsConfigManager(storage);

            InternalChildren = new Drawable[]
            {
                // Main container
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Sprite
                        {
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fill,
                            Texture          = textures.Get(@"Backgrounds/Drawings/background.png")
                        },
                        // Visualiser
                        new VisualiserContainer
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,

                            RelativeSizeAxes = Axes.X,
                            Size             = new Vector2(1, 10),

                            Colour = new Color4(255, 204, 34, 255),

                            Lines = 6
                        },
                        // Groups
                        groupsContainer = new GroupContainer(drawingsConfig.Get <int>(DrawingsConfig.Groups), drawingsConfig.Get <int>(DrawingsConfig.TeamsPerGroup))
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,

                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,

                            Padding = new MarginPadding
                            {
                                Top    = 35f,
                                Bottom = 35f
                            }
                        },
                        // Scrolling teams
                        teamsContainer = new ScrollingTeamContainer
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,

                            RelativeSizeAxes = Axes.X,
                        },
                        // Scrolling team name
                        fullTeamNameText = new OsuSpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.TopCentre,

                            Position = new Vector2(0, 45f),

                            Colour = OsuColour.Gray(0.33f),

                            Alpha = 0,

                            Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42),
                        }
                    }
                },
                // Control panel container
                new ControlPanel
                {
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Begin random",
                        Action = teamsContainer.StartScrolling,
                    },
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Stop random",
                        Action = teamsContainer.StopScrolling,
                    },
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Reload",
                        Action = reloadTeams
                    },
                    new ControlPanel.Spacer(),
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Reset",
                        Action = () => reset()
                    }
                }
            };

            teamsContainer.OnSelected      += onTeamSelected;
            teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200);

            reset(true);
        }
コード例 #2
0
        private void load(TextureStore textures, Storage storage)
        {
            this.storage = storage;

            TextureStore flagStore = new TextureStore();

            // Local flag store
            flagStore.AddStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(new StorageBackedResourceStore(storage), "Drawings")));
            // Default texture store
            flagStore.AddStore(textures);

            dependencies.Cache(flagStore);

            if (TeamList == null)
            {
                TeamList = new StorageBackedTeamList(storage);
            }

            if (!TeamList.Teams.Any())
            {
                Exit();
                return;
            }

            drawingsConfig = new DrawingsConfigManager(storage);

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Color4(77, 77, 77, 255)
                },
                new Sprite
                {
                    RelativeSizeAxes = Axes.Both,
                    FillMode         = FillMode.Fill,
                    Texture          = textures.Get(@"Backgrounds/Drawings/background.png")
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Horizontal,

                    Children = new Drawable[]
                    {
                        // Main container
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.85f,

                            Children = new Drawable[]
                            {
                                // Visualiser
                                new VisualiserContainer
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,

                                    RelativeSizeAxes = Axes.X,
                                    Size             = new Vector2(1, 10),

                                    Colour = new Color4(255, 204, 34, 255),

                                    Lines = 6
                                },
                                // Groups
                                groupsContainer = new GroupContainer(drawingsConfig.Get <int>(DrawingsConfig.Groups), drawingsConfig.Get <int>(DrawingsConfig.TeamsPerGroup))
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,

                                    RelativeSizeAxes = Axes.Y,
                                    AutoSizeAxes     = Axes.X,

                                    Padding = new MarginPadding
                                    {
                                        Top    = 35f,
                                        Bottom = 35f
                                    }
                                },
                                // Scrolling teams
                                teamsContainer = new ScrollingTeamContainer
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,

                                    RelativeSizeAxes = Axes.X,
                                },
                                // Scrolling team name
                                fullTeamNameText = new OsuSpriteText
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.TopCentre,

                                    Position = new Vector2(0, 45f),

                                    Alpha = 0,

                                    Font     = "Exo2.0-Light",
                                    TextSize = 42f
                                }
                            }
                        },
                        // Control panel container
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.15f,

                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = new Color4(54, 54, 54, 255)
                                },
                                new OsuSpriteText
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,

                                    Text     = "Control Panel",
                                    TextSize = 22f,
                                    Font     = "Exo2.0-Bold"
                                },
                                new FillFlowContainer
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,

                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Width            = 0.75f,

                                    Position = new Vector2(0, 35f),

                                    Direction = FillDirection.Vertical,
                                    Spacing   = new Vector2(0, 5f),

                                    Children = new Drawable[]
                                    {
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Begin random",
                                            Action = teamsContainer.StartScrolling,
                                        },
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Stop random",
                                            Action = teamsContainer.StopScrolling,
                                        },
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Reload",
                                            Action = reloadTeams
                                        }
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Anchor = Anchor.BottomCentre,
                                    Origin = Anchor.BottomCentre,

                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Width            = 0.75f,

                                    Position = new Vector2(0, -5f),

                                    Direction = FillDirection.Vertical,
                                    Spacing   = new Vector2(0, 5f),

                                    Children = new Drawable[]
                                    {
                                        new TriangleButton
                                        {
                                            RelativeSizeAxes = Axes.X,

                                            Text   = "Reset",
                                            Action = () => reset()
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            teamsContainer.OnSelected      += onTeamSelected;
            teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200);

            reset(true);
        }
コード例 #3
0
 public TeamsController(ITeamList list, IPlayerPool pool)
 {
     _list = list;
     _pool = pool;
 }