TableLayout - init
This commit is contained in:
commit
a670ba2edd
9
Documentation.meta
Normal file
9
Documentation.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85e91b612e4e5a245b2eaefd1f66ecd1
|
||||
folderAsset: yes
|
||||
timeCreated: 1466592936
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Documentation/Change List.txt
Normal file
80
Documentation/Change List.txt
Normal file
@ -0,0 +1,80 @@
|
||||
v1.13
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed an issue where rows were sometimes positioned incorrectly on the Z
|
||||
axis in the build
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
v1.12
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed an issue where cells were incorrectly rotated if located inside
|
||||
a Camera Space canvas with a camera using a non-zero rotation
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
v1.11
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed an odd positioning error in Unity 2017.3
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
v1.10
|
||||
------------------------------------------------------------------------------
|
||||
- Added a new example showing how you can dynamically add rows, with and without
|
||||
using row templates.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.09
|
||||
------------------------------------------------------------------------------
|
||||
- Added the following properties:
|
||||
- UseAlternateRowBackgroundColors
|
||||
- RowBackgroundColorAlternate
|
||||
- UseAlternateCellBackgroundColors
|
||||
- CellBackgroundColorAlternate
|
||||
|
||||
These allow you to control the appearance of alternate rows and/or cells.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.08
|
||||
------------------------------------------------------------------------------
|
||||
- Some adjustments to TableRow to prevent unnecessarily calling
|
||||
layout rebuild functions in recent versions of Unity.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.07
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed some World Space Canvas mode positioning issues
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.06
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed a bug with cell z-positions
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.05
|
||||
------------------------------------------------------------------------------
|
||||
- Table Rows now support multi-object editing, so you can adjust their
|
||||
properties in bulk
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.04
|
||||
------------------------------------------------------------------------------
|
||||
- Added the ClearCells() method to TableRow
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.03
|
||||
------------------------------------------------------------------------------
|
||||
- Fixed a bug on iOS
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.02
|
||||
------------------------------------------------------------------------------
|
||||
- Added a new AddRow() method which accepts an existing TableRow
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.01
|
||||
------------------------------------------------------------------------------
|
||||
- Added the ClearRows() method to TableLayout
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
V1.00
|
||||
------------------------------------------------------------------------------
|
||||
- Initial Release
|
||||
------------------------------------------------------------------------------
|
||||
8
Documentation/Change List.txt.meta
Normal file
8
Documentation/Change List.txt.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fac32f77096d63469f658c479d08910
|
||||
timeCreated: 1466686464
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Documentation/TableLayout v1.00 User Guide.pdf
Normal file
BIN
Documentation/TableLayout v1.00 User Guide.pdf
Normal file
Binary file not shown.
8
Documentation/TableLayout v1.00 User Guide.pdf.meta
Normal file
8
Documentation/TableLayout v1.00 User Guide.pdf.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21662193659009444847ac5b13d902c4
|
||||
timeCreated: 1466686369
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Editor.meta
Normal file
9
Editor.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb28176000ff42b4fa82d9357d347030
|
||||
folderAsset: yes
|
||||
timeCreated: 1458853596
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Editor/TableCellEditor.cs
Normal file
68
Editor/TableCellEditor.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
[CustomEditor(typeof(TableCell))]
|
||||
public class TableCellEditor : Editor
|
||||
{
|
||||
private SerializedObject SO_Target;
|
||||
private TableCell TableCell;
|
||||
|
||||
private SerializedProperty columnSpan;
|
||||
private SerializedProperty dontUseTableCellBackground;
|
||||
private SerializedProperty overrideGlobalPadding;
|
||||
private SerializedProperty padding;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
SO_Target = new SerializedObject(target);
|
||||
TableCell = (TableCell)target;
|
||||
|
||||
columnSpan = SO_Target.FindProperty("columnSpan");
|
||||
dontUseTableCellBackground = SO_Target.FindProperty("dontUseTableCellBackground");
|
||||
overrideGlobalPadding = SO_Target.FindProperty("overrideGlobalPadding");
|
||||
padding = SO_Target.FindProperty("m_Padding");
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(columnSpan);
|
||||
EditorGUILayout.PropertyField(dontUseTableCellBackground);
|
||||
EditorGUILayout.PropertyField(overrideGlobalPadding);
|
||||
if (!overrideGlobalPadding.boolValue)
|
||||
{
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
}
|
||||
EditorGUILayout.PropertyField(padding, true);
|
||||
if (!overrideGlobalPadding.boolValue) EditorGUI.EndDisabledGroup();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
SO_Target.ApplyModifiedProperties();
|
||||
|
||||
TableCell.columnSpan = columnSpan.intValue;
|
||||
TableCell.dontUseTableCellBackground = dontUseTableCellBackground.boolValue;
|
||||
TableCell.overrideGlobalPadding = overrideGlobalPadding.boolValue;
|
||||
|
||||
if (!TableCell.overrideGlobalPadding)
|
||||
{
|
||||
TableCell.SetCellPaddingFromTableLayout();
|
||||
}
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
TableCell.NotifyTableCellPropertiesChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Editor/TableCellEditor.cs.meta
Normal file
12
Editor/TableCellEditor.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c3b6bde5a37b5249b8903a5b1a0aeb1
|
||||
timeCreated: 1458851496
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
127
Editor/TableLayoutEditor.cs
Normal file
127
Editor/TableLayoutEditor.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
[CustomEditor(typeof(TableLayout))]
|
||||
public class TableLayoutEditor : Editor
|
||||
{
|
||||
private SerializedObject SO_Target;
|
||||
private TableLayout tableLayout;
|
||||
|
||||
|
||||
private SerializedProperty Padding;
|
||||
private SerializedProperty RowBackgroundImage;
|
||||
private SerializedProperty RowBackgroundColor;
|
||||
private SerializedProperty UseAlternateRowBackgroundColors;
|
||||
private SerializedProperty RowBackgroundColorAlternate;
|
||||
private SerializedProperty CellBackgroundImage;
|
||||
private SerializedProperty CellBackgroundColor;
|
||||
private SerializedProperty UseAlternateCellBackgroundColors;
|
||||
private SerializedProperty CellBackgroundColorAlternate;
|
||||
|
||||
private SerializedProperty AutomaticallyAddColumns;
|
||||
private SerializedProperty AutomaticallyRemoveEmptyColumns;
|
||||
|
||||
private SerializedProperty ColumnWidths;
|
||||
|
||||
private SerializedProperty UseGlobalCellPadding;
|
||||
private SerializedProperty CellPadding;
|
||||
private SerializedProperty CellSpacing;
|
||||
|
||||
private SerializedProperty AutoCalculateHeight;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
SO_Target = new SerializedObject(target);
|
||||
tableLayout = (TableLayout)target;
|
||||
|
||||
Padding = SO_Target.FindProperty("m_Padding");
|
||||
RowBackgroundImage = SO_Target.FindProperty("RowBackgroundImage");
|
||||
RowBackgroundColor = SO_Target.FindProperty("RowBackgroundColor");
|
||||
|
||||
UseAlternateRowBackgroundColors = SO_Target.FindProperty("UseAlternateRowBackgroundColors");
|
||||
RowBackgroundColorAlternate = SO_Target.FindProperty("RowBackgroundColorAlternate");
|
||||
|
||||
CellBackgroundImage = SO_Target.FindProperty("CellBackgroundImage");
|
||||
CellBackgroundColor = SO_Target.FindProperty("CellBackgroundColor");
|
||||
|
||||
UseAlternateCellBackgroundColors = SO_Target.FindProperty("UseAlternateCellBackroundColors");
|
||||
CellBackgroundColorAlternate = SO_Target.FindProperty("CellBackgroundColorAlternate");
|
||||
|
||||
AutomaticallyAddColumns = SO_Target.FindProperty("AutomaticallyAddColumns");
|
||||
AutomaticallyRemoveEmptyColumns = SO_Target.FindProperty("AutomaticallyRemoveEmptyColumns");
|
||||
|
||||
ColumnWidths = SO_Target.FindProperty("ColumnWidths");
|
||||
|
||||
UseGlobalCellPadding = SO_Target.FindProperty("UseGlobalCellPadding");
|
||||
CellPadding = SO_Target.FindProperty("CellPadding");
|
||||
CellSpacing = SO_Target.FindProperty("CellSpacing");
|
||||
|
||||
AutoCalculateHeight = SO_Target.FindProperty("AutoCalculateHeight");
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//base.OnInspectorGUI();
|
||||
|
||||
EditorGUILayout.PropertyField(Padding, true);
|
||||
EditorGUILayout.PropertyField(RowBackgroundImage);
|
||||
EditorGUILayout.PropertyField(RowBackgroundColor);
|
||||
|
||||
EditorGUILayout.PropertyField(UseAlternateRowBackgroundColors);
|
||||
EditorGUILayout.PropertyField(RowBackgroundColorAlternate);
|
||||
|
||||
EditorGUILayout.PropertyField(CellBackgroundImage);
|
||||
EditorGUILayout.PropertyField(CellBackgroundColor);
|
||||
|
||||
EditorGUILayout.PropertyField(UseAlternateCellBackgroundColors);
|
||||
EditorGUILayout.PropertyField(CellBackgroundColorAlternate);
|
||||
|
||||
EditorGUILayout.PropertyField(AutomaticallyAddColumns);
|
||||
EditorGUILayout.PropertyField(AutomaticallyRemoveEmptyColumns);
|
||||
EditorGUILayout.PropertyField(ColumnWidths, true);
|
||||
|
||||
EditorGUILayout.PropertyField(UseGlobalCellPadding);
|
||||
if (!UseGlobalCellPadding.boolValue) EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.PropertyField(CellPadding, true);
|
||||
if (!UseGlobalCellPadding.boolValue) EditorGUI.EndDisabledGroup();
|
||||
EditorGUILayout.PropertyField(CellSpacing);
|
||||
EditorGUILayout.PropertyField(AutoCalculateHeight);
|
||||
|
||||
GUILayout.Space(16);
|
||||
|
||||
if (GUILayout.Button(String.Format("Add row with {0} empty cells", tableLayout.ColumnWidths.Count)))
|
||||
{
|
||||
tableLayout.AddRow(tableLayout.ColumnWidths.Count);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Add Empty Row"))
|
||||
{
|
||||
tableLayout.AddRow(0);
|
||||
}
|
||||
|
||||
EditorGUI.BeginDisabledGroup(tableLayout.Rows.Count <= 0);
|
||||
if (GUILayout.Button("Duplicate Last Row"))
|
||||
{
|
||||
var lastRow = tableLayout.Rows.Last();
|
||||
var newRow = GameObject.Instantiate(lastRow);
|
||||
newRow.name = lastRow.name;
|
||||
|
||||
newRow.transform.SetParent(tableLayout.transform);
|
||||
newRow.transform.SetAsLastSibling();
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
SO_Target.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Editor/TableLayoutEditor.cs.meta
Normal file
12
Editor/TableLayoutEditor.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ba70f79a35024c44a14244a0bacd486
|
||||
timeCreated: 1458853775
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
81
Editor/TableLayoutWizard.cs
Normal file
81
Editor/TableLayoutWizard.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
public class TableLayoutWizard : EditorWindow
|
||||
{
|
||||
int numberOfRows = 3;
|
||||
int numberOfColumns = 3;
|
||||
|
||||
|
||||
[MenuItem("GameObject/UI/TableLayout/Add New Table")]
|
||||
static void AddTableLayout()
|
||||
{
|
||||
var window = EditorWindow.GetWindow<TableLayoutWizard>();
|
||||
window.Show();
|
||||
|
||||
var width = 380f;
|
||||
var height = 110f;
|
||||
|
||||
window.titleContent = new GUIContent("Add New TableLayout");
|
||||
window.position = new Rect( (Screen.currentResolution.width - width) / 2f,
|
||||
(Screen.currentResolution.height - height) / 2f,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
var style = new GUIStyle();
|
||||
style.margin = new RectOffset(10, 10, 10, 10);
|
||||
|
||||
GUILayout.BeginVertical(style);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Number of Rows");
|
||||
numberOfRows = EditorGUI.IntSlider(EditorGUILayout.GetControlRect(), numberOfRows, 0, 32);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (numberOfRows == 0) EditorGUI.BeginDisabledGroup(true);
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("Number of Columns");
|
||||
numberOfColumns = EditorGUI.IntSlider(EditorGUILayout.GetControlRect(), numberOfColumns, 0, 32);
|
||||
GUILayout.EndHorizontal();
|
||||
if (numberOfRows == 0) EditorGUI.EndDisabledGroup();
|
||||
|
||||
GUILayout.Space(16);
|
||||
|
||||
if (GUILayout.Button("Add Table Layout"))
|
||||
{
|
||||
CreateTable(numberOfRows, numberOfColumns);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Cancel"))
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
void CreateTable(int rows, int columns)
|
||||
{
|
||||
var gameObject = TableLayoutUtilities.InstantiatePrefab("TableLayout/TableLayout");
|
||||
gameObject.name = "TableLayout";
|
||||
|
||||
var tableLayout = gameObject.GetComponent<TableLayout>();
|
||||
|
||||
for (var x = 0; x < rows; x++)
|
||||
{
|
||||
tableLayout.AddRow(columns);
|
||||
}
|
||||
|
||||
UnityEditor.Selection.activeObject = gameObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Editor/TableLayoutWizard.cs.meta
Normal file
12
Editor/TableLayoutWizard.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fb1b986663909341ab1f2d46e016f98
|
||||
timeCreated: 1459344995
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Editor/TableRowEditor.cs
Normal file
58
Editor/TableRowEditor.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
[CustomEditor(typeof(TableRow)), CanEditMultipleObjects]
|
||||
public class TableRowEditor : Editor
|
||||
{
|
||||
//private SerializedObject serializedObject;
|
||||
private TableRow TableRow;
|
||||
|
||||
private SerializedProperty preferredHeight;
|
||||
private SerializedProperty dontUseTableRowBackground;
|
||||
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
//serializedObject = new SerializedObject(target);
|
||||
TableRow = (TableRow)target;
|
||||
|
||||
preferredHeight = serializedObject.FindProperty("preferredHeight");
|
||||
dontUseTableRowBackground = serializedObject.FindProperty("dontUseTableRowBackground");
|
||||
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(preferredHeight);
|
||||
EditorGUILayout.PropertyField(dontUseTableRowBackground);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
TableRow.preferredHeight = preferredHeight.floatValue;
|
||||
TableRow.dontUseTableRowBackground = dontUseTableRowBackground.boolValue;
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Add Cell"))
|
||||
{
|
||||
TableRow.AddCell();
|
||||
}
|
||||
|
||||
TableRow.NotifyTableRowPropertiesChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Editor/TableRowEditor.cs.meta
Normal file
12
Editor/TableRowEditor.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5058c7b8373135e478c4823801b305a2
|
||||
timeCreated: 1460647607
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Example.meta
Normal file
9
Example.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e66e27eb7da44604f902a0c8fe4ff2d9
|
||||
folderAsset: yes
|
||||
timeCreated: 1466592931
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
115
Example/DynamicRowsExampleController.cs
Normal file
115
Example/DynamicRowsExampleController.cs
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* This example shows how you can add rows programmatically.
|
||||
*/
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UI.Tables;
|
||||
|
||||
namespace UI.Tables.Examples
|
||||
{
|
||||
public class DynamicRowsExampleController : MonoBehaviour
|
||||
{
|
||||
// this is the TableLayout which we will be adding rows to
|
||||
// (in this example, this TableLayout is nested within a ScrollView)
|
||||
public TableLayout tableLayout;
|
||||
|
||||
// this is a template which we will be using as a base for the new rows
|
||||
public TableRow rowTemplate;
|
||||
|
||||
// this is the content transform of the ScrollView (aka ScrollRect)
|
||||
public RectTransform scrollviewContent;
|
||||
|
||||
// this controls how many test rows will be added to the TableLayout
|
||||
public int numberOfRowsToAdd = 50;
|
||||
private int numberOfRowsAdded = 0;
|
||||
|
||||
// Font for the dynamic rows example
|
||||
public Font font;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
// This doesn't have to be done with a coroutine, this is just so that the example runs slowly enough so that you can see each row being added
|
||||
// (normally we'd probably add them all at once)
|
||||
StartCoroutine(AddRowsUsingTemplate());
|
||||
|
||||
// To see how to add rows without using a template, uncomment the following line (and comment out the above one for preference)
|
||||
//StartCoroutine(AddRowsWithoutTemplate());
|
||||
}
|
||||
|
||||
IEnumerator AddRowsUsingTemplate()
|
||||
{
|
||||
while (numberOfRowsAdded <= numberOfRowsToAdd)
|
||||
{
|
||||
// Create a new row based on our template
|
||||
var newRow = Instantiate<TableRow>(rowTemplate);
|
||||
|
||||
// the template is inactive, so we need to make our new row active
|
||||
newRow.gameObject.SetActive(true);
|
||||
|
||||
// add the new row to the table
|
||||
tableLayout.AddRow(newRow);
|
||||
|
||||
// In order for the scrollview to work correctly, its content transform must have the same height as our table
|
||||
scrollviewContent.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (tableLayout.transform as RectTransform).rect.height);
|
||||
|
||||
// set the text value in the first cell
|
||||
var textObject = newRow.Cells[0].GetComponentInChildren<Text>();
|
||||
textObject.text = "Row " + numberOfRowsAdded;
|
||||
|
||||
// set the value for the toggle element in the second cell (even rows on, odd rows off)
|
||||
var toggleObject = newRow.Cells[1].GetComponentInChildren<Toggle>();
|
||||
toggleObject.isOn = numberOfRowsAdded % 2 == 0;
|
||||
|
||||
// increment the number of rows added (so that the example doesn't continue forever)
|
||||
numberOfRowsAdded++;
|
||||
|
||||
// wait briefly before adding the next row
|
||||
yield return new WaitForSeconds(0.25f);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AddRowsWithoutTemplate()
|
||||
{
|
||||
while (numberOfRowsAdded <= numberOfRowsToAdd)
|
||||
{
|
||||
// Add a row with 0 cells (we'll be adding the cells manually)
|
||||
var newRow = tableLayout.AddRow(0);
|
||||
|
||||
// the default behaviour of a row is to be autosized based on the available space;
|
||||
// in this case we want to explicitly set the row height and have the table's height adjusted to match
|
||||
newRow.preferredHeight = 72;
|
||||
|
||||
// In order for the scrollview to work correctly, its content transform must have the same height as our table
|
||||
scrollviewContent.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (tableLayout.transform as RectTransform).rect.height);
|
||||
|
||||
// Add some cell content
|
||||
// (Generally, you're better off using a prefab or other object as a template, but for this example we'll create an entirely new text object for our cell)
|
||||
var textGameObject = new GameObject("Text", typeof(RectTransform));
|
||||
|
||||
newRow.AddCell(textGameObject.transform as RectTransform);
|
||||
|
||||
var textObject = textGameObject.AddComponent<Text>();
|
||||
textObject.font = font; // failing to set a font for a new text object triggers a null exception
|
||||
textObject.text = "Row " + numberOfRowsAdded;
|
||||
textObject.resizeTextForBestFit = true;
|
||||
textObject.alignment = TextAnchor.MiddleCenter;
|
||||
|
||||
|
||||
// and two empty cells
|
||||
newRow.AddCell();
|
||||
newRow.AddCell();
|
||||
|
||||
// increment the number of rows added (so that the example doesn't continue forever)
|
||||
numberOfRowsAdded++;
|
||||
|
||||
// wait briefly before adding the next row
|
||||
yield return new WaitForSeconds(0.25f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
12
Example/DynamicRowsExampleController.cs.meta
Normal file
12
Example/DynamicRowsExampleController.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b602e2e8fd0440845a9710e77e4781ab
|
||||
timeCreated: 1489689894
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58546
Example/Example.unity
Normal file
58546
Example/Example.unity
Normal file
File diff suppressed because it is too large
Load Diff
8
Example/Example.unity.meta
Normal file
8
Example/Example.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d59fb584c0c9fc4784388f550054031
|
||||
timeCreated: 1466592971
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Example/Sprites.meta
Normal file
9
Example/Sprites.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e04a051d0da36d542b7ee3fe137cb81b
|
||||
folderAsset: yes
|
||||
timeCreated: 1466596863
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Example/Sprites/TableLayout_Logo.png
Normal file
BIN
Example/Sprites/TableLayout_Logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
127
Example/Sprites/TableLayout_Logo.png.meta
Normal file
127
Example/Sprites/TableLayout_Logo.png.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfc39e47a6b40144c9950049316df6b7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 1
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Example/TableLayoutExampleController.cs
Normal file
18
Example/TableLayoutExampleController.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using UI.Tables;
|
||||
|
||||
namespace UI.Tables.Examples
|
||||
{
|
||||
public class TableLayoutExampleController : MonoBehaviour
|
||||
{
|
||||
public List<TableLayout> Examples = new List<TableLayout>();
|
||||
|
||||
public void ShowExample(TableLayout example)
|
||||
{
|
||||
Examples.ForEach(t => { if (t != example) t.gameObject.SetActive(false); });
|
||||
|
||||
if (!example.gameObject.activeInHierarchy) example.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Example/TableLayoutExampleController.cs.meta
Normal file
12
Example/TableLayoutExampleController.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a014805545e19146962cde5987dee3e
|
||||
timeCreated: 1466597972
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Resources.meta
Normal file
9
Resources.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 990a7b9e09fcff2419fc81f3d510fe7f
|
||||
folderAsset: yes
|
||||
timeCreated: 1459345177
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Resources/Prefabs.meta
Normal file
9
Resources/Prefabs.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49367dd7ef146b7499fbff7e85f2f984
|
||||
folderAsset: yes
|
||||
timeCreated: 1459345177
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Resources/Prefabs/TableLayout.meta
Normal file
9
Resources/Prefabs/TableLayout.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cae087213d4264e4a84e41c443953ff7
|
||||
folderAsset: yes
|
||||
timeCreated: 1459345177
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
110
Resources/Prefabs/TableLayout/Cell.prefab
Normal file
110
Resources/Prefabs/TableLayout/Cell.prefab
Normal file
@ -0,0 +1,110 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &171100
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22474846}
|
||||
- component: {fileID: 22206082}
|
||||
- component: {fileID: 11469168}
|
||||
- component: {fileID: 11429482}
|
||||
m_Layer: 5
|
||||
m_Name: Cell
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &11429482
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 171100}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5c3e8a0f84ba2074aab57a41530c9e6f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 1
|
||||
columnSpan: 1
|
||||
dontUseTableCellBackground: 0
|
||||
overrideGlobalPadding: 0
|
||||
m_tableLayout: {fileID: 0}
|
||||
m_tableRow: {fileID: 0}
|
||||
--- !u!114 &11469168
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 171100}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_RaycastTarget: 0
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!222 &22206082
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 171100}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!224 &22474846
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 171100}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 718, y: 32}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 171100}
|
||||
m_IsPrefabAsset: 1
|
||||
8
Resources/Prefabs/TableLayout/Cell.prefab.meta
Normal file
8
Resources/Prefabs/TableLayout/Cell.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce40bf8f12f94a744b07e8cfd9bff1df
|
||||
timeCreated: 1458909393
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
105
Resources/Prefabs/TableLayout/Row.prefab
Normal file
105
Resources/Prefabs/TableLayout/Row.prefab
Normal file
@ -0,0 +1,105 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &144882
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22477988}
|
||||
- component: {fileID: 22222944}
|
||||
- component: {fileID: 11465542}
|
||||
- component: {fileID: 11409680}
|
||||
m_Layer: 5
|
||||
m_Name: Row
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &11409680
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 144882}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d5082d4823641ca42b40e34f1b5c0983, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
preferredHeight: 0
|
||||
dontUseTableRowBackground: 0
|
||||
m_tableLayout: {fileID: 0}
|
||||
--- !u!114 &11465542
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 144882}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_RaycastTarget: 0
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!222 &22222944
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 144882}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!224 &22477988
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 144882}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 718, y: 32}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 0}
|
||||
propertyPath: preferredHeight
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_Padding.m_Left
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 144882}
|
||||
m_IsPrefabAsset: 1
|
||||
8
Resources/Prefabs/TableLayout/Row.prefab.meta
Normal file
8
Resources/Prefabs/TableLayout/Row.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c18ba788d89ff94aa8321e22a650bc6
|
||||
timeCreated: 1458909377
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
197
Resources/Prefabs/TableLayout/TableLayout.prefab
Normal file
197
Resources/Prefabs/TableLayout/TableLayout.prefab
Normal file
@ -0,0 +1,197 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &131506
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22492918}
|
||||
- component: {fileID: 22255798}
|
||||
- component: {fileID: 11474362}
|
||||
- component: {fileID: 11488552}
|
||||
- component: {fileID: 11440236}
|
||||
m_Layer: 5
|
||||
m_Name: TableLayout
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &11440236
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131506}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &11474362
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131506}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_RaycastTarget: 0
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
--- !u!114 &11488552
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131506}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 40af1fc34b317c7478aa58e59ec0256f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 1
|
||||
RowBackgroundImage: {fileID: 0}
|
||||
RowBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
UseAlternateRowBackgroundColors: 0
|
||||
RowBackgroundColorAlternate: {r: 0, g: 0, b: 0, a: 0}
|
||||
CellBackgroundImage: {fileID: 21300000, guid: c88737c4d8c610c43a1be895c06d380c,
|
||||
type: 3}
|
||||
CellBackgroundColor: {r: 1, g: 1, b: 1, a: 0.39215687}
|
||||
UseAlternateCellBackroundColors: 0
|
||||
CellBackgroundColorAlternate: {r: 0, g: 0, b: 0, a: 0}
|
||||
AutomaticallyAddColumns: 1
|
||||
AutomaticallyRemoveEmptyColumns: 1
|
||||
ColumnWidths: []
|
||||
UseGlobalCellPadding: 1
|
||||
CellPadding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
CellSpacing: 0
|
||||
AutoCalculateHeight: 0
|
||||
--- !u!222 &22255798
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131506}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!224 &22492918
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 131506}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
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: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_Padding.m_Left
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_Padding.m_Top
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_Padding.m_Right
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_Padding.m_Bottom
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: CellBackgroundImage
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: c88737c4d8c610c43a1be895c06d380c,
|
||||
type: 3}
|
||||
- target: {fileID: 0}
|
||||
propertyPath: CellBackgroundColor.a
|
||||
value: 0.39215687
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 131506}
|
||||
m_IsPrefabAsset: 1
|
||||
8
Resources/Prefabs/TableLayout/TableLayout.prefab.meta
Normal file
8
Resources/Prefabs/TableLayout/TableLayout.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea5245aa60bf15442aba456edf851d2b
|
||||
timeCreated: 1458909306
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Resources/Sprites.meta
Normal file
9
Resources/Sprites.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bca299c26f4a24b42946377a15c07ffc
|
||||
folderAsset: yes
|
||||
timeCreated: 1459352047
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Resources/Sprites/Outline.png
Normal file
BIN
Resources/Sprites/Outline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
127
Resources/Sprites/Outline.png.meta
Normal file
127
Resources/Sprites/Outline.png.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6855878fb857eb9408b3d9ceeab8908b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 16
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 512
|
||||
spriteBorder: {x: 64, y: 64, z: 64, w: 64}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 1
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Resources/Sprites/Outline_Sharp.png
Normal file
BIN
Resources/Sprites/Outline_Sharp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
127
Resources/Sprites/Outline_Sharp.png.meta
Normal file
127
Resources/Sprites/Outline_Sharp.png.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c88737c4d8c610c43a1be895c06d380c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 16
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 512
|
||||
spriteBorder: {x: 64, y: 64, z: 64, w: 64}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 1
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Resources/Sprites/Outline_With_Background.png
Normal file
BIN
Resources/Sprites/Outline_With_Background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
127
Resources/Sprites/Outline_With_Background.png.meta
Normal file
127
Resources/Sprites/Outline_With_Background.png.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55d36aa4af06b4b4988c2afc77a95fd1
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 16
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 512
|
||||
spriteBorder: {x: 64, y: 64, z: 64, w: 64}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 1
|
||||
swizzle: 50462976
|
||||
cookieLightType: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
107
TableCell.cs
Normal file
107
TableCell.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class TableCell : HorizontalLayoutGroup
|
||||
{
|
||||
[Tooltip("How many columns should this cell span?")]
|
||||
public int columnSpan = 1;
|
||||
|
||||
[Tooltip("If this property is set, then this cell will ignore the TableLayout CellBackgroundColor/CellBackgroundImage values - allowing you to set specific values for this cell.")]
|
||||
public bool dontUseTableCellBackground = false;
|
||||
|
||||
[Tooltip("If this property is set, then this cell will ignore the TableLayout Global Cell Padding values - allowing you to set specific values for this cell.")]
|
||||
public bool overrideGlobalPadding = false;
|
||||
|
||||
[NonSerialized]
|
||||
internal float actualWidth = 0f;
|
||||
[NonSerialized]
|
||||
internal float actualHeight = 0f;
|
||||
[NonSerialized]
|
||||
internal float actualX = 0f;
|
||||
[NonSerialized]
|
||||
internal float actualY = 0f;
|
||||
|
||||
protected Image _image;
|
||||
public Image image
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_image == null)
|
||||
{
|
||||
_image = this.GetComponent<Image>();
|
||||
}
|
||||
|
||||
return _image;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private TableLayout m_tableLayout = null;
|
||||
[SerializeField]
|
||||
private TableRow m_tableRow = null;
|
||||
|
||||
internal void Initialise(TableLayout tableLayout, TableRow row)
|
||||
{
|
||||
if (m_tableLayout == tableLayout && m_tableRow == row) return;
|
||||
|
||||
m_tableLayout = tableLayout;
|
||||
m_tableRow = row;
|
||||
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
this.useGUILayout = false;
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
base.CalculateLayoutInputHorizontal();
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputVertical()
|
||||
{
|
||||
base.CalculateLayoutInputVertical();
|
||||
}
|
||||
|
||||
protected override void OnRectTransformDimensionsChange()
|
||||
{
|
||||
base.OnRectTransformDimensionsChange();
|
||||
}
|
||||
|
||||
public override void SetLayoutHorizontal()
|
||||
{
|
||||
base.SetLayoutHorizontal();
|
||||
}
|
||||
|
||||
public override void SetLayoutVertical()
|
||||
{
|
||||
base.SetLayoutVertical();
|
||||
}
|
||||
|
||||
public void NotifyTableCellPropertiesChanged()
|
||||
{
|
||||
if(m_tableLayout != null && m_tableLayout.gameObject.activeInHierarchy) m_tableLayout.CalculateLayoutInputHorizontal();
|
||||
}
|
||||
|
||||
public void SetCellPaddingFromTableLayout()
|
||||
{
|
||||
padding = m_tableLayout.CellPadding;
|
||||
}
|
||||
|
||||
public TableRow GetRow()
|
||||
{
|
||||
return m_tableRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
TableCell.cs.meta
Normal file
12
TableCell.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c3e8a0f84ba2074aab57a41530c9e6f
|
||||
timeCreated: 1458839493
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
309
TableLayout.cs
Normal file
309
TableLayout.cs
Normal file
@ -0,0 +1,309 @@
|
||||
#define TableLayoutPresent
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class TableLayout : LayoutGroup, ILayoutSelfController
|
||||
{
|
||||
public Sprite RowBackgroundImage;
|
||||
|
||||
private Color rowBackgroundColor = new Color(0, 0, 0, 0);
|
||||
public Color RowBackgroundColor { get => rowBackgroundColor; set => rowBackgroundColor = value; }
|
||||
|
||||
public bool UseAlternateRowBackgroundColors = false;
|
||||
public Color RowBackgroundColorAlternate = new Color(0, 0, 0, 0);
|
||||
|
||||
public Sprite CellBackgroundImage;
|
||||
public Color CellBackgroundColor = new Color(0,0,0,0);
|
||||
|
||||
public bool UseAlternateCellBackroundColors = false;
|
||||
public Color CellBackgroundColorAlternate = new Color(0, 0, 0, 0);
|
||||
|
||||
[Tooltip("If this is set, then this TableLayout will automatically add columns if there are more cells than columns on any row (this includes ColumnSpan checks)")]
|
||||
public bool AutomaticallyAddColumns = true;
|
||||
[Tooltip("If this is set, then this TableLayout will automatically remove any columns with no cells in them in any row (at the END of the row)")]
|
||||
public bool AutomaticallyRemoveEmptyColumns = true;
|
||||
public List<float> ColumnWidths = new List<float>();
|
||||
|
||||
[Tooltip("If this is set, then the cellpadding set here will override any padding settings set on individual cells")]
|
||||
public bool UseGlobalCellPadding = true;
|
||||
public RectOffset CellPadding = new RectOffset();
|
||||
|
||||
public float CellSpacing = 0f;
|
||||
|
||||
public bool AutoCalculateHeight = false;
|
||||
|
||||
public List<TableRow> Rows
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetComponentsInChildren<TableRow>()
|
||||
.Where(tr => tr.transform.parent == this.transform)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private DrivenRectTransformTracker _tracker;
|
||||
|
||||
private LayoutElement _layoutElement;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_layoutElement = this.GetComponent<LayoutElement>();
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
base.CalculateLayoutInputHorizontal();
|
||||
|
||||
UpdateLayout();
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputVertical()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnRectTransformDimensionsChange()
|
||||
{
|
||||
base.OnRectTransformDimensionsChange();
|
||||
}
|
||||
|
||||
public override void SetLayoutHorizontal()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetLayoutVertical()
|
||||
{
|
||||
}
|
||||
|
||||
public void UpdateLayout()
|
||||
{
|
||||
//Debug.Log("TableLayout::UpdateLayout");
|
||||
_tracker.Clear();
|
||||
|
||||
var tableRect = this.rectTransform.rect;
|
||||
var tableHeight = tableRect.height;
|
||||
var tableWidth = tableRect.width;
|
||||
|
||||
var rows = this.Rows.ToList();
|
||||
|
||||
if (!rows.Any()) return;
|
||||
|
||||
var rowHeights = new List<float>();
|
||||
var availableHeight = Mathf.Max(0, tableHeight - rows.Sum(r => r.preferredHeight) - (this.padding.top + this.padding.bottom) - (this.CellSpacing * (rows.Count - 1)));
|
||||
var numberOfAutoSizeRows = rows.Count(r => r.preferredHeight == 0);
|
||||
float calculatedAutoSizeRowHeight = 0;
|
||||
if (numberOfAutoSizeRows > 0)
|
||||
{
|
||||
calculatedAutoSizeRowHeight = availableHeight / numberOfAutoSizeRows;
|
||||
}
|
||||
|
||||
foreach (var row in rows)
|
||||
{
|
||||
rowHeights.Add(row.preferredHeight > 0 ? row.preferredHeight : calculatedAutoSizeRowHeight);
|
||||
}
|
||||
|
||||
#if !UNITY_IOS
|
||||
var columnCount = rows.Max(r => r.Cells.Sum(c => c.columnSpan));
|
||||
#else
|
||||
var columnCount = 0;
|
||||
foreach (var row in rows)
|
||||
{
|
||||
var rowColumnCount = 0;
|
||||
foreach (var cell in row.Cells)
|
||||
{
|
||||
rowColumnCount += cell.columnSpan;
|
||||
}
|
||||
|
||||
columnCount = Math.Max(columnCount, rowColumnCount);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (AutomaticallyRemoveEmptyColumns && columnCount < ColumnWidths.Count)
|
||||
{
|
||||
ColumnWidths.RemoveRange(columnCount, ColumnWidths.Count - columnCount);
|
||||
}
|
||||
|
||||
// 0 == auto-size
|
||||
var availableWidth = tableWidth
|
||||
- (this.padding.left + this.padding.right)
|
||||
- (this.CellSpacing * (columnCount - 1));
|
||||
|
||||
foreach (var columnWidth in ColumnWidths)
|
||||
{
|
||||
availableWidth -= columnWidth;
|
||||
|
||||
if (availableWidth < 0)
|
||||
{
|
||||
availableWidth = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (var c = 0; c < columnCount; c++)
|
||||
{
|
||||
// If we don't have enough column width entries, then
|
||||
// a) if we should automatically add column widths, then add a new zero value (which is translated into AutoSize)
|
||||
// c) if we don't want to automatically add column widths, then additional cells over the column count will likely have a width of zero (which is only a problem if that happens)
|
||||
if (AutomaticallyAddColumns && ColumnWidths.Count <= c)
|
||||
{
|
||||
ColumnWidths.Add(0);
|
||||
}
|
||||
}
|
||||
|
||||
var numberOfAutoSizeColumns = ColumnWidths.Count(c => c == 0);
|
||||
float calculatedAutoSizeColumnWidth = 0f;
|
||||
if (numberOfAutoSizeColumns > 0)
|
||||
{
|
||||
calculatedAutoSizeColumnWidth = availableWidth / numberOfAutoSizeColumns;
|
||||
}
|
||||
|
||||
var columnWidths = new List<float>();
|
||||
for (var c = 0; c < columnCount; c++)
|
||||
{
|
||||
columnWidths.Add(ColumnWidths.Count > c && ColumnWidths[c] != 0 ? ColumnWidths[c] : calculatedAutoSizeColumnWidth);
|
||||
}
|
||||
|
||||
float y = -this.padding.top;
|
||||
for (var r = 0; r < rows.Count; r++)
|
||||
{
|
||||
var row = rows[r];
|
||||
|
||||
row.Initialise(this);
|
||||
|
||||
if (!row.dontUseTableRowBackground)
|
||||
{
|
||||
row.image.sprite = RowBackgroundImage;
|
||||
row.image.color = !UseAlternateRowBackgroundColors || r % 2 == 0 ? RowBackgroundColor : RowBackgroundColorAlternate;
|
||||
}
|
||||
|
||||
var rowHeight = rowHeights[r];
|
||||
row.actualHeight = rowHeight;
|
||||
|
||||
var rowRectTransform = row.transform as RectTransform;
|
||||
|
||||
_tracker.Add(this, rowRectTransform, DrivenTransformProperties.All);
|
||||
|
||||
rowRectTransform.pivot = new Vector2(0, 1);
|
||||
rowRectTransform.anchorMin = new Vector2(0, 1);
|
||||
rowRectTransform.anchorMax = new Vector2(0, 1);
|
||||
rowRectTransform.localScale = new Vector3(1, 1, 1);
|
||||
//rowRectTransform.localPosition = Vector3.zero;
|
||||
rowRectTransform.localRotation = new Quaternion();
|
||||
|
||||
rowRectTransform.sizeDelta = new Vector2(tableWidth - (this.padding.left + this.padding.right), rowHeight);
|
||||
rowRectTransform.anchoredPosition3D = new Vector3(this.padding.left, y, 0);
|
||||
y -= rowHeight;
|
||||
y -= CellSpacing;
|
||||
|
||||
float x = 0f;
|
||||
int c = 0;
|
||||
var cells = row.Cells.ToList();
|
||||
foreach (var cell in cells)
|
||||
{
|
||||
float columnWidth = 0f;
|
||||
var endColumn = c + cell.columnSpan;
|
||||
|
||||
for (var c2 = c; c2 < endColumn; c2++)
|
||||
{
|
||||
columnWidth += columnWidths[c2];
|
||||
}
|
||||
|
||||
columnWidth += (cell.columnSpan - 1) * CellSpacing;
|
||||
|
||||
var difference = tableWidth - x;
|
||||
columnWidth = Mathf.Min(columnWidth, difference);
|
||||
|
||||
cell.actualWidth = columnWidth;
|
||||
cell.actualHeight = rowHeight;
|
||||
cell.actualX = x;
|
||||
|
||||
if (UseGlobalCellPadding && !cell.overrideGlobalPadding)
|
||||
{
|
||||
cell.padding = new RectOffset(CellPadding.left, CellPadding.right, CellPadding.top, CellPadding.bottom);
|
||||
}
|
||||
|
||||
if (!cell.dontUseTableCellBackground)
|
||||
{
|
||||
cell.image.sprite = this.CellBackgroundImage;
|
||||
cell.image.color = !this.UseAlternateCellBackroundColors || c % 2 == 0 ? this.CellBackgroundColor : this.CellBackgroundColorAlternate;
|
||||
}
|
||||
|
||||
x += columnWidth + CellSpacing;
|
||||
c = endColumn;
|
||||
}
|
||||
|
||||
// Apply the changes to the cells
|
||||
row.UpdateLayout();
|
||||
}
|
||||
|
||||
if (AutoCalculateHeight)
|
||||
{
|
||||
rectTransform.pivot = new Vector2(rectTransform.pivot.x, 1);
|
||||
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, -y);
|
||||
|
||||
rectTransform.anchorMin = new Vector2(rectTransform.anchorMin.x, 1);
|
||||
rectTransform.anchorMax = new Vector2(rectTransform.anchorMax.x, 1);
|
||||
|
||||
rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, 0);
|
||||
|
||||
if (_layoutElement != null)
|
||||
{
|
||||
_layoutElement.preferredHeight = rectTransform.rect.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TableRow AddRow()
|
||||
{
|
||||
return AddRow(ColumnWidths.Count);
|
||||
}
|
||||
|
||||
public TableRow AddRow(int cells)
|
||||
{
|
||||
var row = TableLayoutUtilities.InstantiatePrefab("TableLayout/Row");
|
||||
row.name = "Row";
|
||||
|
||||
row.transform.SetParent(this.transform);
|
||||
row.transform.SetAsLastSibling();
|
||||
|
||||
var rowComponent = row.GetComponent<TableRow>();
|
||||
|
||||
for (var x = 0; x < cells; x++)
|
||||
{
|
||||
rowComponent.AddCell();
|
||||
}
|
||||
|
||||
return rowComponent;
|
||||
}
|
||||
|
||||
public TableRow AddRow(TableRow row)
|
||||
{
|
||||
row.transform.SetParent(this.transform);
|
||||
row.transform.SetAsLastSibling();
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
public void ClearRows()
|
||||
{
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
Destroy(row.gameObject);
|
||||
else
|
||||
DestroyImmediate(row.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
TableLayout.cs.meta
Normal file
12
TableLayout.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40af1fc34b317c7478aa58e59ec0256f
|
||||
timeCreated: 1458836690
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
136
TableLayoutUtilities.cs
Normal file
136
TableLayoutUtilities.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
public static class TableLayoutUtilities
|
||||
{
|
||||
public static GameObject InstantiatePrefab(string name, bool playMode = false, bool generateUndo = true)
|
||||
{
|
||||
var prefab = Resources.Load<GameObject>("Prefabs/" + name);
|
||||
|
||||
if (prefab == null)
|
||||
{
|
||||
throw new UnityException(String.Format("Could not find prefab '{0}'!", name));
|
||||
}
|
||||
|
||||
Transform parent = null;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (!playMode) parent = UnityEditor.Selection.activeTransform;
|
||||
#endif
|
||||
var gameObject = GameObject.Instantiate(prefab) as GameObject;
|
||||
gameObject.name = name;
|
||||
|
||||
if (parent == null || !(parent is RectTransform))
|
||||
{
|
||||
parent = GetCanvasTransform();
|
||||
}
|
||||
|
||||
gameObject.transform.SetParent(parent);
|
||||
|
||||
var transform = (RectTransform)gameObject.transform;
|
||||
var prefabTransform = (RectTransform)prefab.transform;
|
||||
|
||||
FixInstanceTransform(prefabTransform, transform);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (generateUndo)
|
||||
{
|
||||
UnityEditor.Undo.RegisterCreatedObjectUndo(gameObject, "Created " + name);
|
||||
}
|
||||
#endif
|
||||
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
public static Transform GetCanvasTransform()
|
||||
{
|
||||
Canvas canvas = null;
|
||||
#if UNITY_EDITOR
|
||||
// Attempt to locate a canvas object parented to the currently selected object
|
||||
if (!Application.isPlaying && UnityEditor.Selection.activeGameObject != null)
|
||||
{
|
||||
canvas = FindParentOfType<Canvas>(UnityEditor.Selection.activeGameObject);
|
||||
//canvas = UnityEditor.Selection.activeTransform.GetComponentInParent<Canvas>();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (canvas == null)
|
||||
{
|
||||
// Attempt to find a canvas anywhere
|
||||
canvas = UnityEngine.Object.FindObjectOfType<Canvas>();
|
||||
|
||||
if (canvas != null) return canvas.transform;
|
||||
}
|
||||
|
||||
// if we reach this point, we haven't been able to locate a canvas
|
||||
// ...So I guess we'd better create one
|
||||
|
||||
|
||||
GameObject canvasGameObject = new GameObject("Canvas");
|
||||
canvasGameObject.layer = LayerMask.NameToLayer("UI");
|
||||
canvas = canvasGameObject.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
canvasGameObject.AddComponent<CanvasScaler>();
|
||||
canvasGameObject.AddComponent<GraphicRaycaster>();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.Undo.RegisterCreatedObjectUndo(canvasGameObject, "Create Canvas");
|
||||
#endif
|
||||
|
||||
var eventSystem = UnityEngine.Object.FindObjectOfType<EventSystem>();
|
||||
|
||||
if (eventSystem == null)
|
||||
{
|
||||
GameObject eventSystemGameObject = new GameObject("EventSystem");
|
||||
eventSystem = eventSystemGameObject.AddComponent<EventSystem>();
|
||||
eventSystemGameObject.AddComponent<StandaloneInputModule>();
|
||||
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
eventSystemGameObject.AddComponent<TouchInputModule>();
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.Undo.RegisterCreatedObjectUndo(eventSystemGameObject, "Create EventSystem");
|
||||
#endif
|
||||
}
|
||||
|
||||
return canvas.transform;
|
||||
}
|
||||
|
||||
public static void FixInstanceTransform(RectTransform baseTransform, RectTransform instanceTransform)
|
||||
{
|
||||
//instanceTransform.localPosition = baseTransform.localPosition;
|
||||
instanceTransform.localPosition = Vector3.zero;
|
||||
//instanceTransform.position = baseTransform.position;
|
||||
instanceTransform.position = Vector3.zero;
|
||||
instanceTransform.rotation = baseTransform.rotation;
|
||||
instanceTransform.localScale = baseTransform.localScale;
|
||||
instanceTransform.anchoredPosition3D = new Vector3(baseTransform.anchoredPosition3D.x, baseTransform.anchoredPosition3D.y, 0);
|
||||
instanceTransform.sizeDelta = baseTransform.sizeDelta;
|
||||
}
|
||||
|
||||
public static T FindParentOfType<T>(GameObject childObject)
|
||||
where T : UnityEngine.Object
|
||||
{
|
||||
Transform t = childObject.transform;
|
||||
while (t.parent != null)
|
||||
{
|
||||
var component = t.parent.GetComponent<T>();
|
||||
|
||||
if (component != null) return component;
|
||||
|
||||
t = t.parent.transform;
|
||||
}
|
||||
|
||||
// We didn't find anything
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
TableLayoutUtilities.cs.meta
Normal file
12
TableLayoutUtilities.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f419a1b91fc15ed47b73dc60881a0ff3
|
||||
timeCreated: 1459346187
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
183
TableRow.cs
Normal file
183
TableRow.cs
Normal file
@ -0,0 +1,183 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI.Tables
|
||||
{
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class TableRow : MonoBehaviour//LayoutGroup
|
||||
{
|
||||
/*private RectTransform _rectTransform;
|
||||
new RectTransform rectTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_rectTransform == null) _rectTransform = this.GetComponent<RectTransform>();
|
||||
return _rectTransform;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*new List<RectTransform> rectChildren
|
||||
{
|
||||
get
|
||||
{
|
||||
List<RectTransform> list = new List<RectTransform>();
|
||||
foreach (RectTransform r in this.rectTransform)
|
||||
{
|
||||
list.Add(r);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}*/
|
||||
|
||||
public List<TableCell> Cells
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetComponentsInChildren<TableCell>()
|
||||
.Where(tc => tc.transform.parent == this.transform)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public int CellCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Cells.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public float preferredHeight = 0;
|
||||
[NonSerialized]
|
||||
internal float actualHeight = 0f;
|
||||
|
||||
public bool dontUseTableRowBackground = false;
|
||||
|
||||
protected Image _image;
|
||||
public Image image
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_image == null)
|
||||
{
|
||||
_image = this.GetComponent<Image>();
|
||||
}
|
||||
|
||||
return _image;
|
||||
}
|
||||
}
|
||||
|
||||
private DrivenRectTransformTracker _tracker;
|
||||
|
||||
[SerializeField]
|
||||
private TableLayout m_tableLayout;
|
||||
|
||||
internal void Initialise(TableLayout tableLayout)
|
||||
{
|
||||
m_tableLayout = tableLayout;
|
||||
}
|
||||
|
||||
/*protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
this.useGUILayout = false;
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
base.CalculateLayoutInputHorizontal();
|
||||
Debug.Log("TableRow::Update");
|
||||
UpdateLayout();
|
||||
}*/
|
||||
|
||||
public void UpdateLayout()
|
||||
{
|
||||
_tracker.Clear();
|
||||
|
||||
var cells = Cells;
|
||||
|
||||
foreach (var cell in cells)
|
||||
{
|
||||
var rectTransform = ((RectTransform)cell.transform);
|
||||
|
||||
_tracker.Add(this, rectTransform, DrivenTransformProperties.All);
|
||||
|
||||
rectTransform.pivot = new Vector2(0, 1);
|
||||
rectTransform.sizeDelta = new Vector2(cell.actualWidth, cell.actualHeight);
|
||||
rectTransform.anchoredPosition3D = new Vector3(cell.actualX, cell.actualY, 0);
|
||||
rectTransform.localScale = new Vector3(1, 1, 1);
|
||||
rectTransform.anchorMin = new Vector2(0, 1);
|
||||
rectTransform.anchorMax = new Vector2(0, 1);
|
||||
|
||||
cell.Initialise(m_tableLayout, this);
|
||||
}
|
||||
}
|
||||
|
||||
/*public override void CalculateLayoutInputVertical()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnRectTransformDimensionsChange()
|
||||
{
|
||||
base.OnRectTransformDimensionsChange();
|
||||
}
|
||||
|
||||
public override void SetLayoutHorizontal()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetLayoutVertical()
|
||||
{
|
||||
}*/
|
||||
|
||||
public TableCell AddCell(RectTransform cellContent = null)
|
||||
{
|
||||
var cell = TableLayoutUtilities.InstantiatePrefab("TableLayout/Cell");
|
||||
cell.transform.SetParent(this.transform);
|
||||
cell.transform.SetAsLastSibling();
|
||||
cell.name = "Cell";
|
||||
|
||||
if (cellContent != null)
|
||||
{
|
||||
cellContent.SetParent(cell.transform);
|
||||
cellContent.transform.localScale = new Vector3(1, 1, 1);
|
||||
cellContent.localPosition = Vector3.zero;
|
||||
}
|
||||
|
||||
return cell.GetComponent<TableCell>();
|
||||
}
|
||||
|
||||
public TableCell AddCell(TableCell cell)
|
||||
{
|
||||
cell.transform.SetParent(this.transform);
|
||||
cell.transform.SetAsLastSibling();
|
||||
cell.transform.localScale = new Vector3(1, 1, 1);
|
||||
cell.transform.localRotation = new Quaternion(0, 0, 0, 0);
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
public void NotifyTableRowPropertiesChanged()
|
||||
{
|
||||
if(m_tableLayout != null && m_tableLayout.gameObject.activeInHierarchy) m_tableLayout.CalculateLayoutInputHorizontal();
|
||||
}
|
||||
|
||||
public TableLayout GetTable()
|
||||
{
|
||||
return m_tableLayout;
|
||||
}
|
||||
|
||||
public void ClearCells()
|
||||
{
|
||||
foreach (var cell in Cells)
|
||||
{
|
||||
DestroyImmediate(cell.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
TableRow.cs.meta
Normal file
12
TableRow.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5082d4823641ca42b40e34f1b5c0983
|
||||
timeCreated: 1458837591
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user