Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Rito_GameEnd_Custom.js
- //=============================================================================
- var Imported = Imported || {};
- Imported.Rito_GameEnd = true;
- var Rito = Rito || {};
- /*:
- * @plugindesc Version 1.02
- * Adds custom background and pictures to your Game End menu.
- * @author Rito
- *
- * @help Please credit me. Usage for commercial/free game.
- *
- * @param Background Filename
- * @desc Change the file name of the background.
- * Image : img\system\GameEnd.png
- * @default GameEnd
- *
- * @param Yes X-Pos
- * @desc X "Yes" position.
- * Image : img\system\GameEnd_command_0.png
- * @default 200
- *
- * @param Yes Y-Pos
- * @desc Y "Yes" position.
- * Image : img\system\GameEnd_command_0.png
- * @default -150
- *
- * @param No X-Pos
- * @desc X "No" position.
- * Image : img\system\GameEnd_command_1.png
- * @default -200
- *
- * @param No Y-Pos
- * @desc Y "No" position.
- * Image : img\system\GameEnd_command_1.png
- * @default -150
- *
- * @param Alignement controls
- * @desc Set alignement control in "Vertical" or "Horizontal" (with directionnal touch) - Default : "Horizontal"
- * @default Horizontal
- */
- var parameters = PluginManager.parameters('Rito_GameEnd_Custom');
- Rito.Param = Rito.Param || {};
- Rito.Param.GameEnd_pic_com_1_x = Number(parameters['Yes X-Pos'] || 200);
- Rito.Param.GameEnd_pic_com_1_y = Number(parameters['Yes Y-Pos'] || -150);
- Rito.Param.GameEnd_pic_com_2_x = Number(parameters['No X-Pos'] || -200);
- Rito.Param.GameEnd_pic_com_2_y = Number(parameters['No Y-Pos'] || -150);
- Rito.Param.Alignement_controls = String(parameters['Alignement controls'] || "Horizontal")
- var bg_gameEnd = parameters['Background Filename'];
- var _alias_Window_GameEnd_updatePlacement = Window_GameEnd.prototype.updatePlacement;
- Window_GameEnd.prototype.updatePlacement = function() {
- this.x = -Graphics.boxWidth;
- this.y = -Graphics.boxheight;
- this.visible = false;
- };
- var _alias_Scene_GameEnd_create = Scene_GameEnd.prototype.create;
- Scene_GameEnd.prototype.create = function() {
- this.createBackground();
- _alias_Scene_GameEnd_create.call(this);
- this.create_picture_commands();
- };
- if (Rito.Param.Alignement_controls == "Horizontal") {
- var _alias_Window_GameEnd_maxCols = Window_GameEnd.prototype.maxCols;
- Window_GameEnd.prototype.maxCols = function() {
- return 2;
- };
- }
- var _alias_Scene_GameEnd_CreateBackground = Scene_GameEnd.prototype.createBackground;
- Scene_GameEnd.prototype.createBackground = function() {
- Scene_MenuBase.prototype.createBackground.call(this);
- this._backgroundSprite = new Sprite();
- this._backgroundSprite.bitmap = ImageManager.loadSystem(bg_gameEnd);
- this.addChild(this._backgroundSprite);
- if (Imported.Soul_Menu_Particles){ this.create_particles(); }
- };
- Scene_GameEnd.prototype.create_picture_commands = function() {
- var _com_index_old = -2;
- this._csel = false;
- this._com_pictures = [];
- this._com_sprites = [];
- this._com_pictures_data = [];
- for (i = 0; i < this._commandWindow._list.length; i++){
- this._com_pictures.push(ImageManager.loadSystem("GameEnd_command_" + i));
- this._com_sprites.push(new Sprite(this._com_pictures[i]));
- this.addChild(this._com_sprites[i]);
- };
- }
- var _alias_Scene_GameEnd_update = Scene_GameEnd.prototype.update;
- Scene_GameEnd.prototype.update = function() {
- _alias_Scene_GameEnd_update.call(this);
- this.update_picture_commands();
- };
- Scene_GameEnd.prototype.refresh_picture_command = function() {
- this._com_index_old = this._commandWindow._index;
- for (i = 0; i < this._com_sprites.length; i++){
- if (this._commandWindow._index != i) {
- var ch = this._com_pictures[i].height / 2;
- }
- else {
- var ch = 0;
- }
- if (i == 0) {this.cpsx = [Rito.Param.GameEnd_pic_com_1_x ,Rito.Param.GameEnd_pic_com_1_y];}
- else if (i == 1) {this.cpsx = [Rito.Param.GameEnd_pic_com_2_x ,Rito.Param.GameEnd_pic_com_2_y];}
- this._com_sprites[i].setFrame(0, ch, this._com_pictures[i].width, this._com_pictures[i].height / 2);
- this._com_sprites[i].x = ((Graphics.boxWidth / 2) - (this._com_pictures[i].width / 2)) + this.cpsx[0];
- this._com_sprites[i].y = ((Graphics.boxHeight / 2) + (this._com_pictures[i].height / 2)) + this.cpsx[1];
- this._com_pictures_data[i] = [this._com_sprites[i].x,this._com_pictures[i].width ,this._com_sprites[i].y,this._com_pictures[i].height / 2 ];
- };
- }
- Scene_GameEnd.prototype.update_picture_commands = function() {
- if (this._com_index_old != this._commandWindow._index) { this.refresh_picture_command()};
- if (TouchInput.isTriggered(true)) {
- for (i = 0; i < this._com_sprites.length; i++){
- if (this.on_picture_com(i) && !this._csel ) {
- this._commandWindow._index = i; this._commandWindow.processOk();
- if (this._commandWindow.isCommandEnabled(i)) {this._csel = true};
- }
- }
- }
- }
- Scene_GameEnd.prototype.on_picture_com = function(index) {
- if (TouchInput.x < this._com_pictures_data[index][0]) { return false};
- if (TouchInput.x > this._com_pictures_data[index][0] + this._com_pictures_data[index][1]) { return false};
- if (TouchInput.y < this._com_pictures_data[index][2]) { return false};
- if (TouchInput.y > this._com_pictures_data[index][2] + this._com_pictures_data[index][3]) { return false};
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement