void Start() { MakeDefaults.Set(); this.table = this.GetComponent <Table>(); this.table.ResetTable(); this.table.AddInputColumn(this.OnInputFieldChange); this.table.AddInputColumn(this.OnInputFieldChange); this.table.AddInputColumn(this.OnInputFieldChange); this.table.AddInputColumn(this.OnInputFieldChange); this.table.AddInputColumn(this.OnInputFieldChange); // Initialize Your Table this.table.Initialize(this.OnTableSelected); // Populate Your Rows (obviously this would be real data here) for (int i = 0; i < 100; i++) { Datum d = Datum.Body(i.ToString()); d.elements.Add(i.ToString()); d.elements.Add("Col2:Row" + i.ToString()); d.elements.Add("Col3:Row" + i.ToString()); d.elements.Add("Col4:Row" + i.ToString()); d.elements.Add("Col5:Row" + i.ToString()); this.table.data.Add(d); } // Draw Your Table this.table.StartRenderEngine(); }
void Start() { // this instantiates default fonts for ALL tables when not explicitely defined on an individual table // ProTip: You don't need to do this if you just set a font for your table in the editor MakeDefaults.Set(); this.table = this.GetComponent <Table>(); this.table.ResetTable(); this.table.AddTextColumn("Column1"); this.table.AddTextColumn("Column2"); this.table.AddTextColumn("Column3"); // Initialize Your Table this.table.Initialize(this.OnTableSelected); // Populate Your Rows (obviously this would be real data here) for (int i = 0; i < Simple.ROWS; i++) { Datum d = Datum.Body(i.ToString()); d.elements.Add("Col1:Row" + i.ToString()); d.elements[0].color = new Color(0, .5f, 0.8f); d.elements[0].backgroundColor = new Color(0.2f, 0, 0); d.elements.Add("Col2:Row" + i.ToString()); d.elements.Add("Col3:Row" + i.ToString()); this.table.data.Add(d); } // Draw Your Table this.table.StartRenderEngine(); }
void BuildTempKong() { MakeDefaults.Set(); table = GetComponent <Table>(); table.ResetTable(); float percents = 0f; ColumnDataTempDocument.ForEach(x => percents += x.widthPercent); float onePeace = width / percents; foreach (TableColumnsData data in ColumnDataTempDocument) { Debug.Log(data.widthPercent); table.AddTextColumn(data.name, null, onePeace * data.widthPercent - 5, 1000f); } table.Initialize(); for (int i = 0; i < 5; i++) { Datum d = Datum.Body(i.ToString()); d.elements.Add("EDAS07F9" + i.ToString()); d.elements.Add("新建 Microsoft Word 文档.docx"); d.elements.Add("相关资料"); d.elements.Add("张三"); d.elements.Add("2017-11-11 11:11:11"); d.elements.Add("下载到本地"); table.data.Add(d); } table.StartRenderEngine(); }
void Start() { this.table = this.GetComponent <Table>(); this.table.ResetTable(); this.table.AddTextColumn(); this.table.AddTextColumn(); this.table.AddTextColumn(); // Initialize Your Table this.table.Initialize(this.OnTableSelected); // Populate Your Rows (obviously this would be real data here) for (int i = 0; i < 100; i++) { Datum d = Datum.Body(i.ToString()); d.elements.Add("Col1:Row" + i.ToString()); d.elements[0].color = Color.green; d.elements.Add("Col2:Row" + i.ToString()); d.elements.Add("Col3:Row" + i.ToString()); this.table.data.Add(d); } // Draw Your Table this.table.StartRenderEngine(); }
public void BuildStandingBook(List <TableClassEquipmentStandingBook> datas, Action <Datum, Column> clickDelegate) { if (datas == null) { datas = TableClassEquipmentStandingBook.TestData; } MakeDefaults.Set(); table = GetComponent <Table>(); table.ResetTable(); float percents = 0f; ColumnDataStandingBook.ForEach(x => percents += x.widthPercent); float onePeace = width / percents; foreach (TableColumnsData data in ColumnDataStandingBook) { table.AddTextColumn(data.name, null, onePeace * data.widthPercent - 5, 200f).horAlignment = Column.HorAlignment.CENTER; } if (clickDelegate != null) { table.Initialize(clickDelegate); } else { table.Initialize(); } foreach (TableClassEquipmentStandingBook data in datas) { Datum d = Datum.Body(data.No); d.elements.Add(data.No); d.elements.Add(data.equipmentType); d.elements.Add(data.type); d.elements.Add(data.technical); d.elements.Add(data.brand); d.elements.Add(data.supplier); d.elements.Add(data.enterTime); d.elements.Add(data.enterResponsePerson); d.elements.Add(data.debugStatus); d.elements.Add(data.checkTime); d.elements.Add(data.checkResponsePerson); d.elements.Add(data.setupLocation); d.elements.Add(data.guaranteePeriod); d.elements.Add(data.transferTime); d.elements.Add("选择文件"); d.elements.Add("查看"); d.elements.Add("定位"); table.data.Add(d); } table.StartRenderEngine(); }
private Datum MakeDatum(string pfx) { string sfx = Time.realtimeSinceStartup.ToString(); Datum d = Datum.Body(sfx); d.elements.Add("Col1:" + pfx + ":" + sfx); d.elements.Add("Col2:" + pfx + ":" + sfx); d.elements.Add("Col3:" + pfx + ":" + sfx); d.elements.Add("Col4:" + pfx + ":" + sfx); d.elements.Add("Col5:" + pfx + ":" + sfx); return(d); }
void BuildMaintenance(List <TableClassEquipmentMaintenance> datas) { if (datas == null) { datas = TableClassEquipmentMaintenance.RandomClassData(30); } MakeDefaults.Set(); table = GetComponent <Table>(); table.ResetTable(); float percents = 0f; ColumnDataMaintenance.ForEach(x => percents += x.widthPercent); float onePeace = width / percents; foreach (TableColumnsData data in ColumnDataStandingBook) { table.AddTextColumn(data.name, null, onePeace * data.widthPercent - 5, 200f); } table.Initialize(); foreach (TableClassEquipmentMaintenance data in datas) { Datum d = Datum.Body(data.No); d.elements.Add(data.No); d.elements.Add(data.name); d.elements.Add(data.type); d.elements.Add(data.technical); d.elements.Add(data.useLocation); d.elements.Add(data.supplier); d.elements.Add(data.beginTime); d.elements.Add(data.intervalMonth); d.elements.Add(data.checkPerson); d.elements.Add(data.checkTime); d.elements.Add(data.maintenanceRecord); d.elements.Add(data.maintenanceTime); d.elements.Add(data.maintenanceContent); d.elements.Add(data.maintenanceLevel); d.elements.Add(data.maintenancePrice); d.elements.Add("查看"); table.data.Add(d); } table.StartRenderEngine(); }
private Datum MakeDatum(string pfx) { string sfx = Time.realtimeSinceStartup.ToString(); Datum d = Datum.Body(sfx); d.elements.Add(this.RandomSprite()); d.elements.Add("Col1:" + pfx + ":" + sfx); d.elements.Add("Col2:" + pfx + ":" + sfx); d.elements.Add(this.RandomSprite()); d.elements.Add("Col4:" + pfx + ":" + sfx); d.elements.Add("Col5:" + pfx + ":" + sfx); d.elements.Add(this.RandomSprite()); string c7 = "Col7:" + pfx + ":" + sfx; int words = Random.Range(0, 40); for (int i = 0; i < words; i++) { c7 += ": WORD" + i.ToString(); } d.elements.Add(c7); return(d); }
private Datum MakeData(bool isHeader = false, bool isFooter = false) { float i = Time.realtimeSinceStartup; Datum d; if (isHeader) { d = Datum.Header(); } else if (isFooter) { d = Datum.Footer(); } else { d = Datum.Body(i.ToString()); } for (int j = 0; j < table.columns.Count; j++) { d.elements.Add(j.ToString() + "_" + i.ToString()); } return(d); }
private void DoTable(int numCols, int numRows, bool initial = false) { this.colCount = numCols; this.rowCount = numRows; this.table.ResetTable(); System.Random rand = new System.Random(); Datum d; for (int i = 0; i < this.colCount; i++) { Column c; if (initial) { if (i == 0 || i == 1) { c = this.table.AddImageColumn("ICON_" + i.ToString(), "Foot" + i.ToString(), 50, 50); } else { c = this.table.AddTextColumn("TEXT_" + i.ToString(), "Foot" + i.ToString()); if (i == 2) { c.horAlignment = Column.HorAlignment.CENTER; } if (i == 3) { c.horAlignment = Column.HorAlignment.RIGHT; } } } } this.table.Initialize(this.SelectionCallback, this.spriteDict); char[] cnames = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToCharArray(); List <string> keyList = new List <string> (this.spriteDict.Keys); for (int i = 0; i < this.rowCount; i++) { d = Datum.Body(i.ToString()); for (int j = 0; j < this.table.columns.Count; j++) { if (j == 0 || j == 1) { d.elements.Add(keyList[rand.Next(keyList.Count)]); } else if (j == 3) { d.elements.Add(rand.Next(9).ToString()); } else { d.elements.Add (i.ToString() + ":" + cnames[j].ToString()); } } this.table.data.Add(d); } this.table.StartRenderEngine(); }
private void OnHeaderClick(Column column, PointerEventData e) { bool isAscending = false; // Reset current sort UI for (int i = 0; i < this.table.columns.Count; i++) { if (column == this.table.columns[i]) { if (column.headerIcon == "UP") { isAscending = true; column.headerIcon = "DOWN"; } else { isAscending = false; column.headerIcon = "UP"; } } else { this.table.columns[i].headerIcon = null; } } // do the sort this.poplist.Sort( delegate(DataTableData.Population p1, DataTableData.Population p2) { // RANK if (column.idx == 0) { if (isAscending) { return(p1.rank.CompareTo(p2.rank)); } else { return(p2.rank.CompareTo(p1.rank)); } } // CITY if (column.idx == 1) { if (isAscending) { return(p1.city.CompareTo(p2.city)); } else { return(p2.city.CompareTo(p1.city)); } } // COUNTRY if (column.idx == 2) { if (isAscending) { return(p1.country.CompareTo(p2.country)); } else { return(p2.country.CompareTo(p1.country)); } } // POPULATION if (column.idx == 3) { if (isAscending) { return(p1.population.CompareTo(p2.population)); } else { return(p2.population.CompareTo(p1.population)); } } // ICON if (column.idx == 4) { if (isAscending) { return(p1.iconIndex.CompareTo(p2.iconIndex)); } else { return(p2.iconIndex.CompareTo(p1.iconIndex)); } } // DENSITY if (column.idx == 5) { if (isAscending) { return(p1.density.CompareTo(p2.density)); } else { return(p2.density.CompareTo(p1.density)); } } // SIZE if (column.idx == 6) { if (isAscending) { return(p1.sqkm.CompareTo(p2.sqkm)); } else { return(p2.sqkm.CompareTo(p1.sqkm)); } } return(p1.rank.CompareTo(p2.rank)); } ); this.table.data.Clear(); for (int i = 0; i < this.poplist.Count; i++) { DataTableData.Population p = this.poplist[i]; Datum d = Datum.Body(i.ToString()); d.elements.Add(p.rank.ToString()); d.elements.Add(p.city); d.elements.Add(p.country); d.elements.Add(p.population.ToString("#,##0")); d.elements.Add(this.spriteNames[p.iconIndex]); d.elements.Add(p.density.ToString("#,##0")); d.elements.Add(p.sqkm.ToString("#,##0.0")); if (!string.IsNullOrEmpty(p.extraText)) { d.extraText = new Element(d, p.extraText); } this.table.data.Add(d); } }