fix bugs, add local storage
This commit is contained in:
parent
e06c1b5b16
commit
7d7e11bdb1
9 changed files with 35 additions and 20 deletions
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.7948f1f9.css",
|
||||
"main.js": "/static/js/main.d6e3df6e.js",
|
||||
"main.js": "/static/js/main.22757a4a.js",
|
||||
"static/js/787.ada1a5f8.chunk.js": "/static/js/787.ada1a5f8.chunk.js",
|
||||
"static/media/Calamity-Regular.otf": "/static/media/Calamity-Regular.cbeefc650e6ac39335b6.otf",
|
||||
"index.html": "/index.html",
|
||||
"main.7948f1f9.css.map": "/static/css/main.7948f1f9.css.map",
|
||||
"main.d6e3df6e.js.map": "/static/js/main.d6e3df6e.js.map",
|
||||
"main.22757a4a.js.map": "/static/js/main.22757a4a.js.map",
|
||||
"787.ada1a5f8.chunk.js.map": "/static/js/787.ada1a5f8.chunk.js.map"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.7948f1f9.css",
|
||||
"static/js/main.d6e3df6e.js"
|
||||
"static/js/main.22757a4a.js"
|
||||
]
|
||||
}
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="for Breath of the Wild"/><meta property="og:site_name" content="itntpiston.app"/><meta property="og:title" content="Hundo Duplication Simulator"><meta property="og:type" content="website"><meta property="og:url" content="https://dupl.itntpiston.app/#/"><meta property="og:description" content="for Breath of the Wild"><link rel="manifest" href="/manifest.json"/><title>Hundo Duplication Simulator</title><script defer="defer" src="/static/js/main.d6e3df6e.js"></script><link href="/static/css/main.7948f1f9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="for Breath of the Wild"/><meta property="og:site_name" content="itntpiston.app"/><meta property="og:title" content="Hundo Duplication Simulator"><meta property="og:type" content="website"><meta property="og:url" content="https://dupl.itntpiston.app/#/"><meta property="og:description" content="for Breath of the Wild"><link rel="manifest" href="/manifest.json"/><title>Hundo Duplication Simulator</title><script defer="defer" src="/static/js/main.22757a4a.js"></script><link href="/static/css/main.7948f1f9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
3
docs/static/js/main.22757a4a.js
vendored
Normal file
3
docs/static/js/main.22757a4a.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,12 @@
|
|||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
1
docs/static/js/main.22757a4a.js.map
vendored
Normal file
1
docs/static/js/main.22757a4a.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
docs/static/js/main.d6e3df6e.js
vendored
3
docs/static/js/main.d6e3df6e.js
vendored
File diff suppressed because one or more lines are too long
1
docs/static/js/main.d6e3df6e.js.map
vendored
1
docs/static/js/main.d6e3df6e.js.map
vendored
File diff suppressed because one or more lines are too long
26
src/App.tsx
26
src/App.tsx
|
@ -13,8 +13,12 @@ import { deserialzeCommands, serializeCommands } from 'core/serialize';
|
|||
|
||||
const Buffer = require("buffer/").Buffer;
|
||||
|
||||
export const App: React.FC = () => {
|
||||
const [commands, setCommands] = useState<Command[]>([
|
||||
const getDefaultCommands = (): Command[]=>{
|
||||
const encoded = localStorage.getItem("HDS.CurrentCommands");
|
||||
if(encoded){
|
||||
return deserialzeCommands(encoded);
|
||||
}
|
||||
return [
|
||||
new CommandInitialize([
|
||||
{
|
||||
item: Item.Diamond,
|
||||
|
@ -38,7 +42,11 @@ export const App: React.FC = () => {
|
|||
new CommandSortKey(),
|
||||
new CommandSave(),
|
||||
new CommandReload()
|
||||
]);
|
||||
];
|
||||
}
|
||||
|
||||
export const App: React.FC = () => {
|
||||
const [commands, setCommands] = useState<Command[]>(getDefaultCommands());
|
||||
const [displayIndex, setDisplayIndex] = useState<number>(0);
|
||||
const [contextMenuX, setContextMenuX] = useState<number>(0);
|
||||
const [contextMenuY, setContextMenuY] = useState<number>(0);
|
||||
|
@ -65,13 +73,11 @@ export const App: React.FC = () => {
|
|||
}
|
||||
}, [commands, displayIndex]);
|
||||
|
||||
// useEffect(()=>{
|
||||
// const encoded = serializeCommands(commands);
|
||||
// console.log(encoded);
|
||||
// const deserialized = deserialzeCommands(encoded);
|
||||
// console.log(deserialized);
|
||||
// window.location.hash = "#"+encoded;
|
||||
// }, [commands]);
|
||||
useEffect(()=>{
|
||||
const encoded = serializeCommands(commands);
|
||||
localStorage.setItem("HDS.CurrentCommands", encoded);
|
||||
}, [commands]);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
|
|
|
@ -61,9 +61,9 @@ export class CommandInitialize implements Command {
|
|||
return read;
|
||||
}
|
||||
public toBuffer(): Buffer {
|
||||
const buf: Buffer = Buffer.alloc(3*this.stacks.length+5);
|
||||
const buf: Buffer = Buffer.alloc(3*this.stacks.length+3);
|
||||
let write = 0;
|
||||
buf.writeUInt8(CommandInitialize.Op);
|
||||
buf.writeInt8(CommandInitialize.Op);
|
||||
write++;
|
||||
buf.writeInt16LE(this.stacks.length, write);
|
||||
write+=2;
|
||||
|
|
Reference in a new issue