查看: 6158|回复: 11

[原创发布] 强迫症阴影图块

[复制链接]
梦石
0
星屑
55
在线时间
20 小时
注册时间
2008-3-7
回帖
10
发表于 2017-4-30 16:38:32 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
实在是受不了原作的阴影系统然后就自己画了一个
使用前:
Map002.png
使用后:
Map001.png
下载:
yinying.png

评分

参与人数 2赞 +2 收起 理由
白嫩白嫩的 + 1 精品文章
2498126422 + 1 塞糖

查看全部评分

梦石
0
星屑
55
在线时间
20 小时
注册时间
2008-3-7
回帖
10
 楼主| 发表于 2017-4-30 16:40:17 | 显示全部楼层
谁有办法可以按原分辨率把地图存成jpg

点评

jpg是压缩格式吧?是不是存png更好?  发表于 2017-4-30 17:15
回复

使用道具 举报

梦石
0
星屑
55
在线时间
407 小时
注册时间
2011-4-10
回帖
352
发表于 2017-4-30 17:25:08 | 显示全部楼层
Galleesen 发表于 2017-4-30 16:40
谁有办法可以按原分辨率把地图存成jpg
  1. /*=============================================================================
  2. * Orange - Mapshot
  3. * By Hudell - [url]www.hudell.com[/url]
  4. * OrangeMapshot.js
  5. * Version: 1.7
  6. * Free for commercial and non commercial use.
  7. *=============================================================================*/
  8. /*:
  9. * @plugindesc This plugin will save a picture of the entire map on a Mapshots folder when you press a key. <OrangeMapshot>
  10. * @author Hudell
  11. *
  12. * @param useMapName
  13. * @desc if true, the filename will be the name of the map. If false it will be the number.
  14. * @default true
  15. *
  16. * @param layerType
  17. * @desc 0 = all, 1 = upper and lower, 2 = separate everything
  18. * @default 0
  19. *
  20. * @param drawAutoShadows
  21. * @desc set this to false to disable autoshadows on the map shot
  22. * @default true
  23. *
  24. * @param drawEvents
  25. * @desc set this to false to stop drawing the events on the full bitmap
  26. * @default true
  27. *
  28. * @param keyCode
  29. * @desc code of the key that will be used (44 = printscreen). [url]http://link.hudell.com/js-keys[/url]
  30. * @default 44
  31. *
  32. * @param imageType
  33. * @desc What type of image should be generated. Can be png, jpeg or webp
  34. * @default png
  35. *
  36. * @param imageQuality
  37. * @desc If the imageType is jpeg or webp, you can set this to a number between 0 and 100 indicating the quality of the image
  38. * @default 70
  39. *
  40. * @param imagePath
  41. * @desc The path where the images will be saved
  42. * @default ./Mapshots
  43. *
  44. * @help
  45. * Check keycodes at  [url]http://link.hudell.com/js-keys[/url]
  46. */
  47. var Imported = Imported || {};

  48. var OrangeMapshot = OrangeMapshot || {};

  49. (function($) {
  50.   "use strict";

  51.   var parameters = $plugins.filter(function(plugin) {
  52.     return plugin.description.indexOf('<OrangeMapshot>') >= 0;
  53.   });
  54.   if (parameters.length === 0) {
  55.     throw new Error("Couldn't find OrangeMapshot parameters.");
  56.   }
  57.   $.Parameters = parameters[0].parameters;

  58.   $.Param = {};
  59.   $.Param.useMapName = $.Parameters.useMapName !== "false";
  60.   $.Param.drawAutoShadows = $.Parameters.drawAutoShadows !== "false";
  61.   $.Param.drawEvents = $.Parameters.drawEvents !== "false";
  62.   $.Param.layerType = Number($.Parameters.layerType || 0);
  63.   $.Param.imageType = $.Parameters.imageType || 'png';
  64.   $.Param.imagePath = $.Parameters.imagePath || './Mapshots';
  65.   $.Param.imageQuality = Number($.Parameters.imageQuality || 70);

  66.   $.Param.keyCode = Number($.Parameters.keyCode || 44);

  67.   $.imageType = function() {
  68.     if ($.Param.imageType == 'webp') return 'image/webp';
  69.     if ($.Param.imageType == 'jpeg' || $.Param.imageType == 'jpg') return 'image/jpeg';
  70.     return 'image/png';
  71.   };

  72.   $.imageRegex = function() {
  73.     if ($.Param.imageType == 'webp') return (/^data:image\/webp;base64,/);
  74.     if ($.Param.imageType == 'jpeg' || $.Param.imageType == 'jpg') return (/^data:image\/jpeg;base64,/);
  75.    
  76.     return (/^data:image\/png;base64,/);
  77.   };

  78.   $.fileExtension = function() {
  79.     if ($.Param.imageType == 'webp') return '.webp';
  80.     if ($.Param.imageType == 'jpeg' || $.Param.imageType == 'jpg') return '.jpg';
  81.     return '.png';
  82.   };

  83.   $.imageQuality = function() {
  84.     if ($.fileExtension() == '.jpg' || $.fileExtension() == '.webp') {
  85.       return Math.min($.Param.imageQuality, 100) / 100;
  86.     }

  87.     return 1;
  88.   };

  89.   $.baseFileName = function() {
  90.     var mapName = ($gameMap._mapId).padZero(3);
  91.     if ($.Param.useMapName) {
  92.       mapName = $dataMapInfos[$gameMap._mapId].name;
  93.     } else {
  94.       mapName = 'Map' + mapName;
  95.     }

  96.     return mapName;
  97.   };

  98.   $.getMapshot = function() {
  99.     var lowerBitmap;
  100.     var upperBitmap;

  101.     switch($.Param.layerType) {
  102.       case 1 :
  103.         lowerBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  104.         upperBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  105.         SceneManager._scene._spriteset._tilemap._paintEverything(lowerBitmap, upperBitmap);

  106.         return [lowerBitmap, upperBitmap];
  107.       case 2 :
  108.         var groundBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  109.         var ground2Bitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  110.         var lowerBitmapLayer = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  111.         var upperBitmapLayer = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  112.         var shadowBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  113.         var lowerEvents = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  114.         var normalEvents = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  115.         var upperEvents = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());

  116.         SceneManager._scene._spriteset._tilemap._paintLayered(groundBitmap, ground2Bitmap, lowerBitmapLayer, upperBitmapLayer, shadowBitmap, lowerEvents, normalEvents, upperEvents);
  117.         return [groundBitmap, ground2Bitmap, lowerBitmapLayer, upperBitmapLayer, shadowBitmap, lowerEvents, normalEvents, upperEvents];
  118.       default :
  119.         lowerBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  120.         upperBitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  121.         SceneManager._scene._spriteset._tilemap._paintEverything(lowerBitmap, upperBitmap);

  122.         var bitmap = new Bitmap($dataMap.width * $gameMap.tileWidth(), $dataMap.height * $gameMap.tileHeight());
  123.         bitmap.blt(lowerBitmap, 0, 0, lowerBitmap.width, lowerBitmap.height, 0, 0, lowerBitmap.width, lowerBitmap.height);
  124.         bitmap.blt(upperBitmap, 0, 0, upperBitmap.width, upperBitmap.height, 0, 0, upperBitmap.width, upperBitmap.height);
  125.         return [bitmap];
  126.     }
  127.   };

  128.   function MapShotTileMap() {
  129.   }
  130.   
  131.   MapShotTileMap.prototype = Object.create(Tilemap.prototype);
  132.   MapShotTileMap.prototype.constructor = MapShotTileMap;

  133.   MapShotTileMap.prototype._drawAutotile = function(bitmap, tileId, dx, dy) {
  134.     var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE;
  135.     var kind = Tilemap.getAutotileKind(tileId);
  136.     var shape = Tilemap.getAutotileShape(tileId);
  137.     var tx = kind % 8;
  138.     var ty = Math.floor(kind / 8);
  139.     var bx = 0;
  140.     var by = 0;
  141.     var setNumber = 0;
  142.     var isTable = false;

  143.     if (Tilemap.isTileA1(tileId)) {
  144.       var waterSurfaceIndex = [0, 1, 2, 1][this.animationFrame % 4];
  145.       setNumber = 0;
  146.       if (kind === 0) {
  147.         bx = waterSurfaceIndex * 2;
  148.         by = 0;
  149.       } else if (kind === 1) {
  150.         bx = waterSurfaceIndex * 2;
  151.         by = 3;
  152.       } else if (kind === 2) {
  153.         bx = 6;
  154.         by = 0;
  155.       } else if (kind === 3) {
  156.         bx = 6;
  157.         by = 3;
  158.       } else {
  159.         bx = Math.floor(tx / 4) * 8;
  160.         by = ty * 6 + Math.floor(tx / 2) % 2 * 3;
  161.         if (kind % 2 === 0) {
  162.           bx += waterSurfaceIndex * 2;
  163.         }
  164.         else {
  165.           bx += 6;
  166.           autotileTable = Tilemap.WATERFALL_AUTOTILE_TABLE;
  167.           by += this.animationFrame % 3;
  168.         }
  169.       }
  170.     } else if (Tilemap.isTileA2(tileId)) {
  171.       setNumber = 1;
  172.       bx = tx * 2;
  173.       by = (ty - 2) * 3;
  174.       isTable = this._isTableTile(tileId);
  175.     } else if (Tilemap.isTileA3(tileId)) {
  176.       setNumber = 2;
  177.       bx = tx * 2;
  178.       by = (ty - 6) * 2;
  179.       autotileTable = Tilemap.WALL_AUTOTILE_TABLE;
  180.     } else if (Tilemap.isTileA4(tileId)) {
  181.       setNumber = 3;
  182.       bx = tx * 2;
  183.       by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0));
  184.       if (ty % 2 === 1) {
  185.         autotileTable = Tilemap.WALL_AUTOTILE_TABLE;
  186.       }
  187.     }

  188.     var table = autotileTable[shape];
  189.     var source = this.bitmaps[setNumber];

  190.     if (table && source) {
  191.       var w1 = this._tileWidth / 2;
  192.       var h1 = this._tileHeight / 2;
  193.       for (var i = 0; i < 4; i++) {
  194.         var qsx = table[i][0];
  195.         var qsy = table[i][1];
  196.         var sx1 = (bx * 2 + qsx) * w1;
  197.         var sy1 = (by * 2 + qsy) * h1;
  198.         var dx1 = dx + (i % 2) * w1;
  199.         var dy1 = dy + Math.floor(i / 2) * h1;
  200.         if (isTable && (qsy === 1 || qsy === 5)) {
  201.           var qsx2 = qsx;
  202.           var qsy2 = 3;
  203.           if (qsy === 1) {
  204.             qsx2 = [0,3,2,1][qsx];
  205.           }
  206.           var sx2 = (bx * 2 + qsx2) * w1;
  207.           var sy2 = (by * 2 + qsy2) * h1;
  208.           bitmap.blt(source, sx2, sy2, w1, h1, dx1, dy1, w1, h1);
  209.           dy1 += h1/2;
  210.           bitmap.blt(source, sx1, sy1, w1, h1 / 2, dx1, dy1, w1, h1 / 2);
  211.         } else {
  212.           bitmap.blt(source, sx1, sy1, w1, h1, dx1, dy1, w1, h1);
  213.         }
  214.       }
  215.     }
  216.   };

  217.   MapShotTileMap.prototype._drawNormalTile = function(bitmap, tileId, dx, dy) {
  218.     var setNumber = 0;

  219.     if (Tilemap.isTileA5(tileId)) {
  220.       setNumber = 4;
  221.     } else {
  222.       setNumber = 5 + Math.floor(tileId / 256);
  223.     }

  224.     var w = this._tileWidth;
  225.     var h = this._tileHeight;
  226.     var sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w;
  227.     var sy = (Math.floor(tileId % 256 / 8) % 16) * h;

  228.     var source = this.bitmaps[setNumber];
  229.     if (source) {
  230.       bitmap.blt(source, sx, sy, w, h, dx, dy, w, h);
  231.     }
  232.   };

  233.   MapShotTileMap.prototype._drawTableEdge = function(bitmap, tileId, dx, dy) {
  234.     if (Tilemap.isTileA2(tileId)) {
  235.       var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE;
  236.       var kind = Tilemap.getAutotileKind(tileId);
  237.       var shape = Tilemap.getAutotileShape(tileId);
  238.       var tx = kind % 8;
  239.       var ty = Math.floor(kind / 8);
  240.       var setNumber = 1;
  241.       var bx = tx * 2;
  242.       var by = (ty - 2) * 3;
  243.       var table = autotileTable[shape];

  244.       if (table) {
  245.         var source = this.bitmaps[setNumber];
  246.         var w1 = this._tileWidth / 2;
  247.         var h1 = this._tileHeight / 2;
  248.         for (var i = 0; i < 2; i++) {
  249.           var qsx = table[2 + i][0];
  250.           var qsy = table[2 + i][1];
  251.           var sx1 = (bx * 2 + qsx) * w1;
  252.           var sy1 = (by * 2 + qsy) * h1 + h1/2;
  253.           var dx1 = dx + (i % 2) * w1;
  254.           var dy1 = dy + Math.floor(i / 2) * h1;
  255.           bitmap.blt(source, sx1, sy1, w1, h1/2, dx1, dy1, w1, h1/2);
  256.         }
  257.       }
  258.     }
  259.   };

  260.   Tilemap.prototype._drawTileOldStyle = function(bitmap, tileId, dx, dy) {
  261.     if (Tilemap.isVisibleTile(tileId)) {
  262.       if (Tilemap.isAutotile(tileId)) {
  263.         MapShotTileMap.prototype._drawAutotile.call(this, bitmap, tileId, dx, dy);
  264.       } else {
  265.         MapShotTileMap.prototype._drawNormalTile.call(this, bitmap, tileId, dx, dy);
  266.       }
  267.     }
  268.   };  

  269.   Tilemap.prototype._paintEverything = function(lowerBitmap, upperBitmap) {
  270.     var tileCols = $dataMap.width;
  271.     var tileRows = $dataMap.height;

  272.     for (var y = 0; y < tileRows; y++) {
  273.       for (var x = 0; x < tileCols; x++) {
  274.         this._paintTilesOnBitmap(lowerBitmap, upperBitmap, x, y);
  275.       }
  276.     }

  277.     if ($.Param.drawEvents !== false) {
  278.       this._paintCharacters(lowerBitmap, 0);
  279.       this._paintCharacters(lowerBitmap, 1);
  280.       this._paintCharacters(upperBitmap, 2);   
  281.     }
  282.   };

  283.   Tilemap.prototype._paintLayered = function(groundBitmap, ground2Bitmap, lowerBitmap, upperLayer, shadowBitmap, lowerEvents, normalEvents, upperEvents) {
  284.     var tileCols = $dataMap.width;
  285.     var tileRows = $dataMap.height;

  286.     for (var y = 0; y < tileRows; y++) {
  287.       for (var x = 0; x < tileCols; x++) {
  288.         this._paintTileOnLayers(groundBitmap, ground2Bitmap, lowerBitmap, upperLayer, shadowBitmap, x, y);
  289.       }
  290.     }

  291.     this._paintCharacters(lowerEvents, 0);
  292.     this._paintCharacters(normalEvents, 1);
  293.     this._paintCharacters(upperEvents, 2);        
  294.   };

  295.   Tilemap.prototype._paintCharacters = function(bitmap, priority) {
  296.     this.children.forEach(function(child) {
  297.       if (child instanceof Sprite_Character) {
  298.         if (child._character !== null) {
  299.           if (child._character instanceof Game_Player || child._character instanceof Game_Follower || child._character instanceof Game_Vehicle) return;
  300.         }

  301.         child.update();

  302.         if (child._characterName === '' && child._tileId === 0) return;
  303.         if (priority !== undefined && child._character._priorityType !== priority) return;

  304.         var x = child.x - child._frame.width / 2 + $gameMap._displayX * $gameMap.tileWidth();
  305.         var y = child.y - child._frame.height + $gameMap._displayY * $gameMap.tileHeight();

  306.         bitmap.blt(child.bitmap, child._frame.x, child._frame.y, child._frame.width, child._frame.height, x, y, child._frame.width, child._frame.height);
  307.       }
  308.     });
  309.   };

  310.   Tilemap.prototype._paintTileOnLayers = function(groundBitmap, ground2Bitmap, lowerBitmap, upperBitmap, shadowBitmap, x, y) {
  311.     var tableEdgeVirtualId = 10000;
  312.     var mx = x;
  313.     var my = y;
  314.     var dx = (mx * this._tileWidth);
  315.     var dy = (my * this._tileHeight);
  316.     var lx = dx / this._tileWidth;
  317.     var ly = dy / this._tileHeight;
  318.     var tileId0 = this._readMapData(mx, my, 0);
  319.     var tileId1 = this._readMapData(mx, my, 1);
  320.     var tileId2 = this._readMapData(mx, my, 2);
  321.     var tileId3 = this._readMapData(mx, my, 3);
  322.     var shadowBits = this._readMapData(mx, my, 4);
  323.     var upperTileId1 = this._readMapData(mx, my - 1, 1);

  324.     if (groundBitmap !== undefined) {
  325.       groundBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  326.     }

  327.     if (ground2Bitmap !== undefined) {
  328.       ground2Bitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  329.     }

  330.     if (lowerBitmap !== undefined) {
  331.       lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  332.     }

  333.     if (upperBitmap !== undefined) {
  334.       upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  335.     }

  336.     if (shadowBitmap !== undefined) {
  337.       shadowBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  338.     }

  339.     var me = this;

  340.     function drawTiles(bitmap, tileId, shadowBits, upperTileId1) {
  341.       if (tileId < 0) {
  342.         if ($.Param.drawAutoShadows && shadowBits !== undefined) {
  343.           MapShotTileMap.prototype._drawShadow.call(me, bitmap, shadowBits, dx, dy);
  344.         }
  345.       } else if (tileId >= tableEdgeVirtualId) {
  346.         MapShotTileMap.prototype._drawTableEdge.call(me, bitmap, upperTileId1, dx, dy);
  347.       } else {
  348.         me._drawTileOldStyle(bitmap, tileId, dx, dy);
  349.       }
  350.     }

  351.     if (groundBitmap !== undefined) {
  352.       drawTiles(groundBitmap, tileId0, undefined, upperTileId1);
  353.   
  354.       if (shadowBitmap !== undefined && tileId0 < 0) {
  355.         drawTiles(shadowBitmap, tileId0, shadowBits, upperTileId1);
  356.       }
  357.     }

  358.     if (ground2Bitmap !== undefined) {
  359.       drawTiles(ground2Bitmap, tileId1, undefined, upperTileId1);
  360.   
  361.       if (shadowBitmap !== undefined && tileId1 < 0) {
  362.         drawTiles(shadowBitmap, tileId1, shadowBits, upperTileId1);
  363.       }
  364.     }

  365.     if (lowerBitmap !== undefined) {
  366.       drawTiles(lowerBitmap, tileId2, undefined, upperTileId1);
  367.   
  368.       if (shadowBitmap !== undefined && tileId2 < 0) {
  369.         drawTiles(shadowBitmap, tileId2, shadowBits, upperTileId1);
  370.       }
  371.     }

  372.     if (upperBitmap !== undefined) {
  373.       drawTiles(upperBitmap, tileId3, shadowBits, upperTileId1);

  374.       if (shadowBitmap !== undefined && tileId3 < 0) {
  375.         drawTiles(shadowBitmap, tileId3, shadowBits, upperTileId1);
  376.       }
  377.     }
  378.   };

  379.   Tilemap.prototype._paintTilesOnBitmap = function(lowerBitmap, upperBitmap, x, y) {
  380.     var tableEdgeVirtualId = 10000;
  381.     var mx = x;
  382.     var my = y;
  383.     var dx = (mx * this._tileWidth);
  384.     var dy = (my * this._tileHeight);
  385.     var lx = dx / this._tileWidth;
  386.     var ly = dy / this._tileHeight;
  387.     var tileId0 = this._readMapData(mx, my, 0);
  388.     var tileId1 = this._readMapData(mx, my, 1);
  389.     var tileId2 = this._readMapData(mx, my, 2);
  390.     var tileId3 = this._readMapData(mx, my, 3);
  391.     var shadowBits = this._readMapData(mx, my, 4);
  392.     var upperTileId1 = this._readMapData(mx, my - 1, 1);
  393.     var lowerTiles = [];
  394.     var upperTiles = [];

  395.     if (this._isHigherTile(tileId0)) {
  396.       upperTiles.push(tileId0);
  397.     } else {
  398.       lowerTiles.push(tileId0);
  399.     }
  400.     if (this._isHigherTile(tileId1)) {
  401.       upperTiles.push(tileId1);
  402.     } else {
  403.       lowerTiles.push(tileId1);
  404.     }

  405.     lowerTiles.push(-shadowBits);

  406.     if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) {
  407.       if (!Tilemap.isShadowingTile(tileId0)) {
  408.         lowerTiles.push(tableEdgeVirtualId + upperTileId1);
  409.       }
  410.     }

  411.     if (this._isOverpassPosition(mx, my)) {
  412.       upperTiles.push(tileId2);
  413.       upperTiles.push(tileId3);
  414.     } else {
  415.       if (this._isHigherTile(tileId2)) {
  416.         upperTiles.push(tileId2);
  417.       } else {
  418.         lowerTiles.push(tileId2);
  419.       }
  420.       if (this._isHigherTile(tileId3)) {
  421.         upperTiles.push(tileId3);
  422.       } else {
  423.         lowerTiles.push(tileId3);
  424.       }
  425.     }

  426.     lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);
  427.     upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight);

  428.     for (var i = 0; i < lowerTiles.length; i++) {
  429.       var lowerTileId = lowerTiles[i];
  430.       if (lowerTileId < 0) {
  431.         if ($.Param.drawAutoShadows) {
  432.           MapShotTileMap.prototype._drawShadow.call(this, lowerBitmap, shadowBits, dx, dy);
  433.         }
  434.       } else if (lowerTileId >= tableEdgeVirtualId) {
  435.         MapShotTileMap.prototype._drawTableEdge.call(this, lowerBitmap, upperTileId1, dx, dy);
  436.       } else {
  437.         this._drawTileOldStyle(lowerBitmap, lowerTileId, dx, dy);
  438.       }
  439.     }

  440.     for (var j = 0; j < upperTiles.length; j++) {
  441.       this._drawTileOldStyle(upperBitmap, upperTiles[j], dx, dy);
  442.     }
  443.   };

  444.   $.saveMapshot = function() {
  445.     if (!Utils.isNwjs()) return;

  446.     var fs = require('fs');
  447.     var path = $.Param.imagePath;

  448.     try {
  449.       fs.mkdir(path, function() {
  450.         try{
  451.           var fileName = path + '/' + $.baseFileName();
  452.           var ext = $.fileExtension();
  453.           var names = [fileName + ext];
  454.           var regex = $.imageRegex();

  455.           switch ($.Param.layerType) {
  456.             case 1 :
  457.               names = [
  458.                 fileName + ' Lower' + ext,
  459.                 fileName + ' Upper' + ext
  460.               ];
  461.               break;
  462.             case 2 :
  463.               names = [
  464.                 fileName + ' Ground' + ext,
  465.                 fileName + ' Ground 2' + ext,
  466.                 fileName + ' Lower' + ext,
  467.                 fileName + ' Upper' + ext,
  468.                 fileName + ' Shadows' + ext,
  469.                 fileName + ' Lower Events' + ext,
  470.                 fileName + ' Normal Events' + ext,
  471.                 fileName + ' Upper Events' + ext
  472.               ];

  473.               break;
  474.             default :
  475.               names = [fileName + ext];
  476.               break;
  477.           }

  478.           var snaps = $.getMapshot();

  479.           var callback = function(error) {
  480.             if (error !== undefined && error !== null) {
  481.               console.error('An error occured while saving the mapshot', error);
  482.             }
  483.           };

  484.           for (var i = 0; i < names.length; i++) {
  485.             var urlData = snaps[i].canvas.toDataURL($.imageType(), $.imageQuality());
  486.             var base64Data = urlData.replace(regex, "");

  487.             fs.writeFile(names[i], base64Data, 'base64', callback);
  488.           }
  489.         } catch (error) {
  490.           if (error !== undefined && error !== null) {
  491.             console.error('An error occured while saving the map shot:', error);
  492.           }
  493.         }
  494.       });

  495.       var nodePath = require('path');
  496.       var longPath = nodePath.resolve(path);

  497.       if (process.platform == 'win32' && $._openedFolder === undefined) {
  498.         $._openedFolder = true;

  499.         setTimeout(function(){
  500.           var exec = require('child_process').exec;
  501.           exec('explorer ' + longPath);
  502.         }, 100);
  503.       } else {
  504.         $gameMessage.add('Mapshot saved to \n' + longPath.replace(/\\/g, '\\\\').match(/.{1,40}/g).join('\n'));
  505.       }

  506.     } catch (error) {
  507.       if (error !== undefined && error !== null) {
  508.         console.error('An error occured while saving the mapshot:', error);
  509.       }
  510.     }
  511.   };

  512.   $.onKeyUp = function(event) {
  513.     if (event.keyCode == $.Param.keyCode) {
  514.       if (SceneManager._scene instanceof Scene_Map) {
  515.         $.saveMapshot();
  516.       }
  517.     }
  518.   };

  519.   document.addEventListener('keyup', $.onKeyUp);
  520. })(OrangeMapshot);

  521. Imported.OrangeMapshot = 1.7;
