设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 8074|回复: 5
打印 上一主题 下一主题

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

[复制链接]

Lv4.逐梦者 (版主)

职业の水客

梦石
0
星屑
13163
在线时间
7064 小时
注册时间
2010-6-16
帖子
3478

开拓者

跳转到指定楼层
1
发表于 2016-1-30 11:05:43 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 寂静的夜里 于 2016-3-5 18:39 编辑
使用相关
重要备注
如何使用


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

插件说明


下面是完整插件代码
JAVASCRIPT 代码复制
  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.  
  36. Game_System.prototype.initialize = function() {
  37.         this._saveEnabled = true;
  38.         this._menuEnabled = true;
  39.         this._encounterEnabled = true;
  40.         this._formationEnabled = true;
  41.         this._battleCount = 0;
  42.         this._winCount = 0;
  43.         this._escapeCount = 0;
  44.         this._saveCount = 0;
  45.         this._versionId = 0;
  46.         this._framesOnSave = 0;
  47.         this._bgmOnSave = null;
  48.         this._bgsOnSave = null;
  49.         this._windowTone = null;
  50.         this._battleBgm = null;
  51.         this._victoryMe = null;
  52.         this._defeatMe = null;
  53.         this._savedBgm = null;
  54.         this._walkingBgm = null;
  55.         this.gallery = []
  56. };
  57.  
  58. var parameters = PluginManager.parameters('PictureGallery');
  59. var maxPictures = Number(parameters['数目'] || 3);
  60. var pictureSpeed = Number(parameters['移动速度'] || 5);
  61. var pictureScaleInit = Number(parameters['初始大小'] || 1);
  62. var pictureScaleDelta = Number(parameters['缩放步长'] || 0.1);
  63. var pictureScaleMax = Number(parameters['放大极限'] || 1);
  64.  
  65. var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  66.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  67.         _Game_Interpreter_pluginCommand.call(this, command, args);
  68.         if (command === '打开CG鉴赏画面') {
  69.                         SceneManager.push(Scene_Gallery);
  70.         }
  71.                 if (command === '解锁CG') {
  72.                         $gameSystem.gallery[args[0]] = true;
  73.                 }
  74.     };
  75.  
  76. ImageManager.loadGallery = function(filename) {
  77.     return this.loadBitmap('img/gallery/', filename, 0, true);
  78. };
  79.  
  80. function Scene_Gallery() {
  81.     this.initialize.apply(this, arguments);
  82. }
  83.  
  84. Scene_Gallery.prototype = Object.create(Scene_Base.prototype);
  85. Scene_Gallery.prototype.constructor = Scene_Gallery;
  86.  
  87. Scene_Gallery.prototype.initialize = function() {
  88.     Scene_Base.prototype.initialize.call(this);
  89.         this.number = 0;
  90.         for (var i = 1; i <= maxPictures; i++) {
  91.                 if ($gameSystem.gallery[i]) {
  92.                         this.number++;
  93.                 }
  94.         }
  95.         this.rate = this.number / maxPictures;
  96. };
  97.  
  98. Scene_Gallery.prototype.create = function() {
  99.     Scene_Base.prototype.create.call(this);
  100.         this._zoomed = false;
  101.         this.createBackground();
  102.         this.createWindowLayer();
  103.         this.createGalleryWindow();
  104. };
  105.  
  106. Scene_Gallery.prototype.start = function() {
  107.     Scene_Base.prototype.start.call(this);
  108.         this._galleryWindow.activate();
  109. };
  110.  
  111. Scene_Gallery.prototype.update = function() {
  112.     Scene_Base.prototype.update.call(this);
  113.         this.updateInputA();
  114. };
  115.  
  116. Scene_Gallery.prototype.updateInputA = function() {
  117.         if (Input.isTriggered("escape")) {
  118.                 SoundManager.playCancel();
  119.                 if (this._galleryWindow.active) {
  120.                         SceneManager.pop(this);
  121.                 } else {
  122.                         this._picture.visible = false;
  123.                         this._pictureText.visible = false;
  124.                         this._galleryWindow.visible = true;
  125.                         this._galleryWindow.activate();
  126.                 }
  127.         }
  128.         if (!this._galleryWindow.active) {
  129.                 if (Input.isPressed("up")) {
  130.                         this._picture.y += pictureSpeed;
  131.                 }
  132.                 if (Input.isPressed("down")) {
  133.                         this._picture.y -= pictureSpeed;
  134.                 }
  135.                 if (Input.isPressed("left")) {
  136.                         this._picture.x += pictureSpeed;
  137.                 }
  138.                 if (Input.isPressed("right")) {
  139.                         this._picture.x -= pictureSpeed;
  140.                 }
  141.                 if (Input.isTriggered("ok")) {
  142.                         SoundManager.playCancel();
  143.                         this._picture.visible = false;
  144.                         this._pictureText.visible = false;
  145.                         this._galleryWindow.visible = true;
  146.                         this._galleryWindow.activate();
  147.                 }
  148.                 if (Input.isTriggered("pageup")) {
  149.                         if (this._picture.scale.x < pictureScaleMax) {
  150.                                 this._picture.scale.x += pictureScaleDelta;
  151.                                 this._picture.scale.y += pictureScaleDelta;
  152.                         }
  153.                 }
  154.                 if (Input.isTriggered("pagedown")) {
  155.                         this._picture.scale.x -= pictureScaleDelta;
  156.                         this._picture.scale.y -= pictureScaleDelta;
  157.                         if (this._picture.width * this._picture.scale.x <= Graphics.boxWidth || this._picture.height * this._picture.scale.y <= Graphics.boxHeight) {
  158.                                 this._picture.scale.x += pictureScaleDelta;
  159.                                 this._picture.scale.y += pictureScaleDelta;
  160.                         }
  161.                 }
  162.                 if (this._picture.x > 0) this._picture.x = 0;
  163.                 if (this._picture.y > 0) this._picture.y = 0;
  164.                 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;
  165.                 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
  166.         }
  167. }
  168.  
  169. Scene_Gallery.prototype.createGalleryWindow = function() {
  170.     this._galleryWindow = new Window_Gallery(50, 100, Graphics.boxWidth - 100, Graphics.boxHeight - 170);
  171.         this._galleryWindow.setHandler('ok', this.onItemOk.bind(this));
  172.         this.addWindow(this._galleryWindow);
  173.         this._galleryWindow.refresh();
  174. };
  175.  
  176. Scene_Gallery.prototype.createBackground = function() {
  177.         this._picture = new Sprite();
  178.         this._pictureText = new Sprite();
  179.     this._backSprite = new Sprite();
  180.         this._textSprite = new Sprite();
  181.         this._picture.visible = false;
  182.         this._pictureText.visible = false;
  183.         this._picture.bitmap = new Bitmap(Graphics.boxWidth, Graphics.boxHeight);
  184.         this._pictureText.bitmap = ImageManager.loadGallery('Text');
  185.     this._backSprite.bitmap = ImageManager.loadGallery('Background');
  186.         this._textSprite.bitmap = new Bitmap(Graphics.boxWidth - 100, 100);
  187.         this._textSprite.move(0, Graphics.boxHeight - 100);
  188.         this._textSprite.bitmap.textColor = "white";
  189.         this._textSprite.bitmap.drawText("画像 : " + this.number + " / " + maxPictures, 100, 0, Graphics.boxWidth - 100, 100, "left");
  190.         this._textSprite.bitmap.drawText("完成率: " + Math.floor(100 * this.rate) + " %" , 0, 0, Graphics.boxWidth - 100, 100, "right");
  191.     this.addChild(this._backSprite);
  192.         this.addChild(this._textSprite);
  193.         this.addChild(this._picture);
  194.         this.addChild(this._pictureText);
  195. };
  196.  
  197. Scene_Gallery.prototype.onItemOk = function() {
  198.     this._picture.bitmap = ImageManager.loadGallery(this._galleryWindow.index() + 1);
  199.         this._galleryWindow.visible = false;
  200.         this._picture.scale = new Point(pictureScaleInit, pictureScaleInit);
  201.         this._picture.move(0, 0);
  202.         this._picture.visible = true;
  203.         this._pictureText.visible = true;
  204. };
  205.  
  206. function Window_Gallery() {
  207.     this.initialize.apply(this, arguments);
  208. }
  209.  
  210. Window_Gallery.prototype = Object.create(Window_Selectable.prototype);
  211. Window_Gallery.prototype.constructor = Window_Gallery;
  212.  
  213. Window_Gallery.prototype.initialize = function(x, y, width, height) {
  214.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  215.         this.lastIndex = 0;
  216.         this.opacity = 0;
  217.     this._data = [];
  218. };
  219.  
  220. Window_Gallery.prototype.maxCols = function() {
  221.     return 3;
  222. };
  223.  
  224. Window_Gallery.prototype.spacing = function() {
  225.     return 120;
  226. };
  227.  
  228. Window_Gallery.prototype.maxItems = function() {
  229.     return maxPictures;
  230. };
  231.  
  232. Window_Gallery.prototype.item = function() {
  233. };
  234.  
  235. Window_Gallery.prototype.makeItemList = function() {
  236. };
  237.  
  238. Window_Gallery.prototype.drawItem = function(i) {
  239.         var rect = this.itemRect(i);
  240.         rect.width -= this.textPadding();
  241.         this.drawItemName(i + 1, rect.x, rect.y);
  242. };
  243.  
  244. Window_Gallery.prototype.refresh = function() {
  245.     this.makeItemList();
  246.     this.createContents();
  247.     this.drawAllItems();
  248. };
  249.  
  250. Window_Gallery.prototype.itemHeight = function() {
  251.     return 110;
  252. };
  253.  
  254. Window_Gallery.prototype.drawItemName = function(i, x, y) {
  255.     this.resetTextColor();
  256.     this.drawIcon(i, x + 2, y + 2);
  257.         this.drawText("N - " + i, x + (Graphics.boxWidth / 960) * 65, y + 80);
  258. };
  259.  
  260. Window_Gallery.prototype.drawIcon = function(index, x, y) {
  261.         if ($gameSystem.gallery[index]) {
  262.                 var bitmap = ImageManager.loadGallery(index);
  263.         } else {
  264.                 var bitmap = ImageManager.loadGallery("locked");
  265.         }
  266.     this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x + 10, y + 10, (Graphics.boxWidth / 960) * (192 - 20), 108 - 20);
  267. };
  268.  
  269. Window_Gallery.prototype.processOk = function() {
  270.     if ($gameSystem.gallery[this.index() + 1]) {
  271.         this.playOkSound();
  272.         this.updateInputData();
  273.         this.deactivate();
  274.         this.callOkHandler();
  275.     } else {
  276.         this.playBuzzerSound();
  277.     }
  278. };
  279.  
  280. var old_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
  281. Scene_Boot.prototype.loadSystemImages = function() {
  282.         ImageManager.loadGallery("locked");
  283.         for (var i = 0; i <= maxPictures; i++) {
  284.                 ImageManager.loadGallery(i);
  285.         }
  286.         old_loadSystemImages();
  287. };

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

