zip压缩加载测试
This commit is contained in:
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();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user