-
Notifications
You must be signed in to change notification settings - Fork 0
/
SceneLoaderMain.cs
43 lines (37 loc) · 1.2 KB
/
SceneLoaderMain.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
using System.Collections.Generic;
using System.Collections;
using UnityEngine;
using FairyGUI;
/// <summary>
/// Demonstrated the simple flow of a game.
/// </summary>
public class SceneLoaderMain : MonoBehaviour
{
public string UiPackage = "CutScene";
public string FirstSceneToLoad = "scene1";
public LevelSceneAndInterface[] levelsScenesAndInterfaces;
Dictionary <string, string> convertedDictionary;
void Start()
{
Application.targetFrameRate = 60;
Stage.inst.onKeyDown.Add(OnKeyDown);
UIPackage.AddPackage("UI/" + UiPackage);
SceneAndUiManager.inst.Init();
convertedDictionary = new Dictionary<string, string>();
foreach(LevelSceneAndInterface asThis in levelsScenesAndInterfaces)
{
convertedDictionary[asThis.levelName] = asThis.interfaceName;
Debug.Log(asThis.levelName);
Debug.Log(asThis.interfaceName);
}
SceneAndUiManager.inst.SetlevelScenesInterfacesIndex(convertedDictionary);
SceneAndUiManager.inst.LoadLevel(FirstSceneToLoad);
}
void OnKeyDown(EventContext context)
{
if (context.inputEvent.keyCode == KeyCode.Escape)
{
Application.Quit();
}
}
}