|
马上注册,享用更多精彩。
您需要 登录 才可以下载或查看,没有帐号?免费注册
x
作者:salvareless
- //=============================================================================
- // 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); //绘制彩条
- };
复制代码
|
评分
-
查看全部评分
|