江湖梦网游戏服务平台

 找回密码
 免费注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 2855|回复: 2

[搬运汉化] 声望

[复制链接]

4

帖子

0

精华

0

贡献

江湖散人

Rank: 2Rank: 2

积分
136
发表于 2020-1-17 23:11 | 显示全部楼层 |阅读模式

马上注册,享用更多精彩。

您需要 登录 才可以下载或查看,没有帐号?免费注册

x
作者:salvareless

  1. //=============================================================================
  2. // Salvareless Own Use System
  3. // SOS_声望界面.js
  4. //=============================================================================
  5. //=========================================================================
  6. //        声明区段
  7. //=========================================================================
  8. function Window_Shengwang() {
  9.         this.initialize.apply(this, arguments);
  10. };

  11. Window_Shengwang.prototype = Object.create(Window_Selectable.prototype);
  12. Window_Shengwang.prototype.initialize = function(x, y, width, height) {
  13.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  14. };

  15. function Scene_Shengwang() {
  16.         this.initialize.apply(this, arguments);
  17. };

  18. Scene_Shengwang.prototype = Object.create(Scene_MenuBase.prototype);
  19. Scene_Shengwang.prototype.initialize = function() {
  20.     Scene_MenuBase.prototype.initialize.call(this);
  21. };

  22. Scene_Shengwang.prototype.create = function() {
  23. Scene_MenuBase.prototype.create.call(this);
  24.     this._commandWindow = new Window_Shengwang(0, 0, 816, 624);
  25.     this.addWindow(this._commandWindow);
  26. };

  27. Scene_Shengwang.prototype.update = function() {
  28.     if (Input.isTriggered('escape') || Input.isTriggered('cancel')) {
  29.         this._commandWindow.hide();
  30.         SceneManager.goto(Scene_Menu);
  31.     };
  32. };

  33. // ======================================================================
  34. // * Scene_Menu
  35. // ======================================================================
  36. Scene_Menu.prototype.Shengwang_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
  37. Scene_Menu.prototype.createCommandWindow = function() {
  38.         this.Shengwang_createCommandWindow();
  39.         this._commandWindow.setHandler('shengwang',   this.command_Shengwang.bind(this));
  40. };
  41. Scene_Menu.prototype.command_Shengwang = function() {
  42.         SceneManager.push(Scene_Shengwang);
  43. };

  44. // ======================================================================
  45. // * Window_MenuCommand
  46. // ======================================================================
  47. Window_MenuCommand.prototype.Shengwang_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands;
  48. Window_MenuCommand.prototype.addOriginalCommands = function() {
  49.         this.Shengwang_addOriginalCommands();
  50.         this.addCommand('声望', 'shengwang', this.areMainCommandsEnabled());
  51. };

  52. //=======================================================================
  53. // 显示区段
  54. //=======================================================================
  55. Window_Shengwang.prototype.initialize = function(x, y, width, height) {
  56.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  57.     this.drawShengwangText();
  58. };

  59. Window_Shengwang.prototype.drawShengwangText = function() {
  60.         var dy = 0;
  61.         var dx = 34;                                //左侧文字绘制的X坐标,已经留出图标位置。
  62.         var di = 416;                                //右侧图标显示的X坐标,左侧为0
  63.         var dxx = 450;                                //右侧文字绘制的X坐标。已经留出图标位置。
  64.         var dw = 816;                                //界面总宽
  65.         var gx = 160;                                //绘制条的起始位置,已经留出五个字的生命名称及:符号,例如:“银西法尔特:”
  66.         this.contents.fontSize = 24;
  67.     this.drawText("声望", 0, -4, dw, 'left');
  68.         dy += 24;        //行高变化
  69.         this.drawText("———————————————————————————————", 0, dy, dw, 'left');
  70.         this.contents.fontSize = 20;
  71.         dy += 24;
  72.     this.drawText("凡尘世界声望", 0, dy, dw, 'left');
  73.         dy += 32;
  74.         //第一行左
  75.         this.drawIcon( 3, 0, dy + 3);                //图标语句
  76.         this.drawText("银西法尔特:", dx, dy, dw, 'left');
  77.         var v1 = $gameVariables.value(22);        //要使用的变量
  78.         var v2 = 1000;                                                //当前阶段的声望上限
  79.         var rate = v1 / v2;                                        //计算声望条的绘制比例
  80.         var color = '#ff0000'                                //设置声望条的颜色
  81.         var text = "仇恨:" + v1 + "/" + v2;        //赋值要显示在声望条上面的文字
  82.         this.drawGauge(gx, dy, 240, rate, color);        //绘制声望条
  83.         this.drawText(text, gx + 12, dy - 2 , dw, 'left');        //绘制要显示在声望条上面的文字
  84.         //第一行右
  85.         this.drawIcon( 3, di, dy + 3);
  86.         this.drawText("尘隐镇:", dxx, dy, dw, 'left' );
  87.         
  88. };
  89. //绘制条函数
  90. Window_Shengwang.prototype.drawGauge = function(x, y, width, rate, color) {
  91.         var fillW = Math.floor(width * rate);                        //比例换算成彩条长度
  92.     this.contents.fillRect(x, y + 12, width, 20, '#000000');        //绘制条的黑底
  93.     this.contents.gradientFillRect(x, y + 12, fillW, 20, color, color);                //绘制彩条

  94. };
复制代码


评分

参与人数 1梦想 +100 收起 理由
Fanzi + 100 很给力!

查看全部评分

21

帖子

0

精华

0

贡献

江湖散人

Rank: 2Rank: 2

积分
114
发表于 2020-1-19 16:24 | 显示全部楼层
老哥问一下,如果在新窗口显示一个变量1,this.drawTextEx( $gameVariables.value(1),0,40)这样错在哪里了呀

9582

帖子

13

精华

124

贡献

管理员

狮子王

Rank: 13Rank: 13Rank: 13

积分
102873

突出贡献荣誉管理论坛元老

QQ
发表于 2020-1-19 22:10 | 显示全部楼层
XIAOYU666 发表于 2020-1-19 16:24
老哥问一下,如果在新窗口显示一个变量1,this.drawTextEx( $gameVariables.value(1),0,40)这样错在哪里了 ...

看你写在哪吧。这句看似没啥问题啊。
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|手机版|Archiver|小黑屋|江湖梦网 ( 粤ICP备18126133号-1 )

GMT+8, 2024-4-23 17:21 , Processed in 0.257310 second(s), 28 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表