2022-01-03 22:42:43 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
namespace RhythmHeavenMania.Editor
|
|
|
|
{
|
|
|
|
public class Editor : MonoBehaviour
|
|
|
|
{
|
|
|
|
private Initializer Initializer;
|
|
|
|
|
2022-01-06 00:11:33 +00:00
|
|
|
[SerializeField] private Canvas MainCanvas;
|
2022-01-07 23:51:08 +00:00
|
|
|
[SerializeField] public Camera EditorCamera;
|
2022-01-06 00:11:33 +00:00
|
|
|
|
2022-01-03 22:42:43 +00:00
|
|
|
[Header("Rect")]
|
|
|
|
[SerializeField] private RenderTexture ScreenRenderTexture;
|
|
|
|
[SerializeField] private RawImage Screen;
|
2022-01-09 23:35:55 +00:00
|
|
|
[SerializeField] private RectTransform GridGameSelector;
|
2022-01-03 22:42:43 +00:00
|
|
|
|
2022-01-06 00:11:33 +00:00
|
|
|
[Header("Components")]
|
|
|
|
[SerializeField] private Timeline Timeline;
|
|
|
|
|
2022-01-12 03:29:27 +00:00
|
|
|
public static List<TimelineEventObj> EventObjs = new List<TimelineEventObj>();
|
|
|
|
|
2022-01-07 23:51:08 +00:00
|
|
|
public static Editor instance { get; private set; }
|
|
|
|
|
2022-01-03 22:42:43 +00:00
|
|
|
private void Start()
|
|
|
|
{
|
2022-01-07 23:51:08 +00:00
|
|
|
instance = this;
|
2022-01-03 22:42:43 +00:00
|
|
|
Initializer = GetComponent<Initializer>();
|
2022-01-06 00:11:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
{
|
2022-01-03 22:42:43 +00:00
|
|
|
GameManager.instance.GameCamera.targetTexture = ScreenRenderTexture;
|
|
|
|
GameManager.instance.CursorCam.targetTexture = ScreenRenderTexture;
|
|
|
|
Screen.texture = ScreenRenderTexture;
|
2022-01-06 00:11:33 +00:00
|
|
|
|
2022-01-08 16:42:48 +00:00
|
|
|
GameManager.instance.Init();
|
2022-01-06 00:11:33 +00:00
|
|
|
Timeline.Init();
|
2022-01-09 23:35:55 +00:00
|
|
|
|
|
|
|
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);
|
2022-01-11 00:17:29 +00:00
|
|
|
GameIcon_.name = EventCaller.instance.minigames[i].displayName;
|
2022-01-09 23:35:55 +00:00
|
|
|
}
|
2022-01-11 02:06:13 +00:00
|
|
|
|
|
|
|
GridGameSelector.GetComponent<GridGameSelector>().SelectGame("Game Manager", 1);
|
2022-01-09 23:35:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Sprite GameIcon(string name)
|
|
|
|
{
|
|
|
|
return Resources.Load<Sprite>($"Sprites/Editor/GameIcons/{name}");
|
2022-01-03 22:42:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|