Skip to content

Commit

Permalink
Merge pull request #78 from Joseonpaldo/minseok
Browse files Browse the repository at this point in the history
show mini game isWin?
  • Loading branch information
themerous authored Sep 14, 2024
2 parents 1574f05 + 55a9059 commit ed4e7fc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
53 changes: 29 additions & 24 deletions src/components/game/YutPan.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import './animation.css'
import {
backStyle,
cardStyle,
containerStyle,
containerStyle, loadingBackgroundStyle,
rankStyle,
YetResultBtnStyle,
YutFanBackGroundStyle,
Expand All @@ -37,8 +37,6 @@ import apiAxiosInstance from "@/hooks/apiAxiosInstance";
import ChatComponent from "@/components/game/chatComponent";
import Roulette from "@/components/game/roulette";
import Minigame from "@/components/mini-game/Minigame";
import Gameover from "@/components/game/Gameover";


function YutPan() {

Expand All @@ -61,6 +59,11 @@ function YutPan() {

const [showEndGame, setShowEndGame] = useState(false);

const [showMiniGameIsWin, setShowMiniGameIsWin] = useState(false);
const [miniGameIsWin, setMiniGameIsWin] = useState(false);



let bankruptcyCount = 0;


Expand Down Expand Up @@ -506,8 +509,10 @@ function YutPan() {
handleBankruptcy(message.message);
updatePlayer(message.message, {index: -1});
updatePlayer(message.message, {top: parseInt(1000, 10)});
} else if (message.type === "error") {

} else if (message.type === "TheEnd") {
setShowEndGame(true)
}
else if (message.type === "error") {
if ("not found room" === message.message) {
stompClient.send(
`/app/main/start/${roomId}`,
Expand All @@ -532,6 +537,8 @@ function YutPan() {
if (showMiniGame) {
setShowMiniGame(false);
}
setMiniGameIsWin(message.message);
setShowMiniGameIsWin(true);
}
});

Expand Down Expand Up @@ -1038,26 +1045,16 @@ function YutPan() {
<UpgradeEstateConfirmDialog open={UpgradeEstateOpen} onClose={UpgradeEstateHandleClose} level={UpgradeLevel}/>

<div style={{
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "rgba(0,0,0,0.22)",
loadingBackgroundStyle,
display: loading,
justifyContent: "center",
alignItems: "center",
}}>
<div className="loader"></div>
</div>
{
showRoulette || (client == null || myPlayer == null) ? <Roulette client={client} myPlayer={myPlayer}/> : null
}
<div style={{
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "rgba(0,0,0,0.22)",
justifyContent: "center",
alignItems: "center",
loadingBackgroundStyle,
display: showMiniGame ? "flex" : "none",
scale: panScale / 1.8,
}}>
Expand All @@ -1066,12 +1063,7 @@ function YutPan() {
</div>
{(client == null || myPlayer == null) ? null : <ChatComponent socket={client} myPlayer={myPlayer}/>}
<div style={{
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "rgba(0,0,0,0.22)",
justifyContent: "center",
alignItems: "center",
loadingBackgroundStyle,
display: showEndGame ? "flex" : "none",
fontSize: "50px",
fontWeight: "bolder",
Expand All @@ -1080,7 +1072,20 @@ function YutPan() {
}}>
{
(client == null || myPlayer == null) ? null :
players[myPlayer]?.name + " " + players[myPlayer]?.rank + "등"
players[myPlayer]?.name + " " + players[myPlayer]?.rank + "등"
}
</div>

<div style={{
loadingBackgroundStyle,
display: showMiniGameIsWin ? "flex" : "none",
fontSize: "50px",
fontWeight: "bolder",
color: "#ffffff",
textShadow: "#ffff78 0px 0px 10px",
}}>
{
miniGameIsWin ? "미니게임 승리" : "미니게임 패배"
}
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions src/components/game/YutPanStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ const rankStyle = {



const loadingBackgroundStyle = {
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "rgba(0,0,0,0.22)",
justifyContent: "center",
alignItems: "center",
};




export {
YutNameStyle,
YutStateStyle,
Expand All @@ -147,4 +159,5 @@ export {
containerStyle,
cardStyle,
rankStyle,
loadingBackgroundStyle,
}

0 comments on commit ed4e7fc

Please sign in to comment.