예제 #1
0
        public LoungeSubScreen(Action <Screen> pushGameplayScreen)
        {
            this.pushGameplayScreen = pushGameplayScreen;

            RoomInspector inspector;

            Children = new Drawable[]
            {
                Filter = new FilterControl {
                    Depth = -1
                },
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.55f,
                            Children         = new Drawable[]
                            {
                                new ScrollContainer
                                {
                                    RelativeSizeAxes         = Axes.Both,
                                    ScrollbarOverlapsContent = false,
                                    Padding = new MarginPadding(10),
                                    Child   = new SearchContainer
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Child            = rooms = new RoomsContainer {
                                            JoinRequested = joinRequested
                                        }
                                    },
                                },
                                processingOverlay = new ProcessingOverlay {
                                    Alpha = 0
                                }
                            }
                        },
                        inspector = new RoomInspector
                        {
                            Anchor           = Anchor.TopRight,
                            Origin           = Anchor.TopRight,
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.45f,
                        },
                    },
                },
            };

            inspector.Room.BindTo(rooms.SelectedRoom);

            Filter.Search.Current.ValueChanged += s => filterRooms();
            Filter.Tabs.Current.ValueChanged   += t => filterRooms();
            Filter.Search.Exit += Exit;
        }
 public new void Setup() => Schedule(() =>
 {
     Child = container = new RoomsContainer
     {
         Anchor = Anchor.Centre,
         Origin = Anchor.Centre,
         Width  = 0.5f,
     };
 });
예제 #3
0
        private void load()
        {
            RoomsContainer     roomsContainer;
            OsuScrollContainer scrollContainer;

            InternalChildren = new Drawable[]
            {
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.55f,
                            Children         = new Drawable[]
                            {
                                scrollContainer = new OsuScrollContainer
                                {
                                    RelativeSizeAxes         = Axes.Both,
                                    ScrollbarOverlapsContent = false,
                                    Padding = new MarginPadding(10),
                                    Child   = roomsContainer = new RoomsContainer {
                                        JoinRequested = joinRequested
                                    }
                                },
                                loadingLayer = new LoadingLayer(roomsContainer),
                            }
                        },
                        new RoomInspector
                        {
                            Anchor           = Anchor.TopRight,
                            Origin           = Anchor.TopRight,
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0.45f,
                        },
                    },
                },
                Filter = new TimeshiftFilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = 80,
                },
            };

            // scroll selected room into view on selection.
            selectedRoom.BindValueChanged(val =>
            {
                var drawable = roomsContainer.Rooms.FirstOrDefault(r => r.Room == val.NewValue);
                if (drawable != null)
                {
                    scrollContainer.ScrollIntoView(drawable);
                }
            });
        }
예제 #4
0
 private void load()
 {
     Child = container = new RoomsContainer
     {
         Anchor        = Anchor.Centre,
         Origin        = Anchor.Centre,
         Width         = 0.5f,
         JoinRequested = joinRequested
     };
 }
 public new void Setup() => Schedule(() =>
 {
     Child = container = new RoomsContainer
     {
         Anchor       = Anchor.Centre,
         Origin       = Anchor.Centre,
         Width        = 0.5f,
         SelectedRoom = { BindTarget = SelectedRoom }
     };
 });
예제 #6
0
        public ServerManager(string hostNameOrAddress, int port)
        {
            _clients           = new List <ClientController>();
            _usersManager      = new UsersManager();
            _roomsContainer    = new RoomsContainer();
            _messagesContainer = new MessagesContainer();

            // Establish the local endpoint for the socket
            IPHostEntry ipHostEntry = Dns.GetHostEntry(hostNameOrAddress);

            IPAddress[] ipv4Addresses = Array.FindAll(ipHostEntry.AddressList, a => a.AddressFamily == AddressFamily.InterNetwork);
            _localEndPoint = new IPEndPoint(ipv4Addresses[0], port);
        }
        public new void Setup() => Schedule(() =>
        {
            Child = new PopoverContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Width            = 0.5f,

                Child = container = new RoomsContainer
                {
                    SelectedRoom = { BindTarget = SelectedRoom }
                }
            };
        });
예제 #8
0
        public TestCaseLoungeRoomsContainer()
        {
            RoomsContainer container;

            Child = container = new RoomsContainer
            {
                Anchor        = Anchor.Centre,
                Origin        = Anchor.Centre,
                Width         = 0.5f,
                JoinRequested = joinRequested
            };

            AddStep("clear rooms", () => roomManager.Rooms.Clear());

            AddStep("add rooms", () =>
            {
                for (int i = 0; i < 3; i++)
                {
                    roomManager.Rooms.Add(new Room
                    {
                        RoomID = { Value = i },
                        Name   = { Value = $"Room {i}" },
                        Host   = { Value      = new User {
                                       Username = "******"
                                   } },
                        EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) }
                    });
                }
            });

            AddAssert("has 2 rooms", () => container.Rooms.Count == 3);
            AddStep("remove first room", () => roomManager.Rooms.Remove(roomManager.Rooms.FirstOrDefault()));
            AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
            AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));

            AddStep("select first room", () => container.Rooms.First().Action?.Invoke());
            AddAssert("first room selected", () => container.SelectedRoom.Value == roomManager.Rooms.First());

            AddStep("join first room", () => container.Rooms.First().Action?.Invoke());
            AddAssert("first room joined", () => roomManager.Rooms.First().Status.Value is JoinedRoomStatus);
        }
