Skip to content

Commit

Permalink
v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lchzh3473 committed Feb 11, 2024
1 parent 9303327 commit 5963f2c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "unity-extract-vite",
"private": true,
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
4 changes: 2 additions & 2 deletions scripts/meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.1",
"version": "0.1.2",
"pubdate": 1686388918,
"lastupdate": 1690882485
"lastupdate": 1707626662
}
18 changes: 17 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,25 @@ app.callback = (type: string, obj: unknown) => {
if (type === 'TextAsset') {
const textArea = document.createElement('textarea');
textArea.value = obj as string;
container.appendChild(textArea);
// container.appendChild(textArea);
textArea.style.cssText += ';width:80%;max-width:854px;min-height:100px;display:block;margin:0 auto';
textArea.readOnly = true;
const controller = document.createElement('div');
container.appendChild(controller);
controller.appendChild(textArea);
const downloadButton = document.createElement('button');
downloadButton.textContent = 'Download Text';
const downloadText = () => {
const blob = new Blob([textArea.value], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'plain.txt';
a.click();
URL.revokeObjectURL(url);
};
downloadButton.addEventListener('click', downloadText);
controller.appendChild(downloadButton);
}
if (type === 'Texture2D') {
const imageBitmap = obj as ImageBitmap;
Expand Down

0 comments on commit 5963f2c

Please sign in to comment.