diff --git a/.github/workflows/testflight.yml b/.github/workflows/testflight.yml index caa7d751..a5f6d459 100644 --- a/.github/workflows/testflight.yml +++ b/.github/workflows/testflight.yml @@ -37,7 +37,7 @@ jobs: targetPlatform: iOS buildName: ArcCreate versioning: Custom - version: "0.1" + version: "0.2" - uses: actions/upload-artifact@v2 with: diff --git a/Assets/Scripts/ChartFormat/FileAccess/IFileAccessWrapper.cs b/Assets/Scripts/ChartFormat/FileAccess/IFileAccessWrapper.cs index b8a34af6..32ea1fba 100644 --- a/Assets/Scripts/ChartFormat/FileAccess/IFileAccessWrapper.cs +++ b/Assets/Scripts/ChartFormat/FileAccess/IFileAccessWrapper.cs @@ -1,10 +1,11 @@ +using System; using System.IO; namespace ArcCreate.ChartFormat { public interface IFileAccessWrapper { - string GetFileUri(string path); + Uri GetFileUri(string path); Option ReadFileByLines(string path); diff --git a/Assets/Scripts/ChartFormat/FileAccess/PhysicalFileAccess.cs b/Assets/Scripts/ChartFormat/FileAccess/PhysicalFileAccess.cs index 04408e2c..d1c45d21 100644 --- a/Assets/Scripts/ChartFormat/FileAccess/PhysicalFileAccess.cs +++ b/Assets/Scripts/ChartFormat/FileAccess/PhysicalFileAccess.cs @@ -5,9 +5,9 @@ namespace ArcCreate.ChartFormat { public class PhysicalFileAccess : IFileAccessWrapper { - public string GetFileUri(string path) + public Uri GetFileUri(string path) { - return "file:///" + Uri.EscapeUriString(path.Replace("\\", "/")); + return new Uri(path); } public Option ReadFileByLines(string path) diff --git a/Assets/Scripts/ChartFormat/FileAccess/VirtualFileAccess.cs b/Assets/Scripts/ChartFormat/FileAccess/VirtualFileAccess.cs index 8a1ea555..685e500d 100644 --- a/Assets/Scripts/ChartFormat/FileAccess/VirtualFileAccess.cs +++ b/Assets/Scripts/ChartFormat/FileAccess/VirtualFileAccess.cs @@ -18,9 +18,9 @@ public VirtualFileAccess(Stream stream) streamWriter = new StreamWriter(stream); } - public string GetFileUri(string path) + public Uri GetFileUri(string path) { - return "file:///" + Uri.EscapeUriString(path.Replace("\\", "/")); + return new Uri(path); } public Option ReadFileByLines(string path) => data; diff --git a/Assets/Scripts/Compose/EventsEditor/Scenecontrol/ScenecontrolLuaEnvironment.cs b/Assets/Scripts/Compose/EventsEditor/Scenecontrol/ScenecontrolLuaEnvironment.cs index 779ec2d1..5c4d924d 100644 --- a/Assets/Scripts/Compose/EventsEditor/Scenecontrol/ScenecontrolLuaEnvironment.cs +++ b/Assets/Scripts/Compose/EventsEditor/Scenecontrol/ScenecontrolLuaEnvironment.cs @@ -77,7 +77,7 @@ public void SetupScript(Script script) public void Rebuild() { - Services.Gameplay.Scenecontrol.ScenecontrolFolder = "file:///" + Values.ScenecontrolFolder; + Services.Gameplay.Scenecontrol.ScenecontrolFolder = Values.ScenecontrolFolder; Clean(); RunScript(); ExecuteEvents(); diff --git a/Assets/Scripts/Compose/Project/ProjectService.cs b/Assets/Scripts/Compose/Project/ProjectService.cs index 934ecaa1..faed2526 100644 --- a/Assets/Scripts/Compose/Project/ProjectService.cs +++ b/Assets/Scripts/Compose/Project/ProjectService.cs @@ -406,7 +406,7 @@ private void LoadChart(ChartSettings chart) if (parseResult.IsOk) { - gameplayData.LoadChart(reader, "file:///" + Path.GetDirectoryName(path)); + gameplayData.LoadChart(reader, Path.GetDirectoryName(path)); } else { diff --git a/Assets/Scripts/Compose/Project/RawEditor/Analysis/RawEditorFileAccess.cs b/Assets/Scripts/Compose/Project/RawEditor/Analysis/RawEditorFileAccess.cs index 1d1ee4f2..eba7189e 100644 --- a/Assets/Scripts/Compose/Project/RawEditor/Analysis/RawEditorFileAccess.cs +++ b/Assets/Scripts/Compose/Project/RawEditor/Analysis/RawEditorFileAccess.cs @@ -16,9 +16,9 @@ public RawEditorFileAccess(string chartData, string chartPath) virt = new VirtualFileAccess(chartData); } - public string GetFileUri(string path) + public Uri GetFileUri(string path) { - return "file:///" + Uri.EscapeUriString(path.Replace("\\", "/")); + return new Uri(path); } public Option ReadFileByLines(string path) diff --git a/Assets/Scripts/Compose/Project/RawEditor/RawEditor.cs b/Assets/Scripts/Compose/Project/RawEditor/RawEditor.cs index d6257e98..2ccc382c 100644 --- a/Assets/Scripts/Compose/Project/RawEditor/RawEditor.cs +++ b/Assets/Scripts/Compose/Project/RawEditor/RawEditor.cs @@ -66,7 +66,7 @@ private void ApplyChanges() int timing = Services.Gameplay.Audio.AudioTiming; ChartReader reader = ChartReaderFactory.GetReader(new RawEditorFileAccess(rawChartData, absoluteMainChartPath), absoluteMainChartPath); reader.Parse(); - gameplayData.LoadChart(reader, "file:///" + Path.GetDirectoryName(absoluteMainChartPath)); + gameplayData.LoadChart(reader, Path.GetDirectoryName(absoluteMainChartPath)); Services.Gameplay.Audio.AudioTiming = timing; } diff --git a/Assets/Scripts/Gameplay/Camera/CameraService.cs b/Assets/Scripts/Gameplay/Camera/CameraService.cs index 7ba2cd34..18d7ba4d 100644 --- a/Assets/Scripts/Gameplay/Camera/CameraService.cs +++ b/Assets/Scripts/Gameplay/Camera/CameraService.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using ArcCreate.Gameplay.Data; using ArcCreate.Utility.Extension; -using DG.Tweening; using UnityEngine; namespace ArcCreate.Gameplay.GameplayCamera @@ -10,7 +9,6 @@ public class CameraService : MonoBehaviour, ICameraService, ICameraControl { [SerializeField] private Camera backgroundCamera; [SerializeField] private Camera overlayCamera; - [SerializeField] private Transform skyInputLabel; [SerializeField] private RectTransform backgroundRect; private float currentTilt; private float currentArcPos; @@ -160,11 +158,6 @@ public void UpdateCamera(int currentTiming) return; } - skyInputLabel.localPosition = new Vector3( - Mathf.LerpUnclamped(Values.SkyInputLabelX, Values.SkyInputLabelXTablet, AspectAdjustment), - skyInputLabel.localPosition.y, - skyInputLabel.localPosition.z); - Vector3 prevPosition = backgroundCamera.transform.localPosition; Vector3 position = ResetPosition + translationExternal; Quaternion lookAtRotation = Quaternion.LookRotation( diff --git a/Assets/Scripts/Gameplay/GameplayData.cs b/Assets/Scripts/Gameplay/GameplayData.cs index 535ff485..65ed39d7 100644 --- a/Assets/Scripts/Gameplay/GameplayData.cs +++ b/Assets/Scripts/Gameplay/GameplayData.cs @@ -197,12 +197,12 @@ public void LoadJacket(string path) /// Set the chart file for this system. /// /// The chart reader defining the chart. - /// The parent uri for loading custom SFX files. + /// The parent folder for loading custom SFX files. /// Custom file accessor. - public void LoadChart(ChartReader reader, string sfxParentUri, IFileAccessWrapper fileAccess = null) + public void LoadChart(ChartReader reader, string sfxParentFolder, IFileAccessWrapper fileAccess = null) { Services.Chart.LoadChart(reader); - Services.Hitsound.LoadCustomSfxs(sfxParentUri, fileAccess).Forget(); + Services.Hitsound.LoadCustomSfxs(sfxParentFolder, fileAccess).Forget(); OnChartFileLoad?.Invoke(); } @@ -218,7 +218,7 @@ public void SetDefaultBackground() isUsingDefaultBackground = true; } - public async UniTask LoadAudioFromHttp(string uri, string ext) + public async UniTask LoadAudioFromHttp(Uri uri, string ext) { if (AudioClip.Value != null) { @@ -243,7 +243,7 @@ public async UniTask LoadAudioFromHttp(string uri, string ext) } } - public async UniTask LoadJacketFromHttp(string uri) + public async UniTask LoadJacketFromHttp(Uri uri) { if (Jacket.Value != null && !isUsingDefaultJacket) { @@ -274,7 +274,7 @@ public async UniTask LoadJacketFromHttp(string uri) } } - public async UniTask LoadBackgroundFromHttp(string uri) + public async UniTask LoadBackgroundFromHttp(Uri uri) { if (Background.Value != null && !isUsingDefaultBackground) { @@ -313,7 +313,7 @@ public void LoadVideoBackground(string path, bool isUri) internal async UniTask StartLoadingAudio(string path) { using (UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip( - Uri.EscapeUriString("file:///" + path.Replace("\\", "/")), + new Uri(path), path.EndsWith("wav") ? AudioType.WAV : AudioType.OGGVORBIS)) { await req.SendWebRequest(); diff --git a/Assets/Scripts/Gameplay/Hitsound/HitsoundService.cs b/Assets/Scripts/Gameplay/Hitsound/HitsoundService.cs index 5e2fd54f..34081764 100644 --- a/Assets/Scripts/Gameplay/Hitsound/HitsoundService.cs +++ b/Assets/Scripts/Gameplay/Hitsound/HitsoundService.cs @@ -78,7 +78,7 @@ public void PlayArcTapHitsound(int timing, string sfx, bool isFromJudgement) } } - public async UniTask LoadCustomSfxs(string parentUri, IFileAccessWrapper fileAccess) + public async UniTask LoadCustomSfxs(string parentFolder, IFileAccessWrapper fileAccess) { IsLoaded = false; @@ -114,7 +114,7 @@ public async UniTask LoadCustomSfxs(string parentUri, IFileAccessWrapper fileAcc finalSfx = finalSfx + ".wav"; } - string uri = fileAccess == null ? Path.Combine(parentUri, finalSfx) : fileAccess.GetFileUri(finalSfx); + Uri uri = fileAccess == null ? new Uri(Path.Combine(parentFolder, finalSfx)) : fileAccess.GetFileUri(finalSfx); if (uri != null) { loadTasks.Add(LoadCustomSfx(sfx, uri)); @@ -137,12 +137,11 @@ public void ResetHitsoundHistory() playedArcHitsoundTimings.Clear(); } - private async UniTask LoadCustomSfx(string sfx, string uri) + private async UniTask LoadCustomSfx(string sfx, Uri uri) { try { - using (UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip( - Uri.EscapeUriString(uri.Replace("\\", "/")), AudioType.WAV)) + using (UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.WAV)) { await req.SendWebRequest(); if (!string.IsNullOrWhiteSpace(req.error)) diff --git a/Assets/Scripts/Gameplay/Hitsound/IHitsoundService.cs b/Assets/Scripts/Gameplay/Hitsound/IHitsoundService.cs index fb77982f..c876b012 100644 --- a/Assets/Scripts/Gameplay/Hitsound/IHitsoundService.cs +++ b/Assets/Scripts/Gameplay/Hitsound/IHitsoundService.cs @@ -53,10 +53,10 @@ public interface IHitsoundService /// /// Loads all sfx file referenced by the currently loaded chart from sfxParentUri. /// - /// Where to load sfx files from. + /// Parent folder of where to load sfx files from. /// Custom file accessor. /// Unitask instance. - UniTask LoadCustomSfxs(string sfxParentUri, IFileAccessWrapper fileAccess); + UniTask LoadCustomSfxs(string parentFolder, IFileAccessWrapper fileAccess); void UpdateHitsoundHistory(int currentTiming); diff --git a/Assets/Scripts/Gameplay/Scenecontrol/Controllers/Scene.cs b/Assets/Scripts/Gameplay/Scenecontrol/Controllers/Scene.cs index 7d249577..d254b629 100755 --- a/Assets/Scripts/Gameplay/Scenecontrol/Controllers/Scene.cs +++ b/Assets/Scripts/Gameplay/Scenecontrol/Controllers/Scene.cs @@ -402,7 +402,7 @@ public ImageController CreateImage( spriteTasks.Add(GetSprite( new SpriteDefinition { - Uri = customFileAccess?.GetFileUri(Path.Combine("Scenecontrol", imgPath)) ?? Path.Combine(Services.Scenecontrol.ScenecontrolFolder, imgPath), + Uri = customFileAccess?.GetFileUri(Path.Combine("Scenecontrol", imgPath)) ?? new Uri(Path.Combine(Services.Scenecontrol.ScenecontrolFolder, imgPath)), Pivot = pivotVec, }, cts.Token).ContinueWith(sprite => c.Image.sprite = sprite)); @@ -438,7 +438,7 @@ public SpriteController CreateSprite( spriteTasks.Add(GetSprite( new SpriteDefinition { - Uri = customFileAccess?.GetFileUri(Path.Combine("Scenecontrol", imgPath)) ?? Path.Combine(Services.Scenecontrol.ScenecontrolFolder, imgPath), + Uri = customFileAccess?.GetFileUri(Path.Combine("Scenecontrol", imgPath)) ?? new Uri(Path.Combine(Services.Scenecontrol.ScenecontrolFolder, imgPath)), Pivot = pivotVec, }, cts.Token).ContinueWith(sprite => c.SpriteRenderer.sprite = sprite)); @@ -845,7 +845,7 @@ private async UniTask GetSprite(SpriteDefinition definition, Cancellatio } spriteCache.Add(definition, null); - using (UnityWebRequest req = UnityWebRequestTexture.GetTexture(Uri.EscapeUriString(definition.Uri.Replace("\\", "/")))) + using (UnityWebRequest req = UnityWebRequestTexture.GetTexture(definition.Uri)) { try { @@ -914,7 +914,7 @@ private void Awake() private struct SpriteDefinition { - public string Uri; + public Uri Uri; public Vector2 Pivot; } } diff --git a/Assets/Scripts/Remote/GameplayControl/RemoteGameplayControl.cs b/Assets/Scripts/Remote/GameplayControl/RemoteGameplayControl.cs index 2c5e7b69..b7efda20 100644 --- a/Assets/Scripts/Remote/GameplayControl/RemoteGameplayControl.cs +++ b/Assets/Scripts/Remote/GameplayControl/RemoteGameplayControl.cs @@ -174,7 +174,7 @@ private async UniTask RetrieveAllFiles(byte[] data) private async UniTask RetrieveChart() { - string uri = GetURI("chart"); + Uri uri = GetURI("chart"); using (UnityWebRequest req = UnityWebRequest.Get(uri)) { await req.SendWebRequest(); @@ -191,7 +191,7 @@ private async UniTask RetrieveChart() string chartData = req.downloadHandler.text; var reader = new AffChartReader(new VirtualFileAccess(chartData), string.Empty, string.Empty, string.Empty); reader.Parse(); - gameplayData.LoadChart(reader, GetURI("sfx/")); + gameplayData.LoadChart(reader, GetURIString("sfx/")); } } @@ -228,7 +228,7 @@ private async UniTask RetrieveBackground(bool useDefault) private async UniTask RetrieveMetadata(string chartPath) { - string uri = GetURI("metadata"); + Uri uri = GetURI("metadata"); using (UnityWebRequest req = UnityWebRequest.Get(uri)) { await req.SendWebRequest(); @@ -309,7 +309,7 @@ private async UniTask RetrieveMetadata(string chartPath) gameplayData.DifficultyColor.Value = c; bool enableVideoBackground = !string.IsNullOrEmpty(chartSettings.VideoPath); - gameplayData.LoadVideoBackground(enableVideoBackground ? GetURI("video") : null, true); + gameplayData.LoadVideoBackground(enableVideoBackground ? GetURIString("video") : null, true); break; } @@ -319,7 +319,7 @@ private async UniTask RetrieveMetadata(string chartPath) private async UniTask RetrieveScenecontrol() { - string uri = GetURI("scjson"); + Uri uri = GetURI("scjson"); using (UnityWebRequest req = UnityWebRequest.Get(uri)) { await req.SendWebRequest(); @@ -334,13 +334,18 @@ private async UniTask RetrieveScenecontrol() } string json = req.downloadHandler.text; - gameplay.Scenecontrol.ScenecontrolFolder = GetURI("scenecontrol/"); + gameplay.Scenecontrol.ScenecontrolFolder = GetURIString("scenecontrol/"); gameplay.Scenecontrol.Import(json); gameplay.Scenecontrol.WaitForSceneLoad(); } } - private string GetURI(string path) + private Uri GetURI(string path) + { + return new Uri(GetURIString(path)); + } + + private string GetURIString(string path) { var uri = $"http://{requestFileFromIP}:{requestFileFromPort}/{path}"; Debug.Log(uri); diff --git a/Assets/Scripts/Storage/Loader/GameplayLoader.cs b/Assets/Scripts/Storage/Loader/GameplayLoader.cs index 83c5ddc9..f319afb5 100644 --- a/Assets/Scripts/Storage/Loader/GameplayLoader.cs +++ b/Assets/Scripts/Storage/Loader/GameplayLoader.cs @@ -46,7 +46,7 @@ private async UniTask LoadAudio(LevelStorage level, ChartSettings chart) throw new Exception("Audio file does not exist"); } - string uri = "file:///" + UnityWebRequest.EscapeURL(audioPath.Value.Replace("\\", "/")); + Uri uri = new Uri(audioPath.Value); await gameplayData.LoadAudioFromHttp(uri, Path.GetExtension(audioPath.Value)); } @@ -59,7 +59,7 @@ private async UniTask LoadBackground(LevelStorage level, ChartSettings chart) return; } - string uri = "file:///" + UnityWebRequest.EscapeURL(bgPath.Value.Replace("\\", "/")); + Uri uri = new Uri(bgPath.Value); await gameplayData.LoadBackgroundFromHttp(uri); } diff --git a/Assets/Scripts/Storage/Loader/StorageFileAccessWrapper.cs b/Assets/Scripts/Storage/Loader/StorageFileAccessWrapper.cs index bf1e48f1..68218fd6 100644 --- a/Assets/Scripts/Storage/Loader/StorageFileAccessWrapper.cs +++ b/Assets/Scripts/Storage/Loader/StorageFileAccessWrapper.cs @@ -14,7 +14,7 @@ public StorageFileAccessWrapper(LevelStorage level) this.level = level; } - public string GetFileUri(string path) + public Uri GetFileUri(string path) { Option realPath = level.GetRealPath(path); if (!realPath.HasValue) @@ -22,7 +22,7 @@ public string GetFileUri(string path) return null; } - return "file:///" + Uri.EscapeUriString(realPath.Value.Replace("\\", "/")); + return new Uri(realPath.Value); } public Option ReadFileByLines(string path) diff --git a/Assets/Scripts/Storage/StorageData.cs b/Assets/Scripts/Storage/StorageData.cs index 940f8ae0..b05959e3 100644 --- a/Assets/Scripts/Storage/StorageData.cs +++ b/Assets/Scripts/Storage/StorageData.cs @@ -153,7 +153,7 @@ public async UniTask AssignTexture(RawImage image, IStorageUnit storage, string Incompletable loading = new Incompletable(); JacketCache.Add(jacketPath, loading); - string uri = "file:///" + UnityWebRequest.EscapeURL(jacketPath.Replace("\\", "/")); + Uri uri = new Uri(jacketPath); using (UnityWebRequest req = UnityWebRequestTexture.GetTexture(uri)) { await req.SendWebRequest(); @@ -223,7 +223,7 @@ public async UniTask GetAudioClipStreaming(IStorageUnit level, string } audioPath = realAudioPath.Value; - string uri = "file:///" + UnityWebRequest.EscapeURL(audioPath.Replace("\\", "/")); + Uri uri = new Uri(audioPath); using (UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip( uri, audioPath.EndsWith(".ogg") ? AudioType.OGGVORBIS : AudioType.WAV)) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index be98544e..e35ee63a 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -175,7 +175,7 @@ PlayerSettings: androidMaxAspectRatio: 2.1 applicationIdentifier: {} buildNumber: - iPhone: 37 + iPhone: 38 AndroidBundleVersionCode: 1 AndroidMinSdkVersion: 19 AndroidTargetSdkVersion: 0