Initial Commit

This commit is contained in:
jellejurre
2025-07-19 01:03:02 +02:00
commit e7904e3140
304 changed files with 22521 additions and 0 deletions

2
Metal-Pipe/CHANGELOG.md Normal file
View File

@@ -0,0 +1,2 @@
## [1.0.0] - 2023/04/18
### Initial Release

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 57f28502b1efbf541a91b054db13bcd7
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Metal-Pipe/Editor.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f170acfbc72991d4e96951ec67fd43f2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,175 @@
using UnityEditor;
using UnityEngine;
namespace DreadScripts.MetalPipe
{
public class MetalPipe : EditorWindow, IHasCustomMenu
{
private const string PREF_KEY = "MetalPipeSettings";
private const string TEXTURE_PATH = "MP_Protagonist";
private const string AUDIO_PATH = "MP_Sooth (LOUD)";
private Texture2D _pipeTexture;
private Texture2D pipeTexture
{
get
{
if (_pipeTexture == null) _pipeTexture = Resources.Load<Texture2D>(TEXTURE_PATH);
return _pipeTexture;
}
}
private AudioClip pipeAudio;
private bool displaySettings;
private bool hasModifiedSettings;
private double nextPlayTime;
private Vector2 scroll;
public float volume = 0.25f;
public bool autoPlay;
public float minAutoTime = 20;
public float maxAutoTime = 420;
#region Properties
private static GameObject _pipePlayerContainer;
private static GameObject pipePlayerContainer
{
get
{
_pipePlayerContainer = new GameObject("Pipe");
_pipePlayerContainer.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy;
var source = _pipePlayerContainer.AddComponent<AudioSource>();
source.hideFlags = HideFlags.DontSave;
source.spatialBlend = 0;
source.playOnAwake = false;
source.priority = 0;
return _pipePlayerContainer;
}
}
private static AudioSource pipeAudioSource => pipePlayerContainer.GetComponent<AudioSource>();
#endregion
[MenuItem("DreadTools/Utility/Metal Pipe")]
public static void ShowWindow()
{
var inst = GetWindow<MetalPipe>("Metal Pipe");
inst.titleContent.image = inst.pipeTexture;
}
public void OnGUI()
{
if (!displaySettings)
{
var ratio = pipeTexture.width / (float)pipeTexture.height;
var rect = GUILayoutUtility.GetAspectRect(ratio);
GUI.DrawTexture(rect, pipeTexture);
var e = Event.current;
switch (e.type)
{
case EventType.Repaint:
EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
break;
case EventType.MouseDown when e.button == 0 && rect.Contains(e.mousePosition):
PlayClip();
break;
}
}
else
{
scroll = EditorGUILayout.BeginScrollView(scroll);
EditorGUI.BeginChangeCheck();
volume = EditorGUILayout.Slider("Volume", volume, 0, 1);
bool wasAutoPlaying = autoPlay;
autoPlay = EditorGUILayout.Toggle(new GUIContent("Auto Play", ""), autoPlay);
if (wasAutoPlaying != autoPlay)
{
EditorApplication.update -= CheckForAutoPlay;
if (autoPlay)
{
RandomizeTimer();
EditorApplication.update += CheckForAutoPlay;
}
}
using (new EditorGUI.DisabledScope(!autoPlay))
{
EditorGUI.indentLevel++;
minAutoTime = Mathf.Max(0, EditorGUILayout.FloatField("Min Auto Time", minAutoTime));
maxAutoTime = Mathf.Max(0, EditorGUILayout.FloatField("Max Auto Time", maxAutoTime));
EditorGUI.indentLevel--;
}
hasModifiedSettings |= EditorGUI.EndChangeCheck();
using (new GUILayout.HorizontalScope())
{
if (GUILayout.Button("Back", GUILayout.ExpandWidth(false)))
displaySettings = false;
using (new EditorGUI.DisabledScope(!hasModifiedSettings))
{
if (GUILayout.Button("Revert Changes"))
LoadSettings();
if (GUILayout.Button("Save Settings"))
SaveSettings();
}
}
EditorGUILayout.EndScrollView();
}
}
public void PlayClip(bool isTest = false)
{
pipeAudioSource.PlayOneShot(pipeAudio, volume);
if (!isTest) RandomizeTimer();
}
public void OnEnable()
{
pipeAudio = Resources.Load<AudioClip>(AUDIO_PATH);
LoadSettings();
if (autoPlay)
{
RandomizeTimer();
EditorApplication.update -= CheckForAutoPlay;
EditorApplication.update += CheckForAutoPlay;
}
}
public void OnDisable() => EditorApplication.update -= CheckForAutoPlay;
public void CheckForAutoPlay()
{
if (Time.realtimeSinceStartup > nextPlayTime)
PlayClip();
}
public void RandomizeTimer() => nextPlayTime = Time.realtimeSinceStartup + Random.Range(minAutoTime, maxAutoTime);
public void AddItemsToMenu(GenericMenu menu) => menu.AddItem(new GUIContent("Settings"), displaySettings, () => displaySettings = !displaySettings);
#region Saving
public void SaveSettings()
{
EditorPrefs.SetString(PREF_KEY, JsonUtility.ToJson(this));
hasModifiedSettings = false;
}
public void LoadSettings()
{
if (EditorPrefs.HasKey(PREF_KEY)) JsonUtility.FromJsonOverwrite(EditorPrefs.GetString(PREF_KEY), this);
hasModifiedSettings = false;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0e9935148c0be85439592b0052c895ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
{
"name": "com.dreadscripts.metalpipe.Editor",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 54f6442ba203a494db8497077d69a272
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

18
Metal-Pipe/LICENSE.md Normal file
View File

@@ -0,0 +1,18 @@
Copyright (c) 2023 Dreadrith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bbbb9d1a52c90f246b5adb328f7d88f6
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 89cd029e998f91f4e94b3805e8268346
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: 79feaf7835c2c9d45b5a5b57d12ea121
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 51b0a0602a3128841b09fd3c2597165a
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

21
Metal-Pipe/package.json Normal file
View File

@@ -0,0 +1,21 @@
{
"author": {
"name": "Dreadrith",
"email": "DreadScripts@gmail.com",
"url": "https://github.com/Dreadrith"
},
"name": "com.dreadscripts.metalpipe",
"displayName": "MetalPipe",
"version": "1.0.0",
"description": "A metal pipe window to soothe your ears with the beautiful sound of a metal pipe.",
"keywords": [
"Soothing",
"Beautiful",
"Hardcode"
],
"gitDependencies": {},
"vpmDependencies": {},
"legacyFolders": {},
"legacyFiles": {},
"type": "tool"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d2ea3144282705e4f9e52f5fcb8aeb2e
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: