Commit 6fc33fa6 authored by timel's avatar timel

feat: rust-src module types

parent d2c4a162
import { ygopro } from "../idl/ocgcore"; import { ygopro } from "../idl/ocgcore";
import { numberToCardPosition, numberToCardZone } from "./util"; import { numberToCardPosition, numberToCardZone } from "./util";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
const LOCATION_OVERLAY = 0x80; const LOCATION_OVERLAY = 0x80;
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default ( export default (
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default (response: ygopro.CtosGameMsgResponse.SelectCardResponse) => { export default (response: ygopro.CtosGameMsgResponse.SelectCardResponse) => {
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default (response: ygopro.CtosGameMsgResponse.SelectChainResponse) => { export default (response: ygopro.CtosGameMsgResponse.SelectChainResponse) => {
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default (response: ygopro.CtosGameMsgResponse.SelectCounterResponse) => { export default (response: ygopro.CtosGameMsgResponse.SelectCounterResponse) => {
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default ( export default (
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default (response: ygopro.CtosGameMsgResponse.SelectIdleCmdResponse) => { export default (response: ygopro.CtosGameMsgResponse.SelectIdleCmdResponse) => {
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default (response: ygopro.CtosGameMsgResponse.SelectOptionResponse) => { export default (response: ygopro.CtosGameMsgResponse.SelectOptionResponse) => {
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
import { cardZoneToNumber } from "../../util"; import { cardZoneToNumber } from "../../util";
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default ( export default (
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default ( export default (
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferWriter } from "rust-src"; import { BufferWriter } from "rust-src";
export default (response: ygopro.CtosGameMsgResponse.SortCardResponse) => { export default (response: ygopro.CtosGameMsgResponse.SortCardResponse) => {
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
/* /*
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
/* /*
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
/* /*
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
/* /*
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
/* /*
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReaderExt } from "../../bufferIO"; import { BufferReaderExt } from "../../bufferIO";
import MsgReloadField = ygopro.StocGameMessage.MsgReloadField; import MsgReloadField = ygopro.StocGameMessage.MsgReloadField;
import { numberToCardPosition } from "../../util"; import { numberToCardPosition } from "../../util";
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
import MsgSelectOption = ygopro.StocGameMessage.MsgSelectOption; import MsgSelectOption = ygopro.StocGameMessage.MsgSelectOption;
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace; import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace;
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
import MsgSelectPosition = ygopro.StocGameMessage.MsgSelectPosition; import MsgSelectPosition = ygopro.StocGameMessage.MsgSelectPosition;
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
import MsgWin = ygopro.StocGameMessage.MsgWin; import MsgWin = ygopro.StocGameMessage.MsgWin;
......
import { ygopro } from "../../idl/ocgcore"; import { ygopro } from "../../idl/ocgcore";
import { YgoProPacket, StocAdapter } from "../packet"; import { YgoProPacket, StocAdapter } from "../packet";
// @ts-ignore
import { BufferReader } from "rust-src"; import { BufferReader } from "rust-src";
/* /*
......
...@@ -10,3 +10,29 @@ interface ImportMetaEnv { ...@@ -10,3 +10,29 @@ interface ImportMetaEnv {
interface ImportMeta { interface ImportMeta {
readonly env: ImportMetaEnv; readonly env: ImportMetaEnv;
} }
/**
* 手动声明WASM模块rust-src
*/
declare module "rust-src" {
export default function rustInit(url?: URL): Promise<void>;
export class BufferWriter {
constructor();
public writeInt8(value: number): void;
public writeUint8(value: number): void;
public writeInt16(value: number): void;
public writeUint16(value: number): void;
public writeInt32(value: number): void;
public writeUint32(value: number): void;
public toArray(): Uint8Array;
}
export class BufferReader {
constructor(buffer: Uint8Array);
public readInt8(): number;
public readUint8(): number;
public readInt16(): number;
public readUint16(): number;
public readInt32(): number;
public readUint32(): number;
}
}
...@@ -43,7 +43,6 @@ import type { UploadProps } from "antd"; ...@@ -43,7 +43,6 @@ import type { UploadProps } from "antd";
import { selectDuelStart } from "@/reducers/moraSlice"; import { selectDuelStart } from "@/reducers/moraSlice";
import NeosConfig from "../../neos.config.json"; import NeosConfig from "../../neos.config.json";
import YGOProDeck from "ygopro-deck-encode"; import YGOProDeck from "ygopro-deck-encode";
// @ts-ignore
import rustInit from "rust-src"; import rustInit from "rust-src";
import { initStrings } from "@/api/strings"; import { initStrings } from "@/api/strings";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment