/// <summary> /// 显示Title /// </summary> private void GUITitleInfo() { GUI.color = new Color(0.8f, 0.8f, 0.8f); GUILayout.BeginHorizontal("OL Title"); GUI.color = Color.white; GUILayout.Space(-5); if (GUILayout.Button("保存", EditorGUIStyle.GetMiddleButton, GUILayout.ExpandHeight(true), GUILayout.Width(100))) { this.ShowNotification(new GUIContent("正在保存。。。")); _primaryKeyInfo.Values.Clear(); for (int i = 0; i < _serializeData.DataList.Count; i++) { string value = _serializeData.DataList[i].T2.ToString(); if (!_primaryKeyInfo.Values.ContainsKey(value)) { _primaryKeyInfo.Values.Add(value, 1); } else { _primaryKeyInfo.Values[value]++; } } TableDatabaseUtils.SavaGlobalData(); EditorUtility.SetDirty(_serializeData); AssetDatabase.SaveAssets(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("添加", EditorGUIStyle.GetMiddleButton, GUILayout.ExpandHeight(true), GUILayout.Width(100))) { Test2 data = new Test2(); _serializeData.DataList.Add(data); if (_primaryKeyInfo.Values.ContainsKey(data.T2.ToString())) { _primaryKeyInfo.Values[data.T2.ToString()]++; } else { _primaryKeyInfo.Values.Add(data.T2.ToString(), 1); } _pageMaxNum = (_serializeData.DataList.Count / _excelConfig.ShowCount); if (_serializeData.DataList.Count % _excelConfig.ShowCount > 0) { _pageMaxNum++; } _pageNum = 1; } GUILayout.Space(-5); GUILayout.EndHorizontal(); }
private void SettingGUI() { GUI.color = new Color(0.8f, 0.8f, 0.8f); GUILayout.BeginHorizontal("OL Title"); GUI.color = Color.white; GUILayout.Space(5); GUILayout.Label("Vector分割符:"); TableDatabaseUtils.TableConfigSerializeData.Setting.SplitVecChar = GUILayout.TextField(TableDatabaseUtils.TableConfigSerializeData.Setting.SplitVecChar, GUILayout.Width(40)); GUILayout.Space(5); GUILayout.Label("List分隔符:"); TableDatabaseUtils.TableConfigSerializeData.Setting.SplitListChar = GUILayout.TextField(TableDatabaseUtils.TableConfigSerializeData.Setting.SplitListChar, GUILayout.Width(40)); GUILayout.Space(5); if (GUILayout.Button("保存配置")) { TableDatabaseUtils.SavaGlobalData(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
private void CheckPlayerData() { for (int i = 0; i < TableDatabaseUtils.TableConfigSerializeData.TableConfigList.Count; i++) { if (TableDatabaseUtils.TableConfigSerializeData.TableConfigList[i].TableName == "Test2") { _tableConfig = TableDatabaseUtils.TableConfigSerializeData.TableConfigList[i]; break; } } if (string.IsNullOrEmpty(_tableConfig.DataPath)) { string path = EditorUtility.SaveFilePanelInProject("保存文件", _tableConfig.TableName + ".asset", "asset", ""); if (string.IsNullOrEmpty(path)) { if (EditorUtility.DisplayDialog("保存失败", "路径为空!!!", "OK")) { return; } } _tableConfig.DataPath = path; _serializeData = ScriptableObject.CreateInstance <Test2SerializeData>(); TableDatabaseUtils.PrimaryKeySerializeData.PrimaryKeyDic.Add(_tableConfig.TableName, new PrimaryKeyInfo()); _primaryKeyInfo = TableDatabaseUtils.PrimaryKeySerializeData.PrimaryKeyDic[_tableConfig.TableName]; _primaryKeyInfo.TableName = _tableConfig.TableName; _primaryKeyInfo.PrimaryKey = _tableConfig.PrimaryKey; _primaryKeyInfo.PrimaryType = _tableConfig.PrimaryType; _primaryKeyInfo.Values = new Dictionary <string, int>(); TableDatabaseUtils.SavaGlobalData(); AssetDatabase.CreateAsset(_serializeData, path); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } else { _serializeData = AssetDatabase.LoadAssetAtPath <Test2SerializeData>(_tableConfig.DataPath); _primaryKeyInfo = TableDatabaseUtils.PrimaryKeySerializeData.PrimaryKeyDic[_tableConfig.TableName]; if (_tableConfig.PrimaryKey != _primaryKeyInfo.PrimaryKey) { //更换主键 _primaryKeyInfo.TableName = _tableConfig.TableName; _primaryKeyInfo.PrimaryKey = _tableConfig.PrimaryKey; _primaryKeyInfo.PrimaryType = _tableConfig.PrimaryType; _primaryKeyInfo.Values = new Dictionary <string, int>(); for (int i = 0; i < _serializeData.DataList.Count; i++) { string value = _serializeData.DataList[i].T2.ToString(); if (!_primaryKeyInfo.Values.ContainsKey(value)) { _primaryKeyInfo.Values.Add(value, 1); } else { _primaryKeyInfo.Values[value]++; } } TableDatabaseUtils.SavaGlobalData(); } } _dataList = new List <Test2>(); _dataList.AddRange(_serializeData.DataList); }
private void WriteConfig() { TableDatabaseUtils.SavaGlobalData(); //EditorUtility.SetDirty(TableDatabaseUtils.TableConfigSerializeData); AssetDatabase.SaveAssets(); }
private void OnDestroy() { _excelConfig.ColumnsWidth[_excelConfig.ColumnsWidth.Count - 1] = TableDatabaseUtils.TableConfigSerializeData.Setting.ColumnWidth; EditorUtility.SetDirty(_excelConfig); TableDatabaseUtils.SavaGlobalData(); }