Skip to content

Commit

Permalink
Fix crash when ddrag has updated but cdrag has not
Browse files Browse the repository at this point in the history
Fix scoreboard image loading
  • Loading branch information
floh22 committed Jul 21, 2021
1 parent d905be9 commit f9bc19e
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 29 deletions.
4 changes: 2 additions & 2 deletions LCUSharp/LCUSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>1.4.6.0</AssemblyVersion>
<FileVersion>1.4.6.21197</FileVersion>
<AssemblyVersion>1.4.7.0</AssemblyVersion>
<FileVersion>1.4.7.21201</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions LeagueBroadcast.Common/LeagueBroadcast.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>1.4.7.0</AssemblyVersion>
<FileVersion>1.4.7.21197</FileVersion>
<AssemblyVersion>1.4.9.0</AssemblyVersion>
<FileVersion>1.4.9.21201</FileVersion>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions LeagueBroadcast.Farsight/LeagueBroadcast.Farsight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<AssemblyVersion>1.4.13.0</AssemblyVersion>
<FileVersion>1.4.13.21197</FileVersion>
<AssemblyVersion>1.4.15.0</AssemblyVersion>
<FileVersion>1.4.15.21201</FileVersion>
<OutputType>Library</OutputType>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions LeagueBroadcast.Trinket/LeagueBroadcast.Trinket.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>1.4.3.0</AssemblyVersion>
<FileVersion>1.4.3.21197</FileVersion>
<AssemblyVersion>1.4.4.0</AssemblyVersion>
<FileVersion>1.4.4.21201</FileVersion>
<OutputType>Library</OutputType>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions LeagueBroadcast.Update/LeagueBroadcast.Update.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyVersion>1.4.7.0</AssemblyVersion>
<FileVersion>1.4.7.21197</FileVersion>
<AssemblyVersion>1.4.9.0</AssemblyVersion>
<FileVersion>1.4.9.21201</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
20 changes: 14 additions & 6 deletions LeagueBroadcast/Common/Data/Provider/DataDragon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,20 @@ public static void DownloadFile(string uri, string path)

client.DownloadDataCompleted += (sender, eventArgs) =>
{
byte[] fileData = eventArgs.Result;
using FileStream fileStream = new FileStream(path, FileMode.Create);
fileStream.Write(fileData, 0, fileData.Length);
client.Dispose();
Log.Verbose($"{uri} downloaded");
FileDownloadComplete.Invoke(null, EventArgs.Empty);
try
{
byte[] fileData = eventArgs.Result;
using FileStream fileStream = new FileStream(path, FileMode.Create);
fileStream.Write(fileData, 0, fileData.Length);
client.Dispose();
Log.Verbose($"{uri} downloaded");
FileDownloadComplete.Invoke(null, EventArgs.Empty);
} catch(Exception e)
{
Log.Warn($"Could not download {uri}\n{eventArgs.Error.Message}");
}


};
try
{
Expand Down
4 changes: 2 additions & 2 deletions LeagueBroadcast/LeagueBroadcast.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<RepositoryUrl>https://github.com/floh22/LeagueBroadcast</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageIcon>BE_icon.png</PackageIcon>
<AssemblyVersion>1.4.50.0</AssemblyVersion>
<FileVersion>1.4.50.21197</FileVersion>
<AssemblyVersion>1.4.53.0</AssemblyVersion>
<FileVersion>1.4.53.21201</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Overlays/ingame/src/visual/InfoPageVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class InfoPageVisual extends VisualElement {
this.BackgroundRect.destroy();
this.BackgroundRect = null;
}
//Reset old Texture
//Load Texture only if it does not already exist
if (this.BackgroundImage === null || this.BackgroundImage === undefined) {
this.scene.load.image('infoBg', 'frontend/backgrounds/InfoPage.png');
}
Expand All @@ -160,7 +160,7 @@ export default class InfoPageVisual extends VisualElement {
this.BackgroundImage = null;
this.scene.textures.remove('infoBg');
}
//Reset old Video
//Load Video only if it does not already exist
if (this.BackgroundVideo === null || this.BackgroundVideo === undefined) {
this.scene.load.video('infoBgVideo', 'frontend/backgrounds/InfoPage.mp4');
}
Expand Down
14 changes: 5 additions & 9 deletions Overlays/ingame/src/visual/ScoreboardVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,9 @@ export default class ScoreboardVisual extends VisualElement {
this.BackgroundRect = null;
}
//Reset old Texture
if (this.scene.textures.exists('scoreBg')) {
this.RemoveVisualComponent(this.BackgroundImage);
this.BackgroundImage?.destroy();
this.BackgroundImage = null;
this.scene.textures.remove('scoreBg');
if (this.BackgroundImage === null || this.BackgroundImage === undefined) {
this.scene.load.image('scoreBg', 'frontend/backgrounds/Score.png');
}
this.scene.load.image('scoreBg', 'frontend/backgrounds/Score.png');
}
//Background Video
else if (newConfig.Background.UseVideo) {
Expand Down Expand Up @@ -753,7 +749,7 @@ export default class ScoreboardVisual extends VisualElement {
//Background Image support
this.scene.load.on(`filecomplete-image-scoreBg`, () => {
this.BackgroundImage = this.scene.make.sprite({ x: ScoreboardVisual.GetConfig()!.Position.X, y: ScoreboardVisual.GetConfig()!.Position.Y, key: 'scoreBg', add: true });
this.BackgroundImage.setOrigin(0.5, 0);
this.BackgroundImage.setOrigin(0.5, 1);
this.BackgroundImage.setDepth(-1);
this.BackgroundImage.setMask(ScoreboardVisual.GetConfig()?.Background.UseAlpha ? this.ImgMask : this.GeoMask);
this.AddVisualComponent(this.BackgroundImage);
Expand All @@ -770,13 +766,13 @@ export default class ScoreboardVisual extends VisualElement {
}
// @ts-ignore
this.BackgroundVideo = this.scene.add.video(ScoreboardVisual.GetConfig()!.Position.X, ScoreboardVisual.GetConfig()!.Position.Y, 'scoreBgVideo', false, true);
this.BackgroundVideo.setOrigin(0.5, 0);
this.BackgroundVideo.setOrigin(0.5, 1);
this.BackgroundVideo.setMask(ScoreboardVisual.GetConfig()?.Background.UseAlpha ? this.ImgMask : this.GeoMask);
this.BackgroundVideo.setLoop(true);
this.BackgroundVideo.setDepth(-1);
this.BackgroundVideo.play();
this.AddVisualComponent(this.BackgroundVideo);
if (!this.isActive && !this.isShowing) {
if (!this.isActive || this.isHiding) {
this.BackgroundVideo.alpha = 0;
}
});
Expand Down

0 comments on commit f9bc19e

Please sign in to comment.