-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MusicVideoPlayer", "VideoPlayer\MusicVideoPlayer.csproj", "{539D165F-CF86-4529-A5C8-25FA04B90886}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{539D165F-CF86-4529-A5C8-25FA04B90886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{539D165F-CF86-4529-A5C8-25FA04B90886}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{539D165F-CF86-4529-A5C8-25FA04B90886}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{539D165F-CF86-4529-A5C8-25FA04B90886}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace MusicVideoPlayer | ||
{ | ||
static class ExtensionMethods | ||
{ | ||
public static Vector3 ToVector3(this string sVector) | ||
{ | ||
Vector3 result; | ||
try | ||
{ | ||
// Remove the parentheses | ||
if (sVector.StartsWith("(") && sVector.EndsWith(")")) | ||
{ | ||
sVector = sVector.Substring(1, sVector.Length - 2); | ||
} | ||
|
||
// split the items | ||
string[] sArray = sVector.Split(','); | ||
|
||
// store as a Vector3 | ||
result = new Vector3( | ||
float.Parse(sArray[0]), | ||
float.Parse(sArray[1]), | ||
float.Parse(sArray[2])); | ||
} catch | ||
{ | ||
return new Vector3(0, 0, 0); | ||
} | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace MusicVideoPlayer.Misc | ||
{ | ||
class Base64Sprites | ||
{ | ||
public static Sprite DownloadIcon; | ||
public static Sprite PlayIcon; | ||
public static Sprite ThinRingIcon; | ||
|
||
//https://www.flaticon.com/free-icon/download_724933 | ||
public static string DownloadIconB64 = @"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA3VAAAN1QE91ljxAAAAB3RJTUUH4gscDB0RZoF8lQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS40E0BoxAAAArdJREFUeF7tmr1rFFEUxXdNRI0gklgIkoiNjYgERBAVKytB0D/ARixsUgiWlmJhKWIhgo2NncRSu4BJZ2GhxAgKCSIELPzAr11/d+cUksnsuDM7O/Oe9weH2eTdd989Jx+72UnLGRHdbrfd6XQmuc5kifVprru1JS4wdxy9Rx1MbgpLv9EyOqht8YC/R4nNfAjgtrbFA6aeyl8u1D7UtnjwADwAD8ADkL9cPAAPwAPwALQtHjwAD8AD8ADkLxcPwAPwADwAbYsHD8AD8AA8APnLJbgAGPg0WkDv+uib/OVC7ecNezfqGTqq4+uFeScYZiUZfXRw5isubY1RHwyyE31IxhodnLnKpf4AbAiGuYYyb3oOGzsLLmuE+mGmrQx0z6ZKRqwOjrA7yDd5WP9X/28YyH4XzFcZgvWG+zwc17HNguEm0VIy7vCh9zyXCR3XTBhyGi0nIw8PBbtHxzQbhj2EPiajl4deb9EBtQ8DBj6BvshDGT7RpxkvegaFwS+gXzIyMLYXnVe7MMHAVfkZGPbOqU244GMMI3fRPz89Wi3cUovwwcwO9NhcyWMmqnmAxrQ9DvA1hZ73XPaBmidc6nmu5/BZ9KKPSv0DI8bsv0EzXyOwtoimVF4I9p9Cm83eE8fsVWkaFk/2JsmABkdUWhh6HEap1wh87g3ar7LC0OOsWmYxo9I0LFYegEEfewPlq9pa33U0q+VS0Kf5ARj0OofWkL3Dc0afLg29wgjAoGXbpA+HQlABVIEH4AF4AB6Axs3CA1BpGhbzAriBrjRcdzRuFsUDiAQPQHbTsPh/B8DPzzFU+D28poO372if7KaxRbSu+ujA2wraJbtpqLEbnddR5ff4Rg2WfqJLPOz/xxcF4xTOodfoR293wODBvu1foot8uEU286HYgtjGdXvIkodm3kytn1brD4RzPZwIzvgdAAAAAElFTkSuQmCC"; | ||
|
||
//https://www.flaticon.com/free-icon/media-play-symbol_31128 | ||
public static string PlayIconB64 = @"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA3VAAAN1QE91ljxAAAAB3RJTUUH4gscDCQK4mA4wwAAABh0RVh0U29mdHdhc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K9RXQzTe1lC8MQNIF4L1LeJ1TTTfUGCgEQNIJbO7duojoPJD/neQEQiBhAjD/V0ZynN5B9//wuIid0AjvU2YpyB02mmv9d7AkGxGkDfzczyet7v58eVaIzFAPrMs+f1zdBaC+Un0OrUAPoSm0j+As0pFsZfINKZAfTTQeL1DPndNP2Z6PoCQp0YQOJ6738WLqSZse79B2KHZADb6vR2l2oNTO4mxhUQXbQBbKdP6LXXV9AM83thhBdlAIk/5ljXN8LpX84OBYgflAGsq4mujnIjrGRROMf730ACAzaAxHV60wdOum9P/wMnFyCRfg3gd926PmfI692c7tvDHfK9QTKjya9Rif4N/Ka3s/pjxEoY5n8C+gI5ZkjsphLtTvk3tAzqv4Oa6ML4+rsYkOAe2Nqddjdof4cHYAXNsCe6/kCC+vPkXviA4f4RapbXm5gwLmddQHtZCfdgae/10kdZ2Q+z12yjLMtPoQAAAABJRU5ErkJggg=="; | ||
|
||
//https://www.flaticon.com/free-icon/oval_136832 | ||
public static string ThinRing64 = @"iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAQAAACQ9RH5AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfiDBMVDAsxjvJGAAAD3klEQVRYw8WZTWxUVRSAv/dKaWhpKZH+sIBY0RaWWtAobcNCQzQxgaSiCa5dKIImGhcEqGtMlAVbEkhYagTSVjQVApWEAroTBhIWYCiWMkV+pjMF5nPBNJb+DG86M8+ze+eec7533n3v3PvODShArKGDV2hjNQ0spQZ4wBgjJEhwgcEgVUi0aMgmP/e0E+aTjKfcYWO0iEEEaBdf8DYLgMdc4DSXSPAXd7hPQA31rKCVNXTQTgXwkH72BoPFZrrBU6pOeMRul+S1XeJ7Hsk9lZN2zR+63MOqjrrbhsheDe7xtpr1kE3zwXY7pj5wp4sL9q11lyk16ebCHKvcr+o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nkAMjAxOC0xMi0xOVQyMDoxMjoxMSswMTowMA8dnkYAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC"; | ||
|
||
public static void ConvertToSprites() | ||
{ | ||
DownloadIcon = Base64ToSprite(DownloadIconB64); | ||
PlayIcon = Base64ToSprite(PlayIconB64); | ||
ThinRingIcon = Base64ToSprite(ThinRing64); | ||
} | ||
|
||
public static Sprite Base64ToSprite(string input) | ||
{ | ||
string base64 = input; | ||
if (input.Contains(",")) | ||
{ | ||
base64 = input.Substring(input.IndexOf(',')); | ||
} | ||
Texture2D tex = Base64ToTexture2D(base64); | ||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), (Vector2.one / 2f)); | ||
} | ||
|
||
public static Texture2D Base64ToTexture2D(string encodedData) | ||
{ | ||
byte[] imageData = Convert.FromBase64String(encodedData); | ||
|
||
Texture2D texture = new Texture2D(0, 0, TextureFormat.ARGB32, false, true); | ||
texture.hideFlags = HideFlags.HideAndDontSave; | ||
texture.filterMode = FilterMode.Trilinear; | ||
texture.LoadImage(imageData); | ||
return texture; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using CustomUI.Utilities; | ||
using HMUI; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace MusicVideoPlayer.Misc | ||
{ | ||
class LoadScripts | ||
{ | ||
static public Dictionary<string, Sprite> _cachedSprites = new Dictionary<string, Sprite>(); | ||
|
||
static public IEnumerator LoadSprite(string spritePath, TableCell obj) | ||
{ | ||
Texture2D tex; | ||
|
||
if (_cachedSprites.ContainsKey(spritePath)) | ||
{ | ||
obj.GetComponentsInChildren<UnityEngine.UI.Image>(true).First(x => x.name == "CoverImage").sprite = _cachedSprites[spritePath]; | ||
yield break; | ||
} | ||
|
||
using (WWW www = new WWW(spritePath)) | ||
{ | ||
yield return www; | ||
tex = www.texture; | ||
float border = (tex.height - (tex.height * 9f / 16f)); | ||
var newSprite = Sprite.Create(tex, new Rect(0, border / 2f, tex.width, tex.height - border), Vector2.one * 0.5f, 100, 1); | ||
_cachedSprites.Add(spritePath, newSprite); | ||
obj.GetComponentsInChildren<UnityEngine.UI.Image>(true).First(x => x.name == "CoverImage").sprite = newSprite; | ||
} | ||
} | ||
|
||
//static public IEnumerator LoadAudio(string audioPath, object obj, string fieldName) | ||
//{ | ||
// using (var www = new WWW(audioPath)) | ||
// { | ||
// yield return www; | ||
// ReflectionUtil.SetPrivateField(obj, fieldName, www.GetAudioClip(true, true, AudioType.UNKNOWN)); | ||
// } | ||
//} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using SongLoaderPlugin; | ||
using UnityEngine; | ||
using System.IO; | ||
|
||
namespace MusicVideoPlayer.Misc | ||
{ | ||
public static class VideoFetcher | ||
{ | ||
public static string FetchURLForPlayingSong() | ||
{ | ||
var standardLevelSceneSetup = Resources.FindObjectsOfTypeAll<StandardLevelSceneSetup>().FirstOrDefault(); | ||
if (standardLevelSceneSetup == null) return null; | ||
|
||
IBeatmapLevel level = standardLevelSceneSetup.GetPrivateField<StandardLevelSceneSetupDataSO>("_standardLevelSceneSetupData")?.difficultyBeatmap?.level; | ||
if (level == null) return null; | ||
|
||
return FetchURL(level); | ||
} | ||
|
||
public static string FetchURL(IBeatmapLevel level) | ||
{ | ||
|
||
string songDirectory = PathForLevel(level); | ||
if (songDirectory == null) return null; | ||
|
||
FileInfo file = new FileInfo(Path.Combine(songDirectory, "video.mp4")); | ||
|
||
if (file.Exists) | ||
{ | ||
return Path.Combine(songDirectory, "video.mp4"); | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
public static bool SongHasVideo(IBeatmapLevel level) | ||
{ | ||
return !FetchURL(level).Equals(""); | ||
} | ||
|
||
public static string PathForLevel(IBeatmapLevel level) | ||
{ | ||
return SongLoader.CustomLevels.Find(x => x.customSongInfo.GetIdentifier() == level.levelID)?.customSongInfo?.path; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using IllusionPlugin; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace MusicVideoPlayer.Misc | ||
{ | ||
public enum VideoPlacement { Background, Left, Right, Bottom, Top, Custom }; | ||
|
||
public class VideoPlacementSetting | ||
{ | ||
public static Vector3 Position(VideoPlacement placement) | ||
{ | ||
switch (placement) | ||
{ | ||
case VideoPlacement.Background: | ||
return new Vector3(0, 20, 40); | ||
case VideoPlacement.Left: | ||
return new Vector3(-8, 2, 10); | ||
case VideoPlacement.Right: | ||
return new Vector3(8, 2, 10); | ||
case VideoPlacement.Bottom: | ||
return new Vector3(0, -2, 7); | ||
case VideoPlacement.Top: | ||
return new Vector3(0, 5, 7); | ||
default: // Custom | ||
return ModPrefs.GetString(Plugin.PluginName, "CustomPosition", new Vector3(0, 4, 15).ToString(), true).ToVector3(); | ||
} | ||
} | ||
|
||
public static Vector3 Rotation(VideoPlacement placement) | ||
{ | ||
switch (placement) | ||
{ | ||
case VideoPlacement.Background: | ||
return new Vector3(0, 0, 0); | ||
case VideoPlacement.Left: | ||
return new Vector3(0, -40, 0); | ||
case VideoPlacement.Right: | ||
return new Vector3(0, 40, 0); | ||
case VideoPlacement.Bottom: | ||
return new Vector3(15, 0, 0); | ||
case VideoPlacement.Top: | ||
return new Vector3(-30, 0, 0); | ||
default: // Custom | ||
return ModPrefs.GetString(Plugin.PluginName, "CustomRotation", new Vector3(0, 0, -10).ToString(), true).ToVector3(); | ||
} | ||
} | ||
|
||
public static float Scale(VideoPlacement placement) | ||
{ | ||
switch (placement) | ||
{ | ||
case VideoPlacement.Background: | ||
return 40; | ||
case VideoPlacement.Left: | ||
return 5; | ||
case VideoPlacement.Right: | ||
return 5; | ||
case VideoPlacement.Bottom: | ||
return 3; | ||
case VideoPlacement.Top: | ||
return 3; | ||
default: // Custom | ||
return ModPrefs.GetFloat(Plugin.PluginName, "CustomScale", 8f, true); | ||
} | ||
} | ||
|
||
public static float[] Modes() | ||
{ | ||
return new float[] | ||
{ | ||
(float)VideoPlacement.Background, | ||
(float)VideoPlacement.Left, | ||
(float)VideoPlacement.Right, | ||
(float)VideoPlacement.Bottom, | ||
(float)VideoPlacement.Top, | ||
(float)VideoPlacement.Custom | ||
}; | ||
} | ||
|
||
public static string Name(VideoPlacement mode) | ||
{ | ||
switch (mode) | ||
{ | ||
case VideoPlacement.Background: | ||
return "Background"; | ||
case VideoPlacement.Left: | ||
return "Left"; | ||
case VideoPlacement.Right: | ||
return "Right"; | ||
case VideoPlacement.Bottom: | ||
return "Bottom"; | ||
case VideoPlacement.Top: | ||
return "Top"; | ||
case VideoPlacement.Custom: | ||
return "Custom"; | ||
default: | ||
return "?"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using IllusionPlugin; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace MusicVideoPlayer.Misc | ||
{ | ||
public enum VideoQuality { Best, High, Medium, Low, Custom }; | ||
|
||
public class VideoQualitySetting | ||
{ | ||
public static string Format(VideoQuality quality) | ||
{ | ||
switch (quality) | ||
{ | ||
case VideoQuality.Best: | ||
return "(bestvideo/best)[ext=mp4]"; | ||
case VideoQuality.High: | ||
return "(bestvideo/best)[height<=720][ext=mp4]"; | ||
case VideoQuality.Medium: | ||
return "(bestvideo/best)[height<=480][ext=mp4]"; | ||
case VideoQuality.Low: | ||
return "(bestvideo/best)[height<480][ext=mp4]"; | ||
default: // Custom | ||
return ModPrefs.GetString(Plugin.PluginName, "CustomDownloadFormat", "bestvideo[filesize<10M][ext=mp4]", true); | ||
} | ||
} | ||
|
||
public static float[] Modes() | ||
{ | ||
return new float[] | ||
{ | ||
(float)VideoQuality.Best, | ||
(float)VideoQuality.High, | ||
(float)VideoQuality.Medium, | ||
(float)VideoQuality.Low, | ||
(float)VideoQuality.Custom | ||
}; | ||
} | ||
|
||
public static string Name(VideoQuality mode) | ||
{ | ||
switch (mode) | ||
{ | ||
case VideoQuality.Best: | ||
return "Best"; | ||
case VideoQuality.High: | ||
return "High"; | ||
case VideoQuality.Medium: | ||
return "Medium"; | ||
case VideoQuality.Low: | ||
return "Low"; | ||
case VideoQuality.Custom: // Custom | ||
return "Custom"; | ||
default: | ||
return "?"; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.