事件内调用如下:


实际使用效果(无CG):


实际使用效果(有CG):


插件设定:


评分

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

查看全部评分

一个看图的地方
群爆炸重建后状态:论坛老人最多(只剩下了活跃的老人),技术力很强(依旧不变)的编程灌水群:901540785
专门讨论RM相关的Q群:56875149
PS:第一个群不是专门讨论RM的,第二个才是哦。

Lv1.梦旅人

梦石
0
星屑
60
在线时间
306 小时
注册时间
2014-8-5
帖子
416
2
发表于 2016-2-1 03:22:43 | 只看该作者
抱走了。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
44 小时
注册时间
2015-12-27
帖子
47
3
发表于 2016-2-1 10:10:44 | 只看该作者
你们团队的美工非常赞啊
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2577
在线时间
362 小时
注册时间
2015-8-15
帖子
80
4
发表于 2017-3-11 09:28:40 | 只看该作者
这个插件非常强大,唯一的问题就是不支持鼠标右键返回游戏界面
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4691
在线时间
112 小时
注册时间
2016-1-15
帖子
64
5
发表于 2017-3-11 17:13:49 手机端发表。 | 只看该作者
抱走了,研究研究
回复 支持 1 反对 0

使用道具 举报

Lv2.观梦者

梦石
0
星屑
607
在线时间
168 小时
注册时间
2019-5-25
帖子
21
6
发表于 2019-6-22 15:46:00 | 只看该作者
感觉好六啊!抱走,谢谢!
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-6-7 21:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表