查看: 9456|回复: 5

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

[复制链接]

职业の水客

梦石
2
星屑
16994
在线时间
7497 小时
注册时间
2010-6-16
回帖
3464

极短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进行缩放时屏幕上显示的操作说明图片.
* 图片的大小不得小于游戏画面.
*/


下面是完整插件代码
[pre lang="javascript"]/*:
* @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进行缩放时屏幕上显示的操作说明图片.
* 图片的大小不得小于游戏画面.
*/

Game_System.prototype.initialize = function() {
        this._saveEnabled = true;
        this._menuEnabled = true;
        this._encounterEnabled = true;
        this._formationEnabled = true;
        this._battleCount = 0;
        this._winCount = 0;
        this._escapeCount = 0;
        this._saveCount = 0;
        this._versionId = 0;
        this._framesOnSave = 0;
        this._bgmOnSave = null;
        this._bgsOnSave = null;
        this._windowTone = null;
        this._battleBgm = null;
        this._victoryMe = null;
        this._defeatMe = null;
        this._savedBgm = null;
        this._walkingBgm = null;
        this.gallery = []
};

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

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command === '打开CG鉴赏画面') {
                        SceneManager.push(Scene_Gallery);
        }
                if (command === '解锁CG') {
                        $gameSystem.gallery[args[0]] = true;
                }
    };

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

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

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

Scene_Gallery.prototype.initialize = function() {
    Scene_Base.prototype.initialize.call(this);
        this.number = 0;
        for (var i = 1; i <= maxPictures; i++) {
                if ($gameSystem.gallery) {
                        this.number++;
                }
        }
        this.rate = this.number / maxPictures;
};

Scene_Gallery.prototype.create = function() {
    Scene_Base.prototype.create.call(this);
        this._zoomed = false;
        this.createBackground();
        this.createWindowLayer();
        this.createGalleryWindow();
};

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

Scene_Gallery.prototype.update = function() {
    Scene_Base.prototype.update.call(this);
        this.updateInputA();
};

Scene_Gallery.prototype.updateInputA = function() {
        if (Input.isTriggered("escape")) {
                SoundManager.playCancel();
                if (this._galleryWindow.active) {
                        SceneManager.pop(this);
                } else {
                        this._picture.visible = false;
                        this._pictureText.visible = false;
                        this._galleryWindow.visible = true;
                        this._galleryWindow.activate();
                }
        }
        if (!this._galleryWindow.active) {
                if (Input.isPressed("up")) {
                        this._picture.y += pictureSpeed;
                }
                if (Input.isPressed("down")) {
                        this._picture.y -= pictureSpeed;
                }
                if (Input.isPressed("left")) {
                        this._picture.x += pictureSpeed;
                }
                if (Input.isPressed("right")) {
                        this._picture.x -= pictureSpeed;
                }
                if (Input.isTriggered("ok")) {
                        SoundManager.playCancel();
                        this._picture.visible = false;
                        this._pictureText.visible = false;
                        this._galleryWindow.visible = true;
                        this._galleryWindow.activate();
                }
                if (Input.isTriggered("pageup")) {
                        if (this._picture.scale.x < pictureScaleMax) {
                                this._picture.scale.x += pictureScaleDelta;
                                this._picture.scale.y += pictureScaleDelta;
                        }
                }
                if (Input.isTriggered("pagedown")) {
                        this._picture.scale.x -= pictureScaleDelta;
                        this._picture.scale.y -= pictureScaleDelta;
                        if (this._picture.width * this._picture.scale.x <= Graphics.boxWidth || this._picture.height * this._picture.scale.y <= Graphics.boxHeight) {
                                this._picture.scale.x += pictureScaleDelta;
                                this._picture.scale.y += pictureScaleDelta;
                        }
                }
                if (this._picture.x > 0) this._picture.x = 0;
                if (this._picture.y > 0) this._picture.y = 0;
                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;
                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
        }
}

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

Scene_Gallery.prototype.createBackground = function() {
        this._picture = new Sprite();
        this._pictureText = new Sprite();
    this._backSprite = new Sprite();
        this._textSprite = new Sprite();
        this._picture.visible = false;
        this._pictureText.visible = false;
        this._picture.bitmap = new Bitmap(Graphics.boxWidth, Graphics.boxHeight);
        this._pictureText.bitmap = ImageManager.loadGallery('Text');
    this._backSprite.bitmap = ImageManager.loadGallery('Background');
        this._textSprite.bitmap = new Bitmap(Graphics.boxWidth - 100, 100);
        this._textSprite.move(0, Graphics.boxHeight - 100);
        this._textSprite.bitmap.textColor = "white";
        this._textSprite.bitmap.drawText("画像 : " + this.number + " / " + maxPictures, 100, 0, Graphics.boxWidth - 100, 100, "left");
        this._textSprite.bitmap.drawText("完成率: " + Math.floor(100 * this.rate) + " %" , 0, 0, Graphics.boxWidth - 100, 100, "right");
    this.addChild(this._backSprite);
        this.addChild(this._textSprite);
        this.addChild(this._picture);
        this.addChild(this._pictureText);
};

Scene_Gallery.prototype.onItemOk = function() {
    this._picture.bitmap = ImageManager.loadGallery(this._galleryWindow.index() + 1);
        this._galleryWindow.visible = false;
        this._picture.scale = new Point(pictureScaleInit, pictureScaleInit);
        this._picture.move(0, 0);
        this._picture.visible = true;
        this._pictureText.visible = true;
};

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

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

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

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

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

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

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

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

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

Window_Gallery.prototype.refresh = function() {
    this.makeItemList();
    this.createContents();
    this.drawAllItems();
};

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

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

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

Window_Gallery.prototype.processOk = function() {
    if ($gameSystem.gallery[this.index() + 1]) {
        this.playOkSound();
        this.updateInputData();
        this.deactivate();
        this.callOkHandler();
    } else {
        this.playBuzzerSound();
    }
};

var old_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
Scene_Boot.prototype.loadSystemImages = function() {
        ImageManager.loadGallery("locked");
        for (var i = 0; i <= maxPictures; i++) {
                ImageManager.loadGallery(i);
        }
        old_loadSystemImages();
};[/pre]
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
星屑
4822
在线时间
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.

在本版发帖返回顶部