增加一个位置层级

This commit is contained in:
2025-04-15 17:06:01 +08:00
parent c03e963dcc
commit 779435c062
15 changed files with 15 additions and 275 deletions

View File

@@ -9,6 +9,7 @@ using HybridCLR.Editor.Settings;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using Sirenix.OdinInspector.Editor; using Sirenix.OdinInspector.Editor;
using Sirenix.Utilities; using Sirenix.Utilities;
using Stary.Evo.InformationSave;
using UnityEditor; using UnityEditor;
using UnityEditorInternal; using UnityEditorInternal;
using UnityEngine; using UnityEngine;
@@ -109,6 +110,15 @@ namespace Stary.Evo.Editor
gameObj.transform.position = Vector3.zero; gameObj.transform.position = Vector3.zero;
gameObj.transform.rotation = Quaternion.identity; gameObj.transform.rotation = Quaternion.identity;
gameObj.name = domain; gameObj.name = domain;
//创建位置层级
GameObject transformInfo = new GameObject("TransformInfo");
transformInfo.transform.SetParent(gameObj.transform);
transformInfo.transform.position = Vector3.zero;
transformInfo.transform.rotation = Quaternion.identity;
transformInfo.AddComponent<LocalTransformInfo>();
Directory.CreateDirectory($"{resPath}/Prefabs"); Directory.CreateDirectory($"{resPath}/Prefabs");
string rootPfbFilePath = $"Assets/Domain/{domain}/AddressableRes/Prefabs/{domain}.prefab"; string rootPfbFilePath = $"Assets/Domain/{domain}/AddressableRes/Prefabs/{domain}.prefab";
var localPath = AssetDatabase.GenerateUniqueAssetPath(rootPfbFilePath); var localPath = AssetDatabase.GenerateUniqueAssetPath(rootPfbFilePath);

View File

@@ -6,7 +6,8 @@
"GUID:c5ecc461727906345a35491a0440694f", "GUID:c5ecc461727906345a35491a0440694f",
"GUID:4d1926c9df5b052469a1c63448b7609a", "GUID:4d1926c9df5b052469a1c63448b7609a",
"GUID:e34a5702dd353724aa315fb8011f08c3", "GUID:e34a5702dd353724aa315fb8011f08c3",
"GUID:9343e3f36d5deca4880d49f48b3fa2b1" "GUID:9343e3f36d5deca4880d49f48b3fa2b1",
"GUID:ec45849e30ba03e4dab386099d8c697b"
], ],
"includePlatforms": [ "includePlatforms": [
"Editor" "Editor"

View File

@@ -1,6 +1,6 @@
{ {
"name": "com.staryevo.main", "name": "com.staryevo.main",
"version": "1.0.12", "version": "1.0.13",
"displayName": "00.StaryEvo", "displayName": "00.StaryEvo",
"description": "This is an Framework package", "description": "This is an Framework package",
"unity": "2021.3", "unity": "2021.3",
@@ -17,7 +17,8 @@
"dependencies": { "dependencies": {
"com.cysharp.unitask": "2.5.10", "com.cysharp.unitask": "2.5.10",
"com.code-philosophy.hybridclr": "4.0.15", "com.code-philosophy.hybridclr": "4.0.15",
"com.tuyoogame.yooasset": "2.3.7" "com.tuyoogame.yooasset": "2.3.7",
"com.staryevo.informationsave": "1.x.x"
}, },
"samples": [ "samples": [
{ {

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 639fe5e44b4245e48b45ae80da27e408
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1 +0,0 @@
# Rokid语音命令工具

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 2007d74d73bee7d468ab76b4f3466708
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d1654ed807ee7c24c94cab4c172e6f91
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,64 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Stary.Evo;
public interface IVoiceCommandSystem : ISystem
{
public void AddVoiceCommand(string content,string spell, Action action);
public void DeleteVoiceCommand(string content);
public void ClearAllVoiceCommands();
}
public class VoiceCommandSystem : AbstractSystem,IVoiceCommandSystem
{
private VoiceCommandController _voiceController;
protected virtual string ControllerName
{
get { return "VoiceCommandController"; }
}
private void createVoiceCommandContriller()
{
GameObject VoiceControllerObject = GameObject.Find(ControllerName);
if (VoiceControllerObject == null)
{
VoiceControllerObject = new GameObject(ControllerName);
}
_voiceController = VoiceControllerObject.GetComponent<VoiceCommandController>();
if (_voiceController == null)
{
_voiceController = VoiceControllerObject.AddComponent<VoiceCommandController>();
}
}
public void AddVoiceCommand(string content,string spell, Action action)
{
if (_voiceController == null) createVoiceCommandContriller();
_voiceController.RegisteredVoiceCommand(content, spell, action);
}
public void DeleteVoiceCommand(string content)
{
if(_voiceController!=null) _voiceController.DeleteVoiceCommand(content);
}
public void ClearAllVoiceCommands()
{
if (_voiceController != null)
{
_voiceController.ClearAllVoiceCommand();
GameObject.Destroy(_voiceController.gameObject);
}
}
public override void Dispose()
{
ClearAllVoiceCommands();
}
protected override void OnInit()
{
throw new System.NotImplementedException();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 073d8fadbb202ad42a540fd5299555c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +0,0 @@
{
"name": "RKVoiceCommand.RunTime",
"rootNamespace": "",
"references": [
"GUID:6447e10b87dc140ab924878c1ecef665",
"GUID:fe14bc9dd681249d19cf4ef377c7e29e",
"GUID:d1a793c2b6959e04ea45b972eaa369c8"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,13 +0,0 @@
fileFormatVersion: 2
<<<<<<<< HEAD:Assets/05.TableTextConversion/Editor/Excel.meta
guid: 10c9b58b77ad42b4193e2a393b1a9899
folderAsset: yes
DefaultImporter:
========
guid: 44e8639d57fc2a94b94ecef44bf1e36a
AssemblyDefinitionImporter:
>>>>>>>> 04.AudioCore:Assets/04.AudioCore/RunTime/AudioCore.RunTime.asmdef.meta
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,104 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Stary.Evo;
using Rokid.UXR.Module;
using UnityEngine.Android;
public class VoiceCommandController : MonoBehaviour
{
public Dictionary<string, Action> VoiceCommands = new Dictionary<string, Action>();
public bool isInit = false;
void Awake()
{
}
void Start()
{
//if (!Permission.HasUserAuthorizedPermission("android.permission.RECORD_AUDIO")) return;
}
/// <summary>
/// 注册语音指令
/// </summary>
/// <param name="content"></param>
/// <param name="spell"></param>
/// <param name="action"></param>
public void RegisteredVoiceCommand(string content, string spell, Action action)
{
if (!isInit)
{
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);
isInit = true;
}
if (!VoiceCommands.ContainsKey(content))
{
VoiceCommands.Add(content, action);
}
else
{
Debug.LogError($"语音命令 :“'{content}' ”已经注册了!!!");
return;
}
OfflineVoiceModule.Instance.AddInstruct(LANGUAGE.CHINESE, content, spell, this.gameObject.name, "OnReceive");
OfflineVoiceModule.Instance.Commit();
}
/// <summary>
/// 删除语音指令
/// </summary>
/// <param name="content"></param>
public void DeleteVoiceCommand(string content)
{
if (VoiceCommands.ContainsKey(content))
{
VoiceCommands.Remove(content);
}
else
{
Debug.LogWarning($"语音命令 :“'{content}' 不存在!!!");
}
}
/// <summary>
/// 清除所有语音指令
/// </summary>
public void ClearAllVoiceCommand()
{
VoiceCommands.Clear();
OfflineVoiceModule.Instance.ClearAllInstruct();
OfflineVoiceModule.Instance.Commit();
}
void OnReceive(string msg)
{
if (VoiceCommands.TryGetValue(msg, out Action action))
{
action?.Invoke();
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
if (VoiceCommands.TryGetValue("变成绿色", out Action action))
{
action?.Invoke();
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9f55b7179dceeae47826f4f0f08ba3fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,20 +0,0 @@
{
"name": "com.staryevo.rkvoicecommand",
"version": "1.0.1",
"displayName": "07.RKVoiceCommand",
"description": "Rokid语音命令工具",
"unity": "2021.3",
"unityRelease": "23f1",
"keywords": [
"unity",
"scirpt"
],
"author": {
"name": "staryEvo",
"url": "https://www.unity3d.com"
},
"dependencies": {
"com.rokid.xr.unity":"3.0.3",
"com.staryevo.main":"1.x.x"
}
}

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: c1e566c37939b1c45885d8ca929414a7
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: