private void RefreshConstatnts() { //если произошло обновление высоты и ширины if (MapConstants.height != height.intValue || MapConstants.width != width.intValue) { //HexConstructor.IncreaseSurface(height.intValue, width.intValue); MapConstants.height = height.intValue; MapConstants.width = width.intValue; HexConstructor.CreateSurface(height.intValue, width.intValue); } }
public override void OnInspectorGUI() { //DrawDefaultInspector(); string path = ""; obj.Update(); EditorGUI.BeginChangeCheck(); RefreshParams(MapConstants.height, MapConstants.width); GUILayout.Label("MapConstants.height: " + height.intValue); GUILayout.Label("MapConstants.width: " + width.intValue); EditorGUILayout.PropertyField(height); EditorGUILayout.PropertyField(width); RefreshConstatnts(); if (EditorGUI.EndChangeCheck()) { obj.ApplyModifiedProperties(); GUI.FocusControl(null); } if (GUILayout.Button("Save File")) { path = SaveDialog("Save File", "txt"); if (path != "") { SaveSurface(path); } } if (GUILayout.Button("Open File")) { path = OpenDialog("Open File", "*"); if (path != "") { LoadSurface(path); } } if (GUILayout.Button("Refresh Map")) { RefreshParams(10, 10); HexConstructor.CreateSurface(height.intValue, width.intValue); RefreshConstatnts(); } EditorGUILayout.HelpBox("Save and Open file *.txt for level map", MessageType.Info); }