Skip to content

Commit a3a5f41

Browse files
committed
edit: name space in sfx
1 parent 2f2e79f commit a3a5f41

File tree

63 files changed

+134
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+134
-114
lines changed

Assets/Code/Infrastructure/AudioVibrationFX/Editor.meta renamed to Assets/Code/Editor/SFX.meta

File renamed without changes.

Assets/Code/Infrastructure/AudioVibrationFX/Editor/EnumSyncPostCompile.cs renamed to Assets/Code/Editor/SFX/EnumSyncPostCompile.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using UnityEditor.Callbacks;
44
using UnityEngine;
55

6-
namespace Code
6+
namespace Code.Editor.SFX
77
{
88
[InitializeOnLoad]
99
public static class EnumSyncPostCompile
@@ -13,7 +13,8 @@ private static void OnScriptsReloaded()
1313
{
1414
Debug.Log("🔄 Scripts recompiled. Trying to sync enums...");
1515

16-
var soundWindow = Resources.FindObjectsOfTypeAll<Code.Infrastructure.AudioVibrationFX.Editor.SoundLibraryEditorWindow>().FirstOrDefault();
16+
SoundLibraryEditorWindow soundWindow = Resources.FindObjectsOfTypeAll<SoundLibraryEditorWindow>().FirstOrDefault();
17+
1718
if (soundWindow != null)
1819
{
1920
soundWindow.UpdateSoundTypesAfterReload();
@@ -24,7 +25,8 @@ private static void OnScriptsReloaded()
2425
Debug.LogWarning("⚠️ SoundLibraryEditorWindow not open. Skipping SoundTypes sync.");
2526
}
2627

27-
var vibrationWindow = Resources.FindObjectsOfTypeAll<Code.Infrastructure.AudioVibrationFX.Editor.VibrationLibraryEditorWindow>().FirstOrDefault();
28+
VibrationLibraryEditorWindow vibrationWindow = Resources.FindObjectsOfTypeAll<VibrationLibraryEditorWindow>().FirstOrDefault();
29+
2830
if (vibrationWindow != null)
2931
{
3032
vibrationWindow.UpdateVibrationTypesAfterReload();

Assets/Code/Infrastructure/AudioVibrationFX/Editor/EnumSyncPostCompile.cs.meta renamed to Assets/Code/Editor/SFX/EnumSyncPostCompile.cs.meta

File renamed without changes.

Assets/Code/Infrastructure/AudioVibrationFX/Editor/SoundLibraryEditorWindow.cs renamed to Assets/Code/Editor/SFX/SoundLibraryEditorWindow.cs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5-
using Code.Infrastructure.AudioVibrationFX.Services.Music;
6-
using Code.Infrastructure.AudioVibrationFX.Services.Sound;
7-
using Code.Infrastructure.AudioVibrationFX.StaticData;
5+
using Code.Services.SFX.Music;
6+
using Code.Services.SFX.Sound;
7+
using Code.StaticData.SFX;
88
using Sirenix.OdinInspector;
99
using Sirenix.OdinInspector.Editor;
1010
using UnityEditor;
1111
using UnityEngine;
1212

13-
namespace Code.Infrastructure.AudioVibrationFX.Editor
13+
namespace Code.Editor.SFX
1414
{
1515
public class SoundLibraryEditorWindow : OdinEditorWindow
1616
{
@@ -90,28 +90,32 @@ private void GenerateEnums()
9090

9191
private void GenerateSound2DEnumFile(string fileName, string enumName, List<SoundData> soundList)
9292
{
93-
var enumPath = $"{SoundPath}{fileName}";
93+
string enumPath = $"{SoundPath}{fileName}";
9494
GenerateEnumFileBase(enumPath, enumName, NameSpaceSound, soundList, TypeSound.Sound2D);
9595
}
9696

9797
private void GenerateSound3DEnumFile(string fileName, string enumName, List<Sound3DData> soundList)
9898
{
99-
var enumPath = $"{SoundPath}{fileName}";
99+
string enumPath = $"{SoundPath}{fileName}";
100100
List<SoundData> baseList = soundList.Cast<SoundData>().ToList();
101101
GenerateEnumFileBase(enumPath, enumName, NameSpaceSound ,baseList, TypeSound.Sound3D);
102102
}
103103

104104
private void GenerateMusicEnumFile(string fileName, string enumName, List<SoundData> soundList)
105105
{
106-
var enumPath = $"{MusicPath}{fileName}";
106+
string enumPath = $"{MusicPath}{fileName}";
107107
GenerateEnumFileBase(enumPath, enumName, NameSpaceMusic, soundList, TypeSound.Music);
108108
}
109109

110110
private void GenerateEnumFileBase(string enumPath, string enumName, string nameSpace ,List<SoundData> soundList, TypeSound typeSound)
111111
{
112-
var names = soundList
112+
List<string> names = soundList
113113
.Where(s => !string.IsNullOrWhiteSpace(s.Name))
114-
.Select(s => s.Name.Replace(" ", "_").Replace("-", "_").Replace(".", "_").Trim())
114+
.Select(s => s.Name
115+
.Replace(" ", "_")
116+
.Replace("-", "_")
117+
.Replace(".", "_")
118+
.Trim())
115119
.Distinct()
116120
.ToList();
117121

@@ -137,7 +141,11 @@ private void GenerateEnumFileBase(string enumPath, string enumName, string nameS
137141

138142
foreach (var sound in soundList)
139143
{
140-
var enumNameSanitized = sound.Name.Replace(" ", "_").Replace("-", "_").Replace(".", "_").Trim();
144+
var enumNameSanitized = sound.Name
145+
.Replace(" ", "_")
146+
.Replace("-", "_")
147+
.Replace(".", "_")
148+
.Trim();
141149

142150
switch (typeSound)
143151
{
@@ -174,7 +182,7 @@ protected override void OnEnable()
174182
{
175183
base.OnEnable();
176184

177-
var loaded = Resources.Load<SoundsData>("StaticData/Sounds/Sounds");
185+
SoundsData loaded = Resources.Load<SoundsData>("StaticData/Sounds/Sounds");
178186

179187
if (loaded != null)
180188
{
@@ -211,13 +219,19 @@ private void SaveSoundsData()
211219
private void UpdateSoundTypes()
212220
{
213221
foreach (var sound in _sounds2DDataEditable)
214-
sound.Sound2DType = Enum.TryParse(sound.Name, out Sound2DType parsedType) ? parsedType : Sound2DType.Unknown;
222+
sound.Sound2DType = Enum.TryParse(sound.Name, out Sound2DType parsedType) ?
223+
parsedType :
224+
Sound2DType.Unknown;
215225

216226
foreach (var sound in _sounds3DDataEditable)
217-
sound.Sound3DType = Enum.TryParse(sound.Name, out Sound3DType parsedType) ? parsedType : Sound3DType.Unknown;
227+
sound.Sound3DType = Enum.TryParse(sound.Name, out Sound3DType parsedType) ?
228+
parsedType :
229+
Sound3DType.Unknown;
218230

219231
foreach (var music in _musicDataEditable)
220-
music.MusicType = Enum.TryParse(music.Name, out MusicType parsedType) ? parsedType : MusicType.Unknown;
232+
music.MusicType = Enum.TryParse(music.Name, out MusicType parsedType) ?
233+
parsedType :
234+
MusicType.Unknown;
221235

222236
EditorUtility.SetDirty(_soundsData);
223237
AssetDatabase.SaveAssets();

Assets/Code/Infrastructure/AudioVibrationFX/Editor/SoundLibraryEditorWindow.cs.meta renamed to Assets/Code/Editor/SFX/SoundLibraryEditorWindow.cs.meta

File renamed without changes.

Assets/Code/Infrastructure/AudioVibrationFX/Editor/VibrationLibraryEditorWindow.cs renamed to Assets/Code/Editor/SFX/VibrationLibraryEditorWindow.cs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5-
using Code.Infrastructure.AudioVibrationFX.Services.Vibration;
6-
using Code.Infrastructure.AudioVibrationFX.StaticData;
5+
using Code.Services.SFX.Vibration;
6+
using Code.StaticData.SFX;
77
using Sirenix.OdinInspector;
88
using Sirenix.OdinInspector.Editor;
99
using UnityEditor;
1010
using UnityEngine;
1111

12-
namespace Code.Infrastructure.AudioVibrationFX.Editor
12+
namespace Code.Editor.SFX
1313
{
1414
public class VibrationLibraryEditorWindow : OdinEditorWindow
1515
{
@@ -87,9 +87,13 @@ protected override void OnDisable()
8787

8888
private void GenerateEnumFile(string path, string enumName, List<VibrationData> vibrationList)
8989
{
90-
var names = vibrationList
90+
List<string> names = vibrationList
9191
.Where(v => !string.IsNullOrWhiteSpace(v.Name))
92-
.Select(v => v.Name.Replace(" ", "_").Replace("-", "_").Replace(".", "_").Trim())
92+
.Select(v => v.Name
93+
.Replace(" ", "_")
94+
.Replace("-", "_")
95+
.Replace(".", "_")
96+
.Trim())
9397
.Distinct()
9498
.ToList();
9599

@@ -118,20 +122,35 @@ private void AssignEnumTypes(List<VibrationData> list)
118122
{
119123
foreach (var vibration in list)
120124
{
121-
var sanitized = vibration.Name.Replace(" ", "_").Replace("-", "_").Replace(".", "_").Trim();
122-
vibration.VibrationType = Enum.TryParse(sanitized, out VibrationType parsed) ? parsed : VibrationType.Unknown;
125+
string sanitized = vibration.Name
126+
.Replace(" ", "_")
127+
.Replace("-", "_")
128+
.Replace(".", "_")
129+
.Trim();
130+
131+
vibration.VibrationType = Enum.TryParse(sanitized, out VibrationType parsed) ?
132+
parsed :
133+
VibrationType.Unknown;
123134
}
124135
}
125136

126137
public void UpdateVibrationTypesAfterReload()
127138
{
128139
foreach (var vibration in _editableVibrations)
129140
{
130-
var sanitized = vibration.Name.Replace(" ", "_").Replace("-", "_").Replace(".", "_").Trim();
131-
vibration.VibrationType = Enum.TryParse(sanitized, out VibrationType parsed) ? parsed : VibrationType.Unknown;
141+
string sanitized = vibration.Name
142+
.Replace(" ", "_")
143+
.Replace("-", "_")
144+
.Replace(".", "_")
145+
.Trim();
146+
147+
vibration.VibrationType = Enum.TryParse(sanitized, out VibrationType parsed) ?
148+
parsed :
149+
VibrationType.Unknown;
132150
}
133151

134152
SaveData();
153+
135154
AssetDatabase.SaveAssets();
136155
AssetDatabase.Refresh();
137156
}

Assets/Code/Infrastructure/AudioVibrationFX/Editor/VibrationLibraryEditorWindow.cs.meta renamed to Assets/Code/Editor/SFX/VibrationLibraryEditorWindow.cs.meta

File renamed without changes.

Assets/Code/Infrastructure/AudioVibrationFX/Editor/GameEditor.asmdef

Lines changed: 0 additions & 18 deletions
This file was deleted.

Assets/Code/Infrastructure/AudioVibrationFX/Editor/GameEditor.asmdef.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Assets/Code/Infrastructure/AudioVibrationFX/Test.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)