diff --git a/Assets/QuickSheet/Editor/BaseMachine.cs b/Assets/QuickSheet/Editor/BaseMachine.cs index ff11b28..a0ae8cd 100644 --- a/Assets/QuickSheet/Editor/BaseMachine.cs +++ b/Assets/QuickSheet/Editor/BaseMachine.cs @@ -13,13 +13,13 @@ namespace UnityQuickSheet { [System.Serializable] - public class HeaderColumn + public class ColumnHeader { public CellType type; public string name; public bool isEnable; public bool isArray; - public HeaderColumn nextArrayItem; + public ColumnHeader nextArrayItem; // used to order columns by ascending. (only need on excel-plugin) public int OrderNO { get; set; } @@ -100,22 +100,22 @@ public string WorkSheetName [System.NonSerialized] public bool onlyCreateDataClass = false; - public List HeaderColumnList + public List ColumnHeaderList { - get { return headerColumnList; } - set { headerColumnList = value;} + get { return columnHeaderList; } + set { columnHeaderList = value; } } [SerializeField] - protected List headerColumnList; + protected List columnHeaderList; /// /// Return true, if the list is instantiated and has any its item more than one. /// /// - public bool HasHeadColumn() + public bool HasColumnHeader() { - if (headerColumnList != null && headerColumnList.Count > 0) + if (columnHeaderList != null && columnHeaderList.Count > 0) return true; return false; @@ -126,8 +126,8 @@ public bool HasHeadColumn() protected void OnEnable() { - if (headerColumnList == null) - headerColumnList = new List(); + if (columnHeaderList == null) + columnHeaderList = new List(); } /// diff --git a/Assets/QuickSheet/Editor/BaseMachineEditor.cs b/Assets/QuickSheet/Editor/BaseMachineEditor.cs index 80fa36f..618bd23 100644 --- a/Assets/QuickSheet/Editor/BaseMachineEditor.cs +++ b/Assets/QuickSheet/Editor/BaseMachineEditor.cs @@ -180,7 +180,7 @@ protected void CreateDataClassScript(BaseMachine machine, ScriptPrescription sp) List fieldList = new List(); //FIXME: replace ValueType to CellType and support Enum type. - foreach (HeaderColumn header in machine.HeaderColumnList) + foreach (ColumnHeader header in machine.ColumnHeaderList) { MemberFieldData member = new MemberFieldData(); member.Name = header.name; @@ -283,7 +283,7 @@ protected string GetAbsoluteBuiltinTemplatePath() protected void DrawHeaderSetting(BaseMachine m) { - if (m.HasHeadColumn()) + if (m.HasColumnHeader()) { GUIStyle headerStyle = GUIHelper.MakeHeader(); GUILayout.Label("Type Settings:", headerStyle); @@ -304,7 +304,7 @@ protected void DrawHeaderSetting(BaseMachine m) EditorGUILayout.BeginVertical("box"); //string lastCellName = string.Empty; - foreach (HeaderColumn header in m.HeaderColumnList) + foreach (ColumnHeader header in m.ColumnHeaderList) { GUILayout.BeginHorizontal(); diff --git a/Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs b/Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs index 30fe084..262d2de 100644 --- a/Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs +++ b/Assets/QuickSheet/ExcelPlugin/Editor/ExcelMachineEditor.cs @@ -125,7 +125,7 @@ Set a folder under the 'Assets' folder! \n GUILayout.BeginHorizontal(); - if (machine.HasHeadColumn()) + if (machine.HasColumnHeader()) { if (GUILayout.Button("Update")) Import(); @@ -232,36 +232,36 @@ protected override void Import(bool reimport = false) List titleList = titles.ToList(); - if (machine.HasHeadColumn() && reimport == false) + if (machine.HasColumnHeader() && reimport == false) { - var headerDic = machine.HeaderColumnList.ToDictionary(header => header.name); + var headerDic = machine.ColumnHeaderList.ToDictionary(header => header.name); // collect non-changed column headers var exist = from t in titleList where headerDic.ContainsKey(t) == true - select new HeaderColumn { name = t, type = headerDic[t].type, isArray = headerDic[t].isArray, OrderNO = headerDic[t].OrderNO }; + select new ColumnHeader { name = t, type = headerDic[t].type, isArray = headerDic[t].isArray, OrderNO = headerDic[t].OrderNO }; // collect newly added or changed column headers var changed = from t in titleList where headerDic.ContainsKey(t) == false - select new HeaderColumn { name = t, type = CellType.Undefined, OrderNO = titleList.IndexOf(t) }; + select new ColumnHeader { name = t, type = CellType.Undefined, OrderNO = titleList.IndexOf(t) }; // merge two list via LINQ var merged = exist.Union(changed).OrderBy(x => x.OrderNO); - machine.HeaderColumnList.Clear(); - machine.HeaderColumnList = merged.ToList(); + machine.ColumnHeaderList.Clear(); + machine.ColumnHeaderList = merged.ToList(); } else { - machine.HeaderColumnList.Clear(); + machine.ColumnHeaderList.Clear(); if (titles != null) { int i = 0; foreach (string s in titles) { - machine.HeaderColumnList.Add(new HeaderColumn { name = s, type = CellType.Undefined, OrderNO = i }); + machine.ColumnHeaderList.Add(new ColumnHeader { name = s, type = CellType.Undefined, OrderNO = i }); i++; } } diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GoogleMachineEditor.cs b/Assets/QuickSheet/GDataPlugin/Editor/GoogleMachineEditor.cs index a4111fc..fe5dadb 100644 --- a/Assets/QuickSheet/GDataPlugin/Editor/GoogleMachineEditor.cs +++ b/Assets/QuickSheet/GDataPlugin/Editor/GoogleMachineEditor.cs @@ -101,7 +101,7 @@ public override void OnInspectorGUI() GUILayout.BeginHorizontal(); - if (machine.HasHeadColumn()) + if (machine.HasColumnHeader()) { if (GUILayout.Button("Update")) Import(); @@ -201,13 +201,13 @@ protected override void Import(bool reimport = false) Regex re = new Regex(@"\d+"); - Dictionary headerDic = null; + Dictionary headerDic = null; if (reimport) - machine.HeaderColumnList.Clear(); + machine.ColumnHeaderList.Clear(); else - headerDic = machine.HeaderColumnList.ToDictionary(k => k.name); + headerDic = machine.ColumnHeaderList.ToDictionary(k => k.name); - List tmpColumnList = new List(); + List tmpColumnList = new List(); // query the first columns only. DoCellQuery((cell) => @@ -228,12 +228,12 @@ protected override void Import(bool reimport = false) return; } - HeaderColumn column = new HeaderColumn(); + ColumnHeader column = new ColumnHeader(); column.name = cell.Value; if (headerDic != null && headerDic.ContainsKey(cell.Value)) { // if the column is already exist, copy its name and type from the exist one. - HeaderColumn h = machine.HeaderColumnList.Find(x => x.name == column.name); + ColumnHeader h = machine.ColumnHeaderList.Find(x => x.name == column.name); if (h != null) { column.type = h.type; @@ -249,7 +249,7 @@ protected override void Import(bool reimport = false) }); // update (all of settings are reset when it reimports) - machine.HeaderColumnList = tmpColumnList; + machine.ColumnHeaderList = tmpColumnList; EditorUtility.SetDirty(machine); AssetDatabase.SaveAssets();