查看: 9638|回复: 5

[原创发布] 【CG鉴赏】PictureGallery

[复制链接]

职业の水客

梦石
2
星屑
17082
在线时间
7500 小时
注册时间
2010-6-16
回帖
3466

极短27评委MZ评测员极短26评委开拓者

发表于 2016-1-30 11:05:43 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 寂静的夜里 于 2016-3-5 18:39 编辑

使用相关原创插件,用于本工作室一商业游戏内(已贩卖)
目前已卖了2个月,所以这个脚本干脆拿出来给各种朋友使用,有以下规定:
1·允许随意修改插件内容
2·修改插件内容后请保留作者信息
3·可以用于任何游戏
4·使用本插件不需要授权
5·使用本插件请声明出自【赵氏面馆】

重要备注1·CG必须是PNG格式 当然你可以自己改插件显示不同格式的
2·CG数必须和插件设定保持一致 不然会提示无法找到图片


如何使用1·把插件放进\js\plugins目录下即可
2·在IMG目录下创建gallery文件夹
3·如何打开CG鉴赏页面?请看最下面的图片
4·如何解锁CG?在事件页使用插件命令 解锁CG i 即可 i=解锁CG数 例如CG文件名是21 那么解锁CG 21 即可显示21
5·详情内容请查阅【插件说明】


插件不更新,不维护,不修BUG,不提供指导方法,不要问为啥用不了,如果出错可能是有BUG了,因为脚本是自用的,如有问题请自行找人解决
想要菜单栏打开CG的 请自行找人修改插件 本人不提供任何帮助
2016年3月5日更新了BUG,可下载本附件的新插件,也可以复制下面的代码自行保存
PictureGallery.7z (2.52 KB, 下载次数: 435)

插件说明/*:
* @plugindesc CG鉴赏画面
* @author Joritian
*
* @param 数目
* @desc CG的数量
* @default 3
*
* @param 初始大小
* @desc 打开CG时的初始缩放比例.
* @default 1
*
* @param 缩放步长
* @desc 每按一次缩放键CG缩放比例所改变的值.
* @default 0.1
*
* @param 放大极限
* @desc 缩放CG时所能达到的最大缩放比例.
* @default 1
*
* @param 移动速度
* @desc 按下方向键时CG的移动速度(像素/帧).
* @default 5
*
* @help 开启此画面请在事件内运以下插件命令:
* 打开CG鉴赏画面
*
* 解锁第i幅图片请使用以下插件命令:
* 解锁CG i
*
* 你必须在img文件夹内创建一个名为gallery的文件夹
* 文件夹内的CG图片命名应为纯数字(图片ID),"locked"为未解锁时显示的图片,"background"为鉴赏画面背景图,"text"为对CG进行缩放时屏幕上显示的操作说明图片.
* 图片的大小不得小于游戏画面.
*/


下面是完整插件代码
  1. /*:
  2. * @plugindesc CG鉴赏画面
  3. * @author Joritian
  4. *
  5. * @param 数目
  6. * @desc CG的数量
  7. * @default 3
  8. *
  9. * @param 初始大小
  10. * @desc 打开CG时的初始缩放比例.
  11. * @default 1
  12. *
  13. * @param 缩放步长
  14. * @desc 每按一次缩放键CG缩放比例所改变的值.
  15. * @default 0.1
  16. *
  17. * @param 放大极限
  18. * @desc 缩放CG时所能达到的最大缩放比例.
  19. * @default 1
  20. *
  21. * @param 移动速度
  22. * @desc 按下方向键时CG的移动速度(像素/帧).
  23. * @default 5
  24. *
  25. * @help 开启此画面请在事件内运以下插件命令:
  26. * 打开CG鉴赏画面
  27. *
  28. * 解锁第i幅图片请使用以下插件命令:
  29. * 解锁CG i
  30. *
  31. * 你必须在img文件夹内创建一个名为gallery的文件夹
  32. * 文件夹内的CG图片命名应为纯数字(图片ID),"locked"为未解锁时显示的图片,"background"为鉴赏画面背景图,"text"为对CG进行缩放时屏幕上显示的操作说明图片.
  33. * 图片的大小不得小于游戏画面.
  34. */

  35. Game_System.prototype.initialize = function() {
  36.         this._saveEnabled = true;
  37.         this._menuEnabled = true;
  38.         this._encounterEnabled = true;
  39.         this._formationEnabled = true;
  40.         this._battleCount = 0;
  41.         this._winCount = 0;
  42.         this._escapeCount = 0;
  43.         this._saveCount = 0;
  44.         this._versionId = 0;
  45.         this._framesOnSave = 0;
  46.         this._bgmOnSave = null;
  47.         this._bgsOnSave = null;
  48.         this._windowTone = null;
  49.         this._battleBgm = null;
  50.         this._victoryMe = null;
  51.         this._defeatMe = null;
  52.         this._savedBgm = null;
  53.         this._walkingBgm = null;
  54.         this.gallery = []
  55. };

  56. var parameters = PluginManager.parameters('PictureGallery');
  57. var maxPictures = Number(parameters['数目'] || 3);
  58. var pictureSpeed = Number(parameters['移动速度'] || 5);
  59. var pictureScaleInit = Number(parameters['初始大小'] || 1);
  60. var pictureScaleDelta = Number(parameters['缩放步长'] || 0.1);
  61. var pictureScaleMax = Number(parameters['放大极限'] || 1);

  62. var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  63.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  64.         _Game_Interpreter_pluginCommand.call(this, command, args);
  65.         if (command === '打开CG鉴赏画面') {
  66.                         SceneManager.push(Scene_Gallery);
  67.         }
  68.                 if (command === '解锁CG') {
  69.                         $gameSystem.gallery[args[0]] = true;
  70.                 }
  71.     };

  72. ImageManager.loadGallery = function(filename) {
  73.     return this.loadBitmap('img/gallery/', filename, 0, true);
  74. };

  75. function Scene_Gallery() {
  76.     this.initialize.apply(this, arguments);
  77. }

  78. Scene_Gallery.prototype = Object.create(Scene_Base.prototype);
  79. Scene_Gallery.prototype.constructor = Scene_Gallery;

  80. Scene_Gallery.prototype.initialize = function() {
  81.     Scene_Base.prototype.initialize.call(this);
  82.         this.number = 0;
  83.         for (var i = 1; i <= maxPictures; i++) {
  84.                 if ($gameSystem.gallery[i]) {
  85.                         this.number++;
  86.                 }
  87.         }
  88.         this.rate = this.number / maxPictures;
  89. };

  90. Scene_Gallery.prototype.create = function() {
  91.     Scene_Base.prototype.create.call(this);
  92.         this._zoomed = false;
  93.         this.createBackground();
  94.         this.createWindowLayer();
  95.         this.createGalleryWindow();
  96. };

  97. Scene_Gallery.prototype.start = function() {
  98.     Scene_Base.prototype.start.call(this);
  99.         this._galleryWindow.activate();
  100. };

  101. Scene_Gallery.prototype.update = function() {
  102.     Scene_Base.prototype.update.call(this);
  103.         this.updateInputA();
  104. };

  105. Scene_Gallery.prototype.updateInputA = function() {
  106.         if (Input.isTriggered("escape")) {
  107.                 SoundManager.playCancel();
  108.                 if (this._galleryWindow.active) {
  109.                         SceneManager.pop(this);
  110.                 } else {
  111.                         this._picture.visible = false;
  112.                         this._pictureText.visible = false;
  113.                         this._galleryWindow.visible = true;
  114.                         this._galleryWindow.activate();
  115.                 }
  116.         }
  117.         if (!this._galleryWindow.active) {
  118.                 if (Input.isPressed("up")) {
  119.                         this._picture.y += pictureSpeed;
  120.                 }
  121.                 if (Input.isPressed("down")) {
  122.                         this._picture.y -= pictureSpeed;
  123.                 }
  124.                 if (Input.isPressed("left")) {
  125.                         this._picture.x += pictureSpeed;
  126.                 }
  127.                 if (Input.isPressed("right")) {
  128.                         this._picture.x -= pictureSpeed;
  129.                 }
  130.                 if (Input.isTriggered("ok")) {
  131.                         SoundManager.playCancel();
  132.                         this._picture.visible = false;
  133.                         this._pictureText.visible = false;
  134.                         this._galleryWindow.visible = true;
  135.                         this._galleryWindow.activate();
  136.                 }
  137.                 if (Input.isTriggered("pageup")) {
  138.                         if (this._picture.scale.x < pictureScaleMax) {
  139.                                 this._picture.scale.x += pictureScaleDelta;
  140.                                 this._picture.scale.y += pictureScaleDelta;
  141.                         }
  142.                 }
  143.                 if (Input.isTriggered("pagedown")) {
  144.                         this._picture.scale.x -= pictureScaleDelta;
  145.                         this._picture.scale.y -= pictureScaleDelta;
  146.                         if (this._picture.width * this._picture.scale.x <= Graphics.boxWidth || this._picture.height * this._picture.scale.y <= Graphics.boxHeight) {
  147.                                 this._picture.scale.x += pictureScaleDelta;
  148.                                 this._picture.scale.y += pictureScaleDelta;
  149.                         }
  150.                 }
  151.                 if (this._picture.x > 0) this._picture.x = 0;
  152.                 if (this._picture.y > 0) this._picture.y = 0;
  153.                 if (this._picture.x + this._picture.width * this._picture.scale.x < Graphics.boxWidth) this._picture.x = Graphics.boxWidth - this._picture.width * this._picture.scale.x;
  154.                 if (this._picture.y + this._picture.height * this._picture.scale.y < Graphics.boxHeight) this._picture.y = Graphics.boxHeight - this._picture.height * this._picture.scale.y
  155.         }
  156. }

  157. Scene_Gallery.prototype.createGalleryWindow = function() {
  158.     this._galleryWindow = new Window_Gallery(50, 100, Graphics.boxWidth - 100, Graphics.boxHeight - 170);
  159.         this._galleryWindow.setHandler('ok', this.onItemOk.bind(this));
  160.         this.addWindow(this._galleryWindow);
  161.         this._galleryWindow.refresh();
  162. };

  163. Scene_Gallery.prototype.createBackground = function() {
  164.         this._picture = new Sprite();
  165.         this._pictureText = new Sprite();
  166.     this._backSprite = new Sprite();
  167.         this._textSprite = new Sprite();
  168.         this._picture.visible = false;
  169.         this._pictureText.visible = false;
  170.         this._picture.bitmap = new Bitmap(Graphics.boxWidth, Graphics.boxHeight);
  171.         this._pictureText.bitmap = ImageManager.loadGallery('Text');
  172.     this._backSprite.bitmap = ImageManager.loadGallery('Background');
  173.         this._textSprite.bitmap = new Bitmap(Graphics.boxWidth - 100, 100);
  174.         this._textSprite.move(0, Graphics.boxHeight - 100);
  175.         this._textSprite.bitmap.textColor = "white";
  176.         this._textSprite.bitmap.drawText("画像 : " + this.number + " / " + maxPictures, 100, 0, Graphics.boxWidth - 100, 100, "left");
  177.         this._textSprite.bitmap.drawText("完成率: " + Math.floor(100 * this.rate) + " %" , 0, 0, Graphics.boxWidth - 100, 100, "right");
  178.     this.addChild(this._backSprite);
  179.         this.addChild(this._textSprite);
  180.         this.addChild(this._picture);
  181.         this.addChild(this._pictureText);
  182. };

  183. Scene_Gallery.prototype.onItemOk = function() {
  184.     this._picture.bitmap = ImageManager.loadGallery(this._galleryWindow.index() + 1);
  185.         this._galleryWindow.visible = false;
  186.         this._picture.scale = new Point(pictureScaleInit, pictureScaleInit);
  187.         this._picture.move(0, 0);
  188.         this._picture.visible = true;
  189.         this._pictureText.visible = true;
  190. };

  191. function Window_Gallery() {
  192.     this.initialize.apply(this, arguments);
  193. }

  194. Window_Gallery.prototype = Object.create(Window_Selectable.prototype);
  195. Window_Gallery.prototype.constructor = Window_Gallery;

  196. Window_Gallery.prototype.initialize = function(x, y, width, height) {
  197.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  198.         this.lastIndex = 0;
  199.         this.opacity = 0;
  200.     this._data = [];
  201. };

  202. Window_Gallery.prototype.maxCols = function() {
  203.     return 3;
  204. };

  205. Window_Gallery.prototype.spacing = function() {
  206.     return 120;
  207. };

  208. Window_Gallery.prototype.maxItems = function() {
  209.     return maxPictures;
  210. };

  211. Window_Gallery.prototype.item = function() {
  212. };

  213. Window_Gallery.prototype.makeItemList = function() {
  214. };

  215. Window_Gallery.prototype.drawItem = function(i) {
  216.         var rect = this.itemRect(i);
  217.         rect.width -= this.textPadding();
  218.         this.drawItemName(i + 1, rect.x, rect.y);
  219. };

  220. Window_Gallery.prototype.refresh = function() {
  221.     this.makeItemList();
  222.     this.createContents();
  223.     this.drawAllItems();
  224. };

  225. Window_Gallery.prototype.itemHeight = function() {
  226.     return 110;
  227. };

  228. Window_Gallery.prototype.drawItemName = function(i, x, y) {
  229.     this.resetTextColor();
  230.     this.drawIcon(i, x + 2, y + 2);
  231.         this.drawText("N - " + i, x + (Graphics.boxWidth / 960) * 65, y + 80);
  232. };

  233. Window_Gallery.prototype.drawIcon = function(index, x, y) {
  234.         if ($gameSystem.gallery[index]) {
  235.                 var bitmap = ImageManager.loadGallery(index);
  236.         } else {
  237.                 var bitmap = ImageManager.loadGallery("locked");
  238.         }
  239.     this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x + 10, y + 10, (Graphics.boxWidth / 960) * (192 - 20), 108 - 20);
  240. };

  241. Window_Gallery.prototype.processOk = function() {
  242.     if ($gameSystem.gallery[this.index() + 1]) {
  243.         this.playOkSound();
  244.         this.updateInputData();
  245.         this.deactivate();
  246.         this.callOkHandler();
  247.     } else {
  248.         this.playBuzzerSound();
  249.     }
  250. };

  251. var old_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
  252. Scene_Boot.prototype.loadSystemImages = function() {
  253.         ImageManager.loadGallery("locked");
  254.         for (var i = 0; i <= maxPictures; i++) {
  255.                 ImageManager.loadGallery(i);
  256.         }
  257.         old_loadSystemImages();
  258. };
