This commit is contained in:
恍兮惚兮 2024-05-12 13:45:50 +08:00
parent 4b966dd46c
commit a3c109d5e4

View File

@ -40,6 +40,23 @@ function clipboardsender(s, lpsplit) {
if (transwithfont.length == 0) return s; if (transwithfont.length == 0) return s;
return splitfonttext(transwithfont) return splitfonttext(transwithfont)
} }
function clipboardsender_only_send(s, lpsplit) {
//magic split \x02 text
s = magicsend + lpsplit.toString() + '\x02' + s;
try {
const _clipboard = require('nw.gui').Clipboard.get();
_clipboard.set(s, 'text');
}
catch (err) {
try {
const clipboard = require('electron').clipboard;
clipboard.writeText(s);
}
catch (err2) {
}
}
}
function rpgmakerhook() { function rpgmakerhook() {
if (Window_Message.prototype.originstartMessage) { } if (Window_Message.prototype.originstartMessage) { }
@ -60,11 +77,11 @@ function rpgmakerhook() {
} }
Bitmap.prototype.drawText = function (text, x, y, maxWidth, lineHeight, align) { Bitmap.prototype.drawText = function (text, x, y, maxWidth, lineHeight, align) {
//y>100的有重复慢速是单字符快速是多字符 //y>100的有重复慢速是单字符快速是多字符
if (y < 100) { if (text && (y < 100)) {
extra = 5 + ((text.length == 1) ? 0 : 1); extra = 5 + ((text.length == 1) ? 0 : 1);
if (y != Bitmap.prototype.last_y) if (y != Bitmap.prototype.last_y)
clipboardsender('\n', extra) clipboardsender_only_send('\n', extra)
clipboardsender(text, extra) clipboardsender_only_send(text, extra)
Bitmap.prototype.last_y = y; Bitmap.prototype.last_y = y;
} }
return this.drawText_ori(text, x, y, maxWidth, lineHeight, align); return this.drawText_ori(text, x, y, maxWidth, lineHeight, align);