void OnEnable() { m_sortingLayerNames = GetSortingLayerNames(); m_tilesetComponent = new TilesetComponent(MyAutoTileMap); if (MyAutoTileMap.MapData != null) { m_mapWidth = MyAutoTileMap.MapData.Data.TileMapWidth; m_mapHeight = MyAutoTileMap.MapData.Data.TileMapHeight; } if (MyAutoTileMap.BrushGizmo != null) { MyAutoTileMap.BrushGizmo.gameObject.SetActive(false); } m_layerList = new ReorderableList(serializedObject, serializedObject.FindProperty("MapLayers"), true, true, true, true); m_layerList.drawElementCallback += _LayerList_DrawElementCallback; m_layerList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Map Layers"); }; m_layerList.onChangedCallback = (ReorderableList list) => { //NOTE: When reordering elements in ReorderableList, elements are not moved, but data is swapped between them. // So if you keep addres of element 0 ex: data = list[0], after reordering element 0 with 1, data will contain the elemnt1 data. // Keeping a reference to MapLayer in TileChunks is useless serializedObject.ApplyModifiedProperties(); // apply adding and removing changes MyAutoTileMap.SaveMap(); MyAutoTileMap.LoadMap(); }; m_layerList.onAddCallback = (ReorderableList list) => { list.index = MyAutoTileMap.MapLayers.Count; // select added layer MyAutoTileMap.AddMapLayer(); }; }
void OnEnable() { m_tilesetComponent = new TilesetComponent( MyAutoTileMap ); if( MyAutoTileMap.MapData != null ) { m_mapWidth = MyAutoTileMap.MapData.Data.TileMapWidth; m_mapHeight = MyAutoTileMap.MapData.Data.TileMapHeight; } if( MyAutoTileMap.BrushGizmo != null ) { MyAutoTileMap.BrushGizmo.gameObject.SetActive(false); } }
private void OnTileSelectionChanged(TilesetComponent source, int newTileId, int tilesetSelStart, int tilesetSelEnd) { s_brushMode = eBrushMode.Paint; }
private void OnTileSelectionChanged(TilesetComponent source, int newTileId, int tilesetSelStart, int tilesetSelEnd) { s_brushMode = eBrushMode.Paint; }
void OnEnable() { m_sortingLayerNames = GetSortingLayerNames(); m_tilesetComponent = new TilesetComponent( MyAutoTileMap ); m_tilesetComponent.OnTileSelectionChanged += OnTileSelectionChanged; if( MyAutoTileMap.MapData != null ) { m_mapWidth = MyAutoTileMap.MapData.Data.TileMapWidth; m_mapHeight = MyAutoTileMap.MapData.Data.TileMapHeight; } if( MyAutoTileMap.BrushGizmo != null ) { MyAutoTileMap.BrushGizmo.gameObject.SetActive(false); } m_layerList = new ReorderableList(serializedObject, serializedObject.FindProperty("MapLayers"), true, true, true, true); m_layerList.drawElementCallback += _LayerList_DrawElementCallback; m_layerList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Map Layers"); }; m_layerList.onChangedCallback = (ReorderableList list) => { //NOTE: When reordering elements in ReorderableList, elements are not moved, but data is swapped between them. // So if you keep addres of element 0 ex: data = list[0], after reordering element 0 with 1, data will contain the elemnt1 data. // Keeping a reference to MapLayer in TileChunks is useless serializedObject.ApplyModifiedProperties(); // apply adding and removing changes MyAutoTileMap.SaveMap(); MyAutoTileMap.LoadMap(); }; m_layerList.onAddCallback = (ReorderableList list) => { list.index = MyAutoTileMap.MapLayers.Count; // select added layer MyAutoTileMap.AddMapLayer(); }; }