public void HandleDrag(IntVector2 tileCoords) { if (_tileCoords == tileCoords) { return; } // For now, do not allow dragging on top of another section since we don't handle multiple sections in one // tile. if (_mutableMapSectionData.TileMetadataMap.ContainsKey(tileCoords) && _mutableMapSectionData.TileMetadataMap[tileCoords].SectionConnection != null) { return; } if (_mutableMapSectionData.TileMetadataMap[_tileCoords].SectionConnection == null) { throw new Exception("Section connection not found in SectionTileMapElement"); } uint?previousConnection = _mutableMapSectionData.TileMetadataMap[_tileCoords].SectionConnection; if (previousConnection != null) { _mutableMapSectionData.ClearSectionConnection(_tileCoords); } _mutableMapSectionData.SetSectionConnection(tileCoords, previousConnection.Value); _tileCoords = tileCoords; }
private void HandleConfirmPressed() { if (_selectedIndex < 0 || _selectedIndex >= _mapData.Sections.Length) { _logger.LogError(LoggedFeature.MapEditor, "Invalid section index: {0}", _selectedIndex); return; } uint sectionIndex = _dropdownIndexMap.FirstOrDefault(x => x.Value == _selectedIndex).Key; _mapSectionData.SetSectionConnection(_tileCoords, sectionIndex); }