Different uniqid when calld in wp_localize_script and shortcode

Inside the __construct() you can put this

global $shortcode_id;
$shortcode_id = 0;

in the display_gallery_shortcode() function you can do this

<?php 
global $shortcode_id;
$shortcode_id ++;
$settings_arr = array();//Here is your settings for each shortcode
ob_start();
?>

<script> 
if(!my_plugin_data) var my_plugin_data = {}
my_plugin_data[<?php echo $shortcode_id ?>] = <?php echo json_encode($settings_arr) ?>
</script>
<div>MY SHORTCODE CONTENT GOES HERE</div>

<?php 
return ob_get_clean();

Try to reload the page and check the variable in the javascript console.

console.log(my_plugin_data);