Merge branch 'master' into LouDi_Quan
This commit is contained in:
commit
6535662d13
@ -3,6 +3,7 @@ namespace QFramework
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
|
||||||
public static class LocalAudioResUtil
|
public static class LocalAudioResUtil
|
||||||
{
|
{
|
||||||
@ -192,9 +193,30 @@ namespace QFramework
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Convert the downloaded data to an AudioClip
|
// 等待下载完成
|
||||||
|
while (!request.downloadHandler.isDone)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 下载完成后,转换为 AudioClip
|
||||||
AudioClip clip = DownloadHandlerAudioClip.GetContent(request);
|
AudioClip clip = DownloadHandlerAudioClip.GetContent(request);
|
||||||
mAsset = clip;
|
|
||||||
|
if (clip != null)
|
||||||
|
{
|
||||||
|
// 检查音频加载状态
|
||||||
|
while (clip.loadState != AudioDataLoadState.Loaded)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
mAsset = clip; // 音频加载完成后赋值给 mAsset
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("Failed to load audio clip.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RefCount <= 0)
|
if (RefCount <= 0)
|
||||||
|
|||||||
@ -46,30 +46,39 @@ namespace QFramework
|
|||||||
GameObject obj = Utility.FindObj(path);
|
GameObject obj = Utility.FindObj(path);
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
anim = obj.GetComponent<Animation>();
|
try
|
||||||
|
{
|
||||||
|
anim = obj.GetComponent<Animation>();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(frame) == false && frame != "-1")
|
if (string.IsNullOrEmpty(frame) == false && frame != "-1")
|
||||||
{
|
|
||||||
int curFrame = 0;
|
|
||||||
int.TryParse(frame, out curFrame);
|
|
||||||
anim[animName].time = curFrame / anim.clip.frameRate;
|
|
||||||
anim[animName].speed = 0;
|
|
||||||
anim.Play(animName);
|
|
||||||
this.Finish();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float curSpeed = 1;
|
|
||||||
if (string.IsNullOrEmpty(speed)==false)
|
|
||||||
{
|
{
|
||||||
float.TryParse(speed, out curSpeed);
|
int curFrame = 0;
|
||||||
|
int.TryParse(frame, out curFrame);
|
||||||
|
anim[animName].time = curFrame / anim.clip.frameRate;
|
||||||
|
anim[animName].speed = 0;
|
||||||
|
anim.Play(animName);
|
||||||
|
this.Finish();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float curSpeed = 1;
|
||||||
|
if (string.IsNullOrEmpty(speed) == false)
|
||||||
|
{
|
||||||
|
float.TryParse(speed, out curSpeed);
|
||||||
|
}
|
||||||
|
anim[animName].speed = curSpeed;
|
||||||
|
anim.Play(animName);
|
||||||
}
|
}
|
||||||
anim[animName].speed = curSpeed;
|
|
||||||
anim.Play(animName);
|
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{path} 播放动画 {animName} 出错");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Debug.LogError("未找到路径:" + path);
|
||||||
this.Finish();
|
this.Finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user