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