复制代码

点评

这个插件我记得在1.3版本的MV中是运行正常的,1.4以后没有试过。  发表于 2017-4-30 17:26

评分

参与人数 1赞 +1 收起 理由
whitedewxiao + 1 精品文章

查看全部评分

回复

使用道具 举报

梦石
0
星屑
55
在线时间
20 小时
注册时间
2008-3-7
回帖
10
 楼主| 发表于 2017-4-30 18:05:55 | 显示全部楼层
sutao80216 发表于 2017-4-30 17:25
/*=============================================================================
* Orange - Mapsho ...

泄泄!太感谢了
回复

使用道具 举报

梦石
0
星屑
50
在线时间
19 小时
注册时间
2017-4-4
回帖
3
发表于 2017-5-5 16:36:49 | 显示全部楼层
sutao80216 发表于 2017-4-30 17:25
/*=============================================================================
* Orange - Mapsho ...

谢谢分享,1.4可以用
回复 0 1

使用道具 举报

梦石
0
星屑
65
在线时间
69 小时
注册时间
2017-1-28
回帖
55
发表于 2017-9-5 17:41:07 | 显示全部楼层
sutao80216 发表于 2017-4-30 17:25
/*=============================================================================
* Orange - Mapsho ...

我这串代码已经安装好了 请问是在游戏运行中 按PrintScreen 吗 然后png图片是自动 保存在  img/Mapshots 文件夹吗   求告知?
回复

使用道具 举报

梦石
0
星屑
65
在线时间
69 小时
注册时间
2017-1-28
回帖
55
发表于 2017-9-5 17:41:58 | 显示全部楼层
Nic0 发表于 2017-5-5 16:36
谢谢分享,1.4可以用

我这串代码已经安装好了 请问是在游戏运行中 按PrintScreen 吗 然后png图片是自动 保存在  img/Mapshots 文件夹吗   求告知?
回复

使用道具 举报

梦石
0
星屑
75
在线时间
7 小时
注册时间
2024-3-20
回帖
4
发表于 2024-3-26 11:10:13 | 显示全部楼层
1.6.3版本好像用不了,我按Print Screen 键快按烂了都没有反应
回复

使用道具 举报

梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2024-3-26 16:15:48 | 显示全部楼层
1970359915 发表于 2024-3-26 11:10
1.6.3版本好像用不了,我按Print Screen 键快按烂了都没有反应

挖坟可耻,print screen键按了要自己去找个地方(比如聊天框)ctrl+v粘贴出来,或者你可以用win+shift+S
回复

使用道具 举报

梦石
0
星屑
75
在线时间
7 小时
注册时间
2024-3-20
回帖
4
发表于 2024-3-26 21:30:43 | 显示全部楼层
小秋橙 发表于 2024-3-26 16:15
挖坟可耻,print screen键按了要自己去找个地方(比如聊天框)ctrl+v粘贴出来,或者你可以用win+shift+S ...

哇咔咔,谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部