-
Notifications
You must be signed in to change notification settings - Fork 5
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
jixxed
committed
Jan 28, 2024
1 parent
15e230c
commit 7191196
Showing
5 changed files
with
107 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,7 @@ | ||
namespace StationeersMods.Interface | ||
{ | ||
public enum ShaderType | ||
{ | ||
EMISSIVE, NORMAL, CUTABLE | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
StationieersMods/StationeersMods.Interface/StationeersColor.cs
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,18 @@ | ||
namespace StationeersMods.Interface | ||
{ | ||
public enum StationeersColor | ||
{ | ||
BLUE=0, | ||
GRAY=1, | ||
GREEN=2, | ||
ORANGE=3, | ||
RED=4, | ||
YELLOW=5, | ||
WHITE=6, | ||
BLACK=7, | ||
BROWN=8, | ||
KHAKI=9, | ||
PINK=10, | ||
PURPLE=11 | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
StationieersMods/StationeersMods.Interface/StationeersModsUtility.cs
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,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Assets.Scripts; | ||
using Assets.Scripts.Objects; | ||
using Assets.Scripts.Util; | ||
using UnityEngine; | ||
|
||
namespace StationeersMods.Interface | ||
{ | ||
public class StationeersModsUtility | ||
{ | ||
|
||
public static Material GetMaterial(StationeersColor color, ShaderType shaderType) | ||
{ | ||
ref List<ColorSwatch> customColors = ref Singleton<GameManager>.Instance.CustomColors; | ||
ColorSwatch customColor = customColors[(int)color]; | ||
switch (shaderType) | ||
{ | ||
case ShaderType.NORMAL: | ||
return customColor.Normal; | ||
case ShaderType.EMISSIVE: | ||
return customColor.Emissive; | ||
case ShaderType.CUTABLE: | ||
return customColor.Cutable; | ||
default: | ||
throw new ArgumentOutOfRangeException(nameof(shaderType), shaderType, null); | ||
} | ||
} | ||
|
||
public static Material GetMaterial(string materialName) | ||
{ | ||
return (Material) Resources.Load("Objects/Models/Materials/" + materialName, typeof(Material)); | ||
} | ||
|
||
public static Material[] GetBlueprintMaterials(int size) | ||
{ | ||
var blueprintMaterial = FindPrefab("StructureFrame").Blueprint.GetComponent<MeshRenderer>().materials[0]; | ||
var materials = new Material[size]; | ||
Array.Fill(materials, blueprintMaterial, 0, size); | ||
return materials; | ||
} | ||
|
||
public static Thing FindPrefab(string prefabName) | ||
{ | ||
return WorldManager.Instance.SourcePrefabs.Find((Thing prefab) => prefab != null && prefabName.Equals(prefab.PrefabName)); | ||
} | ||
|
||
public static Item FindTool(StationeersTool tool) | ||
{ | ||
return FindPrefab(tool.PrefabName).GetComponent<Item>(); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
StationieersMods/StationeersMods.Interface/StationeersTool.cs
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,24 @@ | ||
namespace StationeersMods.Interface | ||
{ | ||
public class StationeersTool | ||
{ | ||
public static StationeersTool ANGLE_GRINDER = new StationeersTool( "ItemAngleGrinder"); | ||
public static StationeersTool WELDER = new StationeersTool( "ItemWeldingTorch"); | ||
public static StationeersTool CABLE_CUTTERS = new StationeersTool( "ItemWireCutters"); | ||
public static StationeersTool CROWBAR = new StationeersTool( "ItemCrowbar"); | ||
public static StationeersTool DRILL = new StationeersTool( "ItemDrill"); | ||
public static StationeersTool MINING_DRILL = new StationeersTool( "ItemMiningDrill"); | ||
public static StationeersTool PICKAXE = new StationeersTool( "ItemPickaxe"); | ||
public static StationeersTool DUCT_TAPE = new StationeersTool( "ItemDuctTape"); | ||
public static StationeersTool FIRE_EXTINGUISHER = new StationeersTool( "ItemFireExtinguisher"); | ||
public static StationeersTool LABELLER = new StationeersTool( "ItemLabeller"); | ||
public static StationeersTool WRENCH = new StationeersTool( "ItemWrench"); | ||
public static StationeersTool SCREWDRIVER = new StationeersTool( "ItemScrewdrive"); | ||
public string PrefabName { get; private set; } | ||
|
||
public StationeersTool(string prefabName) | ||
{ | ||
PrefabName = prefabName; | ||
} | ||
} | ||
} |