Commit 34425c60 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/wasm_loader' into 'main'

fix

See merge request mycard/Neos!134
parents bbee7335 54e935ac
Pipeline #20696 passed with stages
in 16 minutes and 24 seconds
......@@ -22,17 +22,14 @@ npm_ci:
dependencies:
- npm_ci
# ts_check:
# dependencies:
# - npm_ci
# stage: check
# tags:
# - linux
# before_script:
# - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# script:
# - wasm-pack build ./rust-src --target web
# - npx tsc
ts_check:
dependencies:
- npm_ci
stage: check
tags:
- linux
script:
- npx tsc
rs_check:
stage: check
......@@ -83,7 +80,6 @@ npm_build:
script:
- mv neos.config.prod.json neos.config.json
- npm run build:prod
- npx tsc
artifacts:
paths:
- dist
......
import { ygopro } from "../../../idl/ocgcore";
import init, { ocgDamageAdapter } from "rust-src";
//@ts-ignore
import { ocgDamageAdapter } from "rust-src";
/*
* Msg Damage
......@@ -7,8 +8,8 @@ import init, { ocgDamageAdapter } from "rust-src";
* @param player - 玩家编号
* @param value - 减少的Hp数值
* */
export default async (data: Uint8Array) => {
const damage = await init().then(() => ocgDamageAdapter(data));
export default (data: Uint8Array) => {
const damage = ocgDamageAdapter(data);
return new ygopro.StocGameMessage.MsgUpdateHp(damage);
};
......@@ -31,6 +31,8 @@ import {
selectMeInitInfo,
selectOpInitInfo,
} from "../../reducers/duel/initInfoSlice";
//@ts-ignore
import rustInit from "rust-src";
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const NeosDuel = () => {
......@@ -39,6 +41,7 @@ const NeosDuel = () => {
useEffect(() => {
const init = async () => {
await initStrings();
await rustInit();
};
if (initialRender.current) {
......
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