Skip to content
Snippets Groups Projects
Commit 2ad1121b authored by Falampe's avatar Falampe
Browse files

added static presentations.

if there is a folder called "presentation" within the theme all jpg Pictures will be loaded on the whiteboard on themechange thru the website.
parent a050369c
No related branches found
No related tags found
No related merge requests found
Assets/StreamingAssets/Config~/theme/achterMai/presentation/tagDerBefreiung.jpg

242 KiB

Assets/StreamingAssets/Config~/theme/achterMai/presentation/tagDerNiederlage.jpg

216 KiB

using Codice.Client.BaseCommands.IssueTracker;
using System;
using System.IO;
using TeachR.ApplicationManager;
using TeachR.WebCommunication;
using UnityEngine;
using TeachR.StructureTree;
namespace TeachR.Displays
{
......@@ -13,6 +16,7 @@ namespace TeachR.Displays
[RuntimeInitializeOnLoadMethod]
private static void Init()
{
ImpulseController.ThemeChangedHook += LoadPresentationOnThemeChange;
CoachRtc.Persistent.On("loadPresentation", json => Load(json.GetValue<PresentationData>()));
CoachRtc.Persistent.On("changeSlide", json => Presentation.Slide = int.Parse(json.content));
CoachRtc.Persistent.On("clearPresentation", _ => Presentation = null);
......@@ -26,7 +30,6 @@ namespace TeachR.Displays
private static void Load(PresentationData json)
{
Presentation = new Presentation(json);
Debug.Log(Presentation.ToString());
OnLoad?.Invoke();
}
......@@ -40,5 +43,26 @@ namespace TeachR.Displays
if (Presentation != null) Presentation.Prev();
else Debug.Log("No slides loaded yet");
}
private static string folderPath;
private static string[] filePath;
// Look into themeFolder and load jpg-pictures to posters in classroom.
// If folder does not exist or is empty, no posters will be loaded.
public static async void LoadPresentationOnThemeChange(string fromFolder)
{
Debug.Log("ICH LEBE!");
folderPath = Path.Combine(Application.streamingAssetsPath, "Config~", fromFolder, "presentation");
if (!Directory.Exists(folderPath)) return;
filePath = Directory.GetFiles(folderPath, "*.jpg");// mehr dateiformate zulassen
if (filePath.Length > 0)
{
Presentation = await Presentation.FromFiles(filePath);
}
else
{
Debug.Log("No postercontent found");
}
}
}
}
\ No newline at end of file
......@@ -10,7 +10,8 @@
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:5797ac88e999e2e42a3aa9bee208f62f",
"GUID:f50e0b5d75e4c9348a7d42a1c5382977",
"GUID:0ced200546f7ed84e923e5314f07fa40"
"GUID:0ced200546f7ed84e923e5314f07fa40",
"GUID:71eb3b62d9c24a443ae2633f4a99eb65"
],
"includePlatforms": [],
"excludePlatforms": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment