Added Observation Scene to show the Replay

This commit is contained in:
Thorbjoern
2025-05-26 18:56:25 +02:00
parent 37c6bd8269
commit c304bc0e10
211 changed files with 60070 additions and 14 deletions
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System;
using System.Reactive;
using UnityEngine.UI;
using Postgrest;
namespace GhostSystem
{
@@ -30,6 +31,8 @@ namespace GhostSystem
private bool isPlaying = false;
private float playbackTime = 0f;
private float totalDuration = 0f;
private string firstTimestamp = "";
private string lastTimestamp = "";
private Dictionary<string, List<FrameModel>> objectTracks = new();
@@ -82,6 +85,8 @@ namespace GhostSystem
public async Task LoadFrames()
{
Debug.Log("SceneId used in query: " + SceneId);
Debug.Log("StartTime filter: " + dateSelector.selectedDateTime().ToString("o"));
var query = SupabaseManager.instance.supabase
.From<FrameModel>()
@@ -115,6 +120,8 @@ namespace GhostSystem
if (frames.Count > 1)
{
totalDuration = (float)(frames.Last().TimestampParsed - frames.First().TimestampParsed).TotalSeconds;
firstTimestamp = frames.First().TimestampParsed.ToLongTimeString();
lastTimestamp = frames.Last().TimestampParsed.ToLongTimeString();
}
}
@@ -122,7 +129,7 @@ namespace GhostSystem
{
isPlaying = true;
playbackTime = 0f;
Debug.LogError("Replay started: total duration = " + totalDuration);
Debug.LogError("Replay started: total duration = " + totalDuration + " s, First: " + firstTimestamp + ", Last: " + lastTimestamp);
}
public void PauseReplay() => isPlaying = false; // Für das Pause UI-Element, um das Replay zu pausieren
@@ -202,12 +209,6 @@ namespace GhostSystem
}
}
/*public void OnSliderValueChanged(float value)
{
if (totalDuration <= 0f) return;
isScrubbing = true;
SetPlaybackTime(value * totalDuration);
}*/
public void SetSliderScrubValue(float sliderValue)
{
if (isScrubbing)