-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSceneManager.cs
53 lines (46 loc) · 1.39 KB
/
SceneManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MiniJSON_VIDE;
using PointClick;
/// <summary>
/// Switching between frames. Managing hotspots.
/// </summary>
public class SceneManager : MonoBehaviour
{
public SceneManager Instance;
public void Awake()
{
Instance = this;
}
// Start is called before the first frame update
void Start()
{
List<string> gameFile = FileManager.ReadTextAsset("game");
Debug.Log(string.Join("\n", gameFile));
object data = DiagJson.Deserialize(string.Join("\n",gameFile));
ParseGameFile((Dictionary<string, object>) data);
}
// Update is called once per frame
void Update()
{
}
private void ParseGameFile(Dictionary<string, object> data)
{
List<SceneLayout> Places = new();
List<Item> Items = new();
/* string name, description;
string[] items, string[] places, string*/
foreach(var item in data.Keys)
{
if (item.Contains("place:"))
{
string label = item.Split(':')[1];
Debug.Log($"Processing the place '{label}'\n");
Dictionary<string, object> tmpdict = (Dictionary<string, object>)data[item];
tmpdict.Add("label", label);
Places.Add(new SceneLayout(tmpdict));
}
}
}
}