{
- yield* GameManager.SlotData.SlotClass.Spin(bet, isCountStop, countStop, isRatioStop, ratioStop, OnClickStop);
+ if (money < GameManager.SlotData.NowBet) {
+ noMoney();
+ return;
+ }
+ if (isCountStop) {
+ if (GameManager.SlotData.CountStop <= 0) {
+ OnClickStop();
+ return;
+ }
+ GameManager.SlotData.CountStop--;
+ setCountStop((v) => v - 1);
+ }
+ yield* GameManager.SlotData.SlotClass.Spin(bet, OnClickStop);
yield CoroutineV2.WaitTime(delay);
if (GameManager.SlotData.IsSpin) {
yield* spin();
} else {
+ GameManager.SlotData.IsSpin = false;
setIsSpin(false);
}
}
- function setRPCLog(s: string) {
+ function noMoney(): void {
+ GameManager.SlotData.IsSpin = false;
+ AddLog(`金額不足: ${money}`);
+ }
+
+ function AddLog(s: string) {
+ const todayTimeStr: string = dayjs().format("YYYY/MM/DD 00:00:00");
setLog((v) => {
if (v.length > 100) {
v.pop();
}
- v.unshift(s);
+ v.unshift(`${todayTimeStr} ${s}`);
return v;
});
}
@@ -168,14 +201,14 @@ const SDGame = (props: ISDGame) => {
倍率
- setIsRatio(e.target.checked)} />
- {isRatioStop && <>) => setRatio(+e.target.value)} type="text" value={ratioStop} placeholder={ratioStop.toString()} style={{ width: "10%" }} />倍>}
+ { setIsRatioStop(e.target.checked); GameManager.SlotData.IsRatioStop = e.target.checked; }} />
+ {isRatioStop && <>) => { setRatioStop(+e.target.value); GameManager.SlotData.RatioStop = +e.target.value; }} type="text" value={ratioStop} placeholder={ratioStop.toString()} style={{ width: "10%" }} />倍>}
轉數
- setIsSpinCount(e.target.checked)} />
- {isCountStop && <>) => setSpinCount(+e.target.value)} type="text" value={countStop} placeholder={countStop.toString()} style={{ width: "10%" }} />轉>}
+ { setIsCountStop(e.target.checked); GameManager.SlotData.IsCountStop = e.target.checked; }} />
+ {isCountStop && <>) => { setCountStop(+e.target.value); GameManager.SlotData.CountStop = +e.target.value; }} type="text" value={countStop} placeholder={countStop.toString()} style={{ width: "10%" }} />轉>}
diff --git a/src/UI/Lobby/SlotList.tsx b/src/UI/Lobby/SlotList.tsx
index 8c83591..e1e6f0a 100644
--- a/src/UI/Lobby/SlotList.tsx
+++ b/src/UI/Lobby/SlotList.tsx
@@ -1,7 +1,7 @@
import CSMessage from "@/Common/Message/CSMessage";
import { CoroutineV2 } from "@/Engine/CatanEngine/CoroutineV2/CoroutineV2";
import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse";
-import CSSettingsSDV3 from "@/FormTable/CSSettingsV3";
+import CSSettingsSDV3 from "@/FormTableSD/CSSettingsSDV3";
import BusinessTypeSetting from "@/_BusinessTypeSetting/BusinessTypeSetting";
import Image from "@/components/Image/Image";
import { useGameItems } from "@/context/GameItemsContext";
diff --git a/src/define/Game/Base/SlotBase.ts b/src/define/Game/Base/SlotBase.ts
index 7dc8e8c..5e57a31 100644
--- a/src/define/Game/Base/SlotBase.ts
+++ b/src/define/Game/Base/SlotBase.ts
@@ -52,7 +52,7 @@ export class SlotBase {
//#region Custom
- public *Spin(bet: number, isCountStop: boolean, countStop: number, isRatioStop: boolean, ratioStop: number, OnClickStop: () => void): IterableIterator {
+ public *Spin(bet: number, OnClickStop: () => void): IterableIterator {
const { player, setPlayer } = gameObj;
let gameRunData: JSON = null;
let req: CommonSlotSpinRequest = new CommonSlotSpinRequest(this.id, bet);
@@ -93,12 +93,11 @@ export class SlotBase {
winMoneyLog = `, winMoney: ${winMoney}`;
}
setPlayer({ ...player, m: money });
- // this._bj_Casino_Bot.SetUI();
let ratio: number = winMoney > 0 ? NumberEx.divide(winMoney, GameManager.SlotData.NowBet) : 0;
- if (isRatioStop && ratio >= ratioStop) {
+ if (GameManager.SlotData.IsRatioStop && ratio >= GameManager.SlotData.RatioStop) {
OnClickStop();
}
- if (isCountStop && countStop === 0) {
+ if (GameManager.SlotData.IsCountStop && GameManager.SlotData.CountStop === 0) {
OnClickStop();
}
if (ratio > 100) {
diff --git a/src/index.tsx b/src/index.tsx
index 40423bf..904430f 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -9,7 +9,6 @@ import "dayjs/locale/zh-tw";
import ReactDOM from "react-dom/client";
import { RouterProvider, createBrowserRouter, createHashRouter } from "react-router-dom";
import { BaseEnumerator } from "./Engine/CatanEngine/CoroutineV2/Core/BaseEnumerator";
-import Game from "./UI/Game";
import Lobby from "./UI/Lobby";
import Login from "./UI/Login";
import { ModalProvider } from "./UIControl/ModalContext";
@@ -26,11 +25,7 @@ const router = [
{
path: "/lobby",
element: ,
- },
- {
- path: "/game/:id",
- element: ,
- },
+ }
];
const browserRouter: Router = createBrowserRouter(router);
const hashRouter: Router = createHashRouter(router);
@@ -38,7 +33,7 @@ const hashRouter: Router = createHashRouter(router);
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
-
+
);
diff --git a/src/modules/data/SlotData.ts b/src/modules/data/SlotData.ts
index 76752f9..465ad1c 100644
--- a/src/modules/data/SlotData.ts
+++ b/src/modules/data/SlotData.ts
@@ -5,4 +5,8 @@ export default class SlotData {
public SlotClass: SlotBase = undefined;
public IsSpin: boolean = false;
public NowBet: number = undefined;
+ public IsRatioStop: boolean = false;
+ public RatioStop: number = undefined;
+ public IsCountStop: boolean = false;
+ public CountStop: number = undefined;
}
diff --git a/vite.config.ts b/vite.config.ts
index 1674cf2..9d7fe82 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,6 +1,6 @@
-import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
+import { defineConfig } from "vite";
// https://vitejs.dev/config/
export default defineConfig({
@@ -24,5 +24,5 @@ export default defineConfig({
outDir: "./build"
},
base: "./",
- envDir: "./viteEnv",
+ // envDir: "./viteEnv",
});
\ No newline at end of file