赞 | 34 |
VIP | 2 |
好人卡 | 3 |
积分 | 312 |
经验 | 36064 |
最后登录 | 2024-11-16 |
在线时间 | 608 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 31195
- 在线时间
- 608 小时
- 注册时间
- 2014-7-18
- 帖子
- 729
|
2楼
楼主 |
发表于 2017-5-1 13:33:27
|
只看该作者
本帖最后由 xjzsq 于 2019-6-27 12:20 编辑
糊了好几个晚上代码,今天终于糊完了,发出来。
最终实现代码:- /*:
- @author xjzsq
- @plugindesc 地图显示角色状态信息
- @help
- */
- var $refresh = true;
- function Window_MapStatus() {
- this.initialize.apply(this,arguments)
- }
- Window_MapStatus.prototype = Object.create(Window_Base.prototype);
- Window_MapStatus.prototype.constructor = Window_MapStatus;
- Window_MapStatus.prototype.initialize = function (x, y, width, height) {
- Window_Base.prototype.initialize.call(this, x, y, width, height);
- this.opacity = 0;
- this.refresh();
- }
- Game_Actor.prototype.xjzsq_refresh = Game_Actor.prototype.refresh;
- Game_Actor.prototype.refresh = function () {
- this.xjzsq_refresh;
- $refresh = true;
- }
- Window_MapStatus.prototype.drawGauge = function (x, y, width, rate, color1, color2) {
- var fillW = Math.floor(width * rate);
- var gaugeY = y + this.lineHeight() - 8;
- this.contents.fillRect(x, gaugeY, width, 6, this.gaugeBackColor());
- this.contents.gradientFillRect(x, y + 24, fillW, 6, color1, color2, true);
- this.contents.gradientFillRect(x, y + 30, fillW, 6, color2, color1, true);
- this.contents.fillRect(x, y + 24, width, 2, this.normalColor());
- this.contents.fillRect(x, y + 34, width, 2, this.normalColor());
- this.contents.fillRect(x, y + 26, 2, 8, this.normalColor());
- this.contents.fillRect(x + width - 2, y + 26, 2, 8, this.normalColor());
- };
- Window_MapStatus.prototype.refresh = function () {
- this.contents.clear();
- this.drawActorFace($gameParty.members()[0], 0, 0);
- this.drawActorName($gameParty.members()[0], 0, 0);
- this.drawActorLevel($gameParty.members()[0], 151, 0);
- this.drawActorIcons($gameParty.members()[0], 0, 108);
- this.drawActorHp($gameParty.members()[0], 151, 36);
- this.drawActorMp($gameParty.members()[0], 151, 72);
- this.drawActorTp($gameParty.members()[0], 151, 108, 186);
- this.drawActorExp($gameParty.members()[0], 0, 144, 346);
- }
- Window_MapStatus.prototype.update = function () {
- Window_Base.prototype.update.call(this);
- if($refresh){
- this.refresh();
- $refresh = false;
- }
- if ($gamePlayer.screenX() >= 0 && $gamePlayer.screenX() <= this.width && $gamePlayer.screenY() >= 0 && $gamePlayer.screenY() <= this.height)
- {
- this.contentsOpacity = 75;
- }
- else this.contentsOpacity = 225;
- }
- Game_BattlerBase.prototype.expRate = function () {
- return this.currentExp() / this.nextLevelExp();
- };
- Window_MapStatus.prototype.drawActorExp = function (actor, x, y, width) {
- width = width || 186;
- var color1 = this.tpGaugeColor1();
- var color2 = this.tpGaugeColor2();
- this.drawGauge(x, y, width, actor.expRate(), color1, color2);
- this.changeTextColor(this.systemColor());
- this.drawText(TextManager.expA, x, y, 44);
- this.drawCurrentAndMax(actor.currentExp(), actor.nextLevelExp(), x, y, width,
- this.tpColor(actor), this.normalColor());
- };
- Scene_Map.prototype.createDisplayObjects = function () {
- //创建精灵组
- this.createSpriteset();
- //创建地图名称窗口
- this.createMapNameWindow();
- //创建窗口层
- this.createWindowLayer();
- //创建所有窗口
- this.createAllWindows();
- //创建一个显示角色状态的窗口
- this.createStatusWindow();
- };
- //创建
- Scene_Map.prototype.xjzsq_create = Scene_Map.prototype.create
- Scene_Map.prototype.create = function () {
- this.xjzsq_create()
- var face = ImageManager.loadFace($gameParty.members()[0]._faceName);
- var icons = ImageManager.loadSystem('IconSet');
- };
- //创建一个显示名字的窗口
- Scene_Map.prototype.createStatusWindow = function () {
- this._StatusWindow = new Window_MapStatus(0, 0, 410, 216);
- this.addWindow(this._StatusWindow); //窗口添加到窗口层
- };
复制代码
|
|