zip压缩加载测试
This commit is contained in:
79
Assets/Main/Script/Editor/DomainBaseEditor.cs
Normal file
79
Assets/Main/Script/Editor/DomainBaseEditor.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
// using UnityEditor;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace Stary.Evo
|
||||
// {
|
||||
// [CustomEditor(typeof(DomainBase), true)]
|
||||
// public class DomainBaseEditor : UnityEditor.Editor
|
||||
// {
|
||||
// //定义序列化属性
|
||||
// // private SerializedProperty intValue;
|
||||
// // private SerializedProperty floatValue;
|
||||
// // private SerializedProperty stringValue;
|
||||
// // private SerializedProperty boolValue;
|
||||
// // private SerializedProperty vector3Value;
|
||||
// // private SerializedProperty enumValue;
|
||||
// // private SerializedProperty colorValue;
|
||||
// // private SerializedProperty textureValue;
|
||||
// /// <summary>
|
||||
// /// 序列化属性,在OnEnable中获取
|
||||
// /// </summary>
|
||||
// [HideInInspector]
|
||||
// private SerializedProperty domainConfig;
|
||||
// [HideInInspector]
|
||||
// private SerializedProperty domainName;
|
||||
//
|
||||
// private UnityEditor.Editor cacheEditor;
|
||||
// private void OnEnable()
|
||||
// {
|
||||
// domainConfig = serializedObject.FindProperty("domainConfig");
|
||||
// if (!Application.isPlaying)
|
||||
// {
|
||||
//
|
||||
// domainName = serializedObject.FindProperty("DomainName");
|
||||
// domainConfig.objectReferenceValue =
|
||||
// AssetDatabase.LoadAssetAtPath<DomainConfig>(
|
||||
// $"Assets/Domain/{domainName.stringValue}/AddressableRes/Config/DomainConfig.asset");
|
||||
// }
|
||||
// //通过名字查找被序列化属性。
|
||||
// // intValue = serializedObject.FindProperty("intValue");
|
||||
// // floatValue = serializedObject.FindProperty("floatValue");
|
||||
// // stringValue = serializedObject.FindProperty("stringValue");
|
||||
// // boolValue = serializedObject.FindProperty("boolValue");
|
||||
// // vector3Value = serializedObject.FindProperty("vector3Value");
|
||||
// // enumValue = serializedObject.FindProperty("enumValue");
|
||||
// // colorValue = serializedObject.FindProperty("colorValue");
|
||||
// // textureValue = serializedObject.FindProperty("textureValue");
|
||||
// }
|
||||
//
|
||||
// public override void OnInspectorGUI()
|
||||
// {
|
||||
// //表示更新序列化物体
|
||||
// serializedObject.Update();
|
||||
//
|
||||
// // EditorGUILayout.PropertyField(domainConfig,new GUIContent("111"),true);
|
||||
//
|
||||
//
|
||||
// var data = ((DomainConfig)domainConfig.objectReferenceValue);
|
||||
// if (data != null)
|
||||
// {
|
||||
// //创建TestClass的Editor
|
||||
// if (cacheEditor == null)
|
||||
// cacheEditor = UnityEditor. Editor.CreateEditor(data);
|
||||
// cacheEditor.OnInspectorGUI();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // EditorGUILayout.PropertyField(intValue);
|
||||
// // EditorGUILayout.PropertyField(floatValue);
|
||||
// // EditorGUILayout.PropertyField(stringValue);
|
||||
// // EditorGUILayout.PropertyField(boolValue);
|
||||
// // EditorGUILayout.PropertyField(vector3Value);
|
||||
// // EditorGUILayout.PropertyField(enumValue);
|
||||
// // EditorGUILayout.PropertyField(colorValue);
|
||||
// // EditorGUILayout.PropertyField(textureValue);
|
||||
// //应用修改的属性值,不加的话,Inspector面板的值修改不了
|
||||
// serializedObject.ApplyModifiedProperties();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
3
Assets/Main/Script/Editor/DomainBaseEditor.cs.meta
Normal file
3
Assets/Main/Script/Editor/DomainBaseEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ca49f66bd64466d8cf1ede3acb36592
|
||||
timeCreated: 1744097384
|
||||
51
Assets/Main/Script/Editor/HybridClREntranceEditor.cs
Normal file
51
Assets/Main/Script/Editor/HybridClREntranceEditor.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Stary.Evo.Editor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
[CustomEditor(typeof(HybridClREntrance))]
|
||||
public class HybridClREntranceEditor : UnityEditor.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 序列化属性,在OnEnable中获取
|
||||
/// </summary>
|
||||
[HideInInspector]
|
||||
private SerializedProperty domain;
|
||||
|
||||
private string[] domainNames;
|
||||
private void OnEnable()
|
||||
{
|
||||
domain = serializedObject.FindProperty("domain");
|
||||
domainNames = CreatAssetWindow.GetCreatDomainAllName();
|
||||
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
// 获取当前选中的索引
|
||||
int selectedIndex = System.Array.IndexOf(domainNames, domain.stringValue);
|
||||
if (selectedIndex < 0) selectedIndex = 0; // 默认选中第一个
|
||||
|
||||
// 绘制下拉选择框
|
||||
selectedIndex = EditorGUILayout.Popup("Domain", selectedIndex, domainNames);
|
||||
|
||||
// 更新选择的域名
|
||||
domain.stringValue = domainNames[selectedIndex];
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
HybridClREntrance hybridClREntrance = target as HybridClREntrance;
|
||||
if (GUILayout.Button("打开Domain"))
|
||||
{
|
||||
hybridClREntrance.OpenDomain();
|
||||
}
|
||||
if (GUILayout.Button("关闭Domain"))
|
||||
{
|
||||
hybridClREntrance.CloseDomain();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0996e24f28249ccb2bfb2a14e1358c1
|
||||
timeCreated: 1744706140
|
||||
66
Assets/Main/Script/Editor/PointGatherDataEditor.cs
Normal file
66
Assets/Main/Script/Editor/PointGatherDataEditor.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Stary.Evo.Editor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Main
|
||||
{
|
||||
[CustomEditor(typeof(PointGatherData))]
|
||||
public class PointGatherDataEditor : UnityEditor.Editor
|
||||
{
|
||||
|
||||
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
base.OnInspectorGUI();
|
||||
|
||||
PointGatherData pointGatherData = target as PointGatherData;
|
||||
if (GUILayout.Button("一键生成坐标数据"))
|
||||
{
|
||||
|
||||
ZoneController[] zoneControllers = FindObjectsOfType<ZoneController>(true);
|
||||
PointController[] pointControllers = FindObjectsOfType<PointController>(true);
|
||||
for (int i = 0; i < pointGatherData.ZoneDatas.Count; i++)
|
||||
{
|
||||
ZoneData zoneData = pointGatherData.ZoneDatas[i];
|
||||
|
||||
foreach (var zoneController in zoneControllers)
|
||||
{
|
||||
if (zoneController.name == zoneData.name)
|
||||
{
|
||||
zoneData.position = zoneController.transform.localPosition;
|
||||
zoneData.rotation = zoneController.transform.localEulerAngles;
|
||||
zoneData.scale = zoneController.transform.localScale;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int j = 0; j < zoneData.pointDatas.Count; j++)
|
||||
{
|
||||
PointData pointData = zoneData.pointDatas[j];
|
||||
|
||||
|
||||
|
||||
foreach (var pointController in pointControllers)
|
||||
{
|
||||
if (pointController.name == pointData.name)
|
||||
{
|
||||
pointData.position = pointController.transform.localPosition;
|
||||
pointData.rotation = pointController.transform.localEulerAngles;
|
||||
pointData.scale = pointController.transform.localScale;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
EditorUtility.SetDirty(pointGatherData);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Main/Script/Editor/PointGatherDataEditor.cs.meta
Normal file
3
Assets/Main/Script/Editor/PointGatherDataEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6eaaeb57d33f5704e8cd6b9527d78a6b
|
||||
timeCreated: 1744706140
|
||||
20
Assets/Main/Script/Editor/stary.main.editor.asmdef
Normal file
20
Assets/Main/Script/Editor/stary.main.editor.asmdef
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "stary.main.editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:4492e37c9663479418f9522cc4796b57",
|
||||
"GUID:d1a793c2b6959e04ea45b972eaa369c8",
|
||||
"GUID:044184040b21c434b8aee6f2a3424c06"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/Main/Script/Editor/stary.main.editor.asmdef.meta
Normal file
7
Assets/Main/Script/Editor/stary.main.editor.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c6af7aee383dac46b510d588d1b015d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user