添加debug工具
This commit is contained in:
@ -0,0 +1,70 @@
|
||||
mergeInto( LibraryManager.library,
|
||||
{
|
||||
IngameDebugConsoleStartCopy: function( textToCopy )
|
||||
{
|
||||
var textToCopyJS = UTF8ToString( textToCopy );
|
||||
|
||||
// Delete if element exist
|
||||
var copyTextButton = document.getElementById( 'DebugConsoleCopyButtonGL' );
|
||||
if( !copyTextButton )
|
||||
{
|
||||
copyTextButton = document.createElement( 'button' );
|
||||
copyTextButton.setAttribute( 'id', 'DebugConsoleCopyButtonGL' );
|
||||
copyTextButton.setAttribute( 'style','display:none; visibility:hidden;' );
|
||||
}
|
||||
|
||||
copyTextButton.onclick = function( event )
|
||||
{
|
||||
// Credit: https://stackoverflow.com/a/30810322/2373034
|
||||
if( navigator.clipboard )
|
||||
{
|
||||
navigator.clipboard.writeText( textToCopyJS ).then( function() { }, function( err )
|
||||
{
|
||||
console.error( "Couldn't copy text to clipboard using clipboard.writeText: ", err );
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
var textArea = document.createElement( 'textarea' );
|
||||
textArea.value = textToCopyJS;
|
||||
|
||||
// Avoid scrolling to bottom
|
||||
textArea.style.top = "0";
|
||||
textArea.style.left = "0";
|
||||
textArea.style.position = "fixed";
|
||||
|
||||
document.body.appendChild( textArea );
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
|
||||
try
|
||||
{
|
||||
document.execCommand( 'copy' );
|
||||
}
|
||||
catch( err )
|
||||
{
|
||||
console.error( "Couldn't copy text to clipboard using document.execCommand", err );
|
||||
}
|
||||
|
||||
document.body.removeChild( textArea );
|
||||
}
|
||||
};
|
||||
|
||||
document.body.appendChild( copyTextButton );
|
||||
document.onmouseup = function()
|
||||
{
|
||||
document.onmouseup = null;
|
||||
copyTextButton.click();
|
||||
document.body.removeChild( copyTextButton );
|
||||
};
|
||||
},
|
||||
|
||||
IngameDebugConsoleCancelCopy: function()
|
||||
{
|
||||
var copyTextButton = document.getElementById( 'DebugConsoleCopyButtonGL' );
|
||||
if( copyTextButton )
|
||||
document.body.removeChild( copyTextButton );
|
||||
|
||||
document.onmouseup = null;
|
||||
}
|
||||
} );
|
@ -0,0 +1,39 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa23dd530e9f98c4cb0766404fc0e755
|
||||
timeCreated: 1626377683
|
||||
licenseType: Free
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
data:
|
||||
first:
|
||||
Facebook: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
WebGL: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user