file explorer chart loading

This commit is contained in:
minenice55 2023-01-11 19:55:31 -05:00
parent c24157e878
commit 84ab4f753f
10 changed files with 119 additions and 33 deletions

View file

@ -394,7 +394,7 @@ Camera:
m_Depth: 1
m_CullingMask:
serializedVersion: 2
m_Bits: 8192
m_Bits: 8256
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0

View file

@ -4903,7 +4903,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -289.15, y: 2}
m_AnchoredPosition: {x: -289.15002, y: 2}
m_SizeDelta: {x: -578.29, y: 49.92}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &156962255
@ -25563,7 +25563,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 1589389271}
m_Direction: 2
m_Value: 1
m_Size: 1
m_Size: 0.99823457
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -31110,7 +31110,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -408.97998, y: -17}
m_AnchoredPosition: {x: -408.98004, y: -17}
m_SizeDelta: {x: -817.96, y: -46.29}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1118147045
@ -32587,7 +32587,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 129.94043}
m_AnchoredPosition: {x: 0, y: 129.911}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1154875944
@ -39444,6 +39444,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
level: {fileID: 0}
music: {fileID: 0}
canvas: {fileID: 1791483799}
debugUI: 0
playOnStart: 0
editor: 1
@ -42568,7 +42569,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -42.494995}
m_AnchoredPosition: {x: 0, y: -42.495026}
m_SizeDelta: {x: 1440.022, y: -84.99}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1527251881
@ -49428,7 +49429,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -84.99002}
m_AnchoredPosition: {x: 0, y: -84.99005}
m_SizeDelta: {x: 320, y: -84.99}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1852819572
@ -54654,7 +54655,7 @@ Camera:
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 32
m_Bits: 96
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
@ -55299,7 +55300,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -42.494995}
m_AnchoredPosition: {x: 0, y: -42.495026}
m_SizeDelta: {x: 1054, y: -84.99}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &2066632681

View file

@ -2,8 +2,8 @@ using System;
public static class AppInfo {
//--- AutoGenerated.begin
public const string Version = "0.0.961";
public static readonly DateTime Date = new DateTime(2022, 10, 13, 16, 09, 43, 581, DateTimeKind.Utc);
public const string Version = "0.0.963";
public static readonly DateTime Date = new DateTime(2023, 01, 12, 00, 27, 14, 138, DateTimeKind.Utc);
//--- AutoGenerated.end
}

View file

@ -353,6 +353,7 @@ namespace HeavenStudio
Debug.LogWarning($"Unknown game {gameName} found in remix.json! Adding game...");
game = new Minigames.Minigame(gameName, DisplayName(gameName) + " \n<color=#eb5454>[inferred from remix.json]</color>", "", false, true, new List<Minigames.GameAction>());
EventCaller.instance.minigames.Add(game);
if (Editor.Editor.instance != null)
Editor.Editor.instance.AddIcon(game);
}
action = EventCaller.instance.GetGameAction(game, actionName);

View file

@ -31,7 +31,7 @@ namespace HeavenStudio
private void Start()
{
CreateDebugUI(out Title); SetText(Title, "Rhythm Heaven Mania v1.0 BRAEDON DEBUG PLAYTEST");
CreateDebugUI(out Title); SetText(Title, $"Heaven Studio {GlobalGameManager.buildTime}");
CreateDebugUI(out SongPosBeats);
CreateDebugUI(out SongPos);
CreateDebugUI(out SecPerBeat);

View file

@ -19,7 +19,8 @@ namespace HeavenStudio
public List<GameObject> SoundObjects = new List<GameObject>();
[Header("Components")]
public TextAsset txt;
public string txt;
public string ext;
public Camera GameCamera, CursorCam, OverlayCamera;
public GameObject GameLetterbox;
public CircleCursor CircleCursor;
@ -83,17 +84,6 @@ namespace HeavenStudio
GameObject fade = new GameObject();
this.fade = fade.AddComponent<Games.Global.Flash>();
if (txt != null)
{
string json = txt.text;
Beatmap = JsonConvert.DeserializeObject<DynamicBeatmap>(json);
}
else
{
NewRemix();
}
SortEventsList();
GlobalGameManager.Init();
@ -106,13 +96,16 @@ namespace HeavenStudio
GameObject textbox = Instantiate(Resources.Load<GameObject>("Prefabs/Common/Textbox"));
textbox.name = "Textbox";
if (playOnStart)
if (txt != null && ext != null)
{
Play(startBeat);
LoadRemix(txt, ext);
}
else
{
NewRemix();
}
// SetCurrentGame(eventCaller.GamesHolder.transform.GetComponentsInChildren<Transform>()[1].name);
SortEventsList();
if (Beatmap.entities.Count >= 1)
{
@ -123,6 +116,11 @@ namespace HeavenStudio
{
SetGame("noGame");
}
if (playOnStart)
{
Play(startBeat);
}
}
public void NewRemix()
@ -384,6 +382,11 @@ namespace HeavenStudio
SetCurrentEventToClosest(beat);
onBeatChanged?.Invoke(beat);
KillAllSounds();
if (playOnStart)
{
Play(0);
}
}
public void KillAllSounds()

