- //----------------------------------------------------------------------------- 
- // Game_Screen 
- // 
- // The game object class for screen effect data, such as changes in color tone 
- // and flashes. 
- // 游戏屏幕类 
- // 游戏屏幕效果数据对象类,如色调的变化和闪光。 
-   
- function Game_Screen() { 
-     this.initialize.apply(this, arguments); 
- } 
- // 游戏屏幕类.初始化 
- Game_Screen.prototype.initialize = function() { 
-     this.clear(); 
- }; 
- // 游戏屏幕类.清除 
- Game_Screen.prototype.clear = function() { 
-     this.clearFade();         // 游戏屏幕类.清除淡入淡出 
-     this.clearTone();         // 游戏屏幕类.清除色调 
-     this.clearFlash();        // 游戏屏幕类.清除闪烁 
-     this.clearShake();        // 游戏屏幕类.清除震动 
-     this.clearZoom();         // 游戏屏幕类.清除放大 
-     this.clearWeather();      // 游戏屏幕类.清除天气 
-     this.clearPictures();     // 游戏屏幕类.清除图片组 
- }; 
- // 游戏屏幕类.战斗开始事件 
- Game_Screen.prototype.onBattleStart = function() { 
-     this.clearFade();         // 游戏屏幕类.清除淡入淡出 
-     this.clearFlash();        // 游戏屏幕类.清除闪烁 
-     this.clearShake();        // 游戏屏幕类.清除震动 
-     this.clearZoom();         // 游戏屏幕类.清除放大 
-     this.eraseBattlePictures(); // 游戏屏幕类.擦除战斗图像 
- }; 
- // 游戏屏幕类.取亮度 
- Game_Screen.prototype.brightness = function() { 
-     return this._brightness; 
- }; 
- // 游戏屏幕类.取色调 
- Game_Screen.prototype.tone = function() { 
-     return this._tone; 
- }; 
- // 游戏屏幕类.取闪烁颜色 
- Game_Screen.prototype.flashColor = function() { 
-     return this._flashColor; 
- }; 
- // 游戏屏幕类.取震动 
- Game_Screen.prototype.shake = function() { 
-     return this._shake; 
- }; 
- // 游戏屏幕类.取放大X 
- Game_Screen.prototype.zoomX = function() { 
-     return this._zoomX; 
- }; 
- // 游戏屏幕类.取放大Y 
- Game_Screen.prototype.zoomY = function() { 
-     return this._zoomY; 
- }; 
- // 游戏屏幕类.取放大比例 
- Game_Screen.prototype.zoomScale = function() { 
-     return this._zoomScale; 
- }; 
- // 游戏屏幕类.取天气类型 
- Game_Screen.prototype.weatherType = function() { 
-     return this._weatherType; 
- }; 
- // 游戏屏幕类.取天气强度 
- Game_Screen.prototype.weatherPower = function() { 
-     return this._weatherPower; 
- }; 
- // 游戏屏幕类.取图片 
- Game_Screen.prototype.picture = function(pictureId) { 
-     var realPictureId = this.realPictureId(pictureId);  // 游戏屏幕类.取图片真实ID(图片ID) 
-     return this._pictures[realPictureId];               // 游戏屏幕类.图片组[图片真实ID] 
- }; 
- // 游戏屏幕类.取图片真实ID 
- Game_Screen.prototype.realPictureId = function(pictureId) { 
-     if ($gameParty.inBattle()) {               // 游戏队伍类.在战斗中 
-         return pictureId + this.maxPictures(); // 图片ID + 游戏屏幕类.取最大图片数量() 
-     } else { 
-         return pictureId;                      // 直接返回 图片ID 
-     } 
- }; 
- // 游戏屏幕类.清除淡入淡出 
- Game_Screen.prototype.clearFade = function() { 
-     this._brightness = 255;        // 游戏屏幕类.亮度 = 255 
-     this._fadeOutDuration = 0;     // 游戏屏幕类.淡出持续时间 = 0 
-     this._fadeInDuration = 0;      // 游戏屏幕类.淡入持续时间 = 0 
- }; 
- // 游戏屏幕类.清除色调 
- Game_Screen.prototype.clearTone = function() { 
-     this._tone = [0, 0, 0, 0];         // 游戏屏幕类.当前色调 = [R, G, B, 灰度] 
-     this._toneTarget = [0, 0, 0, 0];   // 游戏屏幕类.目标色调 = [R, G, B, 灰度] 
-     this._toneDuration = 0;            // 游戏屏幕类.渐变转换需求时间 = 0 
- }; 
- // 游戏屏幕类.清除闪烁 
- Game_Screen.prototype.clearFlash = function() { 
-     this._flashColor = [0, 0, 0, 0];   // 游戏屏幕类.闪烁颜色 = [R, G, B, 强度] 
-     this._flashDuration = 0;           // 游戏屏幕类.持续时间 = 0 
- }; 
- // 游戏屏幕类.清除震动 
- Game_Screen.prototype.clearShake = function() { 
-     this._shakePower = 0;              // 游戏屏幕类.震动强度 = 0 
-     this._shakeSpeed = 0;              // 游戏屏幕类.震动速度 = 0 
-     this._shakeDuration = 0;           // 游戏屏幕类.持续时间 = 0 
-     this._shakeDirection = 1;          // 游戏屏幕类.震动方向 = 1 
-     this._shake = 0;                   // 游戏屏幕类.震动 = 0 
- }; 
- // 游戏屏幕类.清除放大 
- Game_Screen.prototype.clearZoom = function() { 
-     this._zoomX = 0;                   // 游戏屏幕类.放大X = 0 
-     this._zoomY = 0;                   // 游戏屏幕类.放大Y = 0 
-     this._zoomScale = 1;               // 游戏屏幕类.当前放大比例 = 1 
-     this._zoomScaleTarget = 1;         // 游戏屏幕类.目标放大比例 = 1 
-     this._zoomDuration = 0;            // 游戏屏幕类.放大转换需求时间 = 0 
- }; 
- // 游戏屏幕类.清除天气 
- Game_Screen.prototype.clearWeather = function() { 
-     this._weatherType = 'none';        // 游戏屏幕类.天气类型 = "none" 
-     this._weatherPower = 0;            // 游戏屏幕类.天气当前强度 = 0 
-     this._weatherPowerTarget = 0;      // 游戏屏幕类.天气目标强度 = 0 
-     this._weatherDuration = 0;         // 游戏屏幕类.转换天气需求时间 = 0 
- }; 
- // 游戏屏幕类.清除图片组 
- Game_Screen.prototype.clearPictures = function() { 
-     this._pictures = []; 
- }; 
- // 游戏屏幕类.擦除战斗图像 
- Game_Screen.prototype.eraseBattlePictures = function() { 
-     this._pictures = this._pictures.slice(0, this.maxPictures() + 1); 
- }; 
- // 游戏屏幕类.取最大图片数量 
- Game_Screen.prototype.maxPictures = function() { 
-     return 100; 
- }; 
- // 游戏屏幕类.开始淡出 
- Game_Screen.prototype.startFadeOut = function(duration) { 
-     this._fadeOutDuration = duration;      // 游戏屏幕类.淡出持续时间 = 持续时间 
-     this._fadeInDuration = 0;              // 游戏屏幕类.淡入持续时间 = 0 
- }; 
- // 游戏屏幕类.开始淡入 
- Game_Screen.prototype.startFadeIn = function(duration) { 
-     this._fadeInDuration = duration;      // 游戏屏幕类.淡入持续时间 = 持续时间 
-     this._fadeOutDuration = 0;            // 游戏屏幕类.淡出持续时间 = 0 
- }; 
- // 游戏屏幕类.开始染色(修改色调) 
- Game_Screen.prototype.startTint = function(tone, duration) { 
-     this._toneTarget = tone.clone();           // 游戏屏幕类.目标色调 
-     this._toneDuration = duration;             // 游戏屏幕类.渐变转换需求时间 
-     if (this._toneDuration === 0) {            // 游戏屏幕类.渐变转换需求时间 === 0 
-         this._tone = this._toneTarget.clone(); // 游戏屏幕类.当前色调 = 游戏屏幕类.目标色调 
-     } 
- }; 
- // 游戏屏幕类.开始闪烁 
- Game_Screen.prototype.startFlash = function(color, duration) {  
-     this._flashColor = color.clone();  // 游戏屏幕类.闪烁颜色 
-     this._flashDuration = duration;    // 游戏屏幕类.持续时间 
- }; 
- // 游戏屏幕类.开始震动 
- Game_Screen.prototype.startShake = function(power, speed, duration) { 
-     this._shakePower = power;           // 游戏屏幕类.震动强度 
-     this._shakeSpeed = speed;           // 游戏屏幕类.震动速度 
-     this._shakeDuration = duration;     // 游戏屏幕类.震动持续时间 
- }; 
- // 游戏屏幕类.开始放大 
- Game_Screen.prototype.startZoom = function(x, y, scale, duration) { 
-     this._zoomX = x;                    // 游戏屏幕类.放大X 
-     this._zoomY = y;                    // 游戏屏幕类.放大Y 
-     this._zoomScaleTarget = scale;      // 游戏屏幕类.放大目标比例 
-     this._zoomDuration = duration;      // 游戏屏幕类.放大需求转换时间 
- }; 
- // 游戏屏幕类.设置放大 
- Game_Screen.prototype.setZoom = function(x, y, scale) { 
-     this._zoomX = x;                    // 游戏屏幕类.放大X 
-     this._zoomY = y;                    // 游戏屏幕类.放大Y 
-     this._zoomScale = scale;            // 游戏屏幕类.放大比例 
- }; 
- // 游戏屏幕类.改变天气 
- Game_Screen.prototype.changeWeather = function(type, power, duration) { 
-     if (type !== 'none' || duration === 0) {                 // 如果预设置天气非none 且 持续时间 === 0 
-         this._weatherType = type;                            // 游戏屏幕类.天气类型 
-     } 
-     this._weatherPowerTarget = type === 'none' ? 0 : power;  // 游戏屏幕类.天气目标强度 
-     this._weatherDuration = duration;                        // 游戏屏幕类.转换天气需求时间 
-     if (duration === 0) { 
-         this._weatherPower = this._weatherPowerTarget;       // 游戏屏幕类.天气当前强度 = 游戏屏幕类.天气目标强度 
-     } 
- }; 
- // 游戏屏幕类.刷新 
- Game_Screen.prototype.update = function() { 
-     this.updateFadeOut();  // 游戏屏幕类.刷新淡出 
-     this.updateFadeIn();   // 游戏屏幕类.刷新淡入 
-     this.updateTone();     // 游戏屏幕类.刷新色调 
-     this.updateFlash();    // 游戏屏幕类.刷新闪烁 
-     this.updateShake();    // 游戏屏幕类.刷新震动 
-     this.updateZoom();     // 游戏屏幕类.刷新放大 
-     this.updateWeather();  // 游戏屏幕类.刷新天气 
-     this.updatePictures(); // 游戏屏幕类.刷新图片 
- }; 
- // 游戏屏幕类.刷新淡出 
- Game_Screen.prototype.updateFadeOut = function() { 
-     if (this._fadeOutDuration > 0) {                         // 游戏屏幕类.淡出持续时间 > 0 
-         var d = this._fadeOutDuration;                        
-         this._brightness = (this._brightness * (d - 1)) / d; // 游戏屏幕类.亮度 
-         this._fadeOutDuration--;                             // 游戏屏幕类.淡出持续时间-- 
-     } 
- }; 
- // 游戏屏幕类.刷新淡入 
- Game_Screen.prototype.updateFadeIn = function() { 
-     if (this._fadeInDuration > 0) {                                // 游戏屏幕类.淡入持续时间 > 0 
-         var d = this._fadeInDuration; 
-         this._brightness = (this._brightness * (d - 1) + 255) / d; // 游戏屏幕类.亮度 
-         this._fadeInDuration--;                                    // 游戏屏幕类.淡入持续时间-- 
-     } 
- }; 
- // 游戏屏幕类.刷新色调 
- Game_Screen.prototype.updateTone = function() { 
-     if (this._toneDuration > 0) {                                  // 游戏屏幕类.渐变转换需求时间 > 0 
-         var d = this._toneDuration; 
-                 // 修正[RGB&灰度](数学战五渣 不译...) 
-         for (var i = 0; i < 4; i++) { 
-             this._tone[i] = (this._tone[i] * (d - 1) + this._toneTarget[i]) / d; 
-         } 
-         this._toneDuration--;                                      // 游戏屏幕类.渐变转换需求时间-- 
-     } 
- }; 
- // 游戏屏幕类.刷新闪烁 
- Game_Screen.prototype.updateFlash = function() { 
-     if (this._flashDuration > 0) {                                 // 游戏屏幕类.闪烁持续时间 > 0 
-         var d = this._flashDuration;                                
-         this._flashColor[3] *= (d - 1) / d;                        // 闪烁强度算法 
-         this._flashDuration--;                                     // 游戏屏幕类.闪烁持续时间-- 
-     } 
- }; 
- // 游戏屏幕类.刷新震动 
- Game_Screen.prototype.updateShake = function() { 
-     if (this._shakeDuration > 0 || this._shake !== 0) { 
-         var delta = (this._shakePower * this._shakeSpeed * this._shakeDirection) / 10; 
-         if (this._shakeDuration <= 1 && this._shake * (this._shake + delta) < 0) { 
-             this._shake = 0; 
-         } else { 
-             this._shake += delta; 
-         } 
-         if (this._shake > this._shakePower * 2) { 
-             this._shakeDirection = -1; 
-         } 
-         if (this._shake < - this._shakePower * 2) { 
-             this._shakeDirection = 1; 
-         } 
-         this._shakeDuration--; 
-     } 
- }; 
- // 游戏屏幕类.刷新放大 
- Game_Screen.prototype.updateZoom = function() { 
-     if (this._zoomDuration > 0) { 
-         var d = this._zoomDuration; 
-         var t = this._zoomScaleTarget; 
-         this._zoomScale = (this._zoomScale * (d - 1) + t) / d; 
-         this._zoomDuration--; 
-     } 
- }; 
- // 游戏屏幕类.刷新天气 
- Game_Screen.prototype.updateWeather = function() { 
-     if (this._weatherDuration > 0) { 
-         var d = this._weatherDuration; 
-         var t = this._weatherPowerTarget; 
-         this._weatherPower = (this._weatherPower * (d - 1) + t) / d; 
-         this._weatherDuration--; 
-         if (this._weatherDuration === 0 && this._weatherPowerTarget === 0) { 
-             this._weatherType = 'none'; 
-         } 
-     } 
- }; 
- // 游戏屏幕类.刷新图片 
- Game_Screen.prototype.updatePictures = function() { 
-     this._pictures.forEach(function(picture) { 
-         if (picture) { 
-             picture.update(); 
-         } 
-     }); 
- }; 
- // 游戏屏幕类.开始伤害[事件]闪烁 
- Game_Screen.prototype.startFlashForDamage = function() { 
-     this.startFlash([255, 0, 0, 128], 8);  // 红色 [0-128] 强度 闪烁8帧 
- }; 
- // 游戏屏幕类.显示图片 
- Game_Screen.prototype.showPicture = function(pictureId, name, origin, x, y, 
-                                              scaleX, scaleY, opacity, blendMode) { 
-     var realPictureId = this.realPictureId(pictureId); 
-     var picture = new Game_Picture(); 
-     picture.show(name, origin, x, y, scaleX, scaleY, opacity, blendMode); 
-     this._pictures[realPictureId] = picture; 
- }; 
- // 游戏屏幕类.移动图片 
- Game_Screen.prototype.movePicture = function(pictureId, origin, x, y, scaleX, 
-                                              scaleY, opacity, blendMode, duration) { 
-     var picture = this.picture(pictureId); 
-     if (picture) { 
-         picture.move(origin, x, y, scaleX, scaleY, opacity, blendMode, duration); 
-     } 
- }; 
- // 游戏屏幕类.旋转图片 
- Game_Screen.prototype.rotatePicture = function(pictureId, speed) { 
-     var picture = this.picture(pictureId); 
-     if (picture) { 
-         picture.rotate(speed); 
-     } 
- }; 
- // 游戏屏幕类.修改图片色调 
- Game_Screen.prototype.tintPicture = function(pictureId, tone, duration) { 
-     var picture = this.picture(pictureId); 
-     if (picture) { 
-         picture.tint(tone, duration); 
-     } 
- }; 
- // 游戏屏幕类.清除图片 
- Game_Screen.prototype.erasePicture = function(pictureId) { 
-     var realPictureId = this.realPictureId(pictureId); 
-     this._pictures[realPictureId] = null; 
- };