基础内容
必要插件安装 缓动曲线和动画基础 ElementFolder,Track与其次级模块,PathNode重构
This commit is contained in:
82
Assets/Modern UI Pack/Scripts/ListView/ListView.cs
Normal file
82
Assets/Modern UI Pack/Scripts/ListView/ListView.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.MUIP
|
||||
{
|
||||
public class ListView : MonoBehaviour
|
||||
{
|
||||
// Resources
|
||||
public Transform itemParent;
|
||||
public GameObject itemPreset;
|
||||
public GameObject scrollbar;
|
||||
|
||||
// Settings
|
||||
public bool initializeOnAwake = true;
|
||||
public bool showScrollbar = true;
|
||||
public RowCount rowCount = RowCount.Two;
|
||||
|
||||
// Item list
|
||||
[SerializeField]
|
||||
public List<ListItem> listItems = new List<ListItem>();
|
||||
|
||||
[System.Serializable]
|
||||
public class ListItem
|
||||
{
|
||||
public string itemTitle = "List Item";
|
||||
[HideInInspector] public ListRow row0;
|
||||
[HideInInspector] public ListRow row1;
|
||||
[HideInInspector] public ListRow row2;
|
||||
#if UNITY_EDITOR
|
||||
[HideInInspector] public bool isExpanded;
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ListRow
|
||||
{
|
||||
public RowType rowType = RowType.Text;
|
||||
public Sprite rowIcon;
|
||||
public string rowText = "Row text";
|
||||
public bool usePreferredWidth;
|
||||
public int preferredWidth = 50;
|
||||
[Range(0.1f, 1)] public float iconScale = 1;
|
||||
}
|
||||
|
||||
public enum RowType { Icon, Text }
|
||||
public enum RowCount { One, Two, Three }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (itemParent == null) { Debug.LogError("<b>[List View]</b> 'Item Parent' is missing."); return; }
|
||||
if (initializeOnAwake == true) { InitializeItems(); }
|
||||
}
|
||||
|
||||
public void InitializeItems()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isPlaying == false) { for (int i = itemParent.childCount; i > 0; --i) { DestroyImmediate(itemParent.GetChild(0).gameObject); } }
|
||||
else { foreach (Transform child in itemParent) { Destroy(child.gameObject); } }
|
||||
#else
|
||||
foreach (Transform child in itemParent) { Destroy(child.gameObject); }
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < listItems.Count; ++i)
|
||||
{
|
||||
GameObject go = Instantiate(itemPreset, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
|
||||
go.transform.SetParent(itemParent, false);
|
||||
go.name = listItems[i].itemTitle;
|
||||
|
||||
ListViewItem lvi = go.GetComponent<ListViewItem>();
|
||||
lvi.rowCount = rowCount;
|
||||
lvi.row0Ref = listItems[i].row0;
|
||||
lvi.row1Ref = listItems[i].row1;
|
||||
lvi.row2Ref = listItems[i].row2;
|
||||
lvi.PassReferences();
|
||||
}
|
||||
|
||||
if (showScrollbar == false && scrollbar != null) { scrollbar.transform.localScale = new Vector3(0, 0, 0); }
|
||||
else if (showScrollbar == true && scrollbar != null) { scrollbar.transform.localScale = new Vector3(1, 1, 1); }
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/Modern UI Pack/Scripts/ListView/ListView.cs.meta
Normal file
18
Assets/Modern UI Pack/Scripts/ListView/ListView.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67a4caa482ba20f4a8749aba356f6fa9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 93f09189124b21e479fc891dbc1b93bf, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 201717
|
||||
packageName: Modern UI Pack
|
||||
packageVersion: 5.5.19
|
||||
assetPath: Assets/Modern UI Pack/Scripts/ListView/ListView.cs
|
||||
uploadId: 628721
|
||||
257
Assets/Modern UI Pack/Scripts/ListView/ListViewEditor.cs
Normal file
257
Assets/Modern UI Pack/Scripts/ListView/ListViewEditor.cs
Normal file
@@ -0,0 +1,257 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace Michsky.MUIP
|
||||
{
|
||||
[CustomEditor(typeof(ListView))]
|
||||
public class ListViewEditor : Editor
|
||||
{
|
||||
GUISkin customSkin;
|
||||
private ListView lvTarget;
|
||||
private int currentTab;
|
||||
|
||||
protected GUIStyle panelStyle;
|
||||
protected GUIStyle lipStyle;
|
||||
protected GUIStyle lipAltStyle;
|
||||
Vector2 scrollPosition = Vector2.zero;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
lvTarget = (ListView)target;
|
||||
|
||||
if (EditorGUIUtility.isProSkin == true) { customSkin = MUIPEditorHandler.GetDarkEditor(customSkin); }
|
||||
else { customSkin = MUIPEditorHandler.GetLightEditor(customSkin); }
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
MUIPEditorHandler.DrawComponentHeader(customSkin, "LV Top Header");
|
||||
|
||||
Color defaultColor = GUI.color;
|
||||
|
||||
GUIContent[] toolbarTabs = new GUIContent[3];
|
||||
toolbarTabs[0] = new GUIContent("Content");
|
||||
toolbarTabs[1] = new GUIContent("Resources");
|
||||
toolbarTabs[2] = new GUIContent("Settings");
|
||||
|
||||
currentTab = MUIPEditorHandler.DrawTabs(currentTab, toolbarTabs, customSkin);
|
||||
|
||||
if (GUILayout.Button(new GUIContent("Content", "Content"), customSkin.FindStyle("Tab Content")))
|
||||
currentTab = 0;
|
||||
if (GUILayout.Button(new GUIContent("Resources", "Resources"), customSkin.FindStyle("Tab Resources")))
|
||||
currentTab = 1;
|
||||
if (GUILayout.Button(new GUIContent("Settings", "Settings"), customSkin.FindStyle("Tab Settings")))
|
||||
currentTab = 2;
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
var rowCount = serializedObject.FindProperty("rowCount");
|
||||
var listItems = serializedObject.FindProperty("listItems");
|
||||
var itemParent = serializedObject.FindProperty("itemParent");
|
||||
var itemPreset = serializedObject.FindProperty("itemPreset");
|
||||
var initializeOnAwake = serializedObject.FindProperty("initializeOnAwake");
|
||||
var showScrollbar = serializedObject.FindProperty("showScrollbar");
|
||||
var scrollbar = serializedObject.FindProperty("scrollbar");
|
||||
|
||||
// Foldout style
|
||||
GUIStyle foldoutStyle = customSkin.FindStyle("UIM Foldout");
|
||||
|
||||
// Custom panel
|
||||
panelStyle = new GUIStyle(GUI.skin.box);
|
||||
panelStyle.normal.textColor = GUI.skin.label.normal.textColor;
|
||||
panelStyle.margin = new RectOffset(0, 0, 0, 0);
|
||||
panelStyle.padding = new RectOffset(0, 0, 0, 0);
|
||||
|
||||
switch (currentTab)
|
||||
{
|
||||
case 0:
|
||||
MUIPEditorHandler.DrawHeader(customSkin, "Content Header", 6);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
EditorGUI.indentLevel = 1;
|
||||
EditorGUILayout.PropertyField(listItems, new GUIContent("List Items"), true);
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
if (GUILayout.Button("+ Add a new list item", customSkin.button))
|
||||
{
|
||||
ListView.ListItem item = new ListView.ListItem();
|
||||
lvTarget.listItems.Add(item);
|
||||
return;
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
MUIPEditorHandler.DrawHeader(customSkin, "Customization Header", 10);
|
||||
MUIPEditorHandler.DrawProperty(rowCount, customSkin, "Row Count");
|
||||
|
||||
if (lvTarget.listItems.Count == 0) { EditorGUILayout.HelpBox("There are no items in the list. ", MessageType.Info); }
|
||||
else
|
||||
{
|
||||
int tempHeight;
|
||||
if (lvTarget.listItems.Count < 3) { tempHeight = 0; }
|
||||
else { tempHeight = 300; }
|
||||
|
||||
// Scroll panel
|
||||
scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUIStyle.none, GUI.skin.verticalScrollbar, GUILayout.Height(tempHeight));
|
||||
GUILayout.BeginVertical(panelStyle);
|
||||
|
||||
for (int i = 0; i < lvTarget.listItems.Count; i++)
|
||||
{
|
||||
// Start Item Background
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
GUILayout.Space(5);
|
||||
GUILayout.BeginHorizontal();
|
||||
if (string.IsNullOrEmpty(lvTarget.listItems[i].itemTitle) == true) { lvTarget.listItems[i].isExpanded = EditorGUILayout.Foldout(lvTarget.listItems[i].isExpanded, "Item #" + i.ToString(), true, foldoutStyle); }
|
||||
else { lvTarget.listItems[i].isExpanded = EditorGUILayout.Foldout(lvTarget.listItems[i].isExpanded, lvTarget.listItems[i].itemTitle, true, foldoutStyle); }
|
||||
lvTarget.listItems[i].isExpanded = GUILayout.Toggle(lvTarget.listItems[i].isExpanded, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(2);
|
||||
|
||||
if (lvTarget.listItems[i].isExpanded)
|
||||
{
|
||||
// Row 1
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Row 1 Type
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(new GUIContent("Row #1 Type"), customSkin.FindStyle("Text"), GUILayout.Width(90));
|
||||
lvTarget.listItems[i].row0.rowType = (ListView.RowType)EditorGUILayout.EnumPopup(lvTarget.listItems[i].row0.rowType);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Row 1 Content
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
if (lvTarget.listItems[i].row0.rowType == ListView.RowType.Icon)
|
||||
{
|
||||
lvTarget.listItems[i].row0.rowIcon = EditorGUILayout.ObjectField(lvTarget.listItems[i].row0.rowIcon, typeof(Sprite), true) as Sprite;
|
||||
lvTarget.listItems[i].row0.iconScale = EditorGUILayout.FloatField("Icon Scale", lvTarget.listItems[i].row0.iconScale);
|
||||
}
|
||||
|
||||
else if (lvTarget.listItems[i].row0.rowType == ListView.RowType.Text)
|
||||
{
|
||||
lvTarget.listItems[i].row0.rowText = EditorGUILayout.TextField("Title", lvTarget.listItems[i].row0.rowText);
|
||||
}
|
||||
|
||||
lvTarget.listItems[i].row0.usePreferredWidth = EditorGUILayout.Toggle("Use Preferred Width", lvTarget.listItems[i].row0.usePreferredWidth);
|
||||
if (lvTarget.listItems[i].row0.usePreferredWidth == true) { lvTarget.listItems[i].row0.preferredWidth = EditorGUILayout.IntField("Preferred Width", lvTarget.listItems[i].row0.preferredWidth); }
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Row 2
|
||||
if (rowCount.enumValueIndex > 0)
|
||||
{
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Row 2 Type
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(new GUIContent("Row #2 Type"), customSkin.FindStyle("Text"), GUILayout.Width(90));
|
||||
lvTarget.listItems[i].row1.rowType = (ListView.RowType)EditorGUILayout.EnumPopup(lvTarget.listItems[i].row1.rowType);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Row 2 Content
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
if (lvTarget.listItems[i].row1.rowType == ListView.RowType.Icon)
|
||||
{
|
||||
lvTarget.listItems[i].row1.rowIcon = EditorGUILayout.ObjectField(lvTarget.listItems[i].row1.rowIcon, typeof(Sprite), true) as Sprite;
|
||||
lvTarget.listItems[i].row1.iconScale = EditorGUILayout.FloatField("Icon Scale", lvTarget.listItems[i].row1.iconScale);
|
||||
}
|
||||
|
||||
else if (lvTarget.listItems[i].row1.rowType == ListView.RowType.Text)
|
||||
{
|
||||
lvTarget.listItems[i].row1.rowText = EditorGUILayout.TextField("Title", lvTarget.listItems[i].row1.rowText);
|
||||
}
|
||||
|
||||
lvTarget.listItems[i].row1.usePreferredWidth = EditorGUILayout.Toggle("Use Preferred Width", lvTarget.listItems[i].row1.usePreferredWidth);
|
||||
if (lvTarget.listItems[i].row1.usePreferredWidth == true) { lvTarget.listItems[i].row1.preferredWidth = EditorGUILayout.IntField("Preferred Width", lvTarget.listItems[i].row1.preferredWidth); }
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
// Row 3
|
||||
if (rowCount.enumValueIndex > 1)
|
||||
{
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Row 3 Type
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(new GUIContent("Row #3 Type"), customSkin.FindStyle("Text"), GUILayout.Width(90));
|
||||
lvTarget.listItems[i].row2.rowType = (ListView.RowType)EditorGUILayout.EnumPopup(lvTarget.listItems[i].row2.rowType);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Row 3 Content
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
if (lvTarget.listItems[i].row2.rowType == ListView.RowType.Icon)
|
||||
{
|
||||
lvTarget.listItems[i].row2.rowIcon = EditorGUILayout.ObjectField(lvTarget.listItems[i].row2.rowIcon, typeof(Sprite), true) as Sprite;
|
||||
lvTarget.listItems[i].row2.iconScale = EditorGUILayout.FloatField("Icon Scale", lvTarget.listItems[i].row2.iconScale);
|
||||
}
|
||||
|
||||
else if (lvTarget.listItems[i].row2.rowType == ListView.RowType.Text)
|
||||
{
|
||||
lvTarget.listItems[i].row2.rowText = EditorGUILayout.TextField("Title", lvTarget.listItems[i].row2.rowText);
|
||||
}
|
||||
|
||||
lvTarget.listItems[i].row2.usePreferredWidth = EditorGUILayout.Toggle("Use Preferred Width", lvTarget.listItems[i].row2.usePreferredWidth);
|
||||
if (lvTarget.listItems[i].row2.usePreferredWidth == true) { lvTarget.listItems[i].row2.preferredWidth = EditorGUILayout.IntField("Preferred Width", lvTarget.listItems[i].row2.preferredWidth); }
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
|
||||
// End item
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Pre-Initialize Items", customSkin.button)) { lvTarget.InitializeItems(); }
|
||||
|
||||
// Scroll Panel End
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndScrollView();
|
||||
if (GUI.enabled == true) { Repaint(); }
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
MUIPEditorHandler.DrawHeader(customSkin, "Core Header", 6);
|
||||
MUIPEditorHandler.DrawProperty(itemParent, customSkin, "Item Parent");
|
||||
MUIPEditorHandler.DrawProperty(itemPreset, customSkin, "Item Preset");
|
||||
MUIPEditorHandler.DrawProperty(scrollbar, customSkin, "Scrollbar");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
MUIPEditorHandler.DrawHeader(customSkin, "Options Header", 6);
|
||||
initializeOnAwake.boolValue = MUIPEditorHandler.DrawToggle(initializeOnAwake.boolValue, customSkin, "Initialize On Awake");
|
||||
showScrollbar.boolValue = MUIPEditorHandler.DrawToggle(showScrollbar.boolValue, customSkin, "Show Scrollbar");
|
||||
if (GUILayout.Button("Sort List By Name (A to Z)")) { lvTarget.listItems.Sort(SortByNameAtoZ); }
|
||||
if (GUILayout.Button("Sort List By Name (Z to A)")) { lvTarget.listItems.Sort(SortByNameZtoA); }
|
||||
break;
|
||||
}
|
||||
|
||||
if (Application.isPlaying == false) { this.Repaint(); }
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private static int SortByNameAtoZ(ListView.ListItem o1, ListView.ListItem o2)
|
||||
{
|
||||
// Compare the names and sort by A to Z
|
||||
return o1.itemTitle.CompareTo(o2.itemTitle);
|
||||
}
|
||||
|
||||
private static int SortByNameZtoA(ListView.ListItem o1, ListView.ListItem o2)
|
||||
{
|
||||
// Compare the names and sort by Z to A
|
||||
return o2.itemTitle.CompareTo(o1.itemTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e94e561fd83d42847a5ca2c2cf082bea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 201717
|
||||
packageName: Modern UI Pack
|
||||
packageVersion: 5.5.19
|
||||
assetPath: Assets/Modern UI Pack/Scripts/ListView/ListViewEditor.cs
|
||||
uploadId: 628721
|
||||
88
Assets/Modern UI Pack/Scripts/ListView/ListViewItem.cs
Normal file
88
Assets/Modern UI Pack/Scripts/ListView/ListViewItem.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.MUIP
|
||||
{
|
||||
public class ListViewItem : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
public ListViewRow row0;
|
||||
public ListViewRow row1;
|
||||
public ListViewRow row2;
|
||||
|
||||
[Header("References")]
|
||||
public ListView.RowCount rowCount;
|
||||
public ListView.ListRow row0Ref;
|
||||
public ListView.ListRow row1Ref;
|
||||
public ListView.ListRow row2Ref;
|
||||
|
||||
public void PassReferences()
|
||||
{
|
||||
if (rowCount == ListView.RowCount.One) { row0.gameObject.SetActive(true); row1.gameObject.SetActive(false); row2.gameObject.SetActive(false); }
|
||||
else if (rowCount == ListView.RowCount.Two) { row0.gameObject.SetActive(true); row1.gameObject.SetActive(true); row2.gameObject.SetActive(false); }
|
||||
else if (rowCount == ListView.RowCount.Three) { row0.gameObject.SetActive(true); row1.gameObject.SetActive(true); row2.gameObject.SetActive(true); }
|
||||
|
||||
// Row 1
|
||||
if (row0Ref.rowType == ListView.RowType.Icon)
|
||||
{
|
||||
row0.iconImage.sprite = row0Ref.rowIcon;
|
||||
row0.iconImage.gameObject.SetActive(true);
|
||||
row0.textObject.gameObject.SetActive(false);
|
||||
row0.iconImage.transform.localScale = new Vector3(row0Ref.iconScale, row0Ref.iconScale, row0Ref.iconScale);
|
||||
}
|
||||
|
||||
else if (row0Ref.rowType == ListView.RowType.Text)
|
||||
{
|
||||
row0.textObject.text = row0Ref.rowText;
|
||||
row0.iconImage.gameObject.SetActive(false);
|
||||
row0.textObject.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (row0Ref.usePreferredWidth == true) { row0.layoutElement.preferredWidth = row0Ref.preferredWidth; }
|
||||
else { row0.layoutElement.preferredWidth = -1; }
|
||||
|
||||
// Row 2
|
||||
if (row1Ref == null)
|
||||
return;
|
||||
|
||||
if (row1Ref.rowType == ListView.RowType.Icon)
|
||||
{
|
||||
row1.iconImage.sprite = row1Ref.rowIcon;
|
||||
row1.iconImage.gameObject.SetActive(true);
|
||||
row1.textObject.gameObject.SetActive(false);
|
||||
row1.iconImage.transform.localScale = new Vector3(row1Ref.iconScale, row1Ref.iconScale, row1Ref.iconScale);
|
||||
}
|
||||
|
||||
else if (row1Ref.rowType == ListView.RowType.Text)
|
||||
{
|
||||
row1.textObject.text = row1Ref.rowText;
|
||||
row1.iconImage.gameObject.SetActive(false);
|
||||
row1.textObject.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (row1Ref.usePreferredWidth == true) { row1.layoutElement.preferredWidth = row1Ref.preferredWidth; }
|
||||
else { row1.layoutElement.preferredWidth = -1; }
|
||||
|
||||
// Row 3
|
||||
if (row2Ref == null)
|
||||
return;
|
||||
|
||||
if (row2Ref.rowType == ListView.RowType.Icon)
|
||||
{
|
||||
row2.iconImage.sprite = row2Ref.rowIcon;
|
||||
row2.iconImage.gameObject.SetActive(true);
|
||||
row2.textObject.gameObject.SetActive(false);
|
||||
row2.iconImage.transform.localScale = new Vector3(row2Ref.iconScale, row2Ref.iconScale, row2Ref.iconScale);
|
||||
}
|
||||
|
||||
else if (row2Ref.rowType == ListView.RowType.Text)
|
||||
{
|
||||
row2.textObject.text = row2Ref.rowText;
|
||||
row2.iconImage.gameObject.SetActive(false);
|
||||
row2.textObject.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (row2Ref.usePreferredWidth == true) { row2.layoutElement.preferredWidth = row2Ref.preferredWidth; }
|
||||
else { row2.layoutElement.preferredWidth = -1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Assets/Modern UI Pack/Scripts/ListView/ListViewItem.cs.meta
Normal file
18
Assets/Modern UI Pack/Scripts/ListView/ListViewItem.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4851166b6d5f47478c1c34aac226415
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 201717
|
||||
packageName: Modern UI Pack
|
||||
packageVersion: 5.5.19
|
||||
assetPath: Assets/Modern UI Pack/Scripts/ListView/ListViewItem.cs
|
||||
uploadId: 628721
|
||||
14
Assets/Modern UI Pack/Scripts/ListView/ListViewRow.cs
Normal file
14
Assets/Modern UI Pack/Scripts/ListView/ListViewRow.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Michsky.MUIP
|
||||
{
|
||||
public class ListViewRow : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
public Image iconImage;
|
||||
public TextMeshProUGUI textObject;
|
||||
public LayoutElement layoutElement;
|
||||
}
|
||||
}
|
||||
18
Assets/Modern UI Pack/Scripts/ListView/ListViewRow.cs.meta
Normal file
18
Assets/Modern UI Pack/Scripts/ListView/ListViewRow.cs.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6980d488c131db45829d12b148fbb13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 201717
|
||||
packageName: Modern UI Pack
|
||||
packageVersion: 5.5.19
|
||||
assetPath: Assets/Modern UI Pack/Scripts/ListView/ListViewRow.cs
|
||||
uploadId: 628721
|
||||
Reference in New Issue
Block a user