赞 | 8 |
VIP | 0 |
好人卡 | 3 |
积分 | 6 |
经验 | 8536 |
最后登录 | 2024-11-7 |
在线时间 | 165 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 642
- 在线时间
- 165 小时
- 注册时间
- 2012-4-18
- 帖子
- 264
|
本帖最后由 salvareless 于 2016-2-22 22:49 编辑
楼主这是要弄声望系统么~~~~呵呵呵~~~~我之两天在着手自己写一个声望系统的脚本,目前还瞎写中。只写好一个雏形,不过如果楼主只需要显示一个功德值的话,随便改改就够用了吧。
以下是雏形= =,原谅我代码写的乱,其实还有一些判断和字符串处理我还在慢慢弄:- //=============================================================================
- // Salvareless Own Use System
- // SOS_声望界面.js
- //=============================================================================
- //=========================================================================
- // 声明区段
- //=========================================================================
- function Window_Shengwang() {
- this.initialize.apply(this, arguments);
- };
- Window_Shengwang.prototype = Object.create(Window_Selectable.prototype);
- Window_Shengwang.prototype.initialize = function(x, y, width, height) {
- Window_Selectable.prototype.initialize.call(this, x, y, width, height);
- };
- function Scene_Shengwang() {
- this.initialize.apply(this, arguments);
- };
- Scene_Shengwang.prototype = Object.create(Scene_MenuBase.prototype);
- Scene_Shengwang.prototype.initialize = function() {
- Scene_MenuBase.prototype.initialize.call(this);
- };
- Scene_Shengwang.prototype.create = function() {
- Scene_MenuBase.prototype.create.call(this);
- this._commandWindow = new Window_Shengwang(0, 0, 816, 624);
- this.addWindow(this._commandWindow);
- };
- Scene_Shengwang.prototype.update = function() {
- if (Input.isTriggered('escape') || Input.isTriggered('cancel')) {
- this._commandWindow.hide();
- SceneManager.goto(Scene_Menu);
- };
- };
- // ======================================================================
- // * Scene_Menu
- // ======================================================================
- Scene_Menu.prototype.Shengwang_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
- Scene_Menu.prototype.createCommandWindow = function() {
- this.Shengwang_createCommandWindow();
- this._commandWindow.setHandler('shengwang', this.command_Shengwang.bind(this));
- };
- Scene_Menu.prototype.command_Shengwang = function() {
- SceneManager.push(Scene_Shengwang);
- };
- // ======================================================================
- // * Window_MenuCommand
- // ======================================================================
- Window_MenuCommand.prototype.Shengwang_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands;
- Window_MenuCommand.prototype.addOriginalCommands = function() {
- this.Shengwang_addOriginalCommands();
- this.addCommand('声望', 'shengwang', this.areMainCommandsEnabled());
- };
- //=======================================================================
- // 显示区段
- //=======================================================================
- Window_Shengwang.prototype.initialize = function(x, y, width, height) {
- Window_Selectable.prototype.initialize.call(this, x, y, width, height);
- this.drawShengwangText();
- };
- Window_Shengwang.prototype.drawShengwangText = function() {
- var dy = 0;
- var dx = 34; //左侧文字绘制的X坐标,已经留出图标位置。
- var di = 416; //右侧图标显示的X坐标,左侧为0
- var dxx = 450; //右侧文字绘制的X坐标。已经留出图标位置。
- var dw = 816; //界面总宽
- var gx = 160; //绘制条的起始位置,已经留出五个字的生命名称及:符号,例如:“银西法尔特:”
- this.contents.fontSize = 24;
- this.drawText("声望", 0, -4, dw, 'left');
- dy += 24; //行高变化
- this.drawText("———————————————————————————————", 0, dy, dw, 'left');
- this.contents.fontSize = 20;
- dy += 24;
- this.drawText("凡尘世界声望", 0, dy, dw, 'left');
- dy += 32;
- //第一行左
- this.drawIcon( 3, 0, dy + 3); //图标语句
- this.drawText("银西法尔特:", dx, dy, dw, 'left');
- var v1 = $gameVariables.value(22); //要使用的变量
- var v2 = 1000; //当前阶段的声望上限
- var rate = v1 / v2; //计算声望条的绘制比例
- var color = '#ff0000' //设置声望条的颜色
- var text = "仇恨:" + v1 + "/" + v2; //赋值要显示在声望条上面的文字
- this.drawGauge(gx, dy, 240, rate, color); //绘制声望条
- this.drawText(text, gx + 12, dy - 2 , dw, 'left'); //绘制要显示在声望条上面的文字
- //第一行右
- this.drawIcon( 3, di, dy + 3);
- this.drawText("尘隐镇:", dxx, dy, dw, 'left' );
-
- };
- //绘制条函数
- Window_Shengwang.prototype.drawGauge = function(x, y, width, rate, color) {
- var fillW = Math.floor(width * rate); //比例换算成彩条长度
- this.contents.fillRect(x, y + 12, width, 20, '#000000'); //绘制条的黑底
- this.contents.gradientFillRect(x, y + 12, fillW, 20, color, color); //绘制彩条
- };
复制代码 |
|