Commit 7b5387ce authored by Chunchi Che's avatar Chunchi Che

update monster ui

parent 676e637d
...@@ -27,19 +27,22 @@ export const FieldSlotShape = () => { ...@@ -27,19 +27,22 @@ export const FieldSlotShape = () => {
return { width: 0.8, height: 1, depth: 0.2 }; return { width: 0.8, height: 1, depth: 0.2 };
}; };
export const CardSlotRotation = () => { export const CardSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0); return new BABYLON.Vector3(1.55, 0, 0);
};
export const CardSlotDefenceRotation = () => {
return new BABYLON.Vector3(1.55, 1.55, 0);
}; };
export const DeckSlotRotation = () => { export const DeckSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0); return new BABYLON.Vector3(1.55, 0, 0);
}; };
export const CemeterySlotRotation = () => { export const CemeterySlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0); return new BABYLON.Vector3(1.55, 0, 0);
}; };
export const ExclusionSlotRotation = () => { export const ExclusionSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0); return new BABYLON.Vector3(1.55, 0, 0);
}; };
export const FieldSlotRotation = () => { export const FieldSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0); return new BABYLON.Vector3(1.55, 0, 0);
}; };
// 浮空 // 浮空
......
...@@ -9,6 +9,7 @@ import { sendSelectPlaceResponse } from "../../api/ocgcore/ocgHelper"; ...@@ -9,6 +9,7 @@ import { sendSelectPlaceResponse } from "../../api/ocgcore/ocgHelper";
import { clearMonsterSelectInfo } from "../../reducers/duel/mod"; import { clearMonsterSelectInfo } from "../../reducers/duel/mod";
import { useAppSelector } from "../../hook"; import { useAppSelector } from "../../hook";
import { selectMeMonsters } from "../../reducers/duel/monstersSlice"; import { selectMeMonsters } from "../../reducers/duel/monstersSlice";
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
const left = -2.15; // TODO: config const left = -2.15; // TODO: config
const gap = 1.05; const gap = 1.05;
...@@ -34,11 +35,21 @@ const CommonMonster = (props: { state: Monster }) => { ...@@ -34,11 +35,21 @@ const CommonMonster = (props: { state: Monster }) => {
shape.depth / 2 + CONFIG.Floating, shape.depth / 2 + CONFIG.Floating,
-1.35 -1.35
); );
const rotation = CONFIG.CardSlotRotation(); const rotation =
props.state.position === ygopro.CardPosition.DEFENSE ||
props.state.position === ygopro.CardPosition.FACEUP_DEFENSE ||
props.state.position === ygopro.CardPosition.FACEDOWN_DEFENSE
? CONFIG.CardSlotDefenceRotation()
: CONFIG.CardSlotRotation();
const edgesWidth = 2.0; const edgesWidth = 2.0;
const edgesColor = BABYLON.Color4.FromColor3(BABYLON.Color3.Yellow()); const edgesColor = BABYLON.Color4.FromColor3(BABYLON.Color3.Yellow());
const dispatch = store.dispatch; const dispatch = store.dispatch;
const faceDown =
props.state.position === ygopro.CardPosition.FACEDOWN_DEFENSE ||
ygopro.CardPosition.FACEDOWN_ATTACK ||
ygopro.CardPosition.FACEDOWN;
useClick( useClick(
(_event) => { (_event) => {
if (props.state.selectInfo) { if (props.state.selectInfo) {
...@@ -67,9 +78,13 @@ const CommonMonster = (props: { state: Monster }) => { ...@@ -67,9 +78,13 @@ const CommonMonster = (props: { state: Monster }) => {
name={`monster-mat-${props.state.sequence}`} name={`monster-mat-${props.state.sequence}`}
diffuseTexture={ diffuseTexture={
props.state.occupant props.state.occupant
? new BABYLON.Texture( ? faceDown
`https://cdn02.moecube.com:444/images/ygopro-images-zh-CN/${props.state.occupant.id}.jpg` ? new BABYLON.Texture(
) `http://localhost:3030/images/card_back.jpg`
)
: new BABYLON.Texture(
`https://cdn02.moecube.com:444/images/ygopro-images-zh-CN/${props.state.occupant.id}.jpg`
)
: new BABYLON.Texture(`http://localhost:3030/images/card_slot.png`) : new BABYLON.Texture(`http://localhost:3030/images/card_slot.png`)
} }
alpha={props.state.occupant ? 1 : 0} alpha={props.state.occupant ? 1 : 0}
......
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