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:
- npm_build
script:
- sudo apt-get install rsync
- 'rsync -atv --progress --human-readable 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 ygopro-database kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/ygopro-database'
- 'rsync -atv --progress --human-readable --delete --exclude="neos-assets/" dist/ kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH'
- 'rsync -atv --progress --human-readable --delete neos-assets/ kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/neos-assets'
- 'rsync -atv --progress --human-readable --delete ygopro-database kirayamato@8.142.104.5:$NEOS_DEPLOY_PATH/ygopro-database'
before_script:
- '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 = () => {
return { width: 0.8, height: 0.2 };
};
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 @@
import initSqlJs, { Database } from "sql.js";
import { CardMeta, CardData, CardText } from "../api/cards";
import NeosConfig from "../../neos.config.json";
export enum sqliteCmd {
// 初始化
......@@ -37,7 +38,7 @@ export interface sqliteResult {
let YGODB: Database | null = null;
const sqlPromise = initSqlJs({
locateFile: (file) => `/assets/${file}`,
locateFile: (file) => `${NeosConfig.assetsPath}/${file}`,
});
// FIXME: 应该有个返回值,告诉业务方本次请求的结果,比如初始化DB失败
......
......@@ -66,7 +66,7 @@ url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css")
}
body {
background-image: url(/assets/background.png);
background-image: url(/neos-assets/background.png);
background-size:cover;
color: #606468;
font: 87.5%/1.5em 'Open Sans', sans-serif;
......
......@@ -14,6 +14,7 @@ import {
} from "../../reducers/duel/mod";
import { ActionCreatorWithPayload } from "@reduxjs/toolkit";
import { interactTypeToString } from "./util";
import NeosConfig from "../../../neos.config.json";
const shape = CONFIG.CardSlotShape();
......@@ -99,11 +100,11 @@ const FixedSlot = (props: {
diffuseTexture={
props.state.occupant
? faceDown
? new BABYLON.Texture(`/assets/card_back.jpg`)
? new BABYLON.Texture(`${NeosConfig.assetsPath}/card_back.jpg`)
: new BABYLON.Texture(
`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}
></standardMaterial>
......
......@@ -15,6 +15,7 @@ import { useClick } from "./hook";
import { useState, useRef, useEffect } from "react";
import { useSpring, animated } from "./spring";
import { zip, interactTypeToString } from "./util";
import NeosConfig from "../../../neos.config.json";
const groundShape = CONFIG.GroundShape();
const left = -(groundShape.width / 2);
......@@ -51,7 +52,7 @@ const Hands = () => {
sequence={idx}
position={position}
rotation={handRotation}
cover={(_) => `/assets/card_back.jpg`}
cover={(_) => `${NeosConfig.assetsPath}/card_back.jpg`}
/>
);
})}
......
......@@ -21,6 +21,7 @@ import Phase from "./phase";
import CheckCardModalV2 from "./checkCardModalV2";
import ExtraDeck from "./extraDeck";
import { initStrings } from "../../api/strings";
import NeosConfig from "../../../neos.config.json";
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const NeosDuel = () => {
......@@ -94,7 +95,7 @@ const Light = () => (
const Ground = () => {
const shape = CONFIG.GroundShape();
const texture = new BABYLON.Texture(`/assets/newfield.png`);
const texture = new BABYLON.Texture(`${NeosConfig.assetsPath}/newfield.png`);
texture.hasAlpha = true;
return (
......
......@@ -9,6 +9,7 @@ import {
setCardListModalIsOpen,
} from "../../reducers/duel/mod";
import { interactTypeToString } from "./util";
import NeosConfig from "../../../neos.config.json";
const shape = CONFIG.SingleSlotShape;
export const Depth = 0.005;
......@@ -77,7 +78,9 @@ const SingleSlot = (props: {
>
<standardMaterial
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}
/>
</box>
......
......@@ -10,6 +10,7 @@ import { Input } from "antd";
import React, { useState, ChangeEvent } from "react";
import { useNavigate } from "react-router-dom";
import "../styles/core.scss";
import NeosConfig from "../../neos.config.json";
export default function Login() {
const [player, setPlayer] = useState("");
......@@ -65,7 +66,8 @@ export default function Login() {
</div>
<div className="sign-up__actions clearfix">
<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>
</p>
</div>
......@@ -85,7 +87,10 @@ export default function Login() {
</li>
<li>
<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>
</li>
<li>
......
......@@ -8,7 +8,6 @@ const Mora = React.lazy(() => import("./Mora"));
const NeosDuel = React.lazy(() => import("./Duel/main"));
export default function () {
// FIXME: 这里Mora/Duel路由应该由每个房间指定一个路径
return (
<Routes>
<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