コード例 #1
0
        private void load(TextureStore textures)
        {
            game.Parse(store, textures, room.Value.Game);

            dependencies.Cache(room.Value.Players.Single(p => p?.BackingUser?.ID == api.LocalUser.Value.ID));

            RelativeSizeAxes = Axes.Both;

            InternalChildren = new Drawable[]
            {
                roomUpdater,
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = new Colour4(106, 100, 104, 255)
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Relative, .1f),
                        new Dimension(),
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Colour4(60, 60, 60, 255)
                                    },
                                    new Container
                                    {
                                        Anchor           = Anchor.TopLeft,
                                        Origin           = Anchor.TopLeft,
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = .2f,
                                        Children         = new Drawable[]
                                        {
                                            new SimpleIconButton(FontAwesome.Solid.SignOutAlt)
                                            {
                                                Anchor = Anchor.Centre,
                                                Origin = Anchor.Centre,
                                                Action = exitRoom,
                                            },
                                        }
                                    },
                                    new Container
                                    {
                                        Anchor           = Anchor.TopRight,
                                        Origin           = Anchor.TopRight,
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = .2f,
                                        Children         = new Drawable[]
                                        {
                                            new SimpleIconButton(FontAwesome.Solid.Envelope)
                                            {
                                                Anchor = Anchor.Centre,
                                                Origin = Anchor.Centre,
                                                Action = inviteOverlay.Show,
                                            },
                                        }
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Child            = new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding(50),
                                    Children         = new Drawable[]
                                    {
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            Height           = 1000,
                                            Child            = new FillFlowContainer
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Direction        = FillDirection.Vertical,
                                                Children         = new Drawable[]
                                                {
                                                    new SpriteText
                                                    {
                                                        Text = @"Jugadores:",
                                                        Font = new FontUsage(size: 80)
                                                    },
                                                    new BasicScrollContainer
                                                    {
                                                        RelativeSizeAxes = Axes.X,
                                                        Height           = 1000,
                                                        ClampExtension   = 30,
                                                        Masking          = true,
                                                        Child            = usersInRoom = new FillFlowContainer
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            AutoSizeAxes     = Axes.Y,
                                                            Direction        = FillDirection.Full,
                                                            Spacing          = new Vector2(0, 20),
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                        new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Height           = .15f,
                                            Child            = continueButton = new SurfaceButton
                                            {
                                                Action           = playGame,
                                                BackgroundColour = Colour4.LightPink,
                                                Children         = new Drawable[]
                                                {
                                                    textButton = new SpriteText
                                                    {
                                                        Anchor = Anchor.Centre,
                                                        Origin = Anchor.Centre,
                                                        Font   = new FontUsage(size: 80),
                                                        Colour = new Colour4(106, 100, 104, 255)
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                inviteOverlay,
                gameStack = new ScreenStack
                {
                    RelativeSizeAxes = Axes.Both,
                },
            };

            Schedule(() => LoadComponentAsync(new GameScreen(), gameStack.Push));

            if (api.LocalUser.Value.ID == room.Value.Owner.BackingUser.ID)
            {
                textButton.Text = "Jugar!";
            }
            else
            {
                textButton.Text = "Listo!";
            }

            for (int i = 0; i < room.Value.Game.Maxplayers; i++)
            {
                usersInRoom.Add(new PlayerInfoContainer(i));
            }


            gameStack.Hide();
        }