yyl
2025-10-21 3bd7f56906e31e8fe0072108c9d4652707b51de8
Main/Utility/ComponentExtersion.cs
@@ -256,7 +256,8 @@
    }
    // 设置按钮是否可点击,且置灰,默认取第一个文本;图片需用ImageEx组件
    // 设置按钮是否可点击,且取第一个文本组件置灰或置原色
    // 要先设置文本再调用该函数 因为没有改变文本组件的颜色避免颜色被还原,同理恢复可以不用改变颜色改文字即可
    // 更多功能请使用SetColorful
    public static void SetInteractable(this Button _btn, bool _interactable, Text _btnText = null)
    {
@@ -277,7 +278,7 @@
            if (!_interactable)
                _btnText.text = UIHelper.AppendColor(TextColType.NavyGray, _btnText.text);    //不改变组件颜色,只改变显示颜色
            else
                _btnText.text = UIHelper.AppendColor(_btnText.color, _btnText.text);
                _btnText.text = UIHelper.AppendColor(_btnText.color, UIHelper.RemoveColor(_btnText.text));
        }
    }
@@ -314,6 +315,7 @@
        }
        var sprite = UILoader.LoadSprite(folderName, iconName);
        if (null == sprite) return;
        _image.overrideSprite = sprite;
    }
@@ -377,4 +379,16 @@
        var texture = UILoader.LoadTexture2D(_id);
        _image.texture = texture;
    }
    public static void SetTexture2DPNG(this RawImage _image, string _id)
    {
        if (_image == null)
        {
            return;
        }
        var texture = UILoader.LoadTexture2DPNG(_id);
        _image.texture = texture;
    }
}