private void currentChannelChanged(ValueChangedEvent <Channel> channel) { Channel?newChannel = channel.NewValue; // null channel denotes that we should be showing the listing. if (newChannel == null) { currentChannel.Value = channelList.ChannelListingChannel; return; } if (newChannel is ChannelListing.ChannelListingChannel) { currentChannelContainer.Clear(false); channelListing.Show(); textBar.ShowSearch.Value = true; } else { channelListing.Hide(); textBar.ShowSearch.Value = false; if (loadedChannels.ContainsKey(newChannel)) { currentChannelContainer.Clear(false); currentChannelContainer.Add(loadedChannels[newChannel]); } else { loading.Show(); // Ensure the drawable channel is stored before async load to prevent double loading ChatOverlayDrawableChannel drawableChannel = CreateDrawableChannel(newChannel); loadedChannels.Add(newChannel, drawableChannel); LoadComponentAsync(drawableChannel, loadedDrawable => { // Ensure the current channel hasn't changed by the time the load completes if (currentChannel.Value != loadedDrawable.Channel) { return; } // Ensure the cached reference hasn't been removed from leaving the channel if (!loadedChannels.ContainsKey(loadedDrawable.Channel)) { return; } currentChannelContainer.Clear(false); currentChannelContainer.Add(loadedDrawable); loading.Hide(); }); } } // Mark channel as read when channel switched if (newChannel.Messages.Any()) { channelManager.MarkChannelAsRead(newChannel); } }
private void onSuccess(Room room) => loadingLayer.Hide();
private void onMatchStarted() => Scheduler.Add(() => { loadingDisplay.Hide(); base.StartGameplay(); });
private void load(OverlayColourProvider colourProvider, OsuColour colours) { InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4 }, new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { new OsuScrollContainer { Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING, Vertical = 10 }, RelativeSizeAxes = Axes.Both, Children = new[] { new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 10), Children = new[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new SectionContainer { Padding = new MarginPadding { Right = FIELD_PADDING / 2 }, Children = new[] { new Section("Room name") { Child = NameField = new OsuTextBox { RelativeSizeAxes = Axes.X, TabbableContentContainer = this, LengthLimit = 100, }, }, // new Section("Room visibility") // { // Alpha = disabled_alpha, // Child = AvailabilityPicker = new RoomAvailabilityPicker // { // Enabled = { Value = false } // }, // }, new Section("Game type") { Child = new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Spacing = new Vector2(7), Children = new Drawable[] { TypePicker = new MatchTypePicker { RelativeSizeAxes = Axes.X, }, typeLabel = new OsuSpriteText { Font = OsuFont.GetFont(size: 14), Colour = colours.Yellow }, }, }, }, new Section("Queue mode") { Child = new Container { RelativeSizeAxes = Axes.X, Height = 40, Child = QueueModeDropdown = new OsuEnumDropdown <QueueMode> { RelativeSizeAxes = Axes.X } } }, new Section("Auto start") { Child = new Container { RelativeSizeAxes = Axes.X, Height = 40, Child = startModeDropdown = new OsuEnumDropdown <StartMode> { RelativeSizeAxes = Axes.X } } } }, }, new SectionContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Padding = new MarginPadding { Left = FIELD_PADDING / 2 }, Children = new[] { new Section("Max participants") { Alpha = disabled_alpha, Child = MaxParticipantsField = new OsuNumberBox { RelativeSizeAxes = Axes.X, TabbableContentContainer = this, ReadOnly = true, }, }, new Section("Password (optional)") { Child = PasswordTextBox = new OsuPasswordTextBox { RelativeSizeAxes = Axes.X, TabbableContentContainer = this, LengthLimit = 255, }, }, } } }, }, playlistContainer = new FillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.5f, Depth = float.MaxValue, Spacing = new Vector2(5), Children = new Drawable[] { drawablePlaylist = new DrawableRoomPlaylist { RelativeSizeAxes = Axes.X, Height = DrawableRoomPlaylistItem.HEIGHT }, new PurpleTriangleButton { RelativeSizeAxes = Axes.X, Height = 40, Text = "Select beatmap", Action = SelectBeatmap } } } } } }, }, }, new Drawable[] { new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Y = 2, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background5 }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 20), Margin = new MarginPadding { Vertical = 20 }, Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, Children = new Drawable[] { ApplyButton = new CreateOrUpdateButton { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Size = new Vector2(230, 55), Enabled = { Value = false }, Action = apply, }, ErrorText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Alpha = 0, Depth = 1, Colour = colours.RedDark } } } } } } } }, loadingLayer = new LoadingLayer(true) }; TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true); RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true); Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true); MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true); RoomID.BindValueChanged(roomId => playlistContainer.Alpha = roomId.NewValue == null ? 1 : 0, true); Password.BindValueChanged(password => PasswordTextBox.Text = password.NewValue ?? string.Empty, true); QueueMode.BindValueChanged(mode => QueueModeDropdown.Current.Value = mode.NewValue, true); AutoStartDuration.BindValueChanged(duration => startModeDropdown.Current.Value = (StartMode)(int)duration.NewValue.TotalSeconds, true); operationInProgress.BindTo(ongoingOperationTracker.InProgress); operationInProgress.BindValueChanged(v => { if (v.NewValue) { loadingLayer.Show(); } else { loadingLayer.Hide(); } }); }
private void onSuccess(Room room) { loadingLayer.Hide(); SettingsApplied?.Invoke(); }
void Start() { LoadingLayer.Hide(); Global.PanelManager.PushPanel(LogicName.Sample); }
private void load(OsuColour colours) { InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4Extensions.FromHex(@"28242d"), }, new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { new OsuScrollContainer { Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING, Vertical = 10 }, RelativeSizeAxes = Axes.Both, Children = new[] { new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 10), Children = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new SectionContainer { Padding = new MarginPadding { Right = FIELD_PADDING / 2 }, Children = new[] { new Section("Room name") { Child = NameField = new SettingsTextBox { RelativeSizeAxes = Axes.X, TabbableContentContainer = this, }, }, new Section("Room visibility") { Alpha = disabled_alpha, Child = AvailabilityPicker = new RoomAvailabilityPicker { Enabled = { Value = false } }, }, new Section("Game type") { Alpha = disabled_alpha, Child = new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Spacing = new Vector2(7), Children = new Drawable[] { TypePicker = new GameTypePicker { RelativeSizeAxes = Axes.X, Enabled = { Value = false } }, typeLabel = new OsuSpriteText { Font = OsuFont.GetFont(size: 14), Colour = colours.Yellow }, }, }, }, }, }, new SectionContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Padding = new MarginPadding { Left = FIELD_PADDING / 2 }, Children = new[] { new Section("Max participants") { Alpha = disabled_alpha, Child = MaxParticipantsField = new SettingsNumberTextBox { RelativeSizeAxes = Axes.X, TabbableContentContainer = this, ReadOnly = true, }, }, new Section("Password (optional)") { Alpha = disabled_alpha, Child = new SettingsPasswordTextBox { RelativeSizeAxes = Axes.X, TabbableContentContainer = this, ReadOnly = true, }, }, } } }, }, initialBeatmapControl = new BeatmapSelectionControl { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, Width = 0.5f } } } }, }, }, new Drawable[] { new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Y = 2, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f), }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 20), Margin = new MarginPadding { Vertical = 20 }, Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, Children = new Drawable[] { ApplyButton = new CreateOrUpdateButton { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Size = new Vector2(230, 55), Enabled = { Value = false }, Action = apply, }, ErrorText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Alpha = 0, Depth = 1, Colour = colours.RedDark } } } } } } } }, loadingLayer = new LoadingLayer(true) }; TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true); RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true); Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true); Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true); MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true); RoomID.BindValueChanged(roomId => initialBeatmapControl.Alpha = roomId.NewValue == null ? 1 : 0, true); operationInProgress.BindTo(ongoingOperationTracker.InProgress); operationInProgress.BindValueChanged(v => { if (v.NewValue) { loadingLayer.Show(); } else { loadingLayer.Hide(); } }); }
IEnumerator OnUpdateResource() { LoadingLayer.Show(); if (!AppConst.UpdateMode) { ResourceUpdateEnd(); yield break; } string dataPath = AppPlatform.DataPath; //数据目录 string url = AppConst.WebUrl + AppPlatform.GetCurPackageResPath(); string listUrl = url + "files.txt"; Debug.Log("LoadUpdate---->>>" + listUrl); WWW www = new WWW(listUrl); yield return(www); if (!string.IsNullOrEmpty(www.error)) //if (www.error != null) { Debug.Log(www.error); LoadingLayer.Hide(); yield break; } if (!Directory.Exists(dataPath)) { Directory.CreateDirectory(dataPath); } File.WriteAllBytes(dataPath + "files.txt", www.bytes); string filesText = www.text; string[] files = filesText.Split('\n'); for (int i = 0; i < files.Length; i++) { float percent = (float)i / (files.Length - 1); LoadingLayer.SetProgressbarValue(percent); if (string.IsNullOrEmpty(files[i])) { continue; } string[] keyValue = files[i].Split('|'); string f = keyValue[0]; string localfile = (dataPath + f).Trim(); string path = Path.GetDirectoryName(localfile); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string fileUrl = url + f; bool canUpdate = !File.Exists(localfile); if (!canUpdate) { string remoteMd5 = keyValue[1].Trim(); string localMd5 = Utility.Md5file(localfile); canUpdate = !remoteMd5.Equals(localMd5); if (canUpdate) { File.Delete(localfile); } } if (canUpdate) { //本地缺少文件 Debug.Log(fileUrl); www = new WWW(fileUrl); yield return(www); if (!string.IsNullOrEmpty(www.error)) // if (www.error != null) { Debug.Log(www.error); LoadingLayer.Hide(); yield break; } File.WriteAllBytes(localfile, www.bytes); } } yield return(new WaitForEndOfFrame()); ResourceUpdateEnd(); }
protected override void SelectItem(PlaylistItem item) { // If the client is already in a room, update via the client. // Otherwise, update the playlist directly in preparation for it to be submitted to the API on match creation. if (client.Room != null) { loadingLayer.Show(); var multiplayerItem = new MultiplayerPlaylistItem { ID = itemToEdit ?? 0, BeatmapID = item.Beatmap.OnlineID, BeatmapChecksum = item.Beatmap.MD5Hash, RulesetID = item.RulesetID, RequiredMods = item.RequiredMods.ToArray(), AllowedMods = item.AllowedMods.ToArray() }; Task task = itemToEdit != null?client.EditPlaylistItem(multiplayerItem) : client.AddPlaylistItem(multiplayerItem); task.ContinueWith(t => { Schedule(() => { // If an error or server side trigger occurred this screen may have already exited by external means. if (!this.IsCurrentScreen()) { return; } loadingLayer.Hide(); if (t.IsFaulted) { Exception exception = t.Exception; if (exception is AggregateException ae) { exception = ae.InnerException; } Debug.Assert(exception != null); string message = exception is HubException // HubExceptions arrive with additional message context added, but we want to display the human readable message: // "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once." // We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now. ? exception.Message.Substring(exception.Message.IndexOf(':') + 1).Trim() : exception.Message; Logger.Log(message, level: LogLevel.Important); Carousel.AllowSelection = true; return; } this.Exit(); }); }); } else { Playlist.Clear(); Playlist.Add(item); this.Exit(); } }
void Start() { LoadingLayer.Hide(); PanelStack.Instance.PushPanel(LogicName.Sample); }