三国卡牌客户端基础资源仓库
yyl
2025-05-19 43486e52373aac7427f2a272302dcbc33c603f34
Assets/Editor/UI/PSDTOUGUIProcessor.cs
File was renamed from Assets/Editor/UI/UIUtility.cs
@@ -1,50 +1,50 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
public class UIUtility
{
    [UnityEditor.MenuItem("Assets/PSDTOUGUI后处理")]
    public static void BaseSettings()
    {
        GameObject go = Selection.activeGameObject;
        if (go == null)
        {
            return;
        }
        // go.AddMissingComponent<Canvas>();
        // go.AddMissingComponent<Canvas>();
        // go.AddMissingComponent<Canvas>();
    }
    [UnityEditor.MenuItem("Assets/新UI处理")]
    public static void NewUIHandle()
    {
        GameObject go = Selection.activeGameObject;
        if (go == null)
        {
            return;
        }
        if (!go.name.EndsWith("Win"))
        {
            Debug.LogError("请选择正确的UI UI应该以Win结尾");
            return;
        }
        go.AddMissingComponent<Canvas>();
        go.AddMissingComponent<CanvasGroup>();
        go.AddMissingComponent<CanvasScaler>();
        var graphics = go.GetComponentsInChildren<Graphic>(true);
        foreach (Graphic g in graphics)
        {
            g.raycastTarget = false;
        }
    }
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
public class PSDTOUGUIProcessor
{
    [UnityEditor.MenuItem("Assets/PSDTOUGUI后处理")]
    public static void BaseSettings()
    {
        GameObject go = Selection.activeGameObject;
        if (go == null)
        {
            return;
        }
        // go.AddMissingComponent<Canvas>();
        // go.AddMissingComponent<Canvas>();
        // go.AddMissingComponent<Canvas>();
    }
    [UnityEditor.MenuItem("Assets/新UI处理")]
    public static void NewUIHandle()
    {
        GameObject go = Selection.activeGameObject;
        if (go == null)
        {
            return;
        }
        if (!go.name.EndsWith("Win"))
        {
            Debug.LogError("请选择正确的UI UI应该以Win结尾");
            return;
        }
        go.AddMissingComponent<Canvas>();
        go.AddMissingComponent<CanvasGroup>();
        go.AddMissingComponent<CanvasScaler>();
        var graphics = go.GetComponentsInChildren<Graphic>(true);
        foreach (Graphic g in graphics)
        {
            g.raycastTarget = false;
        }
    }
}