예제 #9
0
        private void load()
        {
            filter ??= new Bindable <FilterCriteria>(new FilterCriteria());

            OsuScrollContainer scrollContainer;

            InternalChildren = new[]
            {
                loadingLayer = new LoadingLayer(true),
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Left  = WaveOverlayContainer.WIDTH_PADDING,
                        Right = WaveOverlayContainer.WIDTH_PADDING,
                    },
                    Child = new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(GridSizeMode.Absolute, Header.HEIGHT),
                            new Dimension(GridSizeMode.Absolute, 25),
                            new Dimension(GridSizeMode.Absolute, 20)
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                searchTextBox = new LoungeSearchTextBox
                                {
                                    Anchor           = Anchor.CentreRight,
                                    Origin           = Anchor.CentreRight,
                                    RelativeSizeAxes = Axes.X,
                                    Width            = 0.6f,
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Depth            = float.MinValue, // Contained filters should appear over the top of rooms.
                                    Children         = new Drawable[]
                                    {
                                        Buttons.WithChild(CreateNewRoomButton().With(d =>
                                        {
                                            d.Anchor = Anchor.BottomLeft;
                                            d.Origin = Anchor.BottomLeft;
                                            d.Size   = new Vector2(150, 37.5f);
                                            d.Action = () => Open();
                                        })),
                                        new FillFlowContainer
                                        {
                                            Anchor             = Anchor.TopRight,
                                            Origin             = Anchor.TopRight,
                                            AutoSizeAxes       = Axes.Both,
                                            Direction          = FillDirection.Horizontal,
                                            Spacing            = new Vector2(10),
                                            ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
                                            {
                                                d.Anchor = Anchor.TopRight;
                                                d.Origin = Anchor.TopRight;
                                            }))
                                        }
                                    }
                                }
                            },
                            null,
                            new Drawable[]
                            {
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new Drawable[]
                                    {
                                        scrollContainer = new OsuScrollContainer
                                        {
                                            RelativeSizeAxes         = Axes.Both,
                                            ScrollbarOverlapsContent = false,
                                            Child = roomsContainer = new RoomsContainer()
                                        },
                                    }
                                },
                            }
                        }
                    },
                },
            };

            // scroll selected room into view on selection.
            selectedRoom.BindValueChanged(val =>
            {
                var drawable = roomsContainer.Rooms.FirstOrDefault(r => r.Room == val.NewValue);
                if (drawable != null)
                {
                    scrollContainer.ScrollIntoView(drawable);
                }
            });
        }
예제 #10
0
        private void load([CanBeNull] IdleTracker idleTracker)
        {
            const float controls_area_height = 25f;

            if (idleTracker != null)
            {
                isIdle.BindTo(idleTracker.IsIdle);
            }

            OsuScrollContainer scrollContainer;

            InternalChildren = new Drawable[]
            {
                ListingPollingComponent = CreatePollingComponent().With(c => c.Filter.BindTarget = filter),
                popoverContainer        = new PopoverContainer
                {
                    Name             = @"Rooms area",
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Horizontal = WaveOverlayContainer.WIDTH_PADDING,
                        Top        = Header.HEIGHT + controls_area_height + 20,
                    },
                    Child = scrollContainer = new OsuScrollContainer
                    {
                        RelativeSizeAxes         = Axes.Both,
                        ScrollbarOverlapsContent = false,
                        Child = roomsContainer = new RoomsContainer
                        {
                            Filter       = { BindTarget = filter },
                            SelectedRoom = { BindTarget = SelectedRoom }
                        }
                    },
                },
                loadingLayer = new LoadingLayer(true),
                new FillFlowContainer
                {
                    Name             = @"Header area flow",
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                    },
                    Direction = FillDirection.Vertical,
                    Children  = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = Header.HEIGHT,
                            Child            = searchTextBox = new SearchTextBox
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                RelativeSizeAxes = Axes.X,
                                Width            = 0.6f,
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = controls_area_height,
                            Children         = new Drawable[]
                            {
                                Buttons.WithChild(CreateNewRoomButton().With(d =>
                                {
                                    d.Anchor = Anchor.BottomLeft;
                                    d.Origin = Anchor.BottomLeft;
                                    d.Size   = new Vector2(150, 37.5f);
                                    d.Action = () => Open();
                                })),
                                new FillFlowContainer
                                {
                                    Anchor             = Anchor.TopRight,
                                    Origin             = Anchor.TopRight,
                                    AutoSizeAxes       = Axes.Both,
                                    Direction          = FillDirection.Horizontal,
                                    Spacing            = new Vector2(10),
                                    ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
                                    {
                                        d.Anchor = Anchor.TopRight;
                                        d.Origin = Anchor.TopRight;
                                    }))
                                }
                            }
                        }
                    },
                },
            };

            // scroll selected room into view on selection.
            SelectedRoom.BindValueChanged(val =>
            {
                var drawable = roomsContainer.Rooms.FirstOrDefault(r => r.Room == val.NewValue);
                if (drawable != null)
                {
                    scrollContainer.ScrollIntoView(drawable);
                }
            });
        }