查看: 4302|回复: 4

[有事请教] 有无懂js的小伙伴帮我看看立绘xy的设置

[复制链接]
梦石
0
星屑
1321
在线时间
157 小时
注册时间
2006-2-12
回帖
157
发表于 2023-8-4 17:24:29 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
如图我的立绘被切头了,插件预留的js定义的代码如下:[pre lang="JS"]// Declare Constants
const maxExp = '-------';
const lineHeight = this.lineHeight();
const gaugeLineHeight = this.gaugeLineHeight();
const basicDataHeight = lineHeight * 6.5;
const actor = this._actor;
const padding = this.itemPadding();
const halfWidth = this.innerWidth / 2;
let rect = new Rectangle(0, 0, halfWidth, this.innerHeight);
let x = 0;
let y = 0;

// Draw Actor Graphic
this.drawActorGraphic(0, this.innerWidth / 2);

// Declare Smaller Data Area
let sx = rect.x;
let sy = Math.max(rect.y, rect.y + (rect.height - basicDataHeight));
let sw = rect.width;
let sh = rect.y + rect.height - sy;

// Draw Actor Name
this.drawItemDarkRect(0, sy, sw, lineHeight, 2);
this.drawText(actor.name(), sx, sy, sw, 'center');

// Draw Actor Level
sx = rect.x + Math.round((rect.width - 128) / 2);
sy += lineHeight;
this.drawItemDarkRect(0, sy, sw, lineHeight);
this.drawActorLevel(actor, sx, sy);

// Draw Actor Class
const className = actor.currentClass().name;
sx = rect.x + Math.round((rect.width - this.textSizeEx(className).width) / 2);
sy += lineHeight;
this.drawItemDarkRect(0, sy, sw, lineHeight);
this.drawTextEx(className, sx, sy, sw);

// Draw Actor Icons
sx = rect.x + Math.round((rect.width - 144) / 2);
sy += lineHeight;
this.drawItemDarkRect(0, sy, sw, lineHeight);
this.drawActorIcons(actor, sx, sy);

// Draw Gauges
sx = rect.x + Math.round((rect.width - 128) / 2);
sy += lineHeight;
this.drawItemDarkRect(0, sy, sw, this.innerHeight - sy);
this.placeGauge(actor, "hp", sx, sy);
sy += gaugeLineHeight;
this.placeGauge(actor, "mp", sx, sy);
sy += gaugeLineHeight;
if ($dataSystem.optDisplayTp) {
    this.placeGauge(actor, "tp", sx, sy);
}

// Declare Second Half
rect = new Rectangle(halfWidth, 0, halfWidth, this.innerHeight);

// Draw EXP
this.changeTextColor(ColorManager.systemColor());
this.drawItemDarkRect(rect.x, rect.y, rect.width, lineHeight, 2);
this.drawText(TextManager.exp, rect.x, rect.y, rect.width, 'center');
const expHeight = lineHeight * 5;
this.drawItemDarkRect(rect.x, rect.y + lineHeight * 1, rect.width, lineHeight * 2);
this.drawItemDarkRect(rect.x, rect.y + lineHeight * 3, rect.width, lineHeight * 2);
const expTotal = TextManager.expTotal.format(TextManager.exp);
const expNext = TextManager.expNext.format(TextManager.level);
this.changeTextColor(ColorManager.systemColor());
this.drawText(expTotal, rect.x + padding, rect.y + lineHeight * 1, rect.width - padding * 2);
this.drawText(expNext, rect.x + padding, rect.y + lineHeight * 3, rect.width - padding * 2);
this.resetTextColor();
const expTotalValue = actor.currentExp();
const expNextValue = actor.isMaxLevel() ? maxExp : actor.nextRequiredExp();
this.drawText(expTotalValue, rect.x + padding, rect.y + lineHeight * 1, rect.width - padding * 2, 'right');
this.drawText(expNextValue, rect.x + padding, rect.y + lineHeight * 3, rect.width - padding * 2, 'right');

// Declare Parameters
const params1 = this.getParameterList(1);
const nameWidth = rect.width - padding * 2 - this.textWidth('88888');

// Draw Parameters 1
x = rect.x + padding;
y = rect.y + expHeight;
this.changeTextColor(ColorManager.systemColor());
this.drawItemDarkRect(rect.x, y, rect.width, lineHeight, 2);
this.drawText(TextManager.statusMenuBiography, rect.x, y, rect.width, 'center');
this.resetTextColor();
paramWidth = rect.width - (padding * 2);
for (const paramId of params1) {
    this.changeTextColor(ColorManager.systemColor());
    this.drawItemDarkRect(rect.x, y + lineHeight * 1, rect.width, lineHeight);
    this.drawParamName(paramId, x, y + lineHeight * 1, nameWidth);
    this.resetTextColor();
    this.drawParamValue(paramId, x, y + lineHeight * 1, paramWidth);
    y += lineHeight;
}
this.drawItemDarkRect(rect.x, y, rect.width, this.innerHeight - y);[/pre]
5401691141037_.pic.jpg
梦石
0
星屑
6808
在线时间
461 小时
注册时间
2012-2-19
回帖
37
发表于 2023-8-4 18:00:35 | 显示全部楼层
有没有一种可能,是你的图片太大了
回复

使用道具 举报

梦石
0
星屑
1321
在线时间
157 小时
注册时间
2006-2-12
回帖
157
 楼主| 发表于 2023-8-4 18:02:05 | 显示全部楼层
sundeshuo 发表于 2023-8-4 18:00
有没有一种可能,是你的图片太大了

可是我需要这么大啊,我的意思是我要挪动y轴让头显示出来,下半身可以出框
回复

使用道具 举报

梦石
0
星屑
6808
在线时间
461 小时
注册时间
2012-2-19
回帖
37
发表于 2023-8-4 18:14:02 | 显示全部楼层
应该没法改,他那个drawActorGraphic函数改不了
回复

使用道具 举报

梦石
0
星屑
1321
在线时间
157 小时
注册时间
2006-2-12
回帖
157
 楼主| 发表于 2023-8-4 21:04:09 | 显示全部楼层
sundeshuo 发表于 2023-8-4 18:14
应该没法改,他那个drawActorGraphic函数改不了

自己解决了,直接从 物品装备菜单里面复制代码过来
替换成:

// Draw Menu Image
this.drawItemActorMenuImage(this._actor, 0, 0, this.innerWidth / 2, this.innerHeight * 1.8);
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部