1111
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user