Skip to content

Commit

Permalink
Clean preview assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Graicc committed Feb 18, 2022
1 parent 418644b commit 77771af
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
1 change: 0 additions & 1 deletion GorillaCosmetics/AssetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public T GetAsset<T>(string name) where T : IAsset
{
foreach(IAsset asset in assetList)
{
// TODO: Check to make sure this works with networking (it probally doesn't)
if (asset.Descriptor.Name.Trim().ToLower() == formattedName)
{
return (T)asset;
Expand Down
19 changes: 19 additions & 0 deletions GorillaCosmetics/Data/GorillaHat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,24 @@ public GameObject GetAsset()
gameObject.SetActive(true);
return gameObject;
}

public GameObject GetCleanAsset()
{
GameObject gameObject = GetAsset();
void DestroyComponent<T>() where T : Component
{
var components = gameObject.GetComponentsInChildren<T>();
foreach(var component in components)
{
UnityEngine.Object.Destroy(component);
}
}

DestroyComponent<Light>();
DestroyComponent<Camera>();
DestroyComponent<AudioSource>();

return gameObject;
}
}
}
1 change: 0 additions & 1 deletion GorillaCosmetics/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace GorillaCosmetics
{
// TODO: Update readme build instructions
[BepInPlugin("org.legoandmars.gorillatag.gorillacosmetics", "Gorilla Cosmetics", "2.1.1")]
// TODO: Add utilla as a dependency in mmm
[BepInDependency("org.legoandmars.gorillatag.utilla", "1.5.0")]
public class Plugin : BaseUnityPlugin
{
Expand Down
2 changes: 1 addition & 1 deletion GorillaCosmetics/UI/HatButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void SetHat(GorillaHat hat)
}
if (Hat != null)
{
previewHat = Hat.GetAsset();
previewHat = Hat.GetCleanAsset();
HeadModel controlledModel = wardrobeItemButton.controlledModel;
previewHat.transform.parent = controlledModel.gameObject.transform;
// TODO: Get the actual proper numbers
Expand Down
2 changes: 1 addition & 1 deletion GorillaCosmetics/UI/MaterialButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override void ButtonActivation()
}
}

void Awake()
new void Awake()
{
base.Awake();

Expand Down
4 changes: 1 addition & 3 deletions GorillaCosmetics/UI/SelectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ void CreateEnableButton()

public void Disable()
{
// TODO: Show normal cosmetics
foreach (var button in wardrobe.wardrobeItemButtons)
{
var oldButton = button.GetComponent<BaseCosmeticButton>();
Expand All @@ -137,7 +136,6 @@ public void Disable()
badgeButton.enabled = true;
badgeButton.myText.enabled = true;

// TODO: Fix
CosmeticsController.instance.PressWardrobeFunctionButton("hat");
CosmeticsController.instance.PressWardrobeFunctionButton("right");
CosmeticsController.instance.PressWardrobeFunctionButton("left");
Expand Down Expand Up @@ -282,7 +280,7 @@ void UpdateHeadModel()

if (CurrentHat != null)
{
previewHat = CurrentHat.GetAsset();
previewHat = CurrentHat.GetCleanAsset();
previewHat.transform.parent = parent;
previewHat.transform.localPosition = Constants.PreviewHatLocalPosition;
previewHat.transform.localRotation = Constants.PreviewHatLocalRotation;
Expand Down

0 comments on commit 77771af

Please sign in to comment.