yyl
2026-03-04 bc1cb6da854cb2e9144f10ed55330a537ecdca16
Main/Component/UI/Common/EnableButtonConfig.cs
@@ -3,6 +3,7 @@
using UnityEngine;
using System;
using UnityEngine.UI;
using Cysharp.Threading.Tasks;
[CreateAssetMenu(menuName = "Config/EnableButtonConfig")]
public class EnableButtonConfig : ScriptableObject
{
@@ -12,9 +13,9 @@
    public static Dictionary<EnableButtonType, EnableButtonConfig> dict = new Dictionary<EnableButtonType, EnableButtonConfig>();
    public static void SetEnable(Button _btn, Text _text, bool _enable, EnableButtonType _type)
    public static async UniTask SetEnable(Button _btn, Text _text, bool _enable, EnableButtonType _type)
    {
        var _cfg = GetEnableButtonCfg(_type);
        var _cfg = await GetEnableButtonCfg(_type);
        var _btnStyle = _enable ? _cfg.enableButton : _cfg.unEnableButton;
        _btn.interactable = _enable;
        var _colors = _btn.colors;
@@ -25,13 +26,13 @@
        _text.color = _btnStyle.fontColor;
    }
    public static EnableButtonConfig GetEnableButtonCfg(EnableButtonType _type)
    public static async UniTask<EnableButtonConfig> GetEnableButtonCfg(EnableButtonType _type)
    {
        if (dict.ContainsKey(_type))
        {
            return dict[_type];
        }
        var _cfg= BuiltInLoader.LoadScriptableObject<EnableButtonConfig>(StringUtility.Concat("EnableButton_", _type.ToString()));
        var _cfg = await BuiltInLoader.LoadScriptableObjectAsync<EnableButtonConfig>(StringUtility.Concat("EnableButton_", _type.ToString()));
        dict.Add(_type, _cfg);
        return _cfg;
    }