1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Merge pull request #10026 from peppy/update-framework

This commit is contained in:
Dean Herbert 2020-09-03 16:10:43 +09:00 committed by GitHub
commit 19de6124b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 41 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.819.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.903.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -218,14 +219,13 @@ namespace osu.Game.Overlays
Schedule(() => Schedule(() =>
{ {
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present. // TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
channelManager.JoinedChannels.ItemsAdded += onChannelAddedToJoinedChannels; channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels;
foreach (Channel channel in channelManager.JoinedChannels) foreach (Channel channel in channelManager.JoinedChannels)
ChannelTabControl.AddChannel(channel); ChannelTabControl.AddChannel(channel);
channelManager.AvailableChannels.ItemsAdded += availableChannelsChanged; channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged; availableChannelsChanged(null, null);
ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
currentChannel = channelManager.CurrentChannel.GetBoundCopy(); currentChannel = channelManager.CurrentChannel.GetBoundCopy();
currentChannel.BindValueChanged(currentChannelChanged, true); currentChannel.BindValueChanged(currentChannelChanged, true);
@ -384,34 +384,41 @@ namespace osu.Game.Overlays
base.PopOut(); base.PopOut();
} }
private void onChannelAddedToJoinedChannels(IEnumerable<Channel> channels) private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
{ {
foreach (Channel channel in channels) switch (args.Action)
ChannelTabControl.AddChannel(channel);
}
private void onChannelRemovedFromJoinedChannels(IEnumerable<Channel> channels)
{
foreach (Channel channel in channels)
{ {
ChannelTabControl.RemoveChannel(channel); case NotifyCollectionChangedAction.Add:
foreach (Channel channel in args.NewItems.Cast<Channel>())
ChannelTabControl.AddChannel(channel);
break;
var loaded = loadedChannels.Find(c => c.Channel == channel); case NotifyCollectionChangedAction.Remove:
foreach (Channel channel in args.OldItems.Cast<Channel>())
{
ChannelTabControl.RemoveChannel(channel);
if (loaded != null) var loaded = loadedChannels.Find(c => c.Channel == channel);
{
loadedChannels.Remove(loaded);
// Because the container is only cleared in the async load callback of a new channel, it is forcefully cleared if (loaded != null)
// to ensure that the previous channel doesn't get updated after it's disposed {
currentChannelContainer.Remove(loaded); loadedChannels.Remove(loaded);
loaded.Dispose();
} // Because the container is only cleared in the async load callback of a new channel, it is forcefully cleared
// to ensure that the previous channel doesn't get updated after it's disposed
currentChannelContainer.Remove(loaded);
loaded.Dispose();
}
}
break;
} }
} }
private void availableChannelsChanged(IEnumerable<Channel> channels) private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
=> ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels); {
ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
}
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
@ -420,10 +427,8 @@ namespace osu.Game.Overlays
if (channelManager != null) if (channelManager != null)
{ {
channelManager.CurrentChannel.ValueChanged -= currentChannelChanged; channelManager.CurrentChannel.ValueChanged -= currentChannelChanged;
channelManager.JoinedChannels.ItemsAdded -= onChannelAddedToJoinedChannels; channelManager.JoinedChannels.CollectionChanged -= joinedChannelsChanged;
channelManager.JoinedChannels.ItemsRemoved -= onChannelRemovedFromJoinedChannels; channelManager.AvailableChannels.CollectionChanged -= availableChannelsChanged;
channelManager.AvailableChannels.ItemsAdded -= availableChannelsChanged;
channelManager.AvailableChannels.ItemsRemoved -= availableChannelsChanged;
} }
} }

View File

@ -163,8 +163,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything); scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything);
}, true); }, true);
windowModes.ItemsAdded += _ => windowModesChanged(); windowModes.CollectionChanged += (sender, args) => windowModesChanged();
windowModes.ItemsRemoved += _ => windowModesChanged();
windowModesChanged(); windowModesChanged();
} }

View File

@ -112,8 +112,7 @@ namespace osu.Game.Screens.Edit.Timing
}; };
controlPoints = group.ControlPoints.GetBoundCopy(); controlPoints = group.ControlPoints.GetBoundCopy();
controlPoints.ItemsAdded += _ => createChildren(); controlPoints.CollectionChanged += (_, __) => createChildren();
controlPoints.ItemsRemoved += _ => createChildren();
createChildren(); createChildren();
} }

View File

@ -124,8 +124,7 @@ namespace osu.Game.Screens.Edit.Timing
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true); selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
controlGroups = Beatmap.Value.Beatmap.ControlPointInfo.Groups.GetBoundCopy(); controlGroups = Beatmap.Value.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
controlGroups.ItemsAdded += _ => createContent(); controlGroups.CollectionChanged += (sender, args) => createContent();
controlGroups.ItemsRemoved += _ => createContent();
createContent(); createContent();
} }

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -53,8 +54,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
protected override void LoadComplete() protected override void LoadComplete()
{ {
rooms.ItemsAdded += addRooms; rooms.CollectionChanged += roomsChanged;
rooms.ItemsRemoved += removeRooms;
roomManager.RoomsUpdated += updateSorting; roomManager.RoomsUpdated += updateSorting;
rooms.BindTo(roomManager.Rooms); rooms.BindTo(roomManager.Rooms);
@ -82,6 +82,20 @@ namespace osu.Game.Screens.Multi.Lounge.Components
}); });
} }
private void roomsChanged(object sender, NotifyCollectionChangedEventArgs args)
{
switch (args.Action)
{
case NotifyCollectionChangedAction.Add:
addRooms(args.NewItems.Cast<Room>());
break;
case NotifyCollectionChangedAction.Remove:
removeRooms(args.OldItems.Cast<Room>());
break;
}
}
private void addRooms(IEnumerable<Room> rooms) private void addRooms(IEnumerable<Room> rooms)
{ {
foreach (var room in rooms) foreach (var room in rooms)

View File

@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.819.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.903.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" />
<PackageReference Include="Sentry" Version="2.1.6" /> <PackageReference Include="Sentry" Version="2.1.6" />
<PackageReference Include="SharpCompress" Version="0.26.0" /> <PackageReference Include="SharpCompress" Version="0.26.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.819.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.903.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
@ -80,7 +80,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.819.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.903.0" />
<PackageReference Include="SharpCompress" Version="0.26.0" /> <PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />