Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thunderkit Utilities #558

Merged
merged 23 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7f73102
Added asset bundles guide
Indigocoder1 Feb 28, 2024
2d9cd12
Grammar changes and formatting
Indigocoder1 Feb 28, 2024
2f03104
Grammar & readability improvements. Added prefab guide
Indigocoder1 Feb 29, 2024
612d98d
Fix a couple grammar issues
LeeTwentyThree Feb 29, 2024
c8d44e8
Fixed names and comment spaces
Indigocoder1 Mar 1, 2024
c41b416
Merge branch 'master' of https://github.com/Indigocoder1/Nautilus
Indigocoder1 Mar 1, 2024
699d92e
Replace constant classID with PrefabInfo one
Indigocoder1 Mar 1, 2024
56a92bc
Changed TechType to PascalCase
Indigocoder1 Mar 1, 2024
19bda17
Fix duplicate usage of "on"
LeeTwentyThree Mar 1, 2024
d4616b4
Add Nautilus.Utility using statement
LeeTwentyThree Mar 1, 2024
3bc5d8a
Since the prefab has a recipe, must be pickupable
LeeTwentyThree Mar 1, 2024
12d6124
Merge branch 'master' of https://github.com/Indigocoder1/Nautilus
Indigocoder1 Sep 14, 2024
f0e3d6f
Added thunderkit utilites
Indigocoder1 Sep 14, 2024
ad6de78
Added SN/BZ checking
Indigocoder1 Sep 14, 2024
cbd18cb
Added separate enums for the layers in SN & BZ
Indigocoder1 Sep 14, 2024
a6cd36c
Changed name of application modes
Indigocoder1 Sep 14, 2024
600639d
Moved material getters to MaterialUtils
Indigocoder1 Sep 14, 2024
0e5f48d
Changed layer application to use switch expression
Indigocoder1 Sep 14, 2024
50efec8
Removed unnecessary comment
Indigocoder1 Sep 14, 2024
8b2ddd0
Changed property names to respect their type name
Indigocoder1 Sep 14, 2024
a86deef
Added default index of 0 to material indices
Indigocoder1 Sep 14, 2024
1c2a2d5
Added graphic setting and reverted default build config
Indigocoder1 Sep 14, 2024
3a31553
Added graphic option to layer applier & removed outdated comment
Indigocoder1 Sep 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changed name of application modes
  • Loading branch information
Indigocoder1 committed Sep 14, 2024
commit a6cd36c2f7db27be92f08b681ba0bf355c0e6c70
4 changes: 2 additions & 2 deletions Nautilus.sln
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{418502DD-372D-4EF9-8021-B262552DFEDE}.BZ.STABLE|Any CPU.ActiveCfg = BZ.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.BZ.STABLE|Any CPU.Build.0 = BZ.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.Debug|Any CPU.ActiveCfg = SN.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.Debug|Any CPU.Build.0 = SN.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.Debug|Any CPU.ActiveCfg = BZ.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.Debug|Any CPU.Build.0 = BZ.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.Release|Any CPU.ActiveCfg = SN.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.Release|Any CPU.Build.0 = SN.STABLE|Any CPU
{418502DD-372D-4EF9-8021-B262552DFEDE}.SN.STABLE|Any CPU.ActiveCfg = SN.STABLE|Any CPU
Expand Down
18 changes: 16 additions & 2 deletions Nautilus/Utility/MaterialUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ internal static void Patch()

private static IEnumerator LoadReferences()
{
#if SUBNAUTICA
yield return PatchInternal();
#endif

IsReady = true;

yield break;
Expand All @@ -32,6 +31,21 @@ private static IEnumerator LoadReferences()
/// </summary>
public static bool IsReady { get; private set; }

/// <summary>
/// Gets the material for the outside of glass, such as for base windows
/// </summary>
public static Material ExteriorGlassMaterial { get; private set; }

/// <summary>
/// Gets the material for the inside of glass, such as the inside of the Cyclops windshield
/// </summary>
public static Material InteriorGlassMaterial { get; private set; }

/// <summary>
/// Gets a shiny glass material
/// </summary>
public static Material ShinyGlassMaterial { get; private set; }

/// <summary>
/// Contains references to various Shaders.
/// </summary>
Expand Down
21 changes: 21 additions & 0 deletions Nautilus/Utility/MaterialUtils_BelowZero.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections;
using UnityEngine;
using UWE;

#if BELOWZERO
namespace Nautilus.Utility;

public static partial class MaterialUtils_BelowZero
{
private static IEnumerator PatchInternal()
{
yield return LoadIonCubeMaterial();
yield return LoadPrecursorGlassAndFogMaterial();
yield return LoadStasisFieldMaterial();
yield return LoadAirWaterBarrierMaterial();
yield return LoadForcefieldMaterial();
yield return LoadGhostMaterial();
}
}

#endif
25 changes: 25 additions & 0 deletions Nautilus/Utility/MaterialUtils_Subnautica.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ private static IEnumerator PatchInternal()
/// </summary>
public static Material GhostMaterial { get; private set; }

/// <summary>
/// Gets the material used by the UI in the Cyclops
/// </summary>
public static Material HolographicUIMaterial { get; private set; }

private static IEnumerator LoadIonCubeMaterial()
{
if (IonCubeMaterial)
Expand Down Expand Up @@ -128,5 +133,25 @@ private static IEnumerator LoadGhostMaterial()
GhostMaterial = wallShelf.GetComponentInChildren<Constructable>().ghostMaterial;
}
}