View file

@ -1,5 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using UnityEngine;
using UnityEngine.Audio;
@ -9,13 +15,37 @@ namespace HeavenStudio
{
public TextAsset level;
public AudioClip music;
public GameObject canvas;
public bool debugUI;
public bool playOnStart = false;
public bool editor = false;
string json = "";
string ext = "";
private void Start()
{
string[] args = System.Environment.GetCommandLineArgs();
string input = "";
for (int i = 1; i < args.Length; i++) {
// first arg is always this executable
Debug.Log(args[i]);
if (args[i].IndexOfAny(Path.GetInvalidPathChars()) == -1)
{
if (File.Exists(args[i]))
{
input = args[i];
editor = false;
playOnStart = true;
}
}
else if (args[i] == "-debug")
{
debugUI = true;
}
}
GameObject Cameras = Instantiate(Resources.Load<GameObject>("Prefabs/Cameras")); Cameras.name = "Cameras";
GameObject MainCamera = Cameras.transform.GetChild(0).gameObject;
GameObject CursorCamera = Cameras.transform.GetChild(1).gameObject;
@ -33,7 +63,6 @@ namespace HeavenStudio
GameManager gameManager = GameManager.AddComponent<GameManager>();
gameManager.playOnStart = playOnStart;
gameManager.txt = level;
gameManager.GamesHolder = Games;
gameManager.CircleCursor = Cursor.transform.GetChild(0).GetComponent<CircleCursor>();
gameManager.GameCamera = MainCamera.GetComponent<Camera>();
@ -64,8 +93,58 @@ namespace HeavenStudio
}
else
{
this.GetComponent<HeavenStudio.Editor.Editor>().enabled = false;
this.GetComponent<HeavenStudio.Editor.EditorTheme>().enabled = false;
this.GetComponent<HeavenStudio.Editor.BoxSelection>().enabled = false;
canvas.SetActive(false);
OpenCmdRemix(input);
Debug.Log(json);
gameManager.txt = json;
gameManager.ext = ext;
gameManager.Init();
}
}
public void OpenCmdRemix(string path)
{
if (path == string.Empty) return;
if (!File.Exists(path)) return;
byte[] MusicBytes;
bool loadedMusic = false;
string extension = path.GetExtension();
using var zipFile = File.Open(path, FileMode.Open);
using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read);
foreach (var entry in archive.Entries)
switch (entry.Name)
{
case "remix.json":
{
using var stream = entry.Open();
using var reader = new StreamReader(stream);
json = reader.ReadToEnd();
ext = extension;
break;
}
case "song.ogg":
{
using var stream = entry.Open();
using var memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
MusicBytes = memoryStream.ToArray();
Conductor.instance.musicSource.clip = OggVorbis.VorbisPlugin.ToAudioClip(MusicBytes, "music");
loadedMusic = true;
break;
}
}
if (!loadedMusic)
{
Conductor.instance.musicSource.clip = null;
MusicBytes = null;
}
}
}
}

View file

@ -48,6 +48,7 @@ namespace HeavenStudio.Editor
private void Update()
{
if (Editor.instance == null) return;
float deltaTimelineX = timelineContent.transform.localPosition.x - timelineLastX;
Camera camera = Editor.instance.EditorCamera;

View file

@ -31,6 +31,7 @@ namespace HeavenStudio.Editor
private void Start()
{
if (Editor.instance == null) return;
specialLayers.GetComponent<Image>().color = theme.properties.SpecialLayersCol.Hex2RGB();
tempoLayer.GetComponent<Image>().color = theme.properties.TempoLayerCol.Hex2RGB();
musicLayer.GetComponent<Image>().color = theme.properties.MusicLayerCol.Hex2RGB();

View file

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.0.961
bundleVersion: 0.0.963
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
@ -155,11 +155,11 @@ PlayerSettings:
applicationIdentifier:
Standalone: com.Megaminerzero.HeavenStudio
buildNumber:
Standalone: 961
Standalone: 963
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 961
AndroidBundleVersionCode: 963
AndroidMinSdkVersion: 19
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1