Merge branch 'master' of http://192.168.31.100:8088/framework/xosmopluginlibrary
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Stary.Evo.AudioCore
|
||||
}
|
||||
CoroutineHelper.SetRunner();
|
||||
|
||||
// 初始化 Voice 池(最多 1 个,可动态扩展)
|
||||
// 初始化 Voice 池(初始 1 个,可动态扩展)
|
||||
poolDict["Voice"] = new Queue<GameObject>();
|
||||
CreateAudioSource("Voice");
|
||||
|
||||
@@ -37,11 +37,8 @@ namespace Stary.Evo.AudioCore
|
||||
|
||||
// 初始化 SFX 池(初始 4 个,可动态扩展)
|
||||
poolDict["SFX"] = new Queue<GameObject>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
CreateAudioSource("SFX");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建对象
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Internal;
|
||||
|
||||
@@ -23,6 +24,17 @@ namespace Stary.Evo.AudioCore
|
||||
coroutineRunner.StopCoroutine(myCoroutine);
|
||||
}
|
||||
|
||||
private class CoroutineRunner : MonoBehaviour { }
|
||||
private class CoroutineRunner : MonoBehaviour
|
||||
{
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (coroutineRunner != null)
|
||||
{
|
||||
coroutineRunner.StopAllCoroutines();
|
||||
coroutineRunner = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Stary.Evo.AudioCore
|
||||
private static SFXPlayer SFX;
|
||||
private static MusicPlayer Music;
|
||||
|
||||
static AudioCoreManager()
|
||||
public static void Initialize()
|
||||
{
|
||||
audioSourcePool = new AudioSourcePool();
|
||||
// 初始化播放器
|
||||
@@ -18,7 +18,6 @@ namespace Stary.Evo.AudioCore
|
||||
SFX = new SFXPlayer(audioSourcePool);
|
||||
Music = new MusicPlayer(audioSourcePool);
|
||||
}
|
||||
|
||||
#region 语音
|
||||
|
||||
/// <summary>
|
||||
@@ -28,6 +27,7 @@ namespace Stary.Evo.AudioCore
|
||||
/// [onComplete:回调行为], [delayOnCompleteTime:延迟回调执行的时间]}</param>
|
||||
public static void PlayVoice(AudioData audioData)
|
||||
{
|
||||
if(Voice == null) Initialize();
|
||||
Voice.Play(audioData);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace Stary.Evo.AudioCore
|
||||
/// [onComplete:回调行为], [delayOnCompleteTime:延迟回调执行的时间]}</param>
|
||||
public static void PlaySFX(AudioData audioData)
|
||||
{
|
||||
if(SFX == null) Initialize();
|
||||
SFX.Play(audioData);
|
||||
}
|
||||
|
||||
@@ -73,6 +74,7 @@ namespace Stary.Evo.AudioCore
|
||||
/// <param name="audioData">{[clip:音频], [volume:音量], [fadeDuration:自然过渡时间]}</param>
|
||||
public static void PlayMusic(AudioData audioData)
|
||||
{
|
||||
if(Music == null) Initialize();
|
||||
Music.Play(audioData);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.audiocore",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"displayName": "04.AudioCore",
|
||||
"description": "音频播放工具",
|
||||
"unity": "2021.3",
|
||||
|
||||
@@ -4,7 +4,7 @@ using Rokid.UXR.Interaction;
|
||||
using Stary.Evo;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class RKAddInteraction : MonoBehaviour
|
||||
public static class RKAddInteractionExtension
|
||||
{
|
||||
#region 触摸
|
||||
/// <summary>
|
||||
@@ -12,7 +12,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
/// <param name="TouchEvent">触碰后事件</param>
|
||||
public virtual void ObjectAddTouchEvent(GameObject Touchedobject, System.Action<GameObject> TouchEvent, float TouchScale = 1.2f)
|
||||
public static void ObjectAddTouchEvent(this GameObject Touchedobject, System.Action<GameObject> TouchEvent, float TouchScale = 1.2f)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
GrabInteractable GrabInteractable = Touchedobject.GetComponent<GrabInteractable>();
|
||||
@@ -37,7 +37,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 暂停触摸事件
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
public virtual void ObjectPauseTouchEvent(GameObject Touchedobject)
|
||||
public static void ObjectPauseTouchEvent(this GameObject Touchedobject)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider != null)
|
||||
@@ -50,7 +50,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 恢复触摸事件
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
public virtual void ObjectResumeTouchEvent(GameObject Touchedobject)
|
||||
public static void ObjectResumeTouchEvent(this GameObject Touchedobject)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider != null)
|
||||
@@ -64,14 +64,14 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
|
||||
public virtual void ObjectRemoveTouchEvent(GameObject Touchedobject)
|
||||
public static void ObjectRemoveTouchEvent(this GameObject Touchedobject)
|
||||
{
|
||||
GrabInteractable GrabInteractable = Touchedobject.GetComponent<GrabInteractable>();
|
||||
|
||||
if (GrabInteractable != null)
|
||||
{
|
||||
GrabInteractable.OnHoverBegin.RemoveAllListeners();
|
||||
Destroy(GrabInteractable);
|
||||
Object.Destroy(GrabInteractable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject">被拖动物体</param>
|
||||
/// <param name="DragingEvent">拖动时执行的方法</param>
|
||||
public virtual void objectAddDrag(GameObject Dragedobject, System.Action<GameObject> DragingEvent = null, float DragScale = 1.2f)
|
||||
public static void objectAddDrag(this GameObject Dragedobject, System.Action<GameObject> DragingEvent = null, float DragScale = 1.2f)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
GrabInteractable GrabInteractable = Dragedobject.GetComponent<GrabInteractable>();
|
||||
@@ -122,7 +122,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 暂停拖动
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject"></param>
|
||||
public virtual void objectPauseDrag(GameObject Dragedobject)
|
||||
public static void objectPauseDrag(this GameObject Dragedobject)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider!= null) ObjectCollider.enabled = false;
|
||||
@@ -132,21 +132,21 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 恢复拖动
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject"></param>
|
||||
public virtual void objectResumeDrag(GameObject Dragedobject)
|
||||
public static void objectResumeDrag(this GameObject Dragedobject)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider!= null) ObjectCollider.enabled = true;
|
||||
}
|
||||
|
||||
public virtual void objectRemoveDrag(GameObject Dragedobject)
|
||||
public static void objectRemoveDrag(this GameObject Dragedobject)
|
||||
{
|
||||
Throwable Throwable = Dragedobject.GetComponent<Throwable>();
|
||||
GrabInteractable GrabInteractable = Dragedobject.GetComponent<GrabInteractable>();
|
||||
if (Throwable != null) Destroy(Throwable);
|
||||
if (Throwable != null) Object.Destroy(Throwable);
|
||||
if (GrabInteractable != null)
|
||||
{
|
||||
GrabInteractable.OnHeldUpdate.RemoveAllListeners();
|
||||
Destroy(GrabInteractable);
|
||||
Object.Destroy(GrabInteractable);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.rktools",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"displayName": "07.RKTools",
|
||||
"description": "Rokid工具",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user