-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
v0.0.4
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using Kameffee.AudioPlayer; | ||
using UnityEditor; | ||
using UnityEditorInternal; | ||
using UnityEngine; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
[CustomEditor(typeof(BgmBundle))] | ||
public class BgmBundleEditor : Editor | ||
{ | ||
private ReorderableList _reorderableList; | ||
|
||
private void OnEnable() | ||
{ | ||
var _list = serializedObject.FindProperty("_bgmDataList"); | ||
_reorderableList = new ReorderableList(serializedObject, _list) | ||
{ | ||
drawElementCallback = (rect, index, active, focused) => | ||
{ | ||
rect.xMin += 10; | ||
EditorGUI.PropertyField(rect, _list.GetArrayElementAtIndex(index), true); | ||
}, | ||
elementHeightCallback = index => EditorGUI.GetPropertyHeight(_list.GetArrayElementAtIndex(index)), | ||
}; | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
_reorderableList.DoLayoutList(); | ||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using UnityEditor; | ||
using UnityEditorInternal; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
[CustomEditor(typeof(SeBundle))] | ||
public class SeBundleEditor : Editor | ||
{ | ||
private ReorderableList _reorderableList; | ||
|
||
private void OnEnable() | ||
{ | ||
var _list = serializedObject.FindProperty("_seDataList"); | ||
_reorderableList = new ReorderableList(serializedObject, _list) | ||
{ | ||
drawElementCallback = (rect, index, active, focused) => | ||
{ | ||
rect.xMin += 10; | ||
EditorGUI.PropertyField(rect, _list.GetArrayElementAtIndex(index), true); | ||
}, | ||
elementHeightCallback = index => EditorGUI.GetPropertyHeight(_list.GetArrayElementAtIndex(index)), | ||
}; | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
_reorderableList.DoLayoutList(); | ||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "com.kameffee.audio-player.Editor", | ||
"references": [ | ||
"GUID:343deaaf83e0cee4ca978e7df0b80d21", | ||
"GUID:117c7fb0080b4ca41bc18bf080e4cf82" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
[Serializable] | ||
public class BgmData | ||
{ | ||
public AudioClip AudioClip => _audioClip; | ||
|
||
[SerializeField] | ||
private AudioClip _audioClip; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,10 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
| ||
namespace Kameffee.AudioPlayer | ||
{ | ||
[Serializable] | ||
public class BgmData | ||
{ | ||
public AudioClip AudioClip => _audioClip; | ||
public float Pitch => _pitch; | ||
|
||
[SerializeField] | ||
private AudioClip _audioClip; | ||
|
||
[SerializeField] | ||
private float _pitch = 1f; | ||
} | ||
|
||
public interface IBgmBundle | ||
{ | ||
BgmData GetData(int index); | ||
|
||
BgmData GetData(string name); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Kameffee.AudioPlayer | ||
{ | ||
public interface ISeBundle | ||
{ | ||
SeData GetData(int index); | ||
|
||
SeData GetData(string key); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
[CreateAssetMenu(fileName = "SeBundle", menuName = "AudioSettings/SeBundle")] | ||
public class SeBundle : ScriptableObject, ISeBundle | ||
{ | ||
[SerializeField] | ||
private List<SeData> _seDataList; | ||
|
||
public SeData GetData(int index) | ||
{ | ||
if (index < 0 || index >= _seDataList.Count) | ||
{ | ||
throw new ArgumentOutOfRangeException(); | ||
} | ||
|
||
return _seDataList[index]; | ||
} | ||
|
||
public SeData GetData(string key) | ||
{ | ||
return _seDataList.First(data => data.Key == key); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Kameffee.AudioPlayer | ||
{ | ||
[Serializable] | ||
public class SeData | ||
{ | ||
public string Key => _key; | ||
public AudioClip AudioClip => _audioClip; | ||
|
||
[SerializeField] | ||
private string _key = "SeKey_0"; | ||
|
||
[SerializeField] | ||
private AudioClip _audioClip; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.