技能主要更新,修复卡顿并加入动画,以及各种其他更新。
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public static class MoveMusicPicToPrefab
|
||||
{
|
||||
const string ScenePath = "Assets/Scenes/UI_UI.unity";
|
||||
const string PrefabPath = "Assets/Scripts/UI/Panel/dontdestroyonload/btm and top.prefab";
|
||||
const string MusicPicName = "MusicPic";
|
||||
|
||||
[MenuItem("Tools/MusicPic/Move To btm and top Prefab")]
|
||||
public static void Execute()
|
||||
{
|
||||
var scene = EditorSceneManager.OpenScene(ScenePath, OpenSceneMode.Single);
|
||||
if (!scene.IsValid())
|
||||
{
|
||||
Debug.LogError("[MoveMusicPicToPrefab] Failed to open UI_UI scene.");
|
||||
return;
|
||||
}
|
||||
|
||||
var musicPic = FindInScene(scene, MusicPicName);
|
||||
if (musicPic == null)
|
||||
{
|
||||
Debug.LogError("[MoveMusicPicToPrefab] MusicPic not found in UI_UI scene.");
|
||||
return;
|
||||
}
|
||||
|
||||
var prefabRoot = PrefabUtility.LoadPrefabContents(PrefabPath);
|
||||
if (prefabRoot == null)
|
||||
{
|
||||
Debug.LogError("[MoveMusicPicToPrefab] Failed to load prefab.");
|
||||
return;
|
||||
}
|
||||
|
||||
var existing = prefabRoot.transform.Find(MusicPicName);
|
||||
if (existing != null)
|
||||
{
|
||||
Object.DestroyImmediate(existing.gameObject);
|
||||
}
|
||||
|
||||
var copy = Object.Instantiate(musicPic);
|
||||
copy.name = MusicPicName;
|
||||
copy.transform.SetParent(prefabRoot.transform, false);
|
||||
copy.transform.localPosition = Vector3.zero;
|
||||
copy.transform.localRotation = Quaternion.identity;
|
||||
copy.transform.localScale = Vector3.one;
|
||||
|
||||
PrefabUtility.SaveAsPrefabAsset(prefabRoot, PrefabPath);
|
||||
PrefabUtility.UnloadPrefabContents(prefabRoot);
|
||||
|
||||
Object.DestroyImmediate(musicPic);
|
||||
EditorSceneManager.MarkSceneDirty(scene);
|
||||
EditorSceneManager.SaveScene(scene);
|
||||
|
||||
Debug.Log("[MoveMusicPicToPrefab] Moved MusicPic into btm and top prefab and removed from UI_UI scene.");
|
||||
}
|
||||
|
||||
static GameObject FindInScene(Scene scene, string name)
|
||||
{
|
||||
var roots = scene.GetRootGameObjects();
|
||||
foreach (var root in roots)
|
||||
{
|
||||
if (root == null) continue;
|
||||
var t = root.transform.Find(name);
|
||||
if (t != null) return t.gameObject;
|
||||
}
|
||||
var all = Object.FindObjectsByType<Transform>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
foreach (var t in all)
|
||||
{
|
||||
if (t == null) continue;
|
||||
if (t.gameObject.scene != scene) continue;
|
||||
if (t.name == name) return t.gameObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: faf2f941bdebdd142bfd366d79392e51
|
||||
@@ -0,0 +1,29 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class UI_FunctionHoverConfigAutoCreate
|
||||
{
|
||||
private const string AssetPath = "Assets/Resources/UI_FunctionHoverConfig.asset";
|
||||
private const string DefaultJsonPath = "Assets/Resources/UI_FunctionHoverConfig.json";
|
||||
|
||||
static UI_FunctionHoverConfigAutoCreate()
|
||||
{
|
||||
EditorApplication.delayCall += EnsureAsset;
|
||||
}
|
||||
|
||||
private static void EnsureAsset()
|
||||
{
|
||||
var asset = AssetDatabase.LoadAssetAtPath<UI_FunctionHoverConfig>(AssetPath);
|
||||
if (asset == null)
|
||||
{
|
||||
asset = ScriptableObject.CreateInstance<UI_FunctionHoverConfig>();
|
||||
AssetDatabase.CreateAsset(asset, AssetPath);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
asset.ImportFromJsonFile(DefaultJsonPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 573a3576e7a6b1b4188df7d9d22f05ff
|
||||
Reference in New Issue
Block a user