HeavenStudioPlus/Assets/Scripts/LevelEditor/Editor.cs
2022-01-10 19:17:29 -05:00

55 lines
No EOL
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace RhythmHeavenMania.Editor
{
public class Editor : MonoBehaviour
{
private Initializer Initializer;
[SerializeField] private Canvas MainCanvas;
[SerializeField] public Camera EditorCamera;
[Header("Rect")]
[SerializeField] private RenderTexture ScreenRenderTexture;
[SerializeField] private RawImage Screen;
[SerializeField] private RectTransform GridGameSelector;
[Header("Components")]
[SerializeField] private Timeline Timeline;
public static Editor instance { get; private set; }
private void Start()
{
instance = this;
Initializer = GetComponent<Initializer>();
}
public void Init()
{
GameManager.instance.GameCamera.targetTexture = ScreenRenderTexture;
GameManager.instance.CursorCam.targetTexture = ScreenRenderTexture;
Screen.texture = ScreenRenderTexture;
GameManager.instance.Init();
Timeline.Init();
for (int i = 0; i < EventCaller.instance.minigames.Count; i++)
{
GameObject GameIcon_ = Instantiate(GridGameSelector.GetChild(0).gameObject, GridGameSelector);
GameIcon_.GetComponent<Image>().sprite = GameIcon(EventCaller.instance.minigames[i].name);
GameIcon_.gameObject.SetActive(true);
GameIcon_.name = EventCaller.instance.minigames[i].displayName;
}
}
public static Sprite GameIcon(string name)
{
return Resources.Load<Sprite>($"Sprites/Editor/GameIcons/{name}");
}
}
}