| 赞 | 2 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2024-3-18 |
| 在线时间 | 54 小时 |
- 梦石
- 0
- 星屑
- 81
- 在线时间
- 54 小时
- 注册时间
- 2008-12-24
- 回帖
- 188
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 kula1900 于 2017-3-10 20:55 编辑
希望哪个HTML达人写个CHM版本的。先开下我翻译完成的。
场景类,窗口类,本论坛的成员几乎玩坏了。
1页:rpg_objects.js
2页:rpg_managers.js
游戏对象类
1.游戏临时数据类
- //-----------------------------------------------------------------------------
- // Game_Temp
- //
- // The game object class for temporary data that is not included in save data.
- // 游戏临时数据类
- // 游戏对象类 临时数据不包括在存储数据。
- function Game_Temp() {
- this.initialize.apply(this, arguments);
- }
- // 游戏临时数据类.初始化
- Game_Temp.prototype.initialize = function() {
- this._isPlaytest = Utils.isOptionValid('test'); // 游戏临时数据类.游戏测试
- this._commonEventId = 0; // 游戏临时数据类.公共事件ID
- this._destinationX = null; // 游戏临时数据类.目的地X
- this._destinationY = null; // 游戏临时数据类.目的地Y
- };
- // 游戏临时数据类.是否是游戏测试
- Game_Temp.prototype.isPlaytest = function() {
- return this._isPlaytest;
- };
- // 游戏临时数据类.保留公共事件
- Game_Temp.prototype.reserveCommonEvent = function(commonEventId) {
- this._commonEventId = commonEventId;
- };
- // 游戏临时数据类.清除公共事件
- Game_Temp.prototype.clearCommonEvent = function() {
- this._commonEventId = 0;
- };
- // 游戏临时数据类.是否存在保留的公共事件
- Game_Temp.prototype.isCommonEventReserved = function() {
- return this._commonEventId > 0;
- };
- // 游戏临时数据类.取保留公共事件
- Game_Temp.prototype.reservedCommonEvent = function() {
- return $dataCommonEvents[this._commonEventId];
- };
- // 游戏临时数据类.设置目的地
- Game_Temp.prototype.setDestination = function(x, y) {
- this._destinationX = x;
- this._destinationY = y;
- };
- // 游戏临时数据类.清除目的地
- Game_Temp.prototype.clearDestination = function() {
- this._destinationX = null;
- this._destinationY = null;
- };
- // 游戏临时数据类.目的地是否有效
- Game_Temp.prototype.isDestinationValid = function() {
- return this._destinationX !== null;
- };
- // 游戏临时数据类.取目的地X坐标
- Game_Temp.prototype.destinationX = function() {
- return this._destinationX;
- };
- // 游戏临时数据类.取目的地Y坐标
- Game_Temp.prototype.destinationY = function() {
- return this._destinationY;
- };
复制代码
2.游戏系统类
3.游戏时间类
- //-----------------------------------------------------------------------------
- // Game_Timer
- //
- // The game object class for the timer.
- // 游戏时间类
- function Game_Timer() {
- this.initialize.apply(this, arguments);
- }
- // 游戏时间类.初始化
- Game_Timer.prototype.initialize = function() {
- this._frames = 0; // 游戏时间类.帧数
- this._working = false; // 游戏时间类.工作中
- };
- // 游戏时间类.更新(活动场景)
- Game_Timer.prototype.update = function(sceneActive) {
- // 活动场景 非空 且 游戏时间类.工作中 且 游戏时间类.帧数 > 0
- if (sceneActive && this._working && this._frames > 0) {
- this._frames--; // 游戏时间类.帧数--
- if (this._frames === 0) { // 游戏时间类.帧数 === 0
- this.onExpire(); // 游戏时间类.到期事件()
- }
- }
- };
- // 游戏时间类.开始
- Game_Timer.prototype.start = function(count) {
- this._frames = count;
- this._working = true;
- };
- // 游戏时间类.停止
- Game_Timer.prototype.stop = function() {
- this._working = false;
- };
- // 游戏时间类.是否在工作中
- Game_Timer.prototype.isWorking = function() {
- return this._working;
- };
- // 游戏时间类.取分钟数
- Game_Timer.prototype.seconds = function() {
- return Math.floor(this._frames / 60);
- };
- // 游戏时间类.到期事件
- Game_Timer.prototype.onExpire = function() {
- BattleManager.abort(); // 战斗管理器.终止
- };
复制代码
4.游戏消息类
5.游戏开关类
- //-----------------------------------------------------------------------------
- // Game_Switches
- //
- // The game object class for switches.
- // 游戏开关类
- function Game_Switches() {
- this.initialize.apply(this, arguments);
- }
- // 游戏开关类.初始化
- Game_Switches.prototype.initialize = function() {
- this.clear();
- };
- // 游戏开关类.清除
- Game_Switches.prototype.clear = function() {
- this._data = [];
- };
- // 游戏开关类.取值
- Game_Switches.prototype.value = function(switchId) {
- return !!this._data[switchId];
- };
- // 游戏开关类.设置值
- Game_Switches.prototype.setValue = function(switchId, value) {
- if (switchId > 0 && switchId < $dataSystem.switches.length) {
- this._data[switchId] = value;
- this.onChange();
- }
- };
- // 游戏开关类.改变值事件
- Game_Switches.prototype.onChange = function() {
- $gameMap.requestRefresh();
- };
复制代码
6.游戏变量类
- //-----------------------------------------------------------------------------
- // Game_Variables
- //
- // The game object class for variables.
- // 游戏变量类
- function Game_Variables() {
- this.initialize.apply(this, arguments);
- }
- // 游戏变量类.初始化
- Game_Variables.prototype.initialize = function() {
- this.clear();
- };
- // 游戏变量类.清除
- Game_Variables.prototype.clear = function() {
- this._data = [];
- };
- // 游戏变量类.取值
- Game_Variables.prototype.value = function(variableId) {
- return this._data[variableId] || 0;
- };
- // 游戏变量类.设置值
- Game_Variables.prototype.setValue = function(variableId, value) {
- if (variableId > 0 && variableId < $dataSystem.variables.length) {
- if (typeof value === 'number') {
- value = Math.floor(value);
- }
- this._data[variableId] = value;
- this.onChange();
- }
- };
- // 游戏变量类.改变值事件
- Game_Variables.prototype.onChange = function() {
- $gameMap.requestRefresh();
- };
复制代码
7.游戏独立开关类
- //-----------------------------------------------------------------------------
- // Game_SelfSwitches
- //
- // The game object class for self switches.
- // 游戏独立开关类
- function Game_SelfSwitches() {
- this.initialize.apply(this, arguments);
- }
- // 游戏独立开关类.初始化
- Game_SelfSwitches.prototype.initialize = function() {
- this.clear();
- };
- // 游戏独立开关类.清除
- Game_SelfSwitches.prototype.clear = function() {
- this._data = {};
- };
- // 游戏独立变量类.取值
- Game_SelfSwitches.prototype.value = function(key) {
- return !!this._data[key];
- };
- // 游戏独立开关类.设置值
- Game_SelfSwitches.prototype.setValue = function(key, value) {
- if (value) {
- this._data[key] = true;
- } else {
- delete this._data[key];
- }
- this.onChange();
- };
- // 游戏独立开关类.改变值事件
- Game_SelfSwitches.prototype.onChange = function() {
- $gameMap.requestRefresh();
- };
复制代码
8.游戏屏幕类(本类最后几个没有翻译,准备睡觉了,每天开车跑长途,停更2天。)
- //-----------------------------------------------------------------------------
- // 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;
- };
复制代码
|
评分
-
查看全部评分
|