private static bool _cyclopsLoaded;

private static IEnumerator LoadUIMaterial()
{
yield return new WaitUntil(() => LightmappedPrefabs.main);

LightmappedPrefabs.main.RequestScenePrefab("Cyclops", new LightmappedPrefabs.OnPrefabLoaded(OnCyclopsLoaded));

yield return new WaitUntil(() => _cyclopsLoaded);
}

private static void OnCyclopsLoaded(GameObject cyclops)
{
var holoMat = cyclops.transform.Find("HelmHUD/HelmHUDVisuals/Canvas_LeftHUD/EngineOnUI/EngineOff_Button")
.GetComponent<UnityEngine.UI.Image>().material;

HolographicUIMaterial = new Material(holoMat);
_cyclopsLoaded = true;
}
}
#endif
8 changes: 4 additions & 4 deletions Nautilus/Utility/ThunderkitUtilities/ApplySNFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ namespace Nautilus.Utility.ThunderkitUtilities;
internal class ApplySNFont : MonoBehaviour
{
[Tooltip("How to apply the font")]
public GeneralApplicationMode applicationMode;
public GeneralSetMode applicationMode;

private void Start()
{
switch (applicationMode)
{
case GeneralApplicationMode.SingleObject:
case GeneralSetMode.SingleObject:
GetComponent<TextMeshProUGUI>().font = FontUtils.Aller_Rg;
break;
case GeneralApplicationMode.AllChildObjects:
case GeneralSetMode.AllChildObjects:
GetComponentsInChildren<TextMeshProUGUI>().ForEach(t => t.font = FontUtils.Aller_Rg);
break;
case GeneralApplicationMode.AllChildObjectsIncludeInactive:
case GeneralSetMode.AllChildObjectsIncludeInactive:
GetComponentsInChildren<TextMeshProUGUI>(true).ForEach(t => t.font = FontUtils.Aller_Rg);
break;
}
Expand Down
8 changes: 4 additions & 4 deletions Nautilus/Utility/ThunderkitUtilities/ApplySNLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class ApplySNLayer : MonoBehaviour
public LayerName layerName;

[Tooltip("How to apply the layer")]
public GeneralApplicationMode applicationMode;
public GeneralSetMode applicationMode;

private void Start()
{
Expand All @@ -18,13 +18,13 @@ private void Start()

switch(applicationMode)
{
case GeneralApplicationMode.SingleObject:
case GeneralSetMode.SingleObject:
gameObject.layer = layer;
break;
case GeneralApplicationMode.AllChildObjects:
case GeneralSetMode.AllChildObjects:
GetComponentsInChildren<GameObject>().ForEach(g => g.layer = layer);
break;
case GeneralApplicationMode.AllChildObjectsIncludeInactive:
case GeneralSetMode.AllChildObjectsIncludeInactive:
GetComponentsInChildren<GameObject>(true).ForEach(g => g.layer = layer);
break;
}
Expand Down
10 changes: 5 additions & 5 deletions Nautilus/Utility/ThunderkitUtilities/ApplySNMaterial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Nautilus.Utility.ThunderkitUtilities;
internal class ApplySNMaterial : MonoBehaviour
{
[Tooltip("How to apply the material")]
public MaterialApplicationMode applicationMode;
public MaterialSetMode applicationMode;

[Tooltip("What material to apply")]
public MaterialType materialType;
Expand Down Expand Up @@ -41,7 +41,7 @@ private IEnumerator Start()
}

/// <summary>
/// Applies the set material using the specified <see cref="MaterialApplicationMode"/>
/// Applies the set material using the specified <see cref="MaterialSetMode"/>
/// A coroutine is required to ensure all material references are retrieved before being applied
/// </summary>
public IEnumerator AssignMaterials()
Expand All @@ -53,13 +53,13 @@ public IEnumerator AssignMaterials()

switch(applicationMode)
{
case MaterialApplicationMode.SingleObject:
case MaterialSetMode.SingleObject:
ApplyMaterialsOnSingleRend();
break;
case MaterialApplicationMode.AllChildObjects:
case MaterialSetMode.AllChildObjects:
ApplyMaterialsOnChildren(false);
break;
case MaterialApplicationMode.AllChildObjectsIncludeInactive:
case MaterialSetMode.AllChildObjectsIncludeInactive:
ApplyMaterialsOnChildren(true);
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace Nautilus.Utility.ThunderkitUtilities;

internal enum GeneralApplicationMode
internal enum GeneralSetMode
{
SingleObject,
AllChildObjects,
AllChildObjectsIncludeInactive,
}

internal enum MaterialApplicationMode
internal enum MaterialSetMode
{
SingleObject,
AllChildObjects,
Expand Down
Loading