2024-03-15 21:51:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function NWjshook(){
|
|
|
|
|
function NWjssend(s) {
|
|
|
|
|
const _clipboard = require('nw.gui').Clipboard.get();
|
|
|
|
|
_clipboard.set(s, 'text');
|
|
|
|
|
return _clipboard.get('text')
|
|
|
|
|
}
|
|
|
|
|
if(Window_Message.prototype.originstartMessage)return;
|
|
|
|
|
Window_Message.prototype.originstartMessage=Window_Message.prototype.startMessage;
|
|
|
|
|
Window_Message.prototype.startMessage = function()
|
|
|
|
|
{
|
|
|
|
|
gametext = $gameMessage.allText();
|
|
|
|
|
resp=NWjssend(gametext);
|
|
|
|
|
$gameMessage._texts=[resp]
|
|
|
|
|
this.originstartMessage();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Electronhook() {
|
|
|
|
|
|
|
|
|
|
function Electronsend(s) {
|
2024-03-16 23:00:11 +08:00
|
|
|
|
const clipboard = require('electron').clipboard;
|
2024-03-15 21:51:59 +08:00
|
|
|
|
clipboard.writeText(s);
|
|
|
|
|
return clipboard.readText();
|
|
|
|
|
}
|
2024-03-17 02:09:28 +08:00
|
|
|
|
if(tyrano.plugin.kag.tag.text.originstart)return;
|
|
|
|
|
tyrano.plugin.kag.tag.text.originstart=tyrano.plugin.kag.tag.text.start;
|
|
|
|
|
tyrano.plugin.kag.tag.text.start = function (pm) {
|
|
|
|
|
if (1 != this.kag.stat.is_script && 1 != this.kag.stat.is_html) {
|
|
|
|
|
pm.val=Electronsend(pm.val);
|
|
|
|
|
}
|
|
|
|
|
return this.originstart(pm)
|
2024-03-15 21:51:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function retryinject(times){
|
|
|
|
|
if(times==0)return;
|
2024-03-16 13:40:08 +08:00
|
|
|
|
try{
|
|
|
|
|
if(window.tyrano && tyrano.plugin){
|
|
|
|
|
Electronhook();
|
|
|
|
|
}
|
|
|
|
|
else if(window.Utils && Utils.RPGMAKER_NAME){
|
|
|
|
|
NWjshook();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
setTimeout(retryinject,3000,times-1);
|
|
|
|
|
}
|
2024-03-15 21:51:59 +08:00
|
|
|
|
}
|
2024-03-16 13:40:08 +08:00
|
|
|
|
catch(err){
|
|
|
|
|
//非主线程,甚至没有window对象,会弹窗报错
|
2024-03-15 21:51:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-17 00:16:21 +08:00
|
|
|
|
setTimeout(retryinject,1000,3);
|