2022-01-30 12:03:37 +00:00
|
|
|
using System;
|
|
|
|
using System.IO;
|
2022-01-03 22:42:43 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
2022-01-30 12:03:37 +00:00
|
|
|
using System.Threading.Tasks;
|
2022-01-03 22:42:43 +00:00
|
|
|
|
2022-01-30 12:03:37 +00:00
|
|
|
using UnityEngine;
|
2022-01-03 22:42:43 +00:00
|
|
|
using UnityEngine.UI;
|
2022-01-30 12:03:37 +00:00
|
|
|
using UnityEngine.Networking;
|
2022-01-03 22:42:43 +00:00
|
|
|
|
2022-01-14 02:33:51 +00:00
|
|
|
using Newtonsoft.Json;
|
2022-01-16 23:29:45 +00:00
|
|
|
using TMPro;
|
2022-01-22 10:44:19 +00:00
|
|
|
using Starpelly;
|
2022-01-30 12:03:37 +00:00
|
|
|
using SFB;
|
2022-01-14 02:33:51 +00:00
|
|
|
|
2023-01-24 19:31:49 +00:00
|
|
|
using HeavenStudio.Common;
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Editor.Track;
|
|
|
|
using HeavenStudio.Util;
|
2023-01-24 19:31:49 +00:00
|
|
|
using HeavenStudio.StudioDance;
|
2022-01-30 12:03:37 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
using Jukebox;
|
|
|
|
|
2022-01-30 12:03:37 +00:00
|
|
|
using System.IO.Compression;
|
|
|
|
using System.Text;
|
2022-01-28 02:50:57 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Editor
|
2022-01-03 22:42:43 +00:00
|
|
|
{
|
|
|
|
public class Editor : MonoBehaviour
|
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
private GameInitializer Initializer;
|
2022-01-03 22:42:43 +00:00
|
|
|
|
2022-06-28 19:57:32 +00:00
|
|
|
[SerializeField] public 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-02-04 03:25:18 +00:00
|
|
|
public RectTransform eventSelectorBG;
|
2022-01-03 22:42:43 +00:00
|
|
|
|
2022-01-06 00:11:33 +00:00
|
|
|
[Header("Components")]
|
|
|
|
[SerializeField] private Timeline Timeline;
|
2022-01-16 23:29:45 +00:00
|
|
|
[SerializeField] private TMP_Text GameEventSelectorTitle;
|
2022-10-13 16:20:48 +00:00
|
|
|
[SerializeField] private TMP_Text BuildDateDisplay;
|
2023-01-24 19:31:49 +00:00
|
|
|
[SerializeField] public StudioDanceManager StudioDanceManager;
|
2022-01-06 00:11:33 +00:00
|
|
|
|
2022-01-15 07:08:23 +00:00
|
|
|
[Header("Toolbar")]
|
|
|
|
[SerializeField] private Button NewBTN;
|
|
|
|
[SerializeField] private Button OpenBTN;
|
|
|
|
[SerializeField] private Button SaveBTN;
|
2022-01-22 10:44:19 +00:00
|
|
|
[SerializeField] private Button UndoBTN;
|
|
|
|
[SerializeField] private Button RedoBTN;
|
2022-01-29 21:59:20 +00:00
|
|
|
[SerializeField] private Button MusicSelectBTN;
|
2022-02-02 08:36:20 +00:00
|
|
|
[SerializeField] private Button FullScreenBTN;
|
2022-02-28 08:38:43 +00:00
|
|
|
[SerializeField] private Button TempoFinderBTN;
|
2022-06-30 01:58:21 +00:00
|
|
|
[SerializeField] private Button SnapDiagBTN;
|
2022-08-27 03:43:01 +00:00
|
|
|
[SerializeField] private Button ChartParamBTN;
|
2022-01-15 07:08:23 +00:00
|
|
|
|
2022-07-04 16:57:19 +00:00
|
|
|
[SerializeField] private Button EditorThemeBTN;
|
|
|
|
[SerializeField] private Button EditorSettingsBTN;
|
|
|
|
|
2022-08-27 03:43:01 +00:00
|
|
|
[Header("Dialogs")]
|
|
|
|
[SerializeField] private Dialog[] Dialogs;
|
|
|
|
|
2022-03-01 21:11:19 +00:00
|
|
|
[Header("Tooltip")]
|
|
|
|
public TMP_Text tooltipText;
|
|
|
|
|
2022-01-30 12:03:37 +00:00
|
|
|
[Header("Properties")]
|
|
|
|
private bool changedMusic = false;
|
2022-02-03 22:20:26 +00:00
|
|
|
private bool loadedMusic = false;
|
2022-01-30 12:03:37 +00:00
|
|
|
private string currentRemixPath = "";
|
2022-02-04 22:16:22 +00:00
|
|
|
private string remixName = "";
|
2022-07-10 21:39:14 +00:00
|
|
|
public bool fullscreen;
|
2022-02-03 02:09:50 +00:00
|
|
|
public bool discordDuringTesting = false;
|
2022-02-08 01:07:03 +00:00
|
|
|
public bool canSelect = true;
|
2022-06-04 03:15:05 +00:00
|
|
|
public bool editingInputField = false;
|
2022-08-27 03:43:01 +00:00
|
|
|
public bool inAuthorativeMenu = false;
|
2022-07-10 21:39:14 +00:00
|
|
|
public bool isCursorEnabled = true;
|
2023-01-24 19:31:49 +00:00
|
|
|
public bool isDiscordEnabled = true;
|
2022-01-12 03:29:27 +00:00
|
|
|
|
2022-08-27 03:43:01 +00:00
|
|
|
public bool isShortcutsEnabled { get { return (!inAuthorativeMenu) && (!editingInputField); } }
|
|
|
|
|
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;
|
2023-05-07 20:33:15 +00:00
|
|
|
Initializer = GetComponent<GameInitializer>();
|
2022-02-08 01:07:03 +00:00
|
|
|
canSelect = true;
|
2022-01-06 00:11:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
{
|
2023-03-11 04:51:22 +00:00
|
|
|
GameManager.instance.StaticCamera.targetTexture = ScreenRenderTexture;
|
2022-01-03 22:42:43 +00:00
|
|
|
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
|
|
|
|
2023-01-07 03:59:54 +00:00
|
|
|
foreach (var minigame in EventCaller.instance.minigames)
|
|
|
|
AddIcon(minigame);
|
2022-01-11 02:06:13 +00:00
|
|
|
|
2022-01-23 03:40:53 +00:00
|
|
|
Tooltip.AddTooltip(NewBTN.gameObject, "New <color=#adadad>[Ctrl+N]</color>");
|
|
|
|
Tooltip.AddTooltip(OpenBTN.gameObject, "Open <color=#adadad>[Ctrl+O]</color>");
|
|
|
|
Tooltip.AddTooltip(SaveBTN.gameObject, "Save Project <color=#adadad>[Ctrl+S]</color>\nSave Project As <color=#adadad>[Ctrl+Alt+S]</color>");
|
|
|
|
Tooltip.AddTooltip(UndoBTN.gameObject, "Undo <color=#adadad>[Ctrl+Z]</color>");
|
|
|
|
Tooltip.AddTooltip(RedoBTN.gameObject, "Redo <color=#adadad>[Ctrl+Y or Ctrl+Shift+Z]</color>");
|
2022-01-29 21:59:20 +00:00
|
|
|
Tooltip.AddTooltip(MusicSelectBTN.gameObject, "Music Select");
|
2022-02-02 08:36:20 +00:00
|
|
|
Tooltip.AddTooltip(FullScreenBTN.gameObject, "Preview <color=#adadad>[Tab]</color>");
|
2022-02-28 08:38:43 +00:00
|
|
|
Tooltip.AddTooltip(TempoFinderBTN.gameObject, "Tempo Finder");
|
2022-06-30 01:58:21 +00:00
|
|
|
Tooltip.AddTooltip(SnapDiagBTN.gameObject, "Snap Settings");
|
2022-08-27 03:43:01 +00:00
|
|
|
Tooltip.AddTooltip(ChartParamBTN.gameObject, "Remix Properties");
|
2022-01-30 23:40:12 +00:00
|
|
|
|
2022-07-04 16:57:19 +00:00
|
|
|
Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings <color=#adadad>[Ctrl+Shift+O]</color>");
|
2022-01-30 23:40:12 +00:00
|
|
|
UpdateEditorStatus(true);
|
2022-10-13 16:20:48 +00:00
|
|
|
|
|
|
|
BuildDateDisplay.text = GlobalGameManager.buildTime;
|
2023-01-24 19:31:49 +00:00
|
|
|
isCursorEnabled = PersistentDataManager.gameSettings.editorCursorEnable;
|
|
|
|
isDiscordEnabled = PersistentDataManager.gameSettings.discordRPCEnable;
|
2023-03-12 02:56:26 +00:00
|
|
|
GameManager.instance.CursorCam.enabled = isCursorEnabled;
|
2022-01-09 23:35:55 +00:00
|
|
|
}
|
|
|
|
|
2023-01-07 03:59:54 +00:00
|
|
|
public void AddIcon(Minigames.Minigame minigame)
|
|
|
|
{
|
2023-05-21 17:35:00 +00:00
|
|
|
if (minigame.hidden) return;
|
2023-01-07 03:59:54 +00:00
|
|
|
GameObject GameIcon_ = Instantiate(GridGameSelector.GetChild(0).gameObject, GridGameSelector);
|
|
|
|
GameIcon_.GetComponent<Image>().sprite = GameIcon(minigame.name);
|
|
|
|
GameIcon_.GetComponent<GridGameSelectorGame>().MaskTex = GameIconMask(minigame.name);
|
|
|
|
GameIcon_.GetComponent<GridGameSelectorGame>().UnClickIcon();
|
|
|
|
GameIcon_.gameObject.SetActive(true);
|
|
|
|
GameIcon_.name = minigame.displayName;
|
|
|
|
}
|
|
|
|
|
2022-02-03 07:28:14 +00:00
|
|
|
public void LateUpdate()
|
2022-01-14 22:46:14 +00:00
|
|
|
{
|
2022-07-02 02:03:15 +00:00
|
|
|
#region Keyboard Shortcuts
|
2022-08-27 03:43:01 +00:00
|
|
|
if (isShortcutsEnabled)
|
2022-02-02 08:36:20 +00:00
|
|
|
{
|
2022-07-02 02:03:15 +00:00
|
|
|
if (Input.GetKeyDown(KeyCode.Tab))
|
|
|
|
{
|
2022-06-04 03:15:05 +00:00
|
|
|
Fullscreen();
|
2022-07-02 02:03:15 +00:00
|
|
|
}
|
2022-02-02 08:36:20 +00:00
|
|
|
|
2022-09-18 20:48:14 +00:00
|
|
|
if (Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace))
|
2022-06-04 03:15:05 +00:00
|
|
|
{
|
|
|
|
List<TimelineEventObj> ev = new List<TimelineEventObj>();
|
|
|
|
for (int i = 0; i < Selections.instance.eventsSelected.Count; i++) ev.Add(Selections.instance.eventsSelected[i]);
|
|
|
|
CommandManager.instance.Execute(new Commands.Deletion(ev));
|
|
|
|
}
|
2022-07-02 02:03:15 +00:00
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.LeftControl))
|
|
|
|
{
|
|
|
|
if (Input.GetKeyDown(KeyCode.Z))
|
|
|
|
{
|
|
|
|
if (Input.GetKey(KeyCode.LeftShift))
|
|
|
|
CommandManager.instance.Redo();
|
|
|
|
else
|
|
|
|
CommandManager.instance.Undo();
|
|
|
|
}
|
|
|
|
else if (Input.GetKeyDown(KeyCode.Y))
|
|
|
|
{
|
|
|
|
CommandManager.instance.Redo();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.LeftShift))
|
|
|
|
{
|
|
|
|
if (Input.GetKeyDown(KeyCode.D))
|
|
|
|
{
|
|
|
|
ToggleDebugCam();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.LeftControl))
|
|
|
|
{
|
|
|
|
if (Input.GetKeyDown(KeyCode.N))
|
|
|
|
{
|
2022-08-27 03:43:01 +00:00
|
|
|
NewBTN.onClick.Invoke();
|
2022-07-02 02:03:15 +00:00
|
|
|
}
|
|
|
|
else if (Input.GetKeyDown(KeyCode.O))
|
|
|
|
{
|
|
|
|
OpenRemix();
|
|
|
|
}
|
|
|
|
else if (Input.GetKey(KeyCode.LeftAlt))
|
|
|
|
{
|
|
|
|
if (Input.GetKeyDown(KeyCode.S))
|
|
|
|
{
|
|
|
|
SaveRemix(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Input.GetKeyDown(KeyCode.S))
|
|
|
|
{
|
|
|
|
SaveRemix(false);
|
|
|
|
}
|
|
|
|
}
|
2022-01-22 10:44:19 +00:00
|
|
|
}
|
2022-07-02 02:03:15 +00:00
|
|
|
#endregion
|
2022-01-22 10:44:19 +00:00
|
|
|
|
|
|
|
if (CommandManager.instance.canUndo())
|
2023-01-13 22:18:11 +00:00
|
|
|
UndoBTN.transform.GetChild(0).GetComponent<Image>().color = Color.white;
|
2022-01-22 10:44:19 +00:00
|
|
|
else
|
|
|
|
UndoBTN.transform.GetChild(0).GetComponent<Image>().color = Color.gray;
|
|
|
|
|
|
|
|
if (CommandManager.instance.canRedo())
|
2023-01-13 22:18:11 +00:00
|
|
|
RedoBTN.transform.GetChild(0).GetComponent<Image>().color = Color.white;
|
2022-01-22 10:44:19 +00:00
|
|
|
else
|
|
|
|
RedoBTN.transform.GetChild(0).GetComponent<Image>().color = Color.gray;
|
|
|
|
|
2022-02-08 01:07:03 +00:00
|
|
|
if (Timeline.instance.timelineState.selected && Editor.instance.canSelect)
|
2022-01-22 10:44:19 +00:00
|
|
|
{
|
2022-02-03 22:20:26 +00:00
|
|
|
if (Input.GetMouseButtonUp(0))
|
2022-01-22 10:44:19 +00:00
|
|
|
{
|
2022-02-03 22:20:26 +00:00
|
|
|
List<TimelineEventObj> selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true && c.eligibleToMove == true);
|
2022-01-22 10:44:19 +00:00
|
|
|
|
2022-02-03 22:20:26 +00:00
|
|
|
if (selectedEvents.Count > 0)
|
2022-01-22 10:44:19 +00:00
|
|
|
{
|
2022-02-03 22:20:26 +00:00
|
|
|
List<TimelineEventObj> result = new List<TimelineEventObj>();
|
|
|
|
|
|
|
|
for (int i = 0; i < selectedEvents.Count; i++)
|
2022-01-28 02:50:57 +00:00
|
|
|
{
|
2022-07-08 21:58:58 +00:00
|
|
|
//TODO: this is in LateUpdate, so this will never run! change this to something that works properly
|
2022-07-08 16:50:23 +00:00
|
|
|
if (!(selectedEvents[i].isCreating || selectedEvents[i].wasDuplicated))
|
2022-02-03 22:20:26 +00:00
|
|
|
{
|
|
|
|
result.Add(selectedEvents[i]);
|
|
|
|
}
|
|
|
|
selectedEvents[i].OnUp();
|
2022-01-28 02:50:57 +00:00
|
|
|
}
|
2022-02-03 22:20:26 +00:00
|
|
|
CommandManager.instance.Execute(new Commands.Move(result));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-14 22:46:14 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
2022-01-15 22:52:53 +00:00
|
|
|
|
2022-06-14 05:24:41 +00:00
|
|
|
public static Texture GameIconMask(string name)
|
|
|
|
{
|
|
|
|
return Resources.Load<Texture>($"Sprites/Editor/GameIcons/{name}_mask");
|
|
|
|
}
|
|
|
|
|
2022-01-30 12:03:37 +00:00
|
|
|
#region Dialogs
|
|
|
|
|
|
|
|
public void SelectMusic()
|
|
|
|
{
|
|
|
|
var extensions = new[]
|
|
|
|
{
|
|
|
|
new ExtensionFilter("Music Files", "mp3", "ogg", "wav")
|
|
|
|
};
|
|
|
|
|
2022-06-04 03:15:45 +00:00
|
|
|
#if UNITY_STANDALONE_WINDOWS
|
2022-01-30 12:03:37 +00:00
|
|
|
StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", extensions, false, async (string[] paths) =>
|
|
|
|
{
|
|
|
|
if (paths.Length > 0)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (paths.Length == 0) return;
|
|
|
|
RiqFileHandler.WriteSong(paths[0]);
|
|
|
|
StartCoroutine(LoadMusic());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch (System.Exception e)
|
|
|
|
{
|
|
|
|
Debug.Log($"Error selecting music file: {e.Message}");
|
|
|
|
Debug.LogException(e);
|
|
|
|
GlobalGameManager.ShowErrorMessage("Error", e.Message);
|
|
|
|
return;
|
|
|
|
}
|
2022-01-30 12:03:37 +00:00
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
await Task.Yield();
|
2022-01-30 12:03:37 +00:00
|
|
|
}
|
|
|
|
);
|
2022-06-04 03:15:45 +00:00
|
|
|
#else
|
|
|
|
StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", extensions, false, async (string[] paths) =>
|
|
|
|
{
|
|
|
|
if (paths.Length > 0)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (paths.Length == 0) return;
|
|
|
|
RiqFileHandler.WriteSong(paths[0]);
|
|
|
|
StartCoroutine(LoadMusic());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch (System.Exception e)
|
|
|
|
{
|
|
|
|
Debug.Log($"Error selecting music file: {e.Message}");
|
|
|
|
Debug.LogException(e);
|
|
|
|
GlobalGameManager.ShowErrorMessage("Error", e.Message);
|
|
|
|
return;
|
|
|
|
}
|
2022-06-04 03:15:45 +00:00
|
|
|
}
|
2023-06-10 19:13:29 +00:00
|
|
|
await Task.Yield();
|
2022-06-04 03:15:45 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
#endif
|
2022-01-30 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
IEnumerator LoadMusic()
|
2022-01-30 12:03:37 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
yield return GameManager.instance.LoadMusic();
|
|
|
|
Timeline.FitToSong();
|
|
|
|
// Timeline.CreateWaveform();
|
2022-01-30 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void SaveRemix(bool saveAs = true)
|
|
|
|
{
|
|
|
|
if (saveAs == true)
|
|
|
|
{
|
|
|
|
SaveRemixFilePanel();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (currentRemixPath == string.Empty)
|
|
|
|
{
|
|
|
|
SaveRemixFilePanel();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SaveRemixFile(currentRemixPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SaveRemixFilePanel()
|
|
|
|
{
|
|
|
|
var extensions = new[]
|
|
|
|
{
|
2023-04-02 02:28:23 +00:00
|
|
|
new ExtensionFilter("Heaven Studio Remix File", "riq")
|
2022-01-30 12:03:37 +00:00
|
|
|
};
|
2022-06-04 03:15:45 +00:00
|
|
|
|
2022-01-30 12:03:37 +00:00
|
|
|
StandaloneFileBrowser.SaveFilePanelAsync("Save Remix As", "", "remix_level", extensions, (string path) =>
|
|
|
|
{
|
|
|
|
if (path != String.Empty)
|
|
|
|
{
|
|
|
|
SaveRemixFile(path);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SaveRemixFile(string path)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
try
|
2022-01-30 12:03:37 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
RiqFileHandler.WriteRiq(GameManager.instance.Beatmap);
|
|
|
|
RiqFileHandler.PackRiq(path, true);
|
|
|
|
Debug.Log("Packed RIQ successfully!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch (System.Exception e)
|
|
|
|
{
|
|
|
|
Debug.Log($"Error packing RIQ: {e.Message}");
|
|
|
|
return;
|
2022-01-30 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-19 21:53:04 +00:00
|
|
|
public void NewRemix()
|
|
|
|
{
|
2022-09-04 03:36:08 +00:00
|
|
|
if (Timeline.instance != null)
|
|
|
|
Timeline.instance?.Stop(0);
|
|
|
|
else
|
|
|
|
GameManager.instance.Stop(0);
|
2023-06-10 19:13:29 +00:00
|
|
|
LoadRemix(true);
|
2022-08-19 21:53:04 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void LoadRemix(bool create = false)
|
2022-02-26 03:41:32 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
if (create)
|
|
|
|
GameManager.instance.NewRemix();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GameManager.instance.LoadRemix(true);
|
|
|
|
}
|
2022-02-26 03:41:32 +00:00
|
|
|
Timeline.instance.LoadRemix();
|
2022-06-04 03:15:45 +00:00
|
|
|
Timeline.FitToSong();
|
2022-08-19 21:53:04 +00:00
|
|
|
|
|
|
|
currentRemixPath = string.Empty;
|
2022-02-26 03:41:32 +00:00
|
|
|
}
|
|
|
|
|
2022-01-30 12:03:37 +00:00
|
|
|
public void OpenRemix()
|
|
|
|
{
|
|
|
|
var extensions = new[]
|
|
|
|
{
|
2022-09-04 03:26:19 +00:00
|
|
|
new ExtensionFilter("All Supported Files ", new string[] { "riq", "tengoku", "rhmania" }),
|
2023-04-02 02:28:23 +00:00
|
|
|
new ExtensionFilter("Heaven Studio Remix File ", new string[] { "riq" }),
|
|
|
|
new ExtensionFilter("Legacy Heaven Studio Remix ", new string[] { "tengoku", "rhmania" })
|
2022-01-30 12:03:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
StandaloneFileBrowser.OpenFilePanelAsync("Open Remix", "", extensions, false, (string[] paths) =>
|
|
|
|
{
|
|
|
|
var path = Path.Combine(paths);
|
|
|
|
|
2022-08-19 01:28:05 +00:00
|
|
|
if (path == string.Empty) return;
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
GlobalGameManager.ShowLoadingMessage("Loading", $"Loading remix from {path}");
|
|
|
|
try
|
|
|
|
{
|
|
|
|
string tmpDir = RiqFileHandler.ExtractRiq(path);
|
|
|
|
Debug.Log("Imported RIQ successfully!");
|
|
|
|
LoadRemix();
|
|
|
|
}
|
|
|
|
catch (System.Exception e)
|
2022-08-21 23:46:45 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
Debug.Log($"Error importing RIQ: {e.Message}");
|
|
|
|
Debug.LogException(e);
|
|
|
|
GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace);
|
|
|
|
return;
|
2022-08-21 23:46:45 +00:00
|
|
|
}
|
2022-03-10 04:24:06 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
StartCoroutine(LoadMusic());
|
|
|
|
|
2022-08-19 01:28:05 +00:00
|
|
|
currentRemixPath = path;
|
|
|
|
remixName = Path.GetFileName(path);
|
|
|
|
UpdateEditorStatus(false);
|
|
|
|
CommandManager.instance.Clear();
|
2023-06-10 19:13:29 +00:00
|
|
|
|
|
|
|
GlobalGameManager.instance.HideDialog();
|
2022-01-30 12:03:37 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2022-02-02 08:36:20 +00:00
|
|
|
public void Fullscreen()
|
|
|
|
{
|
2023-02-05 03:05:36 +00:00
|
|
|
MainCanvas.gameObject.SetActive(fullscreen);
|
2022-02-02 08:36:20 +00:00
|
|
|
if (fullscreen == false)
|
|
|
|
{
|
|
|
|
MainCanvas.enabled = false;
|
|
|
|
EditorCamera.enabled = false;
|
2023-03-11 04:51:22 +00:00
|
|
|
GameManager.instance.StaticCamera.targetTexture = null;
|
2022-06-04 03:15:05 +00:00
|
|
|
GameManager.instance.CursorCam.enabled = false;
|
2022-02-02 08:36:20 +00:00
|
|
|
fullscreen = true;
|
2023-02-05 03:05:36 +00:00
|
|
|
|
2022-02-02 08:36:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MainCanvas.enabled = true;
|
|
|
|
EditorCamera.enabled = true;
|
2023-03-11 04:51:22 +00:00
|
|
|
GameManager.instance.StaticCamera.targetTexture = ScreenRenderTexture;
|
2022-07-10 21:39:14 +00:00
|
|
|
GameManager.instance.CursorCam.enabled = true && isCursorEnabled;
|
2022-02-02 08:36:20 +00:00
|
|
|
fullscreen = false;
|
2022-06-14 05:24:41 +00:00
|
|
|
|
|
|
|
GameCamera.instance.camera.rect = new Rect(0, 0, 1, 1);
|
|
|
|
GameManager.instance.CursorCam.rect = new Rect(0, 0, 1, 1);
|
|
|
|
GameManager.instance.OverlayCamera.rect = new Rect(0, 0, 1, 1);
|
2022-06-26 21:37:30 +00:00
|
|
|
EditorCamera.rect = new Rect(0, 0, 1, 1);
|
2022-02-02 08:36:20 +00:00
|
|
|
}
|
2023-02-05 19:48:49 +00:00
|
|
|
Timeline.AutoBtnUpdate();
|
2022-02-02 08:36:20 +00:00
|
|
|
}
|
2022-01-30 23:40:12 +00:00
|
|
|
|
|
|
|
private void UpdateEditorStatus(bool updateTime)
|
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
GlobalGameManager.UpdateDiscordStatus($"{remixName}", true, updateTime);
|
2022-01-30 23:40:12 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 23:29:45 +00:00
|
|
|
public void SetGameEventTitle(string txt)
|
|
|
|
{
|
|
|
|
GameEventSelectorTitle.text = txt;
|
|
|
|
}
|
2022-02-08 01:07:03 +00:00
|
|
|
|
|
|
|
public static bool MouseInRectTransform(RectTransform rectTransform)
|
|
|
|
{
|
|
|
|
return (rectTransform.gameObject.activeSelf && RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Editor.instance.EditorCamera));
|
|
|
|
}
|
2022-02-20 13:57:20 +00:00
|
|
|
|
|
|
|
public void ToggleDebugCam()
|
|
|
|
{
|
|
|
|
var game = GameManager.instance.currentGameO;
|
|
|
|
|
|
|
|
if (game != null)
|
|
|
|
{
|
|
|
|
foreach(FreeCam c in game.GetComponentsInChildren<FreeCam>(true))
|
|
|
|
{
|
|
|
|
c.enabled = !c.enabled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-03 22:42:43 +00:00
|
|
|
}
|
2022-06-04 03:15:45 +00:00
|
|
|
}
|