diff --git a/UpmGitTool/Assets/GameRes/Prefab/HitstoryItem.prefab b/UpmGitTool/Assets/GameRes/Prefab/HitstoryItem.prefab index ba634771438ab89e2c067f67bc3c343005d45ae6..69a9b8487e797164c79ee3bdb03516c31ace128c 100644 --- a/UpmGitTool/Assets/GameRes/Prefab/HitstoryItem.prefab +++ b/UpmGitTool/Assets/GameRes/Prefab/HitstoryItem.prefab @@ -91,7 +91,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1c2c8634889a0ae4d9c922eac8ad0e07, type: 3} m_Name: m_EditorClassIdentifier: - BG: {fileID: 0} + BG: {fileID: 4992096307994095353} Label: {fileID: 4992096309375970351} CheckMark: {fileID: 4992096308915946629} --- !u!1 &4992096308915946629 diff --git a/UpmGitTool/Assets/Scenes/SampleScene.unity b/UpmGitTool/Assets/Scenes/SampleScene.unity index 56ef98f5e20b3df3315cdd42b7ade8927d4b5358..2907089c86719c04f5233fdf51516061336df50e 100644 --- a/UpmGitTool/Assets/Scenes/SampleScene.unity +++ b/UpmGitTool/Assets/Scenes/SampleScene.unity @@ -913,11 +913,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 139229361} m_CullTransparentMesh: 1 ---- !u!224 &186873095 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - m_PrefabInstance: {fileID: 4992096308113546225} - m_PrefabAsset: {fileID: 0} --- !u!1 &202069240 GameObject: m_ObjectHideFlags: 0 @@ -3942,6 +3937,7 @@ GameObject: m_Component: - component: {fileID: 1245554589} - component: {fileID: 1245554590} + - component: {fileID: 1245554591} m_Layer: 5 m_Name: Content m_TagString: Untagged @@ -3960,15 +3956,14 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 186873095} + m_Children: [] m_Father: {fileID: 482842296} m_RootOrder: -1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.000019550458} - m_SizeDelta: {x: 0, y: 523.38} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: -91, y: 0} + m_SizeDelta: {x: 182, y: 383.99} m_Pivot: {x: 0, y: 1} --- !u!114 &1245554590 MonoBehaviour: @@ -3994,6 +3989,20 @@ MonoBehaviour: m_Spacing: {x: 5, y: 5} m_Constraint: 0 m_ConstraintCount: 2 +--- !u!114 &1245554591 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1245554588} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cadc544abab43694dbf8d32ec79ce9c6, type: 3} + m_Name: + m_EditorClassIdentifier: + ItemPrefab: {fileID: 4992096307994095351, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} + LayoutGroup: {fileID: 1245554590} --- !u!1 &1250213551 GameObject: m_ObjectHideFlags: 0 @@ -4637,8 +4646,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 202069242} m_HandleRect: {fileID: 202069241} m_Direction: 2 - m_Value: 1 - m_Size: 0.861783 + m_Value: 0 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -5488,20 +5497,7 @@ MonoBehaviour: GitPath: {fileID: 1519007851} BtnCopy: {fileID: 384446007} DescripeLabel: {fileID: 139229363} - UpmVersion: - refName: - hash: - m_MinimumUnityVersion: - m_DisplayName: - m_Description: - m_PackageUniqueId: - m_Name: - m_PackageId: - m_Author: - m_VersionString: - m_Dependencies: [] - m_DocumentationUrl: - m_ChangelogUrl: + VersionContent: {fileID: 1245554591} --- !u!1 &1703846341 GameObject: m_ObjectHideFlags: 0 @@ -7749,104 +7745,3 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2142545839} m_CullTransparentMesh: 1 ---- !u!1001 &4992096308113546225 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1245554589} - m_Modifications: - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_RootOrder - value: -1 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095350, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4992096307994095351, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} - propertyPath: m_Name - value: HitstoryItem - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 3b5cd4b68eaf48a469c75458b4730312, type: 3} diff --git a/UpmGitTool/Assets/Scritps/Core/Fetch/UpmPackageVersion.cs b/UpmGitTool/Assets/Scritps/Core/Fetch/UpmPackageVersion.cs index 850c6492334754a12a85ab06f12d73391152bc85..70c7edfc0d8ecd05a5d0c890aa9c7087943b9af1 100644 --- a/UpmGitTool/Assets/Scritps/Core/Fetch/UpmPackageVersion.cs +++ b/UpmGitTool/Assets/Scritps/Core/Fetch/UpmPackageVersion.cs @@ -9,6 +9,7 @@ using System; using UnityEngine; +using UpmGitTool.UI; namespace UpmGitTool { @@ -17,7 +18,7 @@ namespace UpmGitTool /// 这个只针对Git下载的包处理 /// [Serializable] - public class UpmPackageVersion + public class UpmPackageVersion : IListViewData { [SerializeField] private string refName; [SerializeField] private string hash; diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView.meta b/UpmGitTool/Assets/Scritps/UI/Controller/ListView.meta new file mode 100644 index 0000000000000000000000000000000000000000..b7c6262f59b1281760c0babd26b71f0b7adf9805 --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 945da622ae3439841be6d40199369144 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewData.cs b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewData.cs new file mode 100644 index 0000000000000000000000000000000000000000..5a1cde2b5edbba2ca86c549ca614154fc6c5cb50 --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewData.cs @@ -0,0 +1,16 @@ +/* + *Copyright(C) 2023 by Cocklebur All rights reserved. + *Unity版本:2022.2.1f1c1 + *作者:Chief + *创建日期: 2022-12-27 + *模块说明:UI 模块 + *版本: 1.0 +*/ + +namespace UpmGitTool.UI +{ + /// + /// 列表数据 + /// + public interface IListViewData { } +} \ No newline at end of file diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewData.cs.meta b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewData.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e7c6d7ace2ac6c9f0cc0aa20da52a47de2a98d14 --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce215c89eb172fc40ad8091602055019 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewItem.cs b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewItem.cs new file mode 100644 index 0000000000000000000000000000000000000000..f5af75842e96a620cd4605aa6ed3b1d92933b034 --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewItem.cs @@ -0,0 +1,24 @@ +/* + *Copyright(C) 2023 by Cocklebur All rights reserved. + *Unity版本:2022.2.1f1c1 + *作者:Chief + *创建日期: 2022-12-27 + *模块说明:UI 模块 + *版本: 1.0 +*/ + +namespace UpmGitTool.UI +{ + /// + /// 列表物件 + /// + public interface IListViewItem + { + + public void SetData(IListViewData data); + + + public void SetActive(bool active); + + } +} \ No newline at end of file diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewItem.cs.meta b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewItem.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f8fc161e9c5ffbd49d48fe54686cd0ffe6bc48f4 --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/IListViewItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30a1abf8bb7f51e47afac1c1fd60299e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView/ListViewContent.cs b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/ListViewContent.cs new file mode 100644 index 0000000000000000000000000000000000000000..bd74da55cd8edafc68462479f7878a4bc02ba2c4 --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/ListViewContent.cs @@ -0,0 +1,82 @@ +/* + *Copyright(C) 2023 by Cocklebur All rights reserved. + *Unity版本:2022.2.1f1c1 + *作者:Chief + *创建日期: 2022-12-27 + *模块说明:UI 模块 + *版本: 1.0 +*/ + +using Sirenix.OdinInspector; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace UpmGitTool.UI +{ + /// + /// 列表显示区域 + /// + public class ListViewContent : MonoBehaviour + { + + private List ListData = new List(); + + private List ListItems = new List(); + + [LabelText("物件预制")] + public GameObject ItemPrefab; + + [LabelText("网格布局组件")] + public GridLayoutGroup LayoutGroup; + + public void UpdateList(List L) + { + ListData = L; + Refresh(); + } + + public RectTransform rectTransform => transform as RectTransform; + + public void Refresh() + { + int dataCount = ListData.Count; + int length = ListItems.Count; + SpawnItems(dataCount - length); + //刷新显示; + for (int i = 0; i < length; i++) + { + var item = ListItems[i]; + if (i < dataCount) + { + var data = ListData[i]; + item.SetData(data); + item.SetActive(true); + } + else + item.SetActive(false); + } + + //更新容器尺寸(这里只做了竖向的扩展) + float x = rectTransform.sizeDelta.x; + float y = (LayoutGroup.cellSize.y + LayoutGroup.spacing.y) * dataCount; + rectTransform.sizeDelta = new Vector2(x, y); + } + + private void SpawnItems(int spawnCount) + { + if (spawnCount <= 0) return; + + for (int i = 0; i < spawnCount; i++) + { + //生成一个; + var item = Object.Instantiate(ItemPrefab, transform); + item.transform.localScale = Vector3.one; + var itemCompt = item.GetComponent(); + ListItems.Add(itemCompt); + } + + } + + } +} \ No newline at end of file diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/ListView/ListViewContent.cs.meta b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/ListViewContent.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..64d76aac6db98b9f6ee54f523ac87568a1c2c95a --- /dev/null +++ b/UpmGitTool/Assets/Scritps/UI/Controller/ListView/ListViewContent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cadc544abab43694dbf8d32ec79ce9c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DepencyItem.cs b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DepencyItem.cs index b4ca9c3dd84f74f57547046ac6848ba0107fc52a..4d89d3e4fe93b6b77e3a67ce5813a1a2e73bd891 100644 --- a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DepencyItem.cs +++ b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DepencyItem.cs @@ -3,7 +3,7 @@ *Unity版本:2022.2.1f1c1 *作者:Chief *创建日期: 2022-12-26 - *模块说明:模板信息 + *模块说明:UI 模块 *版本: 1.0 */ diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DescripeContent.cs b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DescripeContent.cs index 1324f6c354355a04fbf0f5f2cc78cca602c47250..ce45bdbcfb2e267c7ce75d354e0609487117132a 100644 --- a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DescripeContent.cs +++ b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_DescripeContent.cs @@ -37,6 +37,9 @@ namespace UpmGitTool.UI [LabelText("描述文本")] public TextMeshProUGUI DescripeLabel; + [LabelText("版本信息")] + public ListViewContent VersionContent; + public void Start() { BtnDocumentation.onClick.AddListener(OpenDocumentationUrl); diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_HistoryItem.cs b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_HistoryItem.cs index 3f9d5e7332a68c0f7744ddbac025b22611539e80..e9389ed56d290cfd48433049b7604c1bb43c4932 100644 --- a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_HistoryItem.cs +++ b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_HistoryItem.cs @@ -3,7 +3,7 @@ *Unity版本:2022.2.1f1c1 *作者:Chief *创建日期: 2022-12-26 - *模块说明:模板信息 + *模块说明:UI 模块 *版本: 1.0 */ @@ -17,7 +17,7 @@ namespace UpmGitTool.UI /// /// 历史版本预制 /// - public class UICtrl_HistoryItem : MonoBehaviour + public class UICtrl_HistoryItem : MonoBehaviour, IListViewItem { [LabelText("背景")] @@ -28,6 +28,22 @@ namespace UpmGitTool.UI [LabelText("使用标记")] public GameObject CheckMark; - + + [LabelText("当前显示版本")] + public UpmPackageVersion UpmVersion; + + public void SetData(IListViewData data) + { + UpmVersion = data as UpmPackageVersion; + if (UpmVersion == null) + { + Logger.LogError($"数据不是 UpmPackageVersion 格式:{data.GetType()}"); + return; + } + + Label.SetText(UpmVersion.VersionString); + } + + public void SetActive(bool active) { gameObject.SetActive(active); } } } \ No newline at end of file diff --git a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_PackageItem.cs b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_PackageItem.cs index f69e5d8be948ba2618adba520f6d23d89fc6e29e..243973660a28ebf095d5c7d7a5eb49920188f433 100644 --- a/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_PackageItem.cs +++ b/UpmGitTool/Assets/Scritps/UI/Controller/UICtrl_PackageItem.cs @@ -3,7 +3,7 @@ *Unity版本:2022.2.1f1c1 *作者:Chief *创建日期: 2022-12-26 - *模块说明:模板信息 + *模块说明:UI 模块 *版本: 1.0 */ diff --git a/UpmGitTool/Assets/StreamingAssets/build_info b/UpmGitTool/Assets/StreamingAssets/build_info index f316a0189d7c8a9108ef75d03e0a6a1073b25b1d..c37821fd1e7e1e73be5be812b9037e7210da0259 100644 --- a/UpmGitTool/Assets/StreamingAssets/build_info +++ b/UpmGitTool/Assets/StreamingAssets/build_info @@ -1 +1 @@ -Build from CHIEF at 2022/12/27 9:42:19 \ No newline at end of file +Build from CHIEF at 2022/12/27 15:10:12 \ No newline at end of file