Advertisement
CompanionWulf

Windowskin Tool Plugin v2.7 (RMMV)

Nov 28th, 2015
1,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Windowskin Tool Plugin v2.7
  3. //   *  This plugin enables you to tweak certain windowskin settings, such as
  4. //      changing the default windowskin from within the Plugin Manager.
  5. //
  6. //      Also, RMMV has the same transparency problem with windowskins as RMVX
  7. //      did in that the windowskin colour (in the Database) overrides the
  8. //      windowskin graphic (which is a simple hack really).
  9. //
  10. //   * © 2015-2016, Companion Wulf
  11. //
  12. //=============================================================================
  13. // CW_WindowskinTool.js
  14. //=============================================================================
  15.  
  16. var Imported = Imported || {}; Imported.CW_WindowskinTool = true;
  17. var CWT = CWT || {};
  18.  
  19. /*:
  20.  * @plugindesc Changes various windowskin settings.
  21.  * @author Companion Wulf
  22.  *
  23.  * @param Default Windowskin
  24.  * @desc The windowskin to replace the default one. You may still have to adjust the default background colors to match.
  25.  * @default Window
  26.  *
  27.  * @param Change Opacity
  28.  * @desc The translucency (0-255) standard windows.
  29.  * @default 220
  30.  *
  31.  * @help
  32.  *
  33.  * -+ Windowskins Folder +-
  34.  * ------------------------
  35.  * Create a new folder called "windowskins" under "img/system/". This will then
  36.  * be available in the "Resource Manager" (MV v1.1) for you to import windowskins
  37.  * directly for use in your game.
  38.  *
  39.  *
  40.  * -+ Plugin Commands +-
  41.  * ---------------------
  42.  *
  43.  * To change the windowskin in-game, use the following plugin command:
  44.  *
  45.  *      ChangeWindowskin <windowskin_name>
  46.  *
  47.  * where <windowskin_name> is the name of the windowskin you want to change to.
  48.  *
  49.  *
  50.  * To reset the windowskin to default (as set in the "Default Windowskin"
  51.  * parameter, not MV's default), use:
  52.  *
  53.  *      ResetWindowskin
  54.  *
  55.  *
  56.  * If you want to use MV's default Window (for whatever reason), use:
  57.  *
  58.  *      ResetSystemWindowskin
  59.  *
  60.  *
  61.  *
  62. */
  63.  
  64. (function() {
  65.     CWT.parameters = PluginManager.parameters('CW_WindowskinTool');
  66.     CWT.defaultWindowskin = String(CWT.parameters['Default Windowskin'] || 'Window');
  67.     CWT.opacity = Number(CWT.parameters['Change Opacity'] || 220);
  68.    
  69.     CWT.GameInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  70.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  71.         CWT.GameInterpreter_pluginCommand.call(this, command, args);
  72.         if (command === 'ChangeWindowskin') {
  73.             $gameSystem._newWindowskin = String(args[0]);
  74.             ImageManager.loadSystem('windowskins/'+$gameSystem._newWindowskin);
  75.         }
  76.         if (command === 'ResetWindowskin') {
  77.             $gameSystem._newWindowskin = CWT.defaultWindowskin;
  78.             ImageManager.loadSystem('windowskins/'+$gameSystem._newWindowskin);
  79.         }
  80.         if (command === 'ResetSystemWindowskin') {
  81.             $gameSystem._newWindowskin = 'Window';
  82.             ImageManager.loadSystem($gameSystem._newWindowskin);
  83.         }
  84.     }
  85.    
  86.     CWT.GameSystem_initialize = Game_System.prototype.initialize;
  87.     Game_System.prototype.initialize = function() {
  88.         CWT.GameSystem_initialize.call(this);
  89.         this._newWindowskin = CWT.defaultWindowskin;
  90.     };
  91.    
  92.     CWT.WindowBase_loadWindowskin = Window_Base.prototype.loadWindowskin;
  93.     Window_Base.prototype.loadWindowskin = function() {
  94.         if ($gameSystem._newWindowskin !== 'Window') {
  95.             this.windowskin = ImageManager.loadSystem('windowskins/'+$gameSystem._newWindowskin);
  96.         } else {
  97.             this.windowskin = ImageManager.loadSystem('Window');
  98.         }
  99.         if (this.windowskin !== 'Window') {
  100.             this.changeTextColor = this.normalColor;
  101.         }
  102.     };
  103.    
  104.     Window_Base.prototype.standardBackOpacity = function() {
  105.         return CWT.opacity;
  106.     };
  107.    
  108.     CWT.WindowBase_update = Window_Base.prototype.update;
  109.     Window_Base.prototype.update = function() {
  110.         CWT.WindowBase_update.call(this);
  111.         if ('windowskins/'+$gameSystem._newWindowskin) {
  112.             if (this.windowskin !== 'windowskins/'+$gameSystem._newWindowskin) this.loadWindowskin();
  113.         }
  114.     }; 
  115. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement