Commit c5cee725 authored by Chunchi Che's avatar Chunchi Che

optimize

parent 138a8447
Pipeline #20271 passed with stages
in 4 minutes and 24 seconds
...@@ -47,9 +47,9 @@ deploy: ...@@ -47,9 +47,9 @@ deploy:
- npm_build - npm_build
script: script:
- sudo apt-get install rsync - sudo apt-get install rsync
- 'rsync -atv --progress --human-readable dist/ kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH' - 'rsync -atv --progress --human-readable --delete --exclude="neos-assets/" dist/ kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH'
- 'rsync -atv --progress --human-readable assets/ kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/assets' - 'rsync -atv --progress --human-readable --delete neos-assets/ kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/neos-assets'
- 'rsync -atv --progress --human-readable ygopro-database kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/ygopro-database' - 'rsync -atv --progress --human-readable --delete ygopro-database kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/ygopro-database'
before_script: before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
......
{
"assetsPath": "/neso-assets"
}
...@@ -71,43 +71,3 @@ export const HandInteractShape = () => { ...@@ -71,43 +71,3 @@ export const HandInteractShape = () => {
return { width: 0.8, height: 0.2 }; return { width: 0.8, height: 0.2 };
}; };
export const HandInteractFontSize = 200; export const HandInteractFontSize = 200;
// 怪兽区
export const MonsterColor = () => {
return BABYLON.Color3.Red();
};
// 额外怪兽区
export const extraMonsterColor = () => {
return BABYLON.Color3.Yellow();
};
// 魔法陷阱区
export const MagicColor = () => {
return BABYLON.Color3.Blue();
};
// 卡组
export const DeckColor = () => {
return BABYLON.Color3.Gray();
};
// 额外卡组
export const ExtraDeckColor = () => {
return BABYLON.Color3.Purple();
};
// 墓地
export const CemeteryColor = () => {
return BABYLON.Color3.Teal();
};
// 除外区
export const ExclusionColor = () => {
return BABYLON.Color3.Black();
};
// 场地
export const FieldColor = () => {
return BABYLON.Color3.White();
};
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
import initSqlJs, { Database } from "sql.js"; import initSqlJs, { Database } from "sql.js";
import { CardMeta, CardData, CardText } from "../api/cards"; import { CardMeta, CardData, CardText } from "../api/cards";
import NeosConfig from "../../neos.config.json";
export enum sqliteCmd { export enum sqliteCmd {
// 初始化 // 初始化
...@@ -37,7 +38,7 @@ export interface sqliteResult { ...@@ -37,7 +38,7 @@ export interface sqliteResult {
let YGODB: Database | null = null; let YGODB: Database | null = null;
const sqlPromise = initSqlJs({ const sqlPromise = initSqlJs({
locateFile: (file) => `/assets/${file}`, locateFile: (file) => `${NeosConfig.assetsPath}/${file}`,
}); });
// FIXME: 应该有个返回值,告诉业务方本次请求的结果,比如初始化DB失败 // FIXME: 应该有个返回值,告诉业务方本次请求的结果,比如初始化DB失败
......
...@@ -66,7 +66,7 @@ url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css") ...@@ -66,7 +66,7 @@ url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css")
} }
body { body {
background-image: url(/assets/background.png); background-image: url(/neos-assets/background.png);
background-size:cover; background-size:cover;
color: #606468; color: #606468;
font: 87.5%/1.5em 'Open Sans', sans-serif; font: 87.5%/1.5em 'Open Sans', sans-serif;
......
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
import { ActionCreatorWithPayload } from "@reduxjs/toolkit"; import { ActionCreatorWithPayload } from "@reduxjs/toolkit";
import { interactTypeToString } from "./util"; import { interactTypeToString } from "./util";
import NeosConfig from "../../../neos.config.json";
const shape = CONFIG.CardSlotShape(); const shape = CONFIG.CardSlotShape();
...@@ -99,11 +100,11 @@ const FixedSlot = (props: { ...@@ -99,11 +100,11 @@ const FixedSlot = (props: {
diffuseTexture={ diffuseTexture={
props.state.occupant props.state.occupant
? faceDown ? faceDown
? new BABYLON.Texture(`/assets/card_back.jpg`) ? new BABYLON.Texture(`${NeosConfig.assetsPath}/card_back.jpg`)
: new BABYLON.Texture( : new BABYLON.Texture(
`https://cdn02.moecube.com:444/images/ygopro-images-zh-CN/${props.state.occupant.id}.jpg` `https://cdn02.moecube.com:444/images/ygopro-images-zh-CN/${props.state.occupant.id}.jpg`
) )
: new BABYLON.Texture(`/assets/card_slot.png`) : new BABYLON.Texture(`${NeosConfig.assetsPath}/card_slot.png`)
} }
alpha={props.state.occupant ? 1 : 0} alpha={props.state.occupant ? 1 : 0}
></standardMaterial> ></standardMaterial>
......
...@@ -15,6 +15,7 @@ import { useClick } from "./hook"; ...@@ -15,6 +15,7 @@ import { useClick } from "./hook";
import { useState, useRef, useEffect } from "react"; import { useState, useRef, useEffect } from "react";
import { useSpring, animated } from "./spring"; import { useSpring, animated } from "./spring";
import { zip, interactTypeToString } from "./util"; import { zip, interactTypeToString } from "./util";
import NeosConfig from "../../../neos.config.json";
const groundShape = CONFIG.GroundShape(); const groundShape = CONFIG.GroundShape();
const left = -(groundShape.width / 2); const left = -(groundShape.width / 2);
...@@ -51,7 +52,7 @@ const Hands = () => { ...@@ -51,7 +52,7 @@ const Hands = () => {
sequence={idx} sequence={idx}
position={position} position={position}
rotation={handRotation} rotation={handRotation}
cover={(_) => `/assets/card_back.jpg`} cover={(_) => `${NeosConfig.assetsPath}/card_back.jpg`}
/> />
); );
})} })}
......
...@@ -21,6 +21,7 @@ import Phase from "./phase"; ...@@ -21,6 +21,7 @@ import Phase from "./phase";
import CheckCardModalV2 from "./checkCardModalV2"; import CheckCardModalV2 from "./checkCardModalV2";
import ExtraDeck from "./extraDeck"; import ExtraDeck from "./extraDeck";
import { initStrings } from "../../api/strings"; import { initStrings } from "../../api/strings";
import NeosConfig from "../../../neos.config.json";
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126 // Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const NeosDuel = () => { const NeosDuel = () => {
...@@ -94,7 +95,7 @@ const Light = () => ( ...@@ -94,7 +95,7 @@ const Light = () => (
const Ground = () => { const Ground = () => {
const shape = CONFIG.GroundShape(); const shape = CONFIG.GroundShape();
const texture = new BABYLON.Texture(`/assets/newfield.png`); const texture = new BABYLON.Texture(`${NeosConfig.assetsPath}/newfield.png`);
texture.hasAlpha = true; texture.hasAlpha = true;
return ( return (
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
setCardListModalIsOpen, setCardListModalIsOpen,
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
import { interactTypeToString } from "./util"; import { interactTypeToString } from "./util";
import NeosConfig from "../../../neos.config.json";
const shape = CONFIG.SingleSlotShape; const shape = CONFIG.SingleSlotShape;
export const Depth = 0.005; export const Depth = 0.005;
...@@ -77,7 +78,9 @@ const SingleSlot = (props: { ...@@ -77,7 +78,9 @@ const SingleSlot = (props: {
> >
<standardMaterial <standardMaterial
name="single-slot-mat" name="single-slot-mat"
diffuseTexture={new BABYLON.Texture(`/assets/card_back.jpg`)} diffuseTexture={
new BABYLON.Texture(`${NeosConfig.assetsPath}/card_back.jpg`)
}
alpha={props.state.length == 0 ? 0 : 1} alpha={props.state.length == 0 ? 0 : 1}
/> />
</box> </box>
......
...@@ -10,6 +10,7 @@ import { Input } from "antd"; ...@@ -10,6 +10,7 @@ import { Input } from "antd";
import React, { useState, ChangeEvent } from "react"; import React, { useState, ChangeEvent } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import "../styles/core.scss"; import "../styles/core.scss";
import NeosConfig from "../../neos.config.json";
export default function Login() { export default function Login() {
const [player, setPlayer] = useState(""); const [player, setPlayer] = useState("");
...@@ -65,7 +66,8 @@ export default function Login() { ...@@ -65,7 +66,8 @@ export default function Login() {
</div> </div>
<div className="sign-up__actions clearfix"> <div className="sign-up__actions clearfix">
<p> <p>
Don't know how to play? <a href="https://neos.doc/">Player Guide</a> Don't know how to play?{" "}
<a href="https://neos.moe/doc/">Player Guide</a>
<span className="fa fa-arrow-right"></span> <span className="fa fa-arrow-right"></span>
</p> </p>
</div> </div>
...@@ -85,7 +87,10 @@ export default function Login() { ...@@ -85,7 +87,10 @@ export default function Login() {
</li> </li>
<li> <li>
<a href="https://mycard.moe/"> <a href="https://mycard.moe/">
<img src="/assets/mycard.icon.png" style={{ width: "25%" }} /> <img
src={`${NeosConfig.assetsPath}/mycard.icon.png`}
style={{ width: "25%" }}
/>
</a> </a>
</li> </li>
<li> <li>
......
...@@ -8,7 +8,6 @@ const Mora = React.lazy(() => import("./Mora")); ...@@ -8,7 +8,6 @@ const Mora = React.lazy(() => import("./Mora"));
const NeosDuel = React.lazy(() => import("./Duel/main")); const NeosDuel = React.lazy(() => import("./Duel/main"));
export default function () { export default function () {
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
return ( return (
<Routes> <Routes>
<Route path="/" element={<LazyLoad lazy={<Login />} />} /> <Route path="/" element={<LazyLoad lazy={<Login />} />} />
......
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