private void UpdateMinMaxValues(TableUI tu) { if (groupSelectionMethod.Equals(GroupSelectionMethod.MinMax)) { return; } if (groupSelectionMethod.Equals(GroupSelectionMethod.Header)) { min.x = 0; min.y = 0; max.x = tu.Header ? tu.Columns : 0; max.y = tu.Header ? 1 : 0; } else if (groupSelectionMethod.Equals(GroupSelectionMethod.Body)) { min.x = 0; min.y = tu.Header ? 1 : 0; max.x = tu.Columns; max.y = tu.Rows; } else if (groupSelectionMethod.Equals(GroupSelectionMethod.All)) { min.x = 0; min.y = 0; max.x = tu.Columns; max.y = tu.Rows; } }
void ApplyProperty(string oriProp, string targetProp, Action <TextMeshProUGUI> extraAction = null) { TableUI tu = GetComponent <TableUI>(); UpdateMinMaxValues(tu); Type t = GetType(); PropertyInfo prop = t.GetProperty(oriProp); for (int i = min.x; i < max.x; i++) { for (int j = min.y; j < max.y; j++) { try { TextMeshProUGUI tmp = tu.data[j].list[i]; typeof(TextMeshProUGUI).GetProperty(targetProp).SetValue(tmp, prop.GetValue(this)); Utils.SetDirty(tmp); extraAction?.Invoke(tmp); } catch (System.Exception) { } } } }
private void OnEnable() { if (tu == null) { tu = target as TableUI; } Undo.undoRedoPerformed += tu.OnUndoRedoEvent; if (tu.bodyCellProperties.textPropertiesUndoEvent == null) { tu.bodyCellProperties.textPropertiesUndoEvent += tu.RefreshBodyTextProperties; } if (tu.headerCellProperties.textPropertiesUndoEvent == null) { tu.headerCellProperties.textPropertiesUndoEvent += tu.RefreshHeaderTextProperties; } if (bodyCellPropertiesEditor == null) { bodyCellPropertiesEditor = CreateEditor(tu.bodyCellProperties); } if (headerCellPropertiesEditor == null) { headerCellPropertiesEditor = CreateEditor(tu.headerCellProperties); } if (labelStyle == null) { labelStyle = new GUIStyle() { fontStyle = FontStyle.Bold, fontSize = 15 } } ; if (labelStyle2 == null) { labelStyle2 = new GUIStyle() { fontStyle = FontStyle.Bold } } ; if (box == null) { box = new GUIStyle("box"); } }