public static void CreateCellTypeEditor() { if (HexMapCellTypeWindow.instance) { DestroyImmediate(HexMapCellTypeWindow.instance); } guiSkin = Utility.GetSkin(); HexMapCellTypeWindow.instance = ScriptableObject.CreateInstance <HexMapCellTypeWindow>(); SceneView.FrameLastActiveSceneView(); }
void OnGUI() { EditorGUILayout.Space(); mapCell = EditorGUILayout.ObjectField(mapCell, typeof(HexCell), true) as HexCell; cellLabelPrefab = EditorGUILayout.ObjectField(cellLabelPrefab, typeof(Text), true) as Text; chunkPrefab = EditorGUILayout.ObjectField(chunkPrefab, typeof(HexGridChunk), true) as HexGridChunk; noiseSource = EditorGUILayout.ObjectField(noiseSource, typeof(Texture), true) as Texture2D; mapSizeX = EditorGUILayout.IntField("地图长:", mapSizeX); mapSizeY = EditorGUILayout.IntField("地图宽:", mapSizeY); EditorGUILayout.Space(); if (GUILayout.Button("生成地图预览")) { if (mapCell == null) { Debug.LogError("没有地图格子预制体"); return; } GenerateMap(); isCreate = true; } if (isCreate) { for (int i = 0; i < HexMapEditor.HexGrid.chunks.Length; i++) { HexMapEditor.HexGrid.chunks[i].LateRefresh(); } } if (GUILayout.Button("打开怪物资源")) { SceneEditorWindow.CreateDungeonEditor(); } if (GUILayout.Button("打开地图数据编辑")) { HexMapCellTypeWindow.CreateCellTypeEditor(); } if (GUILayout.Button("保存当前场景数据到Json")) { MapEditorData.ExportJSON(); } }
public HexMapCellTypeWindow() { HexMapCellTypeWindow.instance = this; SceneView.onSceneGUIDelegate += SceneUpdate; }