diff --git a/.idea/.idea.PlatformCustomizer/.idea/encodings.xml b/.idea/.idea.PlatformCustomizer/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.PlatformCustomizer/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.PlatformCustomizer/.idea/indexLayout.xml b/.idea/.idea.PlatformCustomizer/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.PlatformCustomizer/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.PlatformCustomizer/.idea/projectSettingsUpdater.xml b/.idea/.idea.PlatformCustomizer/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..4bb9f4d --- /dev/null +++ b/.idea/.idea.PlatformCustomizer/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.PlatformCustomizer/.idea/vcs.xml b/.idea/.idea.PlatformCustomizer/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.PlatformCustomizer/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.PlatformCustomizer/.idea/workspace.xml b/.idea/.idea.PlatformCustomizer/.idea/workspace.xml new file mode 100644 index 0000000..8e36d90 --- /dev/null +++ b/.idea/.idea.PlatformCustomizer/.idea/workspace.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "WebServerToolWindowFactoryState": "false", + "settings.editor.selected.configurable": "preferences.pluginManager", + "vue.rearranger.settings.migration": "true" + } +} + + + + + + + + + + + 1660341070164 + + + + + + + + + + + + + \ No newline at end of file diff --git a/PlatformCustomizer/Assets/menuplatform b/PlatformCustomizer/Assets/menuplatform deleted file mode 100644 index 8535050..0000000 Binary files a/PlatformCustomizer/Assets/menuplatform and /dev/null differ diff --git a/PlatformCustomizer/Assets/unlit.shader b/PlatformCustomizer/Assets/unlit.shader deleted file mode 100644 index ad8fc0e..0000000 --- a/PlatformCustomizer/Assets/unlit.shader +++ /dev/null @@ -1,67 +0,0 @@ -// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld' - -Shader "BeatSaber/Unlit Glow" -{ - Properties - { - _Color ("Color", Color) = (1,1,1,1) - [MaterialToggle] _CustomColors("Custom Colors", Float) = 0 - _MainTex ("Texture", 2D) = "white" {} - _Glow ("Glow", Range (0, 1)) = 0 - [Toggle(_CUSTOMCOLORS_ON)] _CustomColors("Custom Colors", Float) = 0 - } - SubShader - { - Tags { "RenderType"="Opaque" } - LOD 100 - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma shader_feature _CUSTOMCOLORS_ON - - #include "UnityCG.cginc" - - struct appdata - { - float4 vertex : POSITION; - fixed4 color : COLOR; - float2 uv : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - }; - - struct v2f - { - float2 uv : TEXCOORD0; - float4 vertex : SV_POSITION; - half4 color : COLOR; - }; - - float4 _Color; - float _Glow; - - sampler2D _MainTex; - float4 _MainTex_ST; - - v2f vert (appdata v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.uv = v.uv; - o.color = v.color; - return o; - } - - fixed4 frag (v2f i) : SV_Target - { - // sample the texture - fixed4 col = _Color * tex2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)); - - return col * float4(1.0,1.0,1.0,_Glow) * i.color; - } - ENDCG - } - } -} diff --git a/PlatformCustomizer/CustomFeet/CustomFeetDir.cs b/PlatformCustomizer/CustomFeet/CustomFeetDir.cs new file mode 100644 index 0000000..bb7caad --- /dev/null +++ b/PlatformCustomizer/CustomFeet/CustomFeetDir.cs @@ -0,0 +1,27 @@ +using System.IO; +using IPA.Utilities; +using PlatformCustomizer.Miscellaneous; + +namespace PlatformCustomizer.CustomFeet +{ + public class CustomFeetDir + { + private const string CustomFeetDirName = "CustomFeet"; + public DirectoryInfo CustomFeetDirectory; + public DirectoryInfo CustomFeet; + + public CustomFeetDir() + { + var baseDir = new DirectoryInfo(UnityGame.InstallPath); + + CustomFeetDirectory = baseDir.GetDirectory(CustomFeetDirName); + + if (!CustomFeetDirectory.Exists) + { + CustomFeetDirectory = baseDir.CreateSubdirectory(CustomFeetDirName); + PathTools.RelativeExtension = null; + } + + } + } +} diff --git a/PlatformCustomizer/CustomFeet/RemoteLocation.cs b/PlatformCustomizer/CustomFeet/RemoteLocation.cs new file mode 100644 index 0000000..a6f9df2 --- /dev/null +++ b/PlatformCustomizer/CustomFeet/RemoteLocation.cs @@ -0,0 +1,65 @@ +using System; +using System.IO; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using SiraUtil.Web; +using UnityEngine; +using PlatformCustomizer.Miscellaneous; +using PlatformCustomizer.CustomFeet; + +namespace PlatformCustomizer.CustomFeet +{ + internal class RemoteLocation : ICustomListItem + { + public readonly string remoteLocation; + private readonly DirectoryInfo _customFeetDir; + private readonly string _fileName; + + private readonly IHttpService _webClient; + + private RemoteLocation(InitData initData, IHttpService webClient, CustomFeetDir feetDirs) + { + _webClient = webClient; + _customFeetDir = feetDirs.CustomFeetDirectory; + + remoteLocation = initData.RemoteLocation; + ListName = initData.Name; + _fileName = initData.Filename; + } + + public string ListName { get; } + + public async Task> Download(CancellationToken token) + { + try + { + var response = await _webClient.GetAsync(remoteLocation, null, token); + if (!response.Successful) + { + return default; + } + Plugin.Log.Critical("KSDJFOIjseoijiosejf"); + var filename = GetFileName(); + File.WriteAllBytes(_customFeetDir.GetFile(filename).FullName, await response.ReadAsByteArrayAsync()); + return new Tuple(true, "CustomFeet\\" + filename); + } + catch (Exception) + { + return default; + } + } + + private string GetFileName() + { + return _fileName; + } + + public struct InitData + { + public string RemoteLocation; + public string Name; + public string Filename; + } + } +} diff --git a/PlatformCustomizer/MenuItems/DisableItems.cs b/PlatformCustomizer/MenuItems/DisableItems.cs new file mode 100644 index 0000000..3d26804 --- /dev/null +++ b/PlatformCustomizer/MenuItems/DisableItems.cs @@ -0,0 +1,26 @@ +using Zenject; +using UnityEngine; +using PlatformCustomizer.Configuration; + +namespace PlatformCustomizer.MenuItems +{ + public class DisableItems : IInitializable + { + PluginConfig config = PluginConfig.Instance; + public GameObject feet = GameObject.Find("Feet"); + public GameObject jordans = GameObject.Find("shoes"); + + public void Initialize() + { + + /*if (config.EnableMod == true) + { + if (config.JordanMode == true) + { + feet.SetActive(false); + Plugin.instantiate.SetActive(true); + } + }*/ + } + } +} diff --git a/PlatformCustomizer/MenuItems/MenuFloorManager.cs b/PlatformCustomizer/MenuItems/MenuFloorManager.cs index a0e78b6..d1d8639 100644 --- a/PlatformCustomizer/MenuItems/MenuFloorManager.cs +++ b/PlatformCustomizer/MenuItems/MenuFloorManager.cs @@ -1,11 +1,10 @@ using System; -using System.Collections.Generic; using PlatformCustomizer.Configuration; using BeatSaberMarkupLanguage; using Zenject; using UnityEngine; using Object = UnityEngine.Object; -using System.IO; +using System.Collections; using PlatformCustomizer.Miscellaneous; namespace PlatformCustomizer.MenuItems @@ -18,8 +17,9 @@ internal class MenuFloorManager : IInitializable, IDisposable public Vector3 footScale; private bool _instantiatedPlatform; - private GameObject _menuPlatform; - private readonly PlatformGrabber _platformGrabber; + public GameObject _menuPlatform; + public GameObject _platform; + private PlatformGrabber _platformGrabber; private Vector3 position; private Vector3 scale; @@ -27,35 +27,47 @@ internal class MenuFloorManager : IInitializable, IDisposable public MenuFloorManager(PlatformGrabber platformGrabber) { _platformGrabber = platformGrabber; + } - + public void Initialize() { - //var loadedAssetBundle = AssetBundle.LoadFromMemory(Utilities.GetResource(Assembly.GetExecutingAssembly(), "PlatformCustomizer.Assets.menuplatform")); - //_menuPlatform = loadedAssetBundle.LoadAllAssets(); - //loadedAssetBundle.Unload(false); - if (_platformGrabber.completed) { - if (config.EnableMenuPlatform == true) - { - InstantiatePlatform(); - return; - } + InstantiatePlatform(); + Plugin.Log.Info("AHIFUIH"); return; } + + + _platformGrabber.CompletedEvent += InstantiatePlatform; + + } + private void InstantiatePlatform() { + _platformGrabber.CompletedEvent -= InstantiatePlatform; + Plugin.Log.Critical("Instantiating Platform"); - - _menuPlatform = new GameObject() + _menuPlatform = new GameObject { name = "MenuPlatform" }; + + _platform = Object.Instantiate(PlatformGrabber.TemplatePlatform, new Vector3(0f, 0.01f, 0f), Quaternion.Euler(new Vector3(0f, 0f)), _menuPlatform.transform); + + var menuPlatform = GameObject.Find("MenuPlatform"); + if (config.EnableMenuPlatform == true) + { + menuPlatform.SetActive(true); + } + else + { + menuPlatform.SetActive(false); + } - _menuPlatform = Object.Instantiate(PlatformGrabber.TemplatePlatform, new Vector3(0f, 0.1f, 0f), Quaternion.Euler(new Vector3(0f, 0f)), _menuPlatform.transform); _instantiatedPlatform = true; } @@ -68,3 +80,7 @@ public void Dispose() } } + +//var loadedAssetBundle = AssetBundle.LoadFromMemory(Utilities.GetResource(Assembly.GetExecutingAssembly(), "PlatformCustomizer.Assets.menuplatform")); +//_menuPlatform = loadedAssetBundle.LoadAllAssets(); +//loadedAssetBundle.Unload(false); diff --git a/PlatformCustomizer/Miscellaneous/CustomListItem.cs b/PlatformCustomizer/Miscellaneous/CustomListItem.cs new file mode 100644 index 0000000..0fff63c --- /dev/null +++ b/PlatformCustomizer/Miscellaneous/CustomListItem.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace PlatformCustomizer.Miscellaneous +{ + internal interface ICustomListItem + { + string ListName { get; } + } + +} diff --git a/PlatformCustomizer/Miscellaneous/PathTools.cs b/PlatformCustomizer/Miscellaneous/PathTools.cs new file mode 100644 index 0000000..9496a89 --- /dev/null +++ b/PlatformCustomizer/Miscellaneous/PathTools.cs @@ -0,0 +1,24 @@ +using System.IO; +using System.Reflection; + +namespace PlatformCustomizer.Miscellaneous +{ + public static class PathTools + { + public static string RelativeExtension; + public static DirectoryInfo GetDirectory(this DirectoryInfo dir, string dirName, bool create = false) + { + if (create) + { + return dir.CreateSubdirectory(dirName); + } + + return new DirectoryInfo(Path.Combine(dir.FullName, dirName)); + } + + public static FileInfo GetFile(this DirectoryInfo dir, string fileName) + { + return new FileInfo(Path.Combine(dir.FullName, fileName)); + } + } +} diff --git a/PlatformCustomizer/Miscellaneous/PlatformGrabber.cs b/PlatformCustomizer/Miscellaneous/PlatformGrabber.cs index eed7b4a..5a80b8a 100644 --- a/PlatformCustomizer/Miscellaneous/PlatformGrabber.cs +++ b/PlatformCustomizer/Miscellaneous/PlatformGrabber.cs @@ -9,8 +9,8 @@ namespace PlatformCustomizer.Miscellaneous // https://github.com/Exomanz/UITweaks/blob/sira3/UITweaks/Utilities/SettingsPanelObjectGrabber.cs public class PlatformGrabber : MonoBehaviour { - public bool completed; - public static GameObject? TemplatePlatform; + public bool completed = false; + public static GameObject TemplatePlatform; public Action? CompletedEvent; @@ -26,6 +26,7 @@ private IEnumerator GetPlatform() { if (completed) { + Plugin.Log.Critical("sdifhioSHJERIOFHJ"); yield break; } @@ -54,6 +55,7 @@ private IEnumerator GetPlatform() completed = true; CompletedEvent?.Invoke(); + Plugin.Log.Critical("sdifhioSHJERIOFHJ"); } } } diff --git a/PlatformCustomizer/Miscellaneous/ResourcesLoader.cs b/PlatformCustomizer/Miscellaneous/ResourcesLoader.cs deleted file mode 100644 index 4837df3..0000000 --- a/PlatformCustomizer/Miscellaneous/ResourcesLoader.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.IO; -using System.Reflection; - -namespace PlatformCustomizer.Miscellaneous -{ - public static class ResourcesLoader - { - public static Stream GetEmbeddedResourceStream(string resourceName) - { - return Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); - } - - public static string[] GetEmbeddedResourceNames() - { - return Assembly.GetExecutingAssembly().GetManifestResourceNames(); - } - } -} diff --git a/PlatformCustomizer/PlatformCustomizer.csproj b/PlatformCustomizer/PlatformCustomizer.csproj index 3a8e4b6..db59f19 100644 --- a/PlatformCustomizer/PlatformCustomizer.csproj +++ b/PlatformCustomizer/PlatformCustomizer.csproj @@ -150,16 +150,21 @@ + + + + - + + @@ -169,8 +174,8 @@ .editorconfig - - + + diff --git a/PlatformCustomizer/manifest.json b/PlatformCustomizer/manifest.json index 9e1b86a..e9ab6de 100644 --- a/PlatformCustomizer/manifest.json +++ b/PlatformCustomizer/manifest.json @@ -1,18 +1,18 @@ { - "$schema": "https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json", - "id": "PlatformCustomizer", - "name": "PlatformCustomizer", - "author": "Raz0rBeam", - "version": "0.0.2", - "description": "A mod to customize the player platform size, color, and allows you to move the UI to the platform", - "gameVersion": "1.24.1", + "$schema": "https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json", + "id": "PlatformCustomizer", + "name": "PlatformCustomizer", + "author": "Raz0rBeam", + "version": "0.0.2", + "description": "A mod that allows you to customize the different aspects of the player's platform.", + "gameVersion": "1.24.1", "dependsOn": { "BSIPA": "^4.0.5", "SiraUtil": "^3.0.6", - "BeatSaberMarkupLanguage": "^1.6.6" + "BeatSaberMarkupLanguage": "^1.6.6" }, "conflictsWith": { - "CountersPlus": "^2.3.1" + "CountersPlus": "^2.3.1" }, - "features": [] + "features": [] } \ No newline at end of file