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
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using TMPro;
public class FillDopdownWithScenes : MonoBehaviour
{
public TMP_Dropdown dropdown;
private void Awake()
{
PopulateWithScenes();
}
void PopulateWithScenes()
{
dropdown.ClearOptions();
List<string> sceneNames = new List<string>();
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
{
string path = SceneUtility.GetScenePathByBuildIndex(i);
string name = System.IO.Path.GetFileNameWithoutExtension(path);
sceneNames.Add(name);
}
dropdown.AddOptions(sceneNames);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6c27d5a2aeea111429f65ac2225a36c6
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class FillDropdownWithDays : MonoBehaviour
{
public TMP_Dropdown dropdown;
Dictionary<int, int> daysPerMonth = new Dictionary<int, int>();
private void Awake()
{
daysPerMonth.Add(0, 31);
daysPerMonth.Add(1, 29);
daysPerMonth.Add(2, 31);
daysPerMonth.Add(3, 30);
daysPerMonth.Add(4, 31);
daysPerMonth.Add(5, 30);
daysPerMonth.Add(6, 31);
daysPerMonth.Add(7, 31);
daysPerMonth.Add(8, 30);
daysPerMonth.Add(9, 31);
daysPerMonth.Add(10, 30);
daysPerMonth.Add(11, 31);
}
public void FillDropdown(int month)
{
dropdown.ClearOptions();
List<string> days = new List<string>();
for (int i = 0; i < daysPerMonth[month]; i++)
{
days.Add((i+1).ToString());
}
dropdown.AddOptions(days);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5f79fe3d9f0326c4d959fe6de8bcac3a
@@ -0,0 +1,22 @@
using GhostSystem;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ReplaySceneLoader : MonoBehaviour
{
public GhostReplayManager replayManager;
private int currentScene;
public void LoadSceneAdditive(int sceneIndex)
{
if(SceneManager.loadedSceneCount > 1)
{
SceneManager.UnloadSceneAsync(currentScene);
}
SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive);
currentScene = sceneIndex;
// replayManager.SceneId = SceneManager.GetSceneByBuildIndex(currentScene).name; wird jetzt durch Event der Szene gelöst
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3d74842cc0a4f48419177a183e13859e