复制代码

gallery.zip (729.76 KB, 下载次数: 368)

事件内调用如下:
QQ截图20160130110636.png

实际使用效果(无CG):
QQ截图20160130110807.png

实际使用效果(有CG):
QQ截图20160130111609.png

插件设定:
QQ截图20160130112132.png

评分

参与人数 2星屑 +66 梦石 +1 赞 +1 收起 理由
樱月琴 + 1 塞糖
余烬之中 + 66 + 1 精品文章

查看全部评分

游戏开发工具集,一站式AI生图+图片完美像素化及相关处理网站。
群爆炸重建后状态:论坛老人最多(只剩下了活跃的老人),技术力很强(依旧不变)的编程灌水群:901540785
专门讨论RM相关的Q群:56875149
PS:第一个群不是专门讨论RM的,第二个才是哦。
PS2:接受MV/MZ插件定制(QQ763992443)
梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
回帖
403
发表于 2016-2-1 03:22:43 | 显示全部楼层
抱走了。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
44 小时
注册时间
2015-12-27
回帖
42
发表于 2016-2-1 10:10:44 | 显示全部楼层
你们团队的美工非常赞啊
回复

使用道具 举报

梦石
0
星屑
2582
在线时间
363 小时
注册时间
2015-8-15
回帖
66
发表于 2017-3-11 09:28:40 | 显示全部楼层
这个插件非常强大,唯一的问题就是不支持鼠标右键返回游戏界面
回复

使用道具 举报

梦石
0
星屑
4823
在线时间
112 小时
注册时间
2016-1-15
回帖
52
发表于 2017-3-11 17:13:49 来自手机 | 显示全部楼层
抱走了,研究研究
回复 1 0

使用道具 举报

梦石
0
星屑
612
在线时间
176 小时
注册时间
2019-5-25
回帖
19
发表于 2019-6-22 15:46:00 | 显示全部楼层
感觉好六啊!抱走,谢谢!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部