private bool P_PopulateTable(List <WeaponItem> input) { TableItemType = input[0].GetType(); for (int i = 0; i < input.Count; i++) { tempRow0 = CreateNewRow(input[i]); tempRow0.name = input[i].Name; tempRow0.AddNewDisplayItem(input[i].Name, Columns[0]); tempRow0.AddNewItem(input[i].Category, Columns[1]); tempRow0.AddNewItem(input[i].Skill, Columns[2]); tempRow0.AddNewItem(input[i].Damage.ToString(), Columns[3]); tempRow0.AddNewItem(input[i].Crit.ToString(), Columns[4]); tempRow0.AddNewItem(input[i].Range, Columns[5]); tempRow0.AddNewItem(input[i].Encumbrance.ToString(), Columns[6]); tempRow0.AddNewItem(input[i].HP.ToString(), Columns[7]); tempRow0.AddNewItem(input[i].Price.ToString(), Columns[8]); tempRow0.AddNewItem(input[i].Rarity.ToString(), Columns[9]); tempRow0.AddNewItem(input[i].Special, Columns[10]); string nav = Overlord.dControl.BookFromIndex(input[i].Index); tempRow0.AddNewItem(nav, Columns[11]); tempRow0.SetNavString(nav); Rows.Add(tempRow0); } ResizeAllRows(); return(true); }
private SW_Row CreateNewRow(object databaseObject) { tempRow1 = Instantiate(Overlord.RowPrefab); tempRow1.transform.SetParent(TableContentHolder.transform, false); tempRow1.Overlord = Overlord; tempRow1.Table = this; tempRow1.DatabaseObject = databaseObject; return(tempRow1); }
private bool P_PopulateTable(List <BookItem> input) { TableItemType = input[0].GetType(); for (int i = 0; i < input.Count; i++) { tempRow0 = CreateNewRow(input[i]); tempRow0.name = input[i].Name; tempRow0.AddNewDisplayItem(input[i].Name, Columns[0]); tempRow0.AddNewItem(input[i].System, Columns[1]); tempRow0.AddNewItem(input[i].Key, Columns[2]); Rows.Add(tempRow0); } return(true); }
public void Initialize(SW_Column column, string text, SW_Table_Overlord overlord, SW_Row row) { layout = GetComponent <LayoutElement>(); textUI = GetComponentInChildren <TextMeshProUGUI>(); if (!textUI) { textUI = GetComponent <TextMeshProUGUI>(); } Overlord = overlord; itemRow = row; textUI.text = text; Value = text; layout.minWidth = column.minWidth; if (column.flexWidth) { layout.flexibleWidth = 1; } }
public void Initialize(float min, bool flex, string text, SW_Table_Overlord overlord, SW_Row row, string navigationString) { layout = GetComponent <LayoutElement>(); textUI = GetComponentInChildren <TextMeshProUGUI>(); if (!textUI) { textUI = GetComponent <TextMeshProUGUI>(); } Overlord = overlord; itemRow = row; textUI.text = text; Value = text; layout.minWidth = min; if (flex) { layout.flexibleWidth = 1; } NavString = navigationString; }
/// <summary> /// Open the filters menu for the selected table /// </summary> /// <param name="titleRow">The table's title row. Used to set Filter titles</param> /// <param name="valueRow">The table's first actual row, used to find what filters need to be created for this table.</param> public void OpenFilters(SW_Row titleRow, SW_Row valueRow) { TitleRow = titleRow; if (Filters.Count == 0) { Filters = new List <SW_Table_Filter>(); if (GetComponentsInChildren <SW_Table_Filter>().Length > 0) { for (int i = 0; i < GetComponentsInChildren <SW_Table_Filter>().Length; i++) { Filters.Add(GetComponentsInChildren <SW_Table_Filter>()[i]); } return; } string title = ""; List <string> propNames = new List <string>(); PropertyInfo propInfo; FilterType fType = 0; SW_Table_Filter filter = null; for (int i = 0; i < valueRow.DatabaseObject.GetType().GetProperties().Length; i++) { propNames.Add(valueRow.DatabaseObject.GetType().GetProperties()[i].Name); } for (int i = 0; i < propNames.Count; i++) { filter = null; fType = FilterType.None; string lower = propNames[i].ToLower(); int ID = 0; for (int j = 0; j < TitleRow.Items.Count - 1; j++) { if (!lower.Contains("price") && !lower.Contains("notes") && !lower.Contains("name")) { if (TitleRow.Items[j].name.ToLower().Contains(lower)) { propInfo = valueRow.DatabaseObject.GetType().GetProperty(propNames[i]); if (propInfo.PropertyType == typeof(string)) { int num = 0; if (Int32.TryParse(valueRow.Items[j].Value, out num)) { fType = FilterType.MinMax; } else { fType = FilterType.Dropdown; } } else { fType = FilterType.MinMax; } ID = j; title = propInfo.Name; } } else if (lower.Contains("price") && TitleRow.Items[j].name.ToLower().Contains("price")) { title = "Price"; fType = FilterType.Price; ID = j; } //Debug.Log(lower +"-"+ fType); } switch (fType) { case FilterType.Dropdown: filter = Instantiate(DropdownPrefab); filter.SetDropdownOptions(Table.RetrieveUniqueStrings(ID)); break; case FilterType.MinMax: filter = Instantiate(MinMaxPrefab); break; case FilterType.Price: filter = Instantiate(PricePrefab); break; case FilterType.None: filter = null; break; default: filter = null; break; } if (filter) { Filters.Add(filter); filter.transform.SetParent(transform, false); filter.Initialize(this, fType, title, ID); } } fitter.enabled = false; fitter.enabled = true; } if (fitter.enabled) { StartCoroutine(DisableFitting()); } }