提交 34010976 编写于 作者: 魔术师Dix's avatar 魔术师Dix

【UpmGitTool】网格布局控制组件;

上级 420d19c1
......@@ -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
......
......@@ -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}
......@@ -9,6 +9,7 @@
using System;
using UnityEngine;
using UpmGitTool.UI;
namespace UpmGitTool
{
......@@ -17,7 +18,7 @@ namespace UpmGitTool
/// 这个只针对Git下载的包处理
/// </summary>
[Serializable]
public class UpmPackageVersion
public class UpmPackageVersion : IListViewData
{
[SerializeField] private string refName;
[SerializeField] private string hash;
......
fileFormatVersion: 2
guid: 945da622ae3439841be6d40199369144
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
/*
*Copyright(C) 2023 by Cocklebur All rights reserved.
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2022-12-27
*模块说明:UI 模块
*版本: 1.0
*/
namespace UpmGitTool.UI
{
/// <summary>
/// 列表数据
/// </summary>
public interface IListViewData { }
}
\ No newline at end of file
fileFormatVersion: 2
guid: ce215c89eb172fc40ad8091602055019
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/*
*Copyright(C) 2023 by Cocklebur All rights reserved.
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2022-12-27
*模块说明:UI 模块
*版本: 1.0
*/
namespace UpmGitTool.UI
{
/// <summary>
/// 列表物件
/// </summary>
public interface IListViewItem
{
public void SetData(IListViewData data);
public void SetActive(bool active);
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 30a1abf8bb7f51e47afac1c1fd60299e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
/*
*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
{
/// <summary>
/// 列表显示区域
/// </summary>
public class ListViewContent : MonoBehaviour
{
private List<IListViewData> ListData = new List<IListViewData>();
private List<IListViewItem> ListItems = new List<IListViewItem>();
[LabelText("物件预制")]
public GameObject ItemPrefab;
[LabelText("网格布局组件")]
public GridLayoutGroup LayoutGroup;
public void UpdateList(List<IListViewData> 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<IListViewItem>();
ListItems.Add(itemCompt);
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: cadc544abab43694dbf8d32ec79ce9c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2022-12-26
*模块说明:模板信息
*模块说明:UI 模块
*版本: 1.0
*/
......
......@@ -37,6 +37,9 @@ namespace UpmGitTool.UI
[LabelText("描述文本")]
public TextMeshProUGUI DescripeLabel;
[LabelText("版本信息")]
public ListViewContent VersionContent;
public void Start()
{
BtnDocumentation.onClick.AddListener(OpenDocumentationUrl);
......
......@@ -3,7 +3,7 @@
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2022-12-26
*模块说明:模板信息
*模块说明:UI 模块
*版本: 1.0
*/
......@@ -17,7 +17,7 @@ namespace UpmGitTool.UI
/// <summary>
/// 历史版本预制
/// </summary>
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
......@@ -3,7 +3,7 @@
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2022-12-26
*模块说明:模板信息
*模块说明:UI 模块
*版本: 1.0
*/
......
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册