Skip to content

Commit

Permalink
create example screen in database on first start
Browse files Browse the repository at this point in the history
resourceName is now changeable
  • Loading branch information
Thiago Zimmermann committed Nov 28, 2020
1 parent f1c6822 commit c357930
Show file tree
Hide file tree
Showing 12 changed files with 911 additions and 593 deletions.
4 changes: 2 additions & 2 deletions src/Hypnonema.Client/Graphics/DuiBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public void GetState()
this.SendMessage(new { type = "getState" });
}

public void Init(string screenName, string posterUrl)
public void Init(string screenName, string posterUrl, string resourceName)
{
this.SendMessage(new { type = "init", screenName, posterUrl });
this.SendMessage(new { type = "init", screenName, posterUrl, resourceName });
}

public void Pause()
Expand Down
8 changes: 4 additions & 4 deletions src/Hypnonema.Client/Hypnonema.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="CitizenFX.Core.Client, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\CitizenFX.Core.Client.1.0.2695\lib\net45\CitizenFX.Core.Client.dll</HintPath>
<HintPath>..\..\packages\CitizenFX.Core.Client.1.0.3246\lib\net45\CitizenFX.Core.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -77,11 +77,11 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" />
<Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets'))" />
<Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" />
</Target>
</Project>
7 changes: 5 additions & 2 deletions src/Hypnonema.Client/Players/VideoPlayerPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class VideoPlayerPool : IDisposable

private readonly string duiUrl = "http://localhost:9414";

private readonly string resourceName = string.Empty;

private readonly int duiWidth = (int)Screen.Width;

private readonly string posterUrl = string.Empty;
Expand All @@ -27,7 +29,8 @@ public VideoPlayerPool(string duiUrl, int duiWidth = 1280, int duiHeight = 720)
this.duiUrl = duiUrl;
this.duiWidth = duiWidth;
this.duiHeight = duiHeight;
this.posterUrl = API.GetResourceMetadata(API.GetCurrentResourceName(), "hypnonema_poster_url", 0);
this.resourceName = API.GetCurrentResourceName();
this.posterUrl = API.GetResourceMetadata(this.resourceName, "hypnonema_poster_url", 0);
}

~VideoPlayerPool()
Expand Down Expand Up @@ -64,7 +67,7 @@ public async Task<IVideoPlayer> CreateVideoPlayerAsync(Shared.Models.Screen scre
await BaseScript.Delay(1000);

// Debug.WriteLine("sending init..");
browser.Init(screen.Name, this.posterUrl);
browser.Init(screen.Name, this.posterUrl, this.resourceName);

if (!screen.Is3DRendered)
return CreateVideoPlayer2D(browser, screen);
Expand Down
4 changes: 2 additions & 2 deletions src/Hypnonema.Client/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CitizenFX.Core.Client" version="1.0.2695" targetFramework="net452" />
<package id="Nerdbank.GitVersioning" version="3.1.91" targetFramework="net452" developmentDependency="true" />
<package id="CitizenFX.Core.Client" version="1.0.3246" targetFramework="net452" />
<package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="net452" developmentDependency="true" />
</packages>
Loading

0 comments on commit c357930

Please sign in to comment.