提交修改

This commit is contained in:
shenjianxing 2024-12-17 16:40:11 +08:00
parent 0ac841c116
commit 7d3075eaa7
8 changed files with 15 additions and 8 deletions

View File

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View File

@ -496,6 +496,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 536581d84ce54d9428779ea6fe75f564, type: 3} m_Script: {fileID: 11500000, guid: 536581d84ce54d9428779ea6fe75f564, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
TitleImg: {fileID: 4875312519751514263}
TechBtn: {fileID: 5661434251009883789} TechBtn: {fileID: 5661434251009883789}
ExamBtn: {fileID: 8035740322758882133} ExamBtn: {fileID: 8035740322758882133}
--- !u!1 &7559888528321789001 --- !u!1 &7559888528321789001

View File

@ -244,6 +244,11 @@ public class Utility
return texture2d; return texture2d;
} }
public static Sprite GetSprite(Texture2D texture2D)
{
return Sprite.Create(texture2D,
new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f);
}
/// <summary> /// <summary>

View File

@ -16,7 +16,7 @@ public class Global : Singleton<Global>
public static string deviceIconsPath = dataPath + "/DeviceIcons/"; public static string deviceIconsPath = dataPath + "/DeviceIcons/";
public static string audioPath = dataPath + "/Audio/"; public static string audioPath = dataPath + "/Audio/";
public static string appXmlPath = dataPath + "/App.xml"; public static string appXmlPath = dataPath + "/App.xml";
public static string imagePath = dataPath + "/Image/";
public static APPSetting appSetting { get; } = new APPSetting(); public static APPSetting appSetting { get; } = new APPSetting();

View File

@ -5,11 +5,13 @@ using QFramework;
namespace QFramework.Example namespace QFramework.Example
{ {
// Generate Id:1da863ea-e248-4bf7-a751-ddc8dd413abf // Generate Id:da6d1ff4-bfaf-4b79-b5a7-9ad638b3a626
public partial class UIModeSelect public partial class UIModeSelect
{ {
public const string Name = "UIModeSelect"; public const string Name = "UIModeSelect";
[SerializeField]
public UnityEngine.UI.Image TitleImg;
[SerializeField] [SerializeField]
public UnityEngine.UI.Button TechBtn; public UnityEngine.UI.Button TechBtn;
[SerializeField] [SerializeField]
@ -19,6 +21,7 @@ namespace QFramework.Example
protected override void ClearUIComponents() protected override void ClearUIComponents()
{ {
TitleImg = null;
TechBtn = null; TechBtn = null;
ExamBtn = null; ExamBtn = null;

View File

@ -5,7 +5,7 @@ using QFramework;
namespace QFramework.Example namespace QFramework.Example
{ {
// Generate Id:e7677476-3881-4b27-aa10-af0dc5d35012 // Generate Id:6cbeaee2-18c4-4579-95c4-e6131eb650b4
public partial class UIModuleSelect public partial class UIModuleSelect
{ {
public const string Name = "UIModuleSelect"; public const string Name = "UIModuleSelect";

View File

@ -54,13 +54,11 @@ namespace QFramework.Example
GameObject Selected = icon.transform.Find("Selected").gameObject; GameObject Selected = icon.transform.Find("Selected").gameObject;
GameObject CurSelect = obj.transform.Find("CurSelect").gameObject; GameObject CurSelect = obj.transform.Find("CurSelect").gameObject;
mResLoader.Add2Load(localImageUrl.ToNetImageResName(), mResLoader.Add2Load(localImageUrl.ToNetImageResName(),
(bool succes, IRes res) => (bool success, IRes res) =>
{ {
if (succes) if (success)
{ {
var texture2D = res.Asset as Texture2D; var texture2D = Utility.GetSprite(res.Asset as Texture2D);
icon.sprite = Sprite.Create(texture2D,
new Rect(0, 0, texture2D.width, texture2D.height), Vector2.one * 0.5f);
} }
}); });
Button btn = obj.GetComponent<Button>(); Button btn = obj.GetComponent<Button>();