Skip to content

Commit

Permalink
Tried adding a MenuPlatform (it doesnt work, but it will soon)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raz0rBeam committed Aug 21, 2022
1 parent 4510b70 commit 7bdaf89
Show file tree
Hide file tree
Showing 17 changed files with 306 additions and 117 deletions.
4 changes: 4 additions & 0 deletions .idea/.idea.PlatformCustomizer/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.PlatformCustomizer/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.PlatformCustomizer/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions .idea/.idea.PlatformCustomizer/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed PlatformCustomizer/Assets/menuplatform
Binary file not shown.
67 changes: 0 additions & 67 deletions PlatformCustomizer/Assets/unlit.shader

This file was deleted.

27 changes: 27 additions & 0 deletions PlatformCustomizer/CustomFeet/CustomFeetDir.cs
Original file line number Diff line number Diff line change
@@ -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;
}

}
}
}
65 changes: 65 additions & 0 deletions PlatformCustomizer/CustomFeet/RemoteLocation.cs
Original file line number Diff line number Diff line change
@@ -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<Tuple<bool, string>> 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<bool, string>(true, "CustomFeet\\" + filename);
}
catch (Exception)
{
return default;
}
}

private string GetFileName()
{
return _fileName;
}

public struct InitData
{
public string RemoteLocation;
public string Name;
public string Filename;
}
}
}
26 changes: 26 additions & 0 deletions PlatformCustomizer/MenuItems/DisableItems.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}*/
}
}
}
50 changes: 33 additions & 17 deletions PlatformCustomizer/MenuItems/MenuFloorManager.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,44 +17,57 @@ 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;

public MenuFloorManager(PlatformGrabber platformGrabber)
{
_platformGrabber = platformGrabber;

}

public void Initialize()
{
//var loadedAssetBundle = AssetBundle.LoadFromMemory(Utilities.GetResource(Assembly.GetExecutingAssembly(), "PlatformCustomizer.Assets.menuplatform"));
//_menuPlatform = loadedAssetBundle.LoadAllAssets<GameObject>();
//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;
}

Expand All @@ -68,3 +80,7 @@ public void Dispose()

}
}

//var loadedAssetBundle = AssetBundle.LoadFromMemory(Utilities.GetResource(Assembly.GetExecutingAssembly(), "PlatformCustomizer.Assets.menuplatform"));
//_menuPlatform = loadedAssetBundle.LoadAllAssets<GameObject>();
//loadedAssetBundle.Unload(false);
Loading

0 comments on commit 7bdaf89

Please sign in to comment.