框架上传

This commit is contained in:
2025-03-31 11:16:52 +08:00
parent 7197b4c0d0
commit ffcdddbd2a
429 changed files with 19115 additions and 1579 deletions

View File

@@ -0,0 +1,127 @@
/****************************************************
文件OneKeySearchDuplicateFiles.cs
作者:张铮
邮箱834207172@qq.com
日期2022/3/7 18:28:50
功能:
*****************************************************/
using Sirenix.OdinInspector;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
namespace Stary.Evo.Editor
{
[TypeInfoBox("批量选中或者取消对应UI上的Raycast")]
public class OneKeyChangeRaycastTarget : SerializedScriptableObject
{
private bool selectRaycastComplete = false;
private bool cancelRaycastComplete = false;
[PreviewField(50)]
[OnValueChanged("SelectRaycastListValueChangeCallBack")]
[HorizontalGroup("Raycast")]
[PropertySpace(10, 10)]
[BoxGroup("Raycast/Left", false)]
[LabelText("需要选中Raycast拖入进来")]
public List<GameObject> SelectRaycastList = new List<GameObject>();
public void SelectRaycastListValueChangeCallBack()
{
selectRaycastComplete = false;
}
[PreviewField(50)]
[OnValueChanged("CancelRaycastListValueChangeCallBack")]
[PropertySpace(10, 10)]
[BoxGroup("Raycast/Right", false)]
[LabelText("需要取消Raycast拖入进来")]
public List<GameObject> CancelRaycastList = new List<GameObject>();
public void CancelRaycastListValueChangeCallBack()
{
cancelRaycastComplete = false;
}
[HideIf("@selectRaycastComplete==true||SelectRaycastList.Count==0")]
[BoxGroup("Raycast/Left")]
[Button("勾选所有射线检测", ButtonSizes.Large, ButtonStyle.FoldoutButton)]
public void SelectRaycast()
{
for (int i = 0; i < SelectRaycastList.Count; i++)
{
if (SelectRaycastList[i] == null)
{
continue;
}
Graphic[] graphicArray = SelectRaycastList[i].GetComponentsInChildren<Graphic>();
for (int k = 0; k < graphicArray.Length; k++)
{
graphicArray[k].raycastTarget = true;
EditorUtility.SetDirty(graphicArray[k]);
}
GameObject tempObject = SelectRaycastList[i];
bool isPrefabInstance = PrefabUtility.IsPartOfPrefabInstance(tempObject);
bool isPrefabAsset = PrefabUtility.IsPartOfPrefabAsset(tempObject);
if (isPrefabAsset)
{
PrefabUtility.SavePrefabAsset(SelectRaycastList[i]);
}
if (isPrefabInstance)
{
PrefabUtility.ApplyPrefabInstance(SelectRaycastList[i], InteractionMode.UserAction);
}
}
selectRaycastComplete = true;
AssetDatabase.Refresh();
}
[HideIf("@cancelRaycastComplete==true||CancelRaycastList.Count==0")]
[BoxGroup("Raycast/Right")]
[Button("取消所有射线检测", ButtonSizes.Large, ButtonStyle.FoldoutButton)]
public void CancelRaycast()
{
for (int i = 0; i < CancelRaycastList.Count; i++)
{
if (CancelRaycastList[i] == null)
{
continue;
}
Graphic[] graphicArray = CancelRaycastList[i].GetComponentsInChildren<Graphic>();
for (int k = 0; k < graphicArray.Length; k++)
{
graphicArray[k].raycastTarget = false;
EditorUtility.SetDirty(graphicArray[k]);
}
GameObject tempObject = CancelRaycastList[i];
bool isPrefabInstance = PrefabUtility.IsPartOfPrefabInstance(tempObject);
bool isPrefabAsset = PrefabUtility.IsPartOfPrefabAsset(tempObject);
if (isPrefabAsset)
{
PrefabUtility.SavePrefabAsset(CancelRaycastList[i]);
}
if (isPrefabInstance)
{
PrefabUtility.ApplyPrefabInstance(CancelRaycastList[i], InteractionMode.UserAction);
}
}
cancelRaycastComplete = true;
AssetDatabase.Refresh();
}
}
}