增加模块图标功能

This commit is contained in:
shenjianxing 2025-03-24 17:18:29 +08:00
parent 5a7bed3295
commit 4f1a0333ca
3 changed files with 127 additions and 6 deletions

View File

@ -1,5 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &362378255116206407
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4007744310226606941}
- component: {fileID: 7455571532591409758}
- component: {fileID: 8685952999310058692}
m_Layer: 5
m_Name: Icon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &4007744310226606941
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362378255116206407}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1041589483741693935}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7455571532591409758
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362378255116206407}
m_CullTransparentMesh: 1
--- !u!114 &8685952999310058692
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 362378255116206407}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &369348797227731928
GameObject:
m_ObjectHideFlags: 0
@ -379,6 +454,7 @@ GameObject:
- component: {fileID: 5800286210300119797}
- component: {fileID: 7870331819941572208}
- component: {fileID: 5640205172889648423}
- component: {fileID: 2499191464483522175}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
@ -402,9 +478,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -30, y: -30}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 14.999985}
m_SizeDelta: {x: -30, y: -219}
m_Pivot: {x: 0.5, y: 0.000000029802322}
--- !u!222 &7870331819941572208
CanvasRenderer:
m_ObjectHideFlags: 0
@ -467,8 +543,8 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_HorizontalAlignment: 32
m_VerticalAlignment: 1024
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
@ -502,6 +578,20 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &2499191464483522175
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2191389905807484100}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &2417640497830947151
GameObject:
m_ObjectHideFlags: 0
@ -1265,6 +1355,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4007744310226606941}
- {fileID: 5800286210300119797}
m_Father: {fileID: 5394197843809455320}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -12,7 +12,7 @@ namespace QFramework.Example
}
public partial class UIModuleSelect : UIPanel
{
ResLoader loader;
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIModuleSelectData ?? new UIModuleSelectData();
@ -29,6 +29,7 @@ namespace QFramework.Example
{
Application.Quit();
});
loader = ResLoader.Allocate();
}
protected override void OnOpen(IUIData uiData = null)
@ -57,6 +58,23 @@ namespace QFramework.Example
SceneManager.sceneLoaded += OnLoadFinished;
});
});
if (string.IsNullOrEmpty(item.Icon)==false)
{
var icon = obj.transform.Find("Icon").GetComponent<Image>();
var localImageUrl = Global.imagePath + item.Icon;
loader.Add2Load(localImageUrl.ToNetImageResName(),
(bool success, IRes res) =>
{
if (success)
{
icon.sprite = Utility.GetSprite(res.Asset as Texture2D);
}
});
icon.gameObject.SetActive(true);
}
lastIndex = index;
}
}
@ -71,6 +89,14 @@ namespace QFramework.Example
});
}
else
{
UIKit.OpenPanelAsync<UILoading>(canvasLevel: UILevel.PopUI).ToAction().StartGlobal();
loader.LoadAsync(() =>
{
TypeEventSystem.Global.Send<OnLoadingHide>(new OnLoadingHide());
});
}

View File

@ -25,6 +25,9 @@ namespace XMLTool
public string Scene { get; set; }
public string ModuleName { get; set; }
public string Descript { get; set; }
public string Icon { get; set; }
public List<Operation> Operations { get; set; }
public List<Device> Devices { get; set; }
@ -265,6 +268,7 @@ namespace XMLTool
// ½âÎöÄ£¿éÃû³Æ
module.type = moduleElement.Element("Type")?.Value;
module.ModuleName = moduleElement.Element("Name")?.Value;
module.Icon = moduleElement.Element("Icon")?.Value;
module.Descript = moduleElement.Element("Descript")?.Value.Trim();
module.Scene = moduleElement.Element("Scene")?.Value;