1111
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Rokid.UXR;
|
||||
using Stary.Evo;
|
||||
|
||||
namespace Main
|
||||
{
|
||||
public class CancellationTokenCore : MonoBehaviour
|
||||
{
|
||||
#region Instance
|
||||
|
||||
private static CancellationTokenCore m_Instance;
|
||||
|
||||
/// <summary>
|
||||
/// Singleton Object
|
||||
/// </summary>
|
||||
public static CancellationTokenCore Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Instance == null)
|
||||
{
|
||||
CancellationTokenCore[] ts = GameObject.FindObjectsOfType<CancellationTokenCore>();
|
||||
|
||||
if (ts != null && ts.Length > 0)
|
||||
{
|
||||
if (ts.Length == 1)
|
||||
{
|
||||
m_Instance = ts[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(string.Format(
|
||||
"## Uni Exception ## Cls:{0} Info:Singleton not allows more than one instance",
|
||||
typeof(CancellationTokenCore)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Instance =
|
||||
new GameObject(string.Format("{0}(Singleton)", typeof(CancellationTokenCore).ToString()))
|
||||
.AddComponent<CancellationTokenCore>();
|
||||
}
|
||||
}
|
||||
|
||||
return m_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// 存储 CancellationTokenSource 实例的字典
|
||||
private readonly Dictionary<object, CancellationTokenSource> _cancellationTokenSources =
|
||||
new Dictionary<object, CancellationTokenSource>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个 CancellationTokenSource 实例,如果不存在则创建一个
|
||||
/// </summary>
|
||||
/// <param name="key">用于标识 CancellationTokenSource 的键</param>
|
||||
/// <returns>CancellationTokenSource 实例</returns>
|
||||
public CancellationToken CancellationTokenSource(string key)
|
||||
{
|
||||
if (_cancellationTokenSources.TryGetValue(key, out var cts))
|
||||
{
|
||||
CancelCancellationTokenSource(key);
|
||||
}
|
||||
|
||||
cts = new CancellationTokenSource();
|
||||
_cancellationTokenSources[key] = cts;
|
||||
return cts.Token;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消指定键对应的 CancellationTokenSource 实例
|
||||
/// </summary>
|
||||
/// <param name="key">用于标识 CancellationTokenSource 的键</param>
|
||||
public void CancelCancellationTokenSource(string key)
|
||||
{
|
||||
if (_cancellationTokenSources.TryGetValue(key, out var cts))
|
||||
{
|
||||
try
|
||||
{
|
||||
cts.Cancel();
|
||||
cts.Dispose();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Debug.Log($"ComponentExtensions:【{key}】异步任务被取消");
|
||||
}
|
||||
|
||||
_cancellationTokenSources.Remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消所有的 CancellationTokenSource 实例
|
||||
/// </summary>
|
||||
public void CancelAllCancellationTokenSources()
|
||||
{
|
||||
foreach (var cts in _cancellationTokenSources.Values)
|
||||
{
|
||||
try
|
||||
{
|
||||
cts.Cancel();
|
||||
cts.Dispose();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Debug.Log($"ComponentExtensions:全部异步任务被取消");
|
||||
}
|
||||
}
|
||||
|
||||
_cancellationTokenSources.Clear();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// 在对象销毁时取消所有的 CancellationTokenSource 实例
|
||||
CancelAllCancellationTokenSources();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取组件的CancellationTokenSource,当组件销毁时,会取消该CancellationTokenSource
|
||||
/// </summary>
|
||||
/// <param name="component"></param>
|
||||
/// <returns></returns>
|
||||
private static CancellationToken CancellationTokenOnDestroy(this GameObject component)
|
||||
{
|
||||
var cts = new CancellationTokenSource();
|
||||
component.GetOrAddComponent<DestroyNotifier>()
|
||||
.OnDestroyEvent += () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
cts.Cancel();
|
||||
cts.Dispose();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Debug.Log($"ComponentExtensions:【{component.name}】异步任务被取消");
|
||||
}
|
||||
};
|
||||
return cts.Token;
|
||||
}
|
||||
|
||||
class DestroyNotifier : MonoBehaviour
|
||||
{
|
||||
public event System.Action OnDestroyEvent;
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
OnDestroyEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5a4ec88d5954d43bdf468e6b80e5ba8
|
||||
timeCreated: 1753338876
|
||||
@@ -5,6 +5,7 @@ namespace Stary.Evo
|
||||
{
|
||||
public class AppConfig
|
||||
{
|
||||
public static OpenDomainType OpenDomainType { get; set; }
|
||||
/// <summary>
|
||||
/// package name
|
||||
/// </summary>
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace Stary.Evo
|
||||
/// </summary>
|
||||
public class DomainBase : MonoBehaviour
|
||||
{
|
||||
public string DomainName { protected get; set; }
|
||||
public string DomainName { get; set; }
|
||||
|
||||
public Transform TransformInfo;
|
||||
protected bool isExit { private get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 触发Domain时,调用该方法
|
||||
@@ -35,7 +35,6 @@ namespace Stary.Evo
|
||||
/// <param name="param"></param>
|
||||
public virtual void OnExit()
|
||||
{
|
||||
isExit = true;
|
||||
AudioCoreManager.StopMusic();
|
||||
|
||||
}
|
||||
@@ -44,7 +43,6 @@ namespace Stary.Evo
|
||||
|
||||
public virtual async Task OnEnterAsync(string param)
|
||||
{
|
||||
isExit = true;
|
||||
}
|
||||
|
||||
public virtual Task OnExitAsync()
|
||||
@@ -52,32 +50,11 @@ namespace Stary.Evo
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async void OnDestroy()
|
||||
{
|
||||
await ForceUnloadAllAssets();
|
||||
}
|
||||
// private async void OnDestroy()
|
||||
// {
|
||||
// await ForceUnloadAllAssets();
|
||||
// }
|
||||
|
||||
// 强制卸载所有资源包,该方法请在合适的时机调用。
|
||||
// 注意:Package在销毁的时候也会自动调用该方法。
|
||||
private async UniTask ForceUnloadAllAssets()
|
||||
{
|
||||
var package = YooAssets.TryGetPackage(DomainName);
|
||||
if (package != null)
|
||||
{
|
||||
var operation = package.UnloadAllAssetsAsync();
|
||||
await operation;
|
||||
await package.DestroyAsync();
|
||||
YooAssets.RemovePackage(DomainName);
|
||||
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
Debug.Log($"UnityEvo:{DomainName} 资源包已卸载...");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:{DomainName} 资源包不存在,请检查是否已经卸载还是卸载异常...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class FsmLoadSystem : FsmSystem , IFsmSystem
|
||||
public class FsmLoadSystem : FsmSystemAsync , IFsmSystemAsync
|
||||
{
|
||||
private OpenDomainType OpenDomainType { get; set; }
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ using YooAsset;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class HotFixState : AbstractFSMIState
|
||||
public class HotFixState : AbstractFSMIStateAsync
|
||||
{
|
||||
public string[] PatchedAOTAssemblyList = new string[]
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace Stary.Evo
|
||||
"com.stary.evo.runtime.dll"
|
||||
|
||||
};
|
||||
public HotFixState(IFsmSystem system) : base(system)
|
||||
public HotFixState(IFsmSystemAsync system) : base(system)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ using YooAsset;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class LoadResMainState : AbstractFSMIState
|
||||
public class LoadResMainState : AbstractFSMIStateAsync
|
||||
{
|
||||
private string _doMain = "Main";
|
||||
|
||||
public LoadResMainState(IFsmSystem system) : base(system)
|
||||
public LoadResMainState(IFsmSystemAsync system) : base(system)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ using YooAsset;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class LoadResState : AbstractFSMIState
|
||||
public class LoadResState : AbstractFSMIStateAsync
|
||||
{
|
||||
private DomainConfig.LoadResType loadResType;
|
||||
public GameObject mainPrefab;
|
||||
private DomainConfig domainConfig;
|
||||
public LoadResState(IFsmSystem system) : base(system)
|
||||
public LoadResState(IFsmSystemAsync system) : base(system)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,13 +73,17 @@ namespace Stary.Evo
|
||||
|
||||
if (info._list.Count >= 2)
|
||||
{
|
||||
if (fsmLoadSystem.GetOpenDomainType() == OpenDomainType.DEFAULT)
|
||||
if (fsmLoadSystem.GetOpenDomainType() == OpenDomainType.PointCloud)
|
||||
{
|
||||
info.Switch(0);
|
||||
info.Switch(1);
|
||||
}
|
||||
else if (fsmLoadSystem.GetOpenDomainType() == OpenDomainType.VIOICE)
|
||||
{
|
||||
info.Switch(1);
|
||||
info.Switch(0);
|
||||
}
|
||||
else if (fsmLoadSystem.GetOpenDomainType() == OpenDomainType.ImageTracked)
|
||||
{
|
||||
info.Switch(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -137,7 +141,35 @@ namespace Stary.Evo
|
||||
}
|
||||
|
||||
if (domainBase != null)
|
||||
{
|
||||
GameObject.Destroy(domainBase.gameObject);
|
||||
|
||||
await ForceUnloadAllAssets(domainBase.DomainName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 强制卸载所有资源包,该方法请在合适的时机调用。
|
||||
// 注意:Package在销毁的时候也会自动调用该方法。
|
||||
private async UniTask ForceUnloadAllAssets(string packageName)
|
||||
{
|
||||
var package = YooAssets.TryGetPackage(packageName);
|
||||
if (package != null)
|
||||
{
|
||||
var operation = package.UnloadAllAssetsAsync();
|
||||
await operation;
|
||||
await package.DestroyAsync();
|
||||
YooAssets.RemovePackage(packageName);
|
||||
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
Debug.Log($"UnityEvo:{packageName} 资源包已卸载...");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"UnityEvo:{packageName} 资源包不存在,请检查是否已经卸载还是卸载异常...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class ResStartState : AbstractFSMIState
|
||||
public class ResStartState : AbstractFSMIStateAsync
|
||||
{
|
||||
public ResStartState(IFsmSystem system) : base(system)
|
||||
public ResStartState(IFsmSystemAsync system) : base(system)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ using YooAsset;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class ResUpdateLocalState : AbstractFSMIState
|
||||
public class ResUpdateLocalState : AbstractFSMIStateAsync
|
||||
{
|
||||
public ResUpdateLocalState(IFsmSystem system) : base(system)
|
||||
public ResUpdateLocalState(IFsmSystemAsync system) : base(system)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ using YooAsset;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public class ResUpdateServerState : AbstractFSMIState
|
||||
public class ResUpdateServerState : AbstractFSMIStateAsync
|
||||
{
|
||||
public ResUpdateServerState(IFsmSystem system) : base(system)
|
||||
public ResUpdateServerState(IFsmSystemAsync system) : base(system)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Immersal;
|
||||
using Sirenix.OdinInspector;
|
||||
using Stary.Evo;
|
||||
using UnityEngine;
|
||||
@@ -28,8 +29,11 @@ namespace Stary.Evo
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
domain = "Main";
|
||||
#elif UNITY_EDITOR
|
||||
var immersalSDK = FindObjectOfType<ImmersalSDK>();
|
||||
immersalSDK.onPoseFound.Invoke();
|
||||
#endif
|
||||
_fsmSystem.SetOpenDomainType(OpenDomainType.DEFAULT);
|
||||
|
||||
AppConfig.PackageDomainName = domain;
|
||||
_fsmSystem.SetCurState(nameof(ResStartState));
|
||||
}
|
||||
@@ -46,15 +50,21 @@ namespace Stary.Evo
|
||||
AppConfig.PackageDomainName = domain;
|
||||
_fsmSystem.SetCurState(nameof(ResStartState));
|
||||
}
|
||||
|
||||
public void OpenDomain(string domain, string openDomainType)
|
||||
{
|
||||
_fsmSystem.SetOpenDomainType((OpenDomainType)Enum.Parse(typeof(OpenDomainType), openDomainType));
|
||||
AppConfig.PackageDomainName = domain;
|
||||
_fsmSystem.SetCurState(nameof(ResStartState));
|
||||
}
|
||||
|
||||
public void CloseDomain()
|
||||
{
|
||||
_fsmSystem.SetCurState(nameof(DefaultState));
|
||||
_fsmSystem.SetCurState(nameof(DefaultStateAsync));
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(_fsmSystem.CurState != null)
|
||||
_fsmSystem.CurState.OnUpdate();
|
||||
}
|
||||
}
|
||||
@@ -66,7 +76,9 @@ namespace Stary.Evo
|
||||
/// </summary>
|
||||
public enum OpenDomainType
|
||||
{
|
||||
DEFAULT,
|
||||
VIOICE
|
||||
PointCloud,
|
||||
VIOICE,
|
||||
Editor,
|
||||
ImageTracked,
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using Stary.Evo;
|
||||
using Stary.Evo.AudioCore;
|
||||
using Stary.Evo.RKTools;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace Main
|
||||
{
|
||||
@@ -14,17 +17,19 @@ namespace Main
|
||||
void AddClickIntervalEvent(Action callback);
|
||||
void StartTime();
|
||||
void EndClick();
|
||||
|
||||
void BindClickEvent(List<ClickElementChildren> clickElementChildrens, Action<GameObject> callback);
|
||||
void ResumeTouchClick(Transform tweenTarget);
|
||||
Task BindClickEvent(List<ClickElementChildren> clickElementChildrens, Action<GameObject> callback,
|
||||
bool isOneByOne = false);
|
||||
void ClickBreatheTween(List<ClickElementChildren> tweenList, Transform tweenTarget);
|
||||
|
||||
void ClickBreatheTween(List<ClickElementChildren> tweenList, Transform tweenTarget, bool isOneByOne);
|
||||
int ElementChildrenClickCount();
|
||||
bool IsElementChildrenClick();
|
||||
}
|
||||
|
||||
public class ClickSystem : AbstractSystem, IClickSystem
|
||||
{
|
||||
// public Sequence loopTargetTween;
|
||||
|
||||
private AudioClip _clickSound;
|
||||
/// <summary>
|
||||
/// 点击计时器
|
||||
/// </summary>
|
||||
@@ -48,19 +53,35 @@ namespace Main
|
||||
Update();
|
||||
}
|
||||
|
||||
public void BindClickEvent(List<ClickElementChildren> clickElementChildrens, Action<GameObject> callback)
|
||||
public async Task BindClickEvent(List<ClickElementChildren> clickElementChildrens, Action<GameObject> callback,
|
||||
bool isOneByOne = false)
|
||||
{
|
||||
StartTime();
|
||||
this.clickElementChildrens = clickElementChildrens;
|
||||
//绑定点击事件
|
||||
foreach (var child in clickElementChildrens)
|
||||
for (int i = 0; i < clickElementChildrens.Count; i++)
|
||||
{
|
||||
child.transform.gameObject.ObjectAddTouchEvent(callback);
|
||||
clickElementChildrens[i].transform.gameObject.ObjectAddTouchEvent(callback);
|
||||
if (isOneByOne && i > 0)
|
||||
{
|
||||
clickElementChildrens[i].transform.gameObject.ObjectPauseTouchEvent();
|
||||
}
|
||||
}
|
||||
|
||||
//播放音效
|
||||
var package = YooAssets.GetPackage("Main");
|
||||
var sfxhandle = package.LoadAssetAsync<AudioClip>("Audios_au_effect_click");
|
||||
await sfxhandle.Task;
|
||||
_clickSound = sfxhandle.GetAssetObject<AudioClip>();
|
||||
}
|
||||
|
||||
public void ClickBreatheTween(List<ClickElementChildren> tweenList, Transform tweenTarget)
|
||||
{
|
||||
Debug.Log("UnityEvo: 点击呼吸");
|
||||
AudioCoreManager.PlaySFX(new AudioData()
|
||||
{
|
||||
clip = _clickSound
|
||||
});
|
||||
time = 0;
|
||||
foreach (var tween in tweenList)
|
||||
{
|
||||
@@ -73,53 +94,111 @@ namespace Main
|
||||
if (tween.transform == tweenTarget)
|
||||
{
|
||||
tween.isClick = true;
|
||||
tween.transform.GetComponent<Animator>().CrossFade("dianji_idle", 0.2f);
|
||||
this.SendEvent<ModeType, ClickElementChildren>(ModeType.PLayAudioOrVideo,tween);
|
||||
tween.transform.GetComponent<Animator>().CrossFade("dianji_idle", 0.01f);
|
||||
this.SendEvent<ModeType, ClickElementChildren>(ModeType.PLayAudioOrVideo, tween);
|
||||
tweenTarget.gameObject.ObjectPauseTouchEvent();
|
||||
// if (loopTargetTween != null)
|
||||
// {
|
||||
// loopTargetTween.Kill();
|
||||
// loopTargetTween = null;
|
||||
// }
|
||||
//
|
||||
// loopTargetTween = DOTween.Sequence();
|
||||
// loopTargetTween.Append(tweenTarget.DOScale(tweenTarget.lossyScale * 1.3f, 1f));
|
||||
//
|
||||
// loopTargetTween.SetLoops(6, LoopType.Yoyo);
|
||||
// loopTargetTween.OnKill(() =>
|
||||
// {
|
||||
// if (tweenTarget != null)
|
||||
// tweenTarget.DOScale(Vector3.one, 0.3f);
|
||||
// });
|
||||
// loopTargetTween.Play();
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// tween.transform.DOKill();
|
||||
// tween.transform.DOScale(Vector3.one * 0.9f, 0.5f);
|
||||
tween.transform.GetComponent<Animator>().CrossFade("dianji_nood", 1f);
|
||||
tween.transform.GetComponent<Animator>().CrossFade("dianji_nood", 0.01f);
|
||||
}
|
||||
}
|
||||
public void ClickBreatheTween(List<ClickElementChildren> tweenList, Transform tweenTarget,bool isOneByOne)
|
||||
{
|
||||
Debug.Log("UnityEvo: 点击呼吸");
|
||||
AudioCoreManager.PlaySFX(new AudioData()
|
||||
{
|
||||
clip = _clickSound
|
||||
});
|
||||
time = 0;
|
||||
for (int i = 0; i < tweenList.Count; i++)
|
||||
{
|
||||
var tween = tweenList[i];
|
||||
// if (tween.transform == tweenTarget)
|
||||
// {
|
||||
// tween.isClick = true;
|
||||
// }
|
||||
if (tween.transform == tweenTarget)
|
||||
{
|
||||
tween.isClick = true;
|
||||
tween.transform.gameObject.ObjectPauseTouchEvent();
|
||||
tween.transform.GetComponent<Animator>().CrossFade("dianji_disappear", 0.01f);
|
||||
|
||||
this.SendEvent<ModeType, ClickElementChildren>(ModeType.PLayAudioOrVideo, tween);
|
||||
|
||||
if (isOneByOne&& i+1 < tweenList.Count)
|
||||
{
|
||||
tweenList[i+1].transform.gameObject.ObjectResumeTouchEvent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void AddClickIntervalEvent(Action callback)
|
||||
{
|
||||
this.ClickIntervalEvent = callback;
|
||||
}
|
||||
|
||||
public int ElementChildrenClickCount()
|
||||
{
|
||||
int count = 0;
|
||||
//是否全部已经点击
|
||||
for (int i = 0; i < clickElementChildrens.Count; i++)
|
||||
{
|
||||
if (clickElementChildrens[i].isClick == true)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
public bool IsElementChildrenClick()
|
||||
{
|
||||
|
||||
//是否全部已经点击
|
||||
for (int i = 0; i < clickElementChildrens.Count; i++)
|
||||
{
|
||||
if (clickElementChildrens[i].isClick == false)
|
||||
{
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public void ResumeTouchClick( Transform tweenTarget)
|
||||
{
|
||||
// if (loopTargetTween != null)
|
||||
// {
|
||||
// loopTargetTween.Kill();
|
||||
// loopTargetTween = null;
|
||||
// }
|
||||
|
||||
time = 0;
|
||||
if (tokenSource != null)
|
||||
{
|
||||
tokenSource?.Cancel();
|
||||
tokenSource?.Dispose();
|
||||
tokenSource = null;
|
||||
}
|
||||
|
||||
foreach (var children in clickElementChildrens)
|
||||
{
|
||||
if (children.transform != tweenTarget )
|
||||
{
|
||||
var animator = children.transform.GetComponent<Animator>();
|
||||
// 获取当前动画状态
|
||||
var currentState = animator.GetCurrentAnimatorStateInfo(0);
|
||||
if (currentState.IsName("dianji_disappear"))
|
||||
{
|
||||
children.transform.gameObject.ObjectResumeTouchEvent();
|
||||
animator.CrossFade("dianji_appear", 0.01f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void EndClick()
|
||||
{
|
||||
// if (loopTargetTween != null)
|
||||
@@ -139,40 +218,39 @@ namespace Main
|
||||
foreach (var children in clickElementChildrens)
|
||||
{
|
||||
children.transform.gameObject.ObjectRemoveTouchEvent();
|
||||
children.transform.GetComponent<Animator>().CrossFade("dianji_disappear", 0.2f);
|
||||
|
||||
children.transform.GetComponent<Animator>().CrossFade("dianji_disappear", 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
private async void Update()
|
||||
{
|
||||
//TODO暂时禁用
|
||||
// if (tokenSource != null)
|
||||
// {
|
||||
// tokenSource?.Cancel();
|
||||
// }
|
||||
//
|
||||
// tokenSource = new CancellationTokenSource();
|
||||
// try
|
||||
// {
|
||||
// while (time <= 11 && !tokenSource.IsCancellationRequested)
|
||||
// {
|
||||
// time += Time.deltaTime;
|
||||
//
|
||||
// if (time >= 10)
|
||||
// {
|
||||
// Debug.Log("UnityEvo:执行未点击间隔事件");
|
||||
// time = 0;
|
||||
// ClickIntervalEvent?.Invoke();
|
||||
// }
|
||||
//
|
||||
// await UniTask.Yield(tokenSource.Token);
|
||||
// }
|
||||
// }
|
||||
// catch (OperationCanceledException e)
|
||||
// {
|
||||
// Debug.Log("UnityEvo: 取消任务:" + e);
|
||||
// }
|
||||
if (tokenSource != null)
|
||||
{
|
||||
tokenSource?.Cancel();
|
||||
}
|
||||
|
||||
tokenSource = new CancellationTokenSource();
|
||||
try
|
||||
{
|
||||
while (time <= 15 && !tokenSource.IsCancellationRequested)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
|
||||
if (time >= 15)
|
||||
{
|
||||
Debug.Log("UnityEvo:执行未点击间隔事件");
|
||||
time = 0;
|
||||
ClickIntervalEvent?.Invoke();
|
||||
}
|
||||
|
||||
await UniTask.Yield(tokenSource.Token);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException e)
|
||||
{
|
||||
Debug.Log("UnityEvo: 取消任务:" + e);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -190,9 +268,8 @@ namespace Main
|
||||
// loopTargetTween = null;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ClickElementChildren
|
||||
{
|
||||
public bool isClick = false;
|
||||
@@ -204,21 +281,22 @@ namespace Main
|
||||
|
||||
public ClickElementChildren(Transform child)
|
||||
{
|
||||
|
||||
this. transform = child;
|
||||
this.transform = child;
|
||||
}
|
||||
|
||||
public ClickElementChildren(Transform child, string[] auid, string vid)
|
||||
{
|
||||
this.auid = auid;
|
||||
this.vid = vid;
|
||||
this. transform = child;
|
||||
this.transform = child;
|
||||
}
|
||||
public ClickElementChildren(Transform child,Transform targetTransform , string[] auid, string vid)
|
||||
|
||||
public ClickElementChildren(Transform child, Transform targetTransform, string[] auid, string vid)
|
||||
{
|
||||
this.auid = auid;
|
||||
this.vid = vid;
|
||||
this. transform = child;
|
||||
this.targetTransform= targetTransform;
|
||||
this.transform = child;
|
||||
this.targetTransform = targetTransform;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,9 +36,10 @@ namespace Main
|
||||
{
|
||||
base.OnEnter();
|
||||
|
||||
this.RegisterEvent<IntroType, string, string>(IntroType.IntroSprite, OnClickPreviousIntro);
|
||||
this.RegisterEvent<IntroType, string, string>(IntroType.IntroSpriteName, OnClickPreviousIntro);
|
||||
this.RegisterEvent<IntroType, RuntimeAnimatorController, string>(IntroType.IntroAnimation, OnAddAnimation);
|
||||
this.RegisterEvent<IntroType, string, string>(IntroType.IntroAudio, OnClickPreviousIntroAudio);
|
||||
this.RegisterEvent<IntroType, Sprite, string>(IntroType.IntroSprite, SetIntroSprite);
|
||||
}
|
||||
|
||||
public override void OnExit(float delay = 0)
|
||||
@@ -46,9 +47,10 @@ namespace Main
|
||||
base.OnExit(delay);
|
||||
intro.sprite = null;
|
||||
intro.gameObject.SetActive(false);
|
||||
this.UnRegisterEvent<IntroType, string, string>(IntroType.IntroSprite, OnClickPreviousIntro);
|
||||
this.UnRegisterEvent<IntroType, string, string>(IntroType.IntroSpriteName, OnClickPreviousIntro);
|
||||
this.UnRegisterEvent<IntroType, string, string>(IntroType.IntroAudio, OnClickPreviousIntroAudio);
|
||||
this.UnRegisterEvent<IntroType, RuntimeAnimatorController, string>(IntroType.IntroAnimation, OnAddAnimation);
|
||||
this.UnRegisterEvent<IntroType, Sprite, string>(IntroType.IntroSprite, SetIntroSprite);
|
||||
var animator = intro.transform.GetComponent<Animator>();
|
||||
if (animator != null)
|
||||
{
|
||||
@@ -70,10 +72,7 @@ namespace Main
|
||||
{
|
||||
var handle= YooAssets.LoadAssetAsync<Sprite>(spriteName);
|
||||
await handle.Task;
|
||||
intro.sprite = handle.GetAssetObject<Sprite>();
|
||||
intro.SetNativeSize();
|
||||
intro.gameObject.SetActive(true);
|
||||
transformInfo.Set(desc);
|
||||
SetIntroSprite(handle.GetAssetObject<Sprite>(), desc);
|
||||
}
|
||||
|
||||
public async void OnClickPreviousIntroAudio(string auid, string desc)
|
||||
@@ -85,7 +84,7 @@ namespace Main
|
||||
});
|
||||
SetIntroSprite(info.sprite, desc);
|
||||
}
|
||||
private void SetIntroSprite(Sprite sprite, string desc)
|
||||
public void SetIntroSprite(Sprite sprite, string desc)
|
||||
{
|
||||
|
||||
intro.sprite = sprite;
|
||||
@@ -95,6 +94,7 @@ namespace Main
|
||||
}
|
||||
public enum IntroType
|
||||
{
|
||||
IntroSpriteName,
|
||||
IntroSprite,
|
||||
IntroAudio,
|
||||
IntroAnimation
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using Stary.Evo;
|
||||
using Stary.Evo.AudioCore;
|
||||
using Stary.Evo.InformationSave;
|
||||
using Stary.Evo.TableTextConversion;
|
||||
using Stary.Evo.UIFarme;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using YooAsset;
|
||||
|
||||
namespace Main
|
||||
{
|
||||
public class TextPanel : BasePanel
|
||||
{
|
||||
static readonly string path = "TextPanel";
|
||||
|
||||
private TextMeshProUGUI intro;
|
||||
|
||||
private LocalTransformInfo transformInfo;
|
||||
|
||||
|
||||
public TextPanel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void Initialize(GameObject panelGo)
|
||||
{
|
||||
base.Initialize(panelGo);
|
||||
|
||||
intro = activePanel.transform.Find("Intro").GetComponent<TextMeshProUGUI>();
|
||||
transformInfo = activePanel.transform.GetComponent<LocalTransformInfo>();
|
||||
intro.text = "";
|
||||
|
||||
intro.overflowMode = TextOverflowModes.Overflow; // 启用溢出模式
|
||||
|
||||
intro.GetComponent<CanvasGroup>().alpha = 0;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
base.OnEnter();
|
||||
|
||||
this.RegisterEvent<IntroType, string, float, string>(IntroType.SetText, OnSetTextIntroEvent);
|
||||
this.RegisterEvent<IntroType, string, string>(IntroType.SetTextSubtitle, OnSetTextIntroEvent);
|
||||
}
|
||||
|
||||
public override void OnExit(float delay = 0)
|
||||
{
|
||||
base.OnExit(delay);
|
||||
intro.text = "";
|
||||
this.UnRegisterEvent<IntroType, string, float, string>(IntroType.SetText, OnSetTextIntroEvent);
|
||||
this.UnRegisterEvent<IntroType, string, string>(IntroType.SetTextSubtitle, OnSetTextIntroEvent);
|
||||
}
|
||||
|
||||
|
||||
public async void OnSetTextIntroEvent(string text, float audioLength, string desc)
|
||||
{
|
||||
try
|
||||
{
|
||||
float delay = audioLength / (float)text.Length / 2;
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
intro.text += text[i];
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(delay),
|
||||
cancellationToken: CancellationTokenCore.Instance.CancellationTokenSource(path));
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Debug.Log($"ComponentExtensions:【{path}】异步任务被取消");
|
||||
}
|
||||
|
||||
intro.ForceMeshUpdate();
|
||||
transformInfo.Set(desc);
|
||||
}
|
||||
|
||||
public async void OnSetTextIntroEvent(string UIid, string desc)
|
||||
{
|
||||
var messageInfo = this.GetData<IAudioTableData>().GetUIInfo(UIid);
|
||||
if (messageInfo != null)
|
||||
{
|
||||
if (messageInfo.subtitle.Count > 0)
|
||||
{
|
||||
foreach (var subtitle in messageInfo.subtitle)
|
||||
{
|
||||
intro.text = "";
|
||||
//float delay = (float)(subtitle.end - subtitle.start) /subtitle.subtitle.Length /2 ;
|
||||
intro.GetComponent<CanvasGroup>().DOFade(1, 0.2f);
|
||||
|
||||
intro.text = subtitle.subtitle;
|
||||
// for (int i = 0; i < subtitle.subtitle.Length; i++)
|
||||
// {
|
||||
// intro.text += subtitle.subtitle[i];
|
||||
// await UniTask.Delay(TimeSpan.FromSeconds(delay),
|
||||
// cancellationToken: tokenSource.Token);
|
||||
// }
|
||||
try
|
||||
{
|
||||
await UniTask.Delay(TimeSpan.FromSeconds((float)(subtitle.end - subtitle.start)),
|
||||
cancellationToken: CancellationTokenCore.Instance.CancellationTokenSource(path));
|
||||
intro.GetComponent<CanvasGroup>().DOFade(0, 0.2f);
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(0.2f),
|
||||
cancellationToken: CancellationTokenCore.Instance.CancellationTokenSource(path));
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Debug.Log($"ComponentExtensions:【{path}】异步任务被取消");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transformInfo.Set(desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"UnityEvo:【{UIid}】没有找到对应的UI信息");
|
||||
}
|
||||
}
|
||||
|
||||
public enum IntroType
|
||||
{
|
||||
SetText,
|
||||
SetTextSubtitle,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c2846e6784c72e4186e83c127058adb
|
||||
guid: 1a6fe969cd7b8f84fb3284ab34f4dd3c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31eb4845a899e544dab03b7aba620e01
|
||||
guid: acecbcc2903fe7044bfb88198181773a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -12,6 +12,7 @@ using YooAsset;
|
||||
|
||||
public class VideoPanel : BasePanel
|
||||
{
|
||||
private Transform area;
|
||||
private RawImage intro;
|
||||
|
||||
private GameObject prospect;
|
||||
@@ -33,13 +34,13 @@ public class VideoPanel : BasePanel
|
||||
public override void Initialize(GameObject panelGo)
|
||||
{
|
||||
base.Initialize(panelGo);
|
||||
|
||||
intro = activePanel.transform.Find("Intro").GetComponent<RawImage>();
|
||||
prospect = activePanel.transform.Find("prospect").gameObject;
|
||||
bg = activePanel.transform.Find("bg").gameObject;
|
||||
videoPlayer = activePanel.GetComponentInChildren<VideoPlayer>();
|
||||
audioSource = activePanel.GetComponentInChildren<AudioSource>();
|
||||
_animator = activePanel.GetComponentInChildren<Animator>();
|
||||
area = activePanel.transform.Find("Area");
|
||||
intro = area.Find("Intro").GetComponent<RawImage>();
|
||||
prospect = area.Find("prospect").gameObject;
|
||||
bg = area.Find("bg").gameObject;
|
||||
videoPlayer = area.GetComponentInChildren<VideoPlayer>();
|
||||
audioSource = area.GetComponentInChildren<AudioSource>();
|
||||
_animator = area.GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
|
||||
@@ -30,7 +30,7 @@ public class VideoSystem : AbstractSystem, IVideoSystem
|
||||
fadeDuration = 2f,
|
||||
volume = 0f,
|
||||
});
|
||||
await this.GetSystem<IPanelSystem>().PushQueue<VideoPanel>(AppConfig.GetDefaultMainInstance().transform,"Main");
|
||||
await this.GetSystem<IPanelSystem>().PushQueue<VideoPanel>(parent: AppConfig.GetDefaultMainInstance().transform,packageName:"Main");
|
||||
this.GetSystem<IPanelSystem>().SendPanelEvent(ModeType.VideoStart,info);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
namespace R
|
||||
{
|
||||
public class Res
|
||||
{
|
||||
public class Main
|
||||
{
|
||||
public static class anim
|
||||
{
|
||||
public const string vid_maskani_anim = "Anim_vid_maskAni";
|
||||
public const string vid_maskcontroller_controller = "Anim_vid_maskController";
|
||||
public const string vid_maskdefault_anim = "Anim_vid_maskDefault";
|
||||
}
|
||||
public static class audios
|
||||
{
|
||||
public const string au_effect_element_pop_mp3 = "Audios_au_effect_element_pop";
|
||||
public const string au_x_07_ending1_wav = "Audios_au_X_07_ending1";
|
||||
public const string au_x_07_ending2_wav = "Audios_au_X_07_ending2";
|
||||
public const string au_x_07_ending3_wav = "Audios_au_X_07_ending3";
|
||||
public const string au_x_07_ending4_wav = "Audios_au_X_07_ending4";
|
||||
}
|
||||
public static class config
|
||||
{
|
||||
public const string domainconfig_asset = "Config_DomainConfig";
|
||||
}
|
||||
public static class dll
|
||||
{
|
||||
public static class android
|
||||
{
|
||||
public const string com_stary_evo_runtime_dll_bytes = "Android_com.stary.evo.runtime.dll";
|
||||
public const string dotween_dll_bytes = "Android_DOTween.dll";
|
||||
public const string informationsave_runtime_dll_bytes = "Android_InformationSave.RunTime.dll";
|
||||
public const string mscorlib_dll_bytes = "Android_mscorlib.dll";
|
||||
public const string system_core_dll_bytes = "Android_System.Core.dll";
|
||||
public const string uifarme_runtime_dll_bytes = "Android_UIFarme.RunTime.dll";
|
||||
public const string unitask_dll_bytes = "Android_UniTask.dll";
|
||||
public const string unityengine_coremodule_dll_bytes = "Android_UnityEngine.CoreModule.dll";
|
||||
public const string yooasset_dll_bytes = "Android_YooAsset.dll";
|
||||
}
|
||||
}
|
||||
public static class prefabs
|
||||
{
|
||||
public const string guideball_point_prefab = "Prefabs_GuideBall_Point";
|
||||
public const string guideball_zone_prefab = "Prefabs_GuideBall_Zone";
|
||||
public const string kkcontroller_prefab = "Prefabs_KKController";
|
||||
public const string main_prefab = "Prefabs_Main";
|
||||
public const string progressbarpanel_prefab = "Prefabs_ProgressBarPanel";
|
||||
public const string videopanel_prefab = "Prefabs_VideoPanel";
|
||||
public const string watermark_prefab = "Prefabs_Watermark";
|
||||
}
|
||||
public static class scenes
|
||||
{
|
||||
}
|
||||
public static class spriteatlas
|
||||
{
|
||||
public const string video_spriteatlas = "";
|
||||
public const string vid_video_mask_spriteatlas = "";
|
||||
}
|
||||
public static class sprites
|
||||
{
|
||||
public const string ui_video_kepu_png = "Sprites_ui_video_kepu";
|
||||
public const string ui_x_07_ending1_png = "Sprites_ui_X_07_ending1";
|
||||
public const string ui_x_07_ending2_png = "Sprites_ui_X_07_ending2";
|
||||
public const string ui_x_07_ending3_png = "Sprites_ui_X_07_ending3";
|
||||
public const string ui_zone1_shengmingjiankangqu_png = "Sprites_ui_zone1_shengmingjiankangqu";
|
||||
public const string ui_zone2_jiankangyingxiangyinsuqu_png = "Sprites_ui_zone2_jiankangyingxiangyinsuqu";
|
||||
public const string ui_zone3_shengmingfanghuqu_png = "Sprites_ui_zone3_shengmingfanghuqu";
|
||||
public const string ui_zone4_jiankangsuyangqu_png = "Sprites_ui_zone4_jiankangsuyangqu";
|
||||
public const string ui_zone5_jiankangshenghuofangshiqu_png = "Sprites_ui_zone5_jiankangshenghuofangshiqu";
|
||||
public static class video
|
||||
{
|
||||
}
|
||||
public static class vid_video_mask
|
||||
{
|
||||
public const string vid_mask_001_png = "vid_video_mask_vid_mask_001";
|
||||
public const string vid_mask_002_png = "vid_video_mask_vid_mask_002";
|
||||
public const string vid_mask_003_png = "vid_video_mask_vid_mask_003";
|
||||
public const string vid_mask_004_png = "vid_video_mask_vid_mask_004";
|
||||
public const string vid_mask_005_png = "vid_video_mask_vid_mask_005";
|
||||
public const string vid_mask_006_png = "vid_video_mask_vid_mask_006";
|
||||
public const string vid_mask_007_png = "vid_video_mask_vid_mask_007";
|
||||
public const string vid_mask_008_png = "vid_video_mask_vid_mask_008";
|
||||
public const string vid_mask_009_png = "vid_video_mask_vid_mask_009";
|
||||
public const string vid_mask_010_png = "vid_video_mask_vid_mask_010";
|
||||
public const string vid_mask_011_png = "vid_video_mask_vid_mask_011";
|
||||
public const string vid_mask_012_png = "vid_video_mask_vid_mask_012";
|
||||
public const string vid_mask_013_png = "vid_video_mask_vid_mask_013";
|
||||
public const string vid_mask_014_png = "vid_video_mask_vid_mask_014";
|
||||
public const string vid_mask_015_png = "vid_video_mask_vid_mask_015";
|
||||
public const string vid_mask_016_png = "vid_video_mask_vid_mask_016";
|
||||
public const string vid_mask_017_png = "vid_video_mask_vid_mask_017";
|
||||
public const string vid_mask_018_png = "vid_video_mask_vid_mask_018";
|
||||
public const string vid_mask_019_png = "vid_video_mask_vid_mask_019";
|
||||
public const string vid_mask_020_png = "vid_video_mask_vid_mask_020";
|
||||
public const string vid_mask_021_png = "vid_video_mask_vid_mask_021";
|
||||
public const string vid_mask_022_png = "vid_video_mask_vid_mask_022";
|
||||
public const string vid_mask_023_png = "vid_video_mask_vid_mask_023";
|
||||
public const string vid_mask_024_png = "vid_video_mask_vid_mask_024";
|
||||
public const string vid_mask_025_png = "vid_video_mask_vid_mask_025";
|
||||
public const string vid_mask_026_png = "vid_video_mask_vid_mask_026";
|
||||
public const string vid_mask_027_png = "vid_video_mask_vid_mask_027";
|
||||
public const string vid_mask_028_png = "vid_video_mask_vid_mask_028";
|
||||
public const string vid_mask_029_png = "vid_video_mask_vid_mask_029";
|
||||
public const string vid_mask_030_png = "vid_video_mask_vid_mask_030";
|
||||
public const string vid_mask_031_png = "vid_video_mask_vid_mask_031";
|
||||
public const string vid_mask_032_png = "vid_video_mask_vid_mask_032";
|
||||
public const string vid_mask_033_png = "vid_video_mask_vid_mask_033";
|
||||
public const string vid_mask_034_png = "vid_video_mask_vid_mask_034";
|
||||
public const string vid_mask_035_png = "vid_video_mask_vid_mask_035";
|
||||
public const string vid_mask_036_png = "vid_video_mask_vid_mask_036";
|
||||
public const string vid_mask_037_png = "vid_video_mask_vid_mask_037";
|
||||
public const string vid_mask_038_png = "vid_video_mask_vid_mask_038";
|
||||
public const string vid_mask_039_png = "vid_video_mask_vid_mask_039";
|
||||
public const string vid_mask_040_png = "vid_video_mask_vid_mask_040";
|
||||
public const string vid_mask_041_png = "vid_video_mask_vid_mask_041";
|
||||
public const string vid_mask_042_png = "vid_video_mask_vid_mask_042";
|
||||
public const string vid_mask_043_png = "vid_video_mask_vid_mask_043";
|
||||
public const string vid_mask_044_png = "vid_video_mask_vid_mask_044";
|
||||
public const string vid_mask_045_png = "vid_video_mask_vid_mask_045";
|
||||
public const string vid_mask_046_png = "vid_video_mask_vid_mask_046";
|
||||
public const string vid_mask_047_png = "vid_video_mask_vid_mask_047";
|
||||
public const string vid_mask_048_png = "vid_video_mask_vid_mask_048";
|
||||
public const string vid_mask_049_png = "vid_video_mask_vid_mask_049";
|
||||
public const string vid_mask_050_png = "vid_video_mask_vid_mask_050";
|
||||
public const string vid_mask_051_png = "vid_video_mask_vid_mask_051";
|
||||
public const string vid_mask_052_png = "vid_video_mask_vid_mask_052";
|
||||
public const string vid_mask_053_png = "vid_video_mask_vid_mask_053";
|
||||
public const string vid_mask_054_png = "vid_video_mask_vid_mask_054";
|
||||
public const string vid_mask_055_png = "vid_video_mask_vid_mask_055";
|
||||
public const string vid_mask_056_png = "vid_video_mask_vid_mask_056";
|
||||
public const string vid_mask_057_png = "vid_video_mask_vid_mask_057";
|
||||
public const string vid_mask_058_png = "vid_video_mask_vid_mask_058";
|
||||
public const string vid_mask_059_png = "vid_video_mask_vid_mask_059";
|
||||
public const string vid_mask_060_png = "vid_video_mask_vid_mask_060";
|
||||
}
|
||||
}
|
||||
public static class video
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc52e18b7084b5242a035413be8a13a6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -29,7 +29,6 @@ public class VoiceSwitchingScene : MonoBehaviour
|
||||
"打开第十八个场景",
|
||||
"打开第十九个场景",
|
||||
"打开第二十个场景",
|
||||
|
||||
};
|
||||
|
||||
private String[] _sceneNamesSpell = new string[]
|
||||
@@ -55,36 +54,62 @@ public class VoiceSwitchingScene : MonoBehaviour
|
||||
"da kai di shi jiu ge chang jing",
|
||||
"da kai di shi er shi ge chang jing",
|
||||
};
|
||||
|
||||
private HybridClREntrance hybridClREntrance;
|
||||
|
||||
private MainDomainAll mainDomainAll;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
hybridClREntrance = GetComponent<HybridClREntrance>();
|
||||
hybridClREntrance = GameObject.FindAnyObjectByType<HybridClREntrance>();
|
||||
#if UNITY_EDITOR
|
||||
hybridClREntrance.enabled=true;
|
||||
AppConfig.OpenDomainType= OpenDomainType.Editor;
|
||||
#endif
|
||||
if (!Permission.HasUserAuthorizedPermission("android.permission.RECORD_AUDIO"))
|
||||
{
|
||||
Permission.RequestUserPermission("android.permission.RECORD_AUDIO");
|
||||
}
|
||||
|
||||
ModuleManager.Instance.RegistModule("com.rokid.voicecommand.VoiceCommandHelper", false);
|
||||
OfflineVoiceModule.Instance.ChangeVoiceCommandLanguage(LANGUAGE.CHINESE);
|
||||
|
||||
mainDomainAll = Resources.Load<MainDomainAll>("MainDomainAll");
|
||||
mainDomainAll = Resources.Load<MainDomainAll>("MainDomainAll");
|
||||
for (int i = 0; i < mainDomainAll.domainAll.Length; i++)
|
||||
{
|
||||
if(mainDomainAll.domainAll[i].isVideo)
|
||||
OfflineVoiceModule.Instance.AddInstruct(LANGUAGE.CHINESE, _sceneNames[i], _sceneNamesSpell[i], this.gameObject.name, "OnReceive");
|
||||
if (mainDomainAll.domainAll[i].isVideo)
|
||||
OfflineVoiceModule.Instance.AddInstruct(LANGUAGE.CHINESE, _sceneNames[i], _sceneNamesSpell[i],
|
||||
this.gameObject.name, "OnReceive");
|
||||
}
|
||||
|
||||
OfflineVoiceModule.Instance.Commit();
|
||||
}
|
||||
|
||||
|
||||
void OnReceive(string msg)
|
||||
{
|
||||
int index = Array.IndexOf(_sceneNames, msg);
|
||||
if (index != -1)
|
||||
if (hybridClREntrance.enabled == false)
|
||||
{
|
||||
hybridClREntrance.OpenDomain(mainDomainAll.domainAll[index].domainName , OpenDomainType.VIOICE);
|
||||
|
||||
AppConfig.OpenDomainType= OpenDomainType.VIOICE;
|
||||
hybridClREntrance.enabled=true;
|
||||
return;
|
||||
}
|
||||
|
||||
int index = Array.IndexOf(_sceneNames, msg);
|
||||
if (index!=-1)
|
||||
{
|
||||
hybridClREntrance.OpenDomain(mainDomainAll.domainAll[index].domainName, OpenDomainType.VIOICE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("UnityEvo:不存在语音指令:" + msg + ",请检查配置文件");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPointClound()
|
||||
{
|
||||
AppConfig.OpenDomainType = OpenDomainType.PointCloud;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,9 @@
|
||||
"GUID:6a5d7223300a2ef48aa366288a446472",
|
||||
"GUID:10c9b58b77ad42b4193e2a393b1a9899",
|
||||
"GUID:fad681b9bfe621d4fa07f4f69c311443",
|
||||
"GUID:ff70fce64a3314305977bdf5610ed86b"
|
||||
"GUID:ff70fce64a3314305977bdf5610ed86b",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:f3fa071c399c4383a9ff8115e53dfefc"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -17,4 +17,9 @@ MonoBehaviour:
|
||||
mainDomainVersion:
|
||||
username: admin2023
|
||||
password: admin@2023
|
||||
productName: yuhanghealthhall
|
||||
projectInfo:
|
||||
projectName:
|
||||
projectCode:
|
||||
projectPackageName: com.xosmo.
|
||||
loadingScene: {fileID: 0}
|
||||
loadingScenePath:
|
||||
|
||||
@@ -41,3 +41,7 @@ MonoBehaviour:
|
||||
domainName: X_05_01
|
||||
- isVideo: 1
|
||||
domainName: X_06_01
|
||||
- isVideo: 1
|
||||
domainName: X_01
|
||||
- isVideo: 1
|
||||
domainName: X_07
|
||||
|
||||
@@ -33,7 +33,6 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 3019045779189427444}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@@ -57,7 +56,9 @@ Canvas:
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
@@ -83,7 +84,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &635877910647768279
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -134,7 +135,6 @@ RectTransform:
|
||||
- {fileID: 4478887775470361833}
|
||||
- {fileID: 7061587243420078504}
|
||||
m_Father: {fileID: 4160048210915643038}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -210,7 +210,6 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3019045779189427444}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -290,7 +289,6 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3019045779189427444}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
|
||||
8
Assets/Main/main.meta
Normal file
8
Assets/Main/main.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f38eb540c6d2e54c90af87ab61aa1bd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
63
Assets/Main/main/Global Volume Profile_17.asset
Normal file
63
Assets/Main/main/Global Volume Profile_17.asset
Normal file
@@ -0,0 +1,63 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
|
||||
m_Name: Global Volume Profile_17
|
||||
m_EditorClassIdentifier:
|
||||
components:
|
||||
- {fileID: 2360971425302899212}
|
||||
--- !u!114 &2360971425302899212
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
||||
m_Name: Bloom
|
||||
m_EditorClassIdentifier:
|
||||
active: 1
|
||||
skipIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
threshold:
|
||||
m_OverrideState: 1
|
||||
m_Value: 3
|
||||
intensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 2
|
||||
scatter:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.5
|
||||
clamp:
|
||||
m_OverrideState: 0
|
||||
m_Value: 65472
|
||||
tint:
|
||||
m_OverrideState: 1
|
||||
m_Value: {r: 0, g: 0.37867165, b: 1, a: 1}
|
||||
highQualityFiltering:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
downscale:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
maxIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 6
|
||||
dirtTexture:
|
||||
m_OverrideState: 0
|
||||
m_Value: {fileID: 0}
|
||||
dimension: 1
|
||||
dirtIntensity:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
8
Assets/Main/main/Global Volume Profile_17.asset.meta
Normal file
8
Assets/Main/main/Global Volume Profile_17.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85a99ebdc1c7f6241a48609b76c18142
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/Main/main/Global Volume Profile_3.asset
Normal file
63
Assets/Main/main/Global Volume Profile_3.asset
Normal file
@@ -0,0 +1,63 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-6254302421713458329
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
||||
m_Name: Bloom
|
||||
m_EditorClassIdentifier:
|
||||
active: 1
|
||||
skipIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
threshold:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1.5
|
||||
intensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 2
|
||||
scatter:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.4
|
||||
clamp:
|
||||
m_OverrideState: 0
|
||||
m_Value: 65472
|
||||
tint:
|
||||
m_OverrideState: 1
|
||||
m_Value: {r: 1, g: 0, b: 0, a: 1}
|
||||
highQualityFiltering:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
downscale:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
maxIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 6
|
||||
dirtTexture:
|
||||
m_OverrideState: 0
|
||||
m_Value: {fileID: 0}
|
||||
dimension: 1
|
||||
dirtIntensity:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
|
||||
m_Name: Global Volume Profile_3
|
||||
m_EditorClassIdentifier:
|
||||
components:
|
||||
- {fileID: -6254302421713458329}
|
||||
8
Assets/Main/main/Global Volume Profile_3.asset.meta
Normal file
8
Assets/Main/main/Global Volume Profile_3.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ae9f0115dfbe65478d0d5ca99b8d0bf
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/Main/main/Global Volume Profile_6.asset
Normal file
63
Assets/Main/main/Global Volume Profile_6.asset
Normal file
@@ -0,0 +1,63 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-6254302421713458329
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
||||
m_Name: Bloom
|
||||
m_EditorClassIdentifier:
|
||||
active: 1
|
||||
skipIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
threshold:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
intensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 2
|
||||
scatter:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.4
|
||||
clamp:
|
||||
m_OverrideState: 0
|
||||
m_Value: 65472
|
||||
tint:
|
||||
m_OverrideState: 1
|
||||
m_Value: {r: 1, g: 0.36771443, b: 0, a: 1}
|
||||
highQualityFiltering:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
downscale:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
maxIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 6
|
||||
dirtTexture:
|
||||
m_OverrideState: 0
|
||||
m_Value: {fileID: 0}
|
||||
dimension: 1
|
||||
dirtIntensity:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
|
||||
m_Name: Global Volume Profile_6
|
||||
m_EditorClassIdentifier:
|
||||
components:
|
||||
- {fileID: -6254302421713458329}
|
||||
8
Assets/Main/main/Global Volume Profile_6.asset.meta
Normal file
8
Assets/Main/main/Global Volume Profile_6.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 996859d9373f04d4aaaf5502637a08c6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user