[add] 可用版本
This commit is contained in:
		| @@ -1,2 +1,3 @@ | |||||||
| src/FormTable | src/FormTable | ||||||
| src/FormTableExt | src/FormTableExt | ||||||
|  | src/FormTableSD | ||||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -28,3 +28,5 @@ dist-ssr | |||||||
| /src/FormTable/* | /src/FormTable/* | ||||||
| /src/FormTableExt | /src/FormTableExt | ||||||
| /src/FormTableExt/* | /src/FormTableExt/* | ||||||
|  | /src/FormTableSD | ||||||
|  | /src/FormTableSD/* | ||||||
							
								
								
									
										7
									
								
								build-templates/shared/jsons/slotset.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								build-templates/shared/jsons/slotset.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -12,7 +12,7 @@ | |||||||
| 			history.go(1); | 			history.go(1); | ||||||
| 		}; | 		}; | ||||||
| 	</script> | 	</script> | ||||||
| 	<title>來博娛樂城</title> | 	<title>LP_Bot</title> | ||||||
| </head> | </head> | ||||||
|  |  | ||||||
| <body oncontextmenu="return false"> | <body oncontextmenu="return false"> | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| import { CoroutineV2 } from "@/Engine/CatanEngine/CoroutineV2/CoroutineV2"; | import { CoroutineV2 } from "@/Engine/CatanEngine/CoroutineV2/CoroutineV2"; | ||||||
| import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | ||||||
| import CSSettingsV3 from "@/FormTable/CSSettingsV3"; | import CSSettingsSDV3 from "@/FormTable/CSSettingsV3"; | ||||||
| import { gameSync } from "@/utils/setRPCData"; | import { gameSync } from "@/utils/setRPCData"; | ||||||
| import MainControl from "../MainControl/MainControl"; | import MainControl from "../MainControl/MainControl"; | ||||||
| import CSMessage from "../Message/CSMessage"; | import CSMessage from "../Message/CSMessage"; | ||||||
| @@ -76,9 +76,9 @@ export default class MainControlData { | |||||||
| 		console.debug("Disconnected Error Type : " + this._disconnectErrorType); | 		console.debug("Disconnected Error Type : " + this._disconnectErrorType); | ||||||
| 		let str: string = null; | 		let str: string = null; | ||||||
| 		if (this._disconnectErrorType < 10 && this._disconnectErrorType >= 0) { | 		if (this._disconnectErrorType < 10 && this._disconnectErrorType >= 0) { | ||||||
| 			str = CSSettingsV3.prototype.CommonString(55 + this._disconnectErrorType); | 			str = CSSettingsSDV3.prototype.CommonString(55 + this._disconnectErrorType); | ||||||
| 		} else if (this._disconnectErrorType > 100 && this._disconnectErrorType < 110) { | 		} else if (this._disconnectErrorType > 100 && this._disconnectErrorType < 110) { | ||||||
| 			str = CSSettingsV3.prototype.CommonString(65 + this._disconnectErrorType - 101); | 			str = CSSettingsSDV3.prototype.CommonString(65 + this._disconnectErrorType - 101); | ||||||
| 		} else { | 		} else { | ||||||
| 			str = "Server Disconnected"; | 			str = "Server Disconnected"; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -2,8 +2,10 @@ import { Action } from "@/Engine/CatanEngine/CSharp/System/Action"; | |||||||
| import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | ||||||
| import { NetConnector } from "@/Engine/CatanEngine/NetManagerV2/NetConnector"; | import { NetConnector } from "@/Engine/CatanEngine/NetManagerV2/NetConnector"; | ||||||
| import { NetManager } from "@/Engine/CatanEngine/NetManagerV2/NetManager"; | import { NetManager } from "@/Engine/CatanEngine/NetManagerV2/NetManager"; | ||||||
|  | import { TableManager } from "@/Engine/CatanEngine/TableV3/TableManager"; | ||||||
| import BaseSingleton from "@/Engine/Utils/Singleton/BaseSingleton"; | import BaseSingleton from "@/Engine/Utils/Singleton/BaseSingleton"; | ||||||
| import BusinessTypeSetting from "@/_BusinessTypeSetting/BusinessTypeSetting"; | import BusinessTypeSetting from "@/_BusinessTypeSetting/BusinessTypeSetting"; | ||||||
|  | import { Tools } from "@/utils/Tools"; | ||||||
|  |  | ||||||
| export class MainControl extends BaseSingleton<MainControl>() { | export class MainControl extends BaseSingleton<MainControl>() { | ||||||
| 	/** 每次啟動APP */ | 	/** 每次啟動APP */ | ||||||
| @@ -55,6 +57,60 @@ export class MainControl extends BaseSingleton<MainControl>() { | |||||||
| 		MainControl.DataReceivedEvent.DispatchCallback([MainControl.DataType.ServerData, resp]); | 		MainControl.DataReceivedEvent.DispatchCallback([MainControl.DataType.ServerData, resp]); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	//#region DownloadForm Function | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * 載入外載表設定檔 | ||||||
|  | 	 * @param formType FormType | ||||||
|  | 	 */ | ||||||
|  | 	public static async DownloadForm(formType: DownloadForm.FormType): Promise<void> { | ||||||
|  | 		if (DownloadForm.DownloadFormData.DownloadSuccess.has(formType)) { | ||||||
|  | 			console.warn(`CSSettingsV3 ${formType} 已經載過`); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		DownloadForm.DownloadFormData.DownloadSuccess.set(formType, true); | ||||||
|  | 		let needForm: string[] = DownloadForm.DownloadFormData[`${formType}Form`]; | ||||||
|  | 		let parallel: Promise<void>[] = []; | ||||||
|  | 		for (let i: number = 0; i < needForm.length; i++) { | ||||||
|  | 			parallel.push(this.DownloadFormSetting(needForm[i])); | ||||||
|  | 		} | ||||||
|  | 		// set Form | ||||||
|  | 		await Promise.all(parallel); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * 載入外載表設定檔 | ||||||
|  | 	 * @param formname 設定檔名稱 | ||||||
|  | 	 */ | ||||||
|  | 	public static async DownloadFormSetting(formname: string): Promise<void> { | ||||||
|  | 		// http://patch-dev.online-bj.com/shared/jsons/slot_050.json | ||||||
|  | 		let fileUrl: string = `${formname}.json`; | ||||||
|  | 		// fileUrl = "https://sd2-dev-patch.sdegaming.com/_Debug/shared/jsons/" + fileUrl; | ||||||
|  | 		// fileUrl = "https://patch.sdegaming.com/slot2/patch/_Release/shared/jsons/" + fileUrl; | ||||||
|  | 		// fileUrl = "http://patch-dev.online-bj.com/shared/jsons/" + fileUrl; | ||||||
|  | 		// fileUrl = "http://jianmiau.tk/_BJ_Source/BJ-Internal-Dev/shared/jsons/" + fileUrl; | ||||||
|  | 		fileUrl = "./shared/jsons/" + fileUrl; | ||||||
|  | 		fileUrl = fileUrl + "?v=" + Date.now(); | ||||||
|  | 		let isDownloading: boolean = true; | ||||||
|  | 		let xhr: XMLHttpRequest = new XMLHttpRequest(); | ||||||
|  | 		// xhr.withCredentials = true; | ||||||
|  | 		xhr.onreadystatechange = function (): void { | ||||||
|  | 			if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) { | ||||||
|  | 				let res: any = {}; | ||||||
|  | 				res.json = JSON.parse(xhr.responseText); | ||||||
|  | 				res.name = formname; | ||||||
|  | 				TableManager.AddJsonAsset(res); | ||||||
|  | 				isDownloading = false; | ||||||
|  | 			} | ||||||
|  | 		}; | ||||||
|  | 		xhr.open("GET", fileUrl); | ||||||
|  | 		xhr.send(); | ||||||
|  | 		while (isDownloading) { | ||||||
|  | 			await Tools.Sleep(100); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	//#endregion | 	//#endregion | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -67,3 +123,22 @@ export module MainControl { | |||||||
| } | } | ||||||
|  |  | ||||||
| export default MainControl; | export default MainControl; | ||||||
|  |  | ||||||
|  | //#region DownloadForm | ||||||
|  |  | ||||||
|  | export module DownloadForm { | ||||||
|  | 	export enum FormType { | ||||||
|  | 		Formread = "formread", | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	export class DownloadFormData { | ||||||
|  |  | ||||||
|  | 		/** 已下載的表 */ | ||||||
|  | 		public static DownloadSuccess: Map<string, boolean> = new Map<string, boolean>(); | ||||||
|  |  | ||||||
|  | 		/** Bag需要的表(xxxx.json) */ | ||||||
|  | 		public static formreadForm: string[] = ["slotset"]; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //#endregion | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| import CSSettingsV3 from "@/FormTable/CSSettingsV3"; | import CSSettingsSDV3 from "@/FormTable/CSSettingsV3"; | ||||||
| import { LanguageManager } from "@/FormTableExt/Manage/Language/LanguageManager"; | import { LanguageManager } from "@/FormTableExt/Manage/Language/LanguageManager"; | ||||||
| import { ResourceInfo } from "@/define/resource"; | import { ResourceInfo } from "@/define/resource"; | ||||||
| import { backpackInfo } from "@/utils/setRPCData"; | import { backpackInfo } from "@/utils/setRPCData"; | ||||||
| @@ -7,7 +7,7 @@ import IResourceItem from "../IResourceItem"; | |||||||
| import { ResourceItemType } from "../ResourceItemType"; | import { ResourceItemType } from "../ResourceItemType"; | ||||||
|  |  | ||||||
| export default class CardCouponItem implements IResourceItem { | export default class CardCouponItem implements IResourceItem { | ||||||
| 	public get Name(): string { return CSSettingsV3.ItemSetting.StringDetail[+CSSettingsV3.ItemSetting.CouponSetting[this.ID].CardName][LanguageManager.GetMsgId()]; } | 	public get Name(): string { return CSSettingsSDV3.ItemSetting.StringDetail[+CSSettingsSDV3.ItemSetting.CouponSetting[this.ID].CardName][LanguageManager.GetMsgId()]; } | ||||||
| 	public get ResourceType(): ResourceItemType { return ResourceItemType.Card_Coupon; } | 	public get ResourceType(): ResourceItemType { return ResourceItemType.Card_Coupon; } | ||||||
| 	public ID: number; | 	public ID: number; | ||||||
| 	public Count: number; | 	public Count: number; | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| import CSSettingsV3 from "@/FormTable/CSSettingsV3"; | import CSSettingsSDV3 from "@/FormTable/CSSettingsV3"; | ||||||
| import { Shop } from "@/define/formkey"; | import { Shop } from "@/define/formkey"; | ||||||
| import { ResourceInfo } from "@/define/resource"; | import { ResourceInfo } from "@/define/resource"; | ||||||
| import Player from "@/modules/player"; | import Player from "@/modules/player"; | ||||||
| @@ -9,7 +9,7 @@ import IResourceItem from "../IResourceItem"; | |||||||
| import { ResourceItemType } from "../ResourceItemType"; | import { ResourceItemType } from "../ResourceItemType"; | ||||||
|  |  | ||||||
| export default class LpPointItem implements IResourceItem { | export default class LpPointItem implements IResourceItem { | ||||||
| 	public get Name(): string { return CSSettingsV3.prototype.ShopString(Shop.String.LpPoint); } | 	public get Name(): string { return CSSettingsSDV3.prototype.ShopString(Shop.String.LpPoint); } | ||||||
| 	public get ResourceType(): ResourceItemType { return ResourceItemType.LpPoint; } | 	public get ResourceType(): ResourceItemType { return ResourceItemType.LpPoint; } | ||||||
| 	public ID: number; | 	public ID: number; | ||||||
| 	public Count: number; | 	public Count: number; | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| import CSSettingsV3 from "@/FormTable/CSSettingsV3"; | import CSSettingsSDV3 from "@/FormTable/CSSettingsV3"; | ||||||
| import Config from "@/define/Config"; | import Config from "@/define/Config"; | ||||||
| import { Shop } from "@/define/formkey"; | import { Shop } from "@/define/formkey"; | ||||||
| import { ResourceInfo } from "@/define/resource"; | import { ResourceInfo } from "@/define/resource"; | ||||||
| @@ -9,7 +9,7 @@ import IResourceItem from "../IResourceItem"; | |||||||
| import { ResourceItemType } from "../ResourceItemType"; | import { ResourceItemType } from "../ResourceItemType"; | ||||||
|  |  | ||||||
| export default class MoneyItem implements IResourceItem { | export default class MoneyItem implements IResourceItem { | ||||||
| 	public get Name(): string { return CSSettingsV3.prototype.ShopString(Shop.String.Money); } | 	public get Name(): string { return CSSettingsSDV3.prototype.ShopString(Shop.String.Money); } | ||||||
| 	public get ResourceType(): ResourceItemType { return ResourceItemType.Money; } | 	public get ResourceType(): ResourceItemType { return ResourceItemType.Money; } | ||||||
| 	public ID: number; | 	public ID: number; | ||||||
| 	public Count: number; | 	public Count: number; | ||||||
|   | |||||||
| @@ -12,13 +12,13 @@ export class TableManager { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	public static AddJsonAsset(jsonAsset: JSON) { | 	public static AddJsonAsset(jsonAsset: any) { | ||||||
| 		if (!jsonAsset) { | 		if (!jsonAsset) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		for (const tableName in jsonAsset) { | 		for (let tableName in jsonAsset.json) { | ||||||
| 			console.debug(`TableV3 [${ tableName }] json loaded`); | 			console.log(`TableV3 [${tableName}] json loaded`); | ||||||
| 			this._tableJsons[tableName] = jsonAsset[tableName]; | 			this._tableJsons[tableName] = jsonAsset.json[tableName]; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,20 +3,31 @@ import { CoroutineV2 } from "@/Engine/CatanEngine/CoroutineV2/CoroutineV2"; | |||||||
| import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | ||||||
| import { NetConnector } from "@/Engine/CatanEngine/NetManagerV2/NetConnector"; | import { NetConnector } from "@/Engine/CatanEngine/NetManagerV2/NetConnector"; | ||||||
| import { NetManagerSD } from "@/Engine/CatanEngine/NetManagerV2/NetManagerSD"; | import { NetManagerSD } from "@/Engine/CatanEngine/NetManagerV2/NetManagerSD"; | ||||||
|  | import A from "@/components/CustomA"; | ||||||
| import { useGameItems } from "@/context/GameItemsContext"; | import { useGameItems } from "@/context/GameItemsContext"; | ||||||
| import SlotBase from "@/define/Game/Base/SlotBase"; |  | ||||||
| import { SDAccountLoginRequest } from "@/define/Request/AccountRequest"; | import { SDAccountLoginRequest } from "@/define/Request/AccountRequest"; | ||||||
| import { SlotInRequest } from "@/define/Request/SlotRequest"; | import { SlotInRequest } from "@/define/Request/SlotRequest"; | ||||||
| import { Button, Flex } from "antd"; | import GameManager from "@/modules/GameManager"; | ||||||
| import { useEffect, useState } from "react"; | import { Button, Checkbox, Dropdown, Flex, Input, MenuProps } from "antd"; | ||||||
|  | import { CheckboxChangeEvent } from "antd/es/checkbox"; | ||||||
|  | import { ChangeEvent, useEffect, useState } from "react"; | ||||||
|  |  | ||||||
| const SDGame = (props: ISDGame) => { | const SDGame = (props: ISDGame) => { | ||||||
| 	const { gameUrl, onClickSlotOut } = props; | 	const { gameUrl, onClickSlotOut } = props; | ||||||
| 	const { player, setPlayer } = useGameItems(); | 	const { player, setPlayer } = useGameItems(); | ||||||
| 	const { gameData } = useGameItems(); | 	const { gameData } = useGameItems(); | ||||||
| 	const { nowSlotId } = gameData; | 	const { nowSlotId } = gameData; | ||||||
| 	const [slotId, setSlotId] = useState<number>(undefined); | 	const [isOK, setIsOK] = useState<boolean>(false); | ||||||
|  | 	const [isSpin, setIsSpin] = useState<boolean>(false); | ||||||
| 	const [slotData, setSlotData] = useState<Object>(undefined); | 	const [slotData, setSlotData] = useState<Object>(undefined); | ||||||
|  | 	const [items, setItems] = useState<MenuProps["items"]>([]); | ||||||
|  | 	const [bet, setBet] = useState<number>(0); | ||||||
|  | 	const [delay, setDelay] = useState<number>(0.1); | ||||||
|  | 	const [isRatioStop, setIsRatio] = useState<boolean>(false); | ||||||
|  | 	const [ratioStop, setRatio] = useState<number>(200); | ||||||
|  | 	const [isCountStop, setIsSpinCount] = useState<boolean>(false); | ||||||
|  | 	const [countStop, setSpinCount] = useState<number>(200); | ||||||
|  | 	const [log, setLog] = useState<string[]>([]); | ||||||
| 	let conn: NetConnector = undefined; | 	let conn: NetConnector = undefined; | ||||||
|  |  | ||||||
| 	function* onLoad(): IterableIterator<any> { | 	function* onLoad(): IterableIterator<any> { | ||||||
| @@ -27,15 +38,16 @@ const SDGame = (props: ISDGame) => { | |||||||
| 		const host: string = queryParameters.get("host"); | 		const host: string = queryParameters.get("host"); | ||||||
| 		const port: number = 9005; | 		const port: number = 9005; | ||||||
|  |  | ||||||
| 		setSlotId(slotid); | 		GameManager.SlotData.SlotId = slotid; | ||||||
| 		conn = new NetConnector("https://" + host, port); | 		conn = new NetConnector("https://" + host, port); | ||||||
| 		conn.OnDataReceived.AddCallback(onNetDataReceived); | 		conn.OnDataReceived.AddCallback(onNetDataReceived); | ||||||
| 		conn.OnDisconnected.AddCallback(onNetDisconnected); | 		conn.OnDisconnected.AddCallback(onNetDisconnected); | ||||||
|  | 		setSlotClass(); | ||||||
| 		NetManagerSD.Initialize(conn); | 		NetManagerSD.Initialize(conn); | ||||||
| 		console.log("[SDsocket] connecting..."); | 		console.log("[SDsocket] connecting..."); | ||||||
| 		yield NetManagerSD.ConnectAsync(); | 		yield NetManagerSD.ConnectAsync(); | ||||||
| 		yield* login(token); | 		yield* login(token); | ||||||
| 		yield* slotIn(slotid); | 		yield* slotIn(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	function* login(token: string): IterableIterator<any> { | 	function* login(token: string): IterableIterator<any> { | ||||||
| @@ -48,39 +60,76 @@ const SDGame = (props: ISDGame) => { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	function* slotIn(slotid: number): IterableIterator<any> { | 	function* slotIn(): IterableIterator<any> { | ||||||
| 		let req: SlotInRequest = new SlotInRequest(slotid); | 		let req: SlotInRequest = new SlotInRequest(GameManager.SlotData.SlotId); | ||||||
| 		yield req.SendAsync(true); | 		yield req.SendAsync(true); | ||||||
| 		let resp: INetResponse<JSON> = req.Result; | 		let resp: INetResponse<JSON> = req.Result; | ||||||
| 		if (resp.IsValid) { | 		if (resp.IsValid) { | ||||||
| 			setSlotData(resp.Data); | 			setSlotData(resp.Data); | ||||||
|  |  | ||||||
|  | 			const br: number[] = resp.Data["br"]; | ||||||
|  | 			const db: number = resp.Data["db"]; | ||||||
|  | 			const betGroup: MenuProps["items"] = []; | ||||||
|  | 			for (let i = 0; i < br.length; i++) { | ||||||
|  | 				betGroup.push({ | ||||||
|  | 					key: i, | ||||||
|  | 					label: ( | ||||||
|  | 						<A href="#" onClick={() => { setBet(br[i]); GameManager.SlotData.NowBet = br[i]; }}> | ||||||
|  | 							{br[i]} | ||||||
|  | 						</A> | ||||||
|  | 					), | ||||||
|  | 				}); | ||||||
|  | 			} | ||||||
|  | 			setItems(betGroup); | ||||||
|  | 			setBet(br[db]); | ||||||
|  | 			GameManager.SlotData.NowBet = br[db]; | ||||||
|  | 			setIsOK(true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	async function OnclickSpin() { | 	async function setSlotClass() { | ||||||
| 		let slot: any; | 		let slot: any; | ||||||
| 		const slotGroup: typeof import("../../define/Game/Base/Slot") = await import(/* @vite-ignore */`../../define/Game/Base/Slot`); | 		const slotGroup: typeof import("../../define/Game/Base/Slot") = await import(/* @vite-ignore */`../../define/Game/Base/Slot`); | ||||||
| 		try { | 		try { | ||||||
| 			slot = slotGroup[`Slot${slotId}`]; | 			slot = slotGroup[`Slot${GameManager.SlotData.SlotId}`]; | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| 			// | 			// | ||||||
| 		} | 		} | ||||||
| 		if (!slot) { | 		if (!slot) { | ||||||
| 			slot = slotGroup.SlotBase; | 			slot = slotGroup.SlotBase; | ||||||
| 		} | 		} | ||||||
| 		const slotClass: SlotBase = new slot(slotId); | 		GameManager.SlotData.SlotClass = new slot(GameManager.SlotData.SlotId, setRPCLog); | ||||||
| 		// this.IsSpin.value = true; |  | ||||||
| 		CoroutineV2.Single(spin(slotClass)).Start(); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	function* spin(slotClass: SlotBase): IterableIterator<any> { | 	async function OnClickSpin() { | ||||||
| 		yield* slotClass.Spin(20); | 		GameManager.SlotData.IsSpin = true; | ||||||
| 		// await Tools.Sleep(this.SpinDelay.value * 1000); | 		setIsSpin(true); | ||||||
| 		// if (this.IsSpin.value && this._bj_Casino_Bot.LobbyScript.IsSlotIn.value) { | 		CoroutineV2.Single(spin()).Start(); | ||||||
| 		//     this.Spin(); | 	} | ||||||
| 		// } else { |  | ||||||
| 		//     this.IsRun = false; | 	function OnClickStop() { | ||||||
| 		// } | 		GameManager.SlotData.IsSpin = false; | ||||||
|  | 		setIsSpin(false); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function* spin(): IterableIterator<any> { | ||||||
|  | 		yield* GameManager.SlotData.SlotClass.Spin(bet, isCountStop, countStop, isRatioStop, ratioStop, OnClickStop); | ||||||
|  | 		yield CoroutineV2.WaitTime(delay); | ||||||
|  | 		if (GameManager.SlotData.IsSpin) { | ||||||
|  | 			yield* spin(); | ||||||
|  | 		} else { | ||||||
|  | 			setIsSpin(false); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	function setRPCLog(s: string) { | ||||||
|  | 		setLog((v) => { | ||||||
|  | 			if (v.length > 100) { | ||||||
|  | 				v.pop(); | ||||||
|  | 			} | ||||||
|  | 			v.unshift(s); | ||||||
|  | 			return v; | ||||||
|  | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/**RPC回傳.若協定錯誤斷線.原因也會在這裡收到 */ | 	/**RPC回傳.若協定錯誤斷線.原因也會在這裡收到 */ | ||||||
| @@ -101,18 +150,46 @@ const SDGame = (props: ISDGame) => { | |||||||
|  |  | ||||||
| 	return (<> | 	return (<> | ||||||
| 		<div style={siderStyle}> | 		<div style={siderStyle}> | ||||||
|  | 			{isOK && | ||||||
| 				<Flex gap="small" wrap="wrap"> | 				<Flex gap="small" wrap="wrap"> | ||||||
| 					<div style={controlStyle}> | 					<div style={controlStyle}> | ||||||
| 					Bet: 20 |  | ||||||
| 						<p> | 						<p> | ||||||
| 						<Button type="primary" onClick={OnclickSpin} style={{ width: "20%" }}>Spin</Button> | 							押注 | ||||||
| 						<Button type="primary" danger onClick={onClickSlotOut} style={{ width: "20%" }}>離開機台</Button> | 							<Dropdown menu={{ items }} placement="bottom"> | ||||||
|  | 								<Button>{bet}</Button> | ||||||
|  | 							</Dropdown> | ||||||
|  | 						</p> | ||||||
|  |  | ||||||
|  | 						<p> | ||||||
|  | 							延遲 | ||||||
|  | 							<Input onInput={(e: ChangeEvent<HTMLInputElement>) => setDelay(+e.target.value)} type="text" value={delay} placeholder={delay.toString()} style={{ width: "10%" }} /> | ||||||
|  | 							秒 | ||||||
|  | 						</p> | ||||||
|  |  | ||||||
|  | 						<p> | ||||||
|  | 							倍率 | ||||||
|  | 							<Checkbox onChange={(e: CheckboxChangeEvent) => setIsRatio(e.target.checked)} /> | ||||||
|  | 							{isRatioStop && <><Input onInput={(e: ChangeEvent<HTMLInputElement>) => setRatio(+e.target.value)} type="text" value={ratioStop} placeholder={ratioStop.toString()} style={{ width: "10%" }} />倍</>} | ||||||
|  | 						</p> | ||||||
|  |  | ||||||
|  | 						<p> | ||||||
|  | 							轉數 | ||||||
|  | 							<Checkbox onChange={(e: CheckboxChangeEvent) => setIsSpinCount(e.target.checked)} /> | ||||||
|  | 							{isCountStop && <><Input onInput={(e: ChangeEvent<HTMLInputElement>) => setSpinCount(+e.target.value)} type="text" value={countStop} placeholder={countStop.toString()} style={{ width: "10%" }} />轉</>} | ||||||
|  | 						</p> | ||||||
|  |  | ||||||
|  | 						<p> | ||||||
|  | 							{isSpin | ||||||
|  | 								? <Button type="primary" onClick={OnClickStop} style={{ width: "20%" }}>Stop</Button> | ||||||
|  | 								: <Button type="primary" onClick={OnClickSpin} style={{ width: "20%" }}>Spin</Button> | ||||||
|  | 							} | ||||||
| 						</p> | 						</p> | ||||||
| 					</div> | 					</div> | ||||||
| 				<div> | 					<div style={{ height: "90vh", position: "relative", top: "0%", overflowY: "scroll" }}> | ||||||
| 					Log | 						{log.map((log: string, index: number) => <p key={index}>{log}</p>)} | ||||||
| 					</div> | 					</div> | ||||||
| 			</Flex> | 				</Flex>} | ||||||
|  | 			<Button type="primary" danger onClick={onClickSlotOut} style={{ width: "20%", position: "fixed", bottom: "1%" }}>離開機台</Button> | ||||||
| 		</div> | 		</div> | ||||||
| 	</>); | 	</>); | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| import CSMessage from "@/Common/Message/CSMessage"; | import CSMessage from "@/Common/Message/CSMessage"; | ||||||
| import { CoroutineV2 } from "@/Engine/CatanEngine/CoroutineV2/CoroutineV2"; | import { CoroutineV2 } from "@/Engine/CatanEngine/CoroutineV2/CoroutineV2"; | ||||||
| import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | ||||||
| import CSSettingsV3 from "@/FormTable/CSSettingsV3"; | import CSSettingsSDV3 from "@/FormTable/CSSettingsV3"; | ||||||
| import BusinessTypeSetting from "@/_BusinessTypeSetting/BusinessTypeSetting"; | import BusinessTypeSetting from "@/_BusinessTypeSetting/BusinessTypeSetting"; | ||||||
| import Image from "@/components/Image/Image"; | import Image from "@/components/Image/Image"; | ||||||
| import { useGameItems } from "@/context/GameItemsContext"; | import { useGameItems } from "@/context/GameItemsContext"; | ||||||
| @@ -29,7 +29,7 @@ const SlotList = () => { | |||||||
| 		const resp: INetResponse<RpcGameLaunchResponse> = req.Result; | 		const resp: INetResponse<RpcGameLaunchResponse> = req.Result; | ||||||
| 		if (!resp.IsValid) { | 		if (!resp.IsValid) { | ||||||
| 			if (resp.Status === 18) { | 			if (resp.Status === 18) { | ||||||
| 				CSMessage.CreateYesMsg(CSSettingsV3.prototype.CommonString(16)); | 				CSMessage.CreateYesMsg(CSSettingsSDV3.prototype.CommonString(16)); | ||||||
| 			} | 			} | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -23,7 +23,8 @@ const Login = () => { | |||||||
| 	const serverType: typeof BusinessEnum.ServerType = BusinessEnum.ServerType; | 	const serverType: typeof BusinessEnum.ServerType = BusinessEnum.ServerType; | ||||||
| 	const [type, setType] = useState<number>(BusinessEnum.ServerType.Internal_Dev); | 	const [type, setType] = useState<number>(BusinessEnum.ServerType.Internal_Dev); | ||||||
| 	const [isLogin, setIsLogin] = useState<boolean>(false); | 	const [isLogin, setIsLogin] = useState<boolean>(false); | ||||||
| 	const [token, SetToken] = useState("eyJhbGciOiJIUzI1NiJ9.Am-dhpCRUo9iBHYJ0kro12-zUlOyNAVOw9poXEkUV14hvkL2RPxVqqtrsYbS9_aoKep4EOFYROFTbv6MfVai7gomKdr07XkmTtADtkbchkfm-yuGXVzW1mYabf646_U66MnvXX2PHS-ATXDYYx5He9PJ-5lF9g5BmhtxUYPW98w.MGUUrFQbBeUBPDJeoKMilbqbg6IkwEqbu2oyJVSmw6M"); | 	const a = "eyJhbGciOiJIUzI1NiJ9.hoaQl5V6Ni6G3xXJXSADO-aS2fopaAd8lA-K6UkTUbhU46l1B5JU2TxINvsRQPmNE1TzKPc0MD5dyFOEJmo8gpGtRWsMWiyzekENR6QwJluQa2nL83QNZaif8BhEff1vm0F_TOAA2ENDiaY7VnkeLHB-Dv3KyRo5AEAmYVFWK_A.k1rj5BHgPKCVvI7sDjBwb6dGOl4OH3131NIr5vxVrGA"; | ||||||
|  | 	const [token, SetToken] = useState(a); | ||||||
| 	const options: Option[] = []; | 	const options: Option[] = []; | ||||||
| 	for (let i = 0, names: string[] = Object.keys(serverType); i < names.length; i++) { | 	for (let i = 0, names: string[] = Object.keys(serverType); i < names.length; i++) { | ||||||
| 		const key: string = names[i]; | 		const key: string = names[i]; | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								src/components/CustomA/index.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/components/CustomA/index.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | import { AnchorHTMLAttributes } from "react"; | ||||||
|  |  | ||||||
|  | interface IAnchorProps extends AnchorHTMLAttributes<HTMLAnchorElement> { | ||||||
|  | 	useRef?: React.LegacyRef<HTMLAnchorElement> | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** 阻止a標籤的href產生網頁跳轉 */ | ||||||
|  | export default function A(props: IAnchorProps) { | ||||||
|  | 	const { useRef, children, onClick } = props; | ||||||
|  |  | ||||||
|  | 	function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) { | ||||||
|  | 		event.preventDefault(); // 阻止默认点击行为 | ||||||
|  | 		onClick && onClick(event); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return ( | ||||||
|  | 		<a {...props} ref={useRef} onClick={handleClick}> | ||||||
|  | 			{children} | ||||||
|  | 		</a> | ||||||
|  | 	); | ||||||
|  | } | ||||||
| @@ -1,5 +1,5 @@ | |||||||
| import MainControlData from "@/Common/DataReceived/MainControlData"; | import MainControlData from "@/Common/DataReceived/MainControlData"; | ||||||
| import MainControl from "@/Common/MainControl/MainControl"; | import MainControl, { DownloadForm } from "@/Common/MainControl/MainControl"; | ||||||
| import BusinessTypeSetting, { BusinessEnum } from "@/_BusinessTypeSetting/BusinessTypeSetting"; | import BusinessTypeSetting, { BusinessEnum } from "@/_BusinessTypeSetting/BusinessTypeSetting"; | ||||||
| import { GameData } from "@/define/gameData"; | import { GameData } from "@/define/gameData"; | ||||||
| import { PlayerData } from "@/define/playerData"; | import { PlayerData } from "@/define/playerData"; | ||||||
| @@ -37,6 +37,9 @@ export function GameItemsProvider({ children }: GameItemsProviderProps) { | |||||||
|  |  | ||||||
| 			// // 設定LineTools環境 | 			// // 設定LineTools環境 | ||||||
| 			// await setLineTools(), | 			// await setLineTools(), | ||||||
|  |  | ||||||
|  | 			// DownloadForm | ||||||
|  | 			await MainControl.DownloadForm(DownloadForm.FormType.Formread) | ||||||
| 		]); | 		]); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,12 +1,17 @@ | |||||||
| import CSMessage from "@/Common/Message/CSMessage"; | import CSMessage from "@/Common/Message/CSMessage"; | ||||||
| import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | import { INetResponse } from "@/Engine/CatanEngine/NetManagerV2/Core/INetResponse"; | ||||||
| import { CommonSlotSpinRequest } from "../Request/CommonSlotRequest"; | import CSSettingsSDV3 from "@/FormTableSD/CSSettingsSDV3"; | ||||||
|  | import { gameObj } from "@/context/GameItemsContext"; | ||||||
|  | import GameManager from "@/modules/GameManager"; | ||||||
|  | import { NumberEx } from "@/utils/Number/NumberEx"; | ||||||
|  | import { CommonSlotFgSpinRequest, CommonSlotSpinRequest } from "../Request/CommonSlotRequest"; | ||||||
|  | import { Slot_ChoiceRequest } from "../Request/SlotRequest"; | ||||||
|  |  | ||||||
|  |  | ||||||
| export class SlotBase { | export class SlotBase { | ||||||
| 	//#region public | 	//#region public | ||||||
|  |  | ||||||
| 	// public get ID(): number { return this._bj_Casino_Bot.LobbyScript.Slot; } | 	public get ID(): number { return this.id; } | ||||||
| 	public get FreeID(): number { return 1; } | 	public get FreeID(): number { return 1; } | ||||||
| 	public get FreeCount(): number { return +this.GameRunData["free"][1]; } | 	public get FreeCount(): number { return +this.GameRunData["free"][1]; } | ||||||
| 	public get HasChoiceFreeGame(): boolean { return false; } | 	public get HasChoiceFreeGame(): boolean { return false; } | ||||||
| @@ -20,7 +25,11 @@ export class SlotBase { | |||||||
|  |  | ||||||
| 	protected id: number; | 	protected id: number; | ||||||
|  |  | ||||||
| 	// protected _bj_Slot: BJ_Casino_Bot_Slot; | 	//#endregion | ||||||
|  |  | ||||||
|  | 	//#region private | ||||||
|  |  | ||||||
|  | 	private addLog: (v: string) => void; | ||||||
|  |  | ||||||
| 	//#endregion | 	//#endregion | ||||||
|  |  | ||||||
| @@ -29,8 +38,9 @@ export class SlotBase { | |||||||
| 	/** | 	/** | ||||||
| 	 * | 	 * | ||||||
| 	 */ | 	 */ | ||||||
| 	constructor(id: number) { | 	constructor(id: number, addLog: (v: string) => void) { | ||||||
| 		this.id = id; | 		this.id = id; | ||||||
|  | 		this.addLog = addLog; | ||||||
| 		this.onLoad(); | 		this.onLoad(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -42,7 +52,8 @@ export class SlotBase { | |||||||
|  |  | ||||||
| 	//#region Custom | 	//#region Custom | ||||||
|  |  | ||||||
| 	public *Spin(bet: number): IterableIterator<any> { | 	public *Spin(bet: number, isCountStop: boolean, countStop: number, isRatioStop: boolean, ratioStop: number, OnClickStop: () => void): IterableIterator<any> { | ||||||
|  | 		const { player, setPlayer } = gameObj; | ||||||
| 		let gameRunData: JSON = null; | 		let gameRunData: JSON = null; | ||||||
| 		let req: CommonSlotSpinRequest = new CommonSlotSpinRequest(this.id, bet); | 		let req: CommonSlotSpinRequest = new CommonSlotSpinRequest(this.id, bet); | ||||||
| 		yield req.SendAsync(); | 		yield req.SendAsync(); | ||||||
| @@ -52,139 +63,127 @@ export class SlotBase { | |||||||
| 		} else { | 		} else { | ||||||
| 			CSMessage.NetError(resp.Method, resp.Status); | 			CSMessage.NetError(resp.Method, resp.Status); | ||||||
| 		} | 		} | ||||||
|  | 		let money: number = gameRunData["money"] ? +gameRunData["money"] : 0; | ||||||
|  | 		let winMoney: number = 0; | ||||||
|  | 		let winMoneyLog: string = ""; | ||||||
|  | 		let freeLog: string = ""; | ||||||
|  | 		let resources: any[] = gameRunData["get"]; | ||||||
|  | 		let free: any = gameRunData["free"]; | ||||||
|  | 		let choiceFreeGame: boolean = gameRunData["rs"] === 0; | ||||||
|  | 		if (resources) { | ||||||
|  | 			winMoney = this._getWinMoney(resources); | ||||||
|  | 		} | ||||||
|  | 		if (choiceFreeGame && this.HasChoiceFreeGame) { | ||||||
|  | 			free = true; | ||||||
|  | 		} | ||||||
|  | 		if (free) { | ||||||
|  | 			let freeCount: number = yield* this._getFreeCount(); | ||||||
|  | 			let fsWinMoney: number = 0; | ||||||
|  | 			let fsMoney: number = 0; | ||||||
|  | 			[freeCount, fsWinMoney, fsMoney] = yield* this.FreeSpin(freeCount); | ||||||
|  | 			if (fsMoney > 0) { | ||||||
|  | 				money = fsMoney; | ||||||
|  | 			} | ||||||
|  | 			if (fsWinMoney > 0) { | ||||||
|  | 				winMoney = fsWinMoney; | ||||||
|  | 			} | ||||||
|  | 			freeLog = `, hasFree: ${freeCount}`; | ||||||
|  | 		} | ||||||
|  | 		if (winMoney > 0) { | ||||||
|  | 			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) { | ||||||
|  | 			OnClickStop(); | ||||||
|  | 		} | ||||||
|  | 		if (isCountStop && countStop === 0) { | ||||||
|  | 			OnClickStop(); | ||||||
|  | 		} | ||||||
|  | 		if (ratio > 100) { | ||||||
|  | 			this.addLog(`Slot${this.ID} Spin Bet: ${GameManager.SlotData.NowBet}, Ratio: ${ratio}, Money: ${money}${winMoneyLog}${freeLog}`); | ||||||
|  | 		} | ||||||
|  | 		this.addLog(`Slot${this.ID} Spin Bet: ${GameManager.SlotData.NowBet}, Money: ${money}${winMoneyLog}${freeLog}`); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// public async Spin(): Promise<void> { | 	public * FreeSpin(freeCount: number) { | ||||||
| 	// 	let gameRunData: JSON = null; | 		let fsWinMoney: number = 0; | ||||||
| 	// 	let req: CommonSlotSpinRequest = new CommonSlotSpinRequest(this.ID, this._bj_Slot.NowBet); | 		let fsMoney: number = 0; | ||||||
| 	// 	await req.SendAsync(); | 		for (let i: number = 0; i < freeCount; i++) { | ||||||
| 	// 	let resp: INetResponse<JSON> = req.Result; | 			let gameRunData: JSON = null; | ||||||
| 	// 	if (resp.IsValid) { | 			let req: CommonSlotFgSpinRequest = new CommonSlotFgSpinRequest(this.ID); | ||||||
| 	// 		gameRunData = this.GameRunData = resp.Data; | 			yield req.SendAsync(); | ||||||
| 	// 	} else { | 			let resp: INetResponse<JSON> = req.Result; | ||||||
| 	// 		CSMessage.NetError(resp.Method, resp.Status); | 			if (resp.IsValid) { | ||||||
| 	// 	} | 				gameRunData = resp.Data; | ||||||
| 	// 	let money: number = gameRunData["money"] ? +gameRunData["money"] : 0; | 				if (this.HasRetriggerFreeSpin) { | ||||||
| 	// 	let winMoney: number = 0; | 					let reTriggerCount: number = this._getRetriggerFreeSpinCount(gameRunData); | ||||||
| 	// 	let winMoneyLog: string = ""; | 					freeCount += reTriggerCount; | ||||||
| 	// 	let freeLog: string = ""; | 				} | ||||||
| 	// 	let resources: any[] = gameRunData["get"]; | 				if (i === freeCount - 1) { | ||||||
| 	// 	let free: any = gameRunData["free"]; | 					let resources: any[] = gameRunData["get"]; | ||||||
| 	// 	let choiceFreeGame: boolean = gameRunData["rs"] === 0; | 					if (resources) { | ||||||
| 	// 	if (resources) { | 						fsWinMoney = this._getWinMoney(resources); | ||||||
| 	// 		winMoney = this._getWinMoney(resources); | 					} | ||||||
| 	// 	} | 					fsMoney = gameRunData["money"] ? +gameRunData["money"] : 0; | ||||||
| 	// 	if (choiceFreeGame && this.HasChoiceFreeGame) { | 				} | ||||||
| 	// 		free = true; | 			} else { | ||||||
| 	// 	} | 				CSMessage.NetError(resp.Method, resp.Status); | ||||||
| 	// 	if (free) { | 			} | ||||||
| 	// 		let freeCount: number = await this._getFreeCount(); | 			this.addLog(`Slot${this.ID} FreeSpin MaxCount: ${freeCount}, Count: ${i + 1}`); | ||||||
| 	// 		let fswinMoney: number = 0; | 		} | ||||||
| 	// 		let fsmoney: number = 0; | 		return [freeCount, fsWinMoney, fsMoney]; | ||||||
| 	// 		[freeCount, fswinMoney, fsmoney] = await this.FreeSpin(freeCount); | 	} | ||||||
| 	// 		if (fsmoney > 0) { |  | ||||||
| 	// 			money = fsmoney; |  | ||||||
| 	// 		} |  | ||||||
| 	// 		if (fswinMoney > 0) { |  | ||||||
| 	// 			winMoney = fswinMoney; |  | ||||||
| 	// 		} |  | ||||||
| 	// 		freeLog = `, hasFree: ${freeCount}`; |  | ||||||
| 	// 	} |  | ||||||
| 	// 	if (winMoney > 0) { |  | ||||||
| 	// 		winMoneyLog = `, winMoney: ${winMoney}`; |  | ||||||
| 	// 	} |  | ||||||
| 	// 	this._bj_Casino_Bot.UserData.Money = money; |  | ||||||
| 	// 	this._bj_Casino_Bot.SetUI(); |  | ||||||
| 	// 	let ratio: number = winMoney > 0 ? NumberEx.divide(winMoney, this._bj_Slot.NowBet) : 0; |  | ||||||
| 	// 	if (this._bj_Slot.IsRatioStop.value && ratio >= this._bj_Slot.RatioStop.value) { |  | ||||||
| 	// 		this._bj_Slot.OnclickStop(); |  | ||||||
| 	// 	} |  | ||||||
| 	// 	if (this._bj_Slot.IsCountStop.value && this._bj_Slot.CountStop.value === 0) { |  | ||||||
| 	// 		this._bj_Slot.OnclickStop(); |  | ||||||
| 	// 	} |  | ||||||
| 	// 	if (ratio > 100) { |  | ||||||
| 	// 		this._bj_Casino_Bot.AddLog(`Slot${this.ID} Spin Bet: ${this._bj_Slot.NowBet}, Ratio: ${ratio}, Money: ${money}${winMoneyLog}${freeLog}`); |  | ||||||
| 	// 	} |  | ||||||
| 	// 	// this._bj_Casino_Bot.AddLog(`Slot${this.ID} Spin Bet: ${this._bj_Slot.NowBet}, Money: ${money}${winMoneyLog}${freeLog}`); |  | ||||||
| 	// } |  | ||||||
|  |  | ||||||
| 	// public async FreeSpin(freeCount: number): Promise<number[]> { | 	protected _getWinMoney(resources: any[]): number { | ||||||
| 	// 	let fswinMoney: number = 0; | 		for (let i: number = 0; i < resources.length; i++) { | ||||||
| 	// 	let fsmoney: number = 0; | 			const resource: any[] = resources[i]; | ||||||
| 	// 	for (let i: number = 0; i < freeCount; i++) { | 			if (resource[0] === 1) { | ||||||
| 	// 		let gameRunData: JSON = null; | 				return resource[1]; | ||||||
| 	// 		let req: CommonSlotFgSpinRequest = new CommonSlotFgSpinRequest(this.ID); | 			} | ||||||
| 	// 		await req.SendAsync(); | 		} | ||||||
| 	// 		let resp: INetResponse<JSON> = req.Result; | 		return 0; | ||||||
| 	// 		if (resp.IsValid) { | 	} | ||||||
| 	// 			gameRunData = resp.Data; |  | ||||||
| 	// 			if (this.HasRetriggerFreeSpin) { |  | ||||||
| 	// 				let retriggercount: number = this._getRetriggerFreeSpinCount(gameRunData); |  | ||||||
| 	// 				freeCount += retriggercount; |  | ||||||
| 	// 			} |  | ||||||
| 	// 			if (i === freeCount - 1) { |  | ||||||
| 	// 				let resources: any[] = gameRunData["get"]; |  | ||||||
| 	// 				if (resources) { |  | ||||||
| 	// 					fswinMoney = this._getWinMoney(resources); |  | ||||||
| 	// 				} |  | ||||||
| 	// 				fsmoney = gameRunData["money"] ? +gameRunData["money"] : 0; |  | ||||||
| 	// 			} |  | ||||||
| 	// 		} else { |  | ||||||
| 	// 			CSMessage.NetError(resp.Method, resp.Status); |  | ||||||
| 	// 		} |  | ||||||
| 	// 		// this._bj_Casino_Bot.AddLog(`Slot${this.ID} FreeSpin MaxCount: ${freeCount}, Count: ${i + 1}`); |  | ||||||
| 	// 	} |  | ||||||
| 	// 	return [freeCount, fswinMoney, fsmoney]; |  | ||||||
| 	// } |  | ||||||
|  |  | ||||||
| 	// protected _getWinMoney(resources: any[]): number { | 	protected _getRetriggerFreeSpinCount(gameRunData: JSON): number { | ||||||
| 	// 	for (let i: number = 0; i < resources.length; i++) { | 		if (gameRunData["free"]) { | ||||||
| 	// 		const resource: any[] = resources[i]; | 			return gameRunData["free"][1]; | ||||||
| 	// 		if (resource[0] === 1) { | 		} | ||||||
| 	// 			return resource[1]; | 		return 0; | ||||||
| 	// 		} | 	} | ||||||
| 	// 	} |  | ||||||
| 	// 	return 0; |  | ||||||
| 	// } |  | ||||||
|  |  | ||||||
| 	// protected _getRetriggerFreeSpinCount(gameRunData: JSON): number { | 	protected *_getFreeCount() { | ||||||
| 	// 	if (gameRunData["free"]) { | 		if (this.HasChoiceFreeGame) { | ||||||
| 	// 		return gameRunData["free"][1]; | 			return yield* this._getChoiceFreeCount(); | ||||||
| 	// 	} | 		} else { | ||||||
| 	// 	return 0; | 			return this.FreeCount; | ||||||
| 	// } | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	// protected async _getFreeCount(): Promise<number> { | 	protected * _getChoiceFreeCount() { | ||||||
| 	// 	if (this.HasChoiceFreeGame) { | 		let id: number = this._getFreeID(); | ||||||
| 	// 		return await this._getChoiceFreeCount(); | 		let request: Slot_ChoiceRequest = new Slot_ChoiceRequest(id); | ||||||
| 	// 	} else { | 		yield request.SendAsync(true); | ||||||
| 	// 		return this.FreeCount; | 		let result: INetResponse<number> = request.Result; | ||||||
| 	// 	} | 		if (result.IsValid) { | ||||||
| 	// } | 			if (this.SlotReqRespIsCount) { | ||||||
|  | 				return result.Data; | ||||||
|  | 			} else { | ||||||
|  | 				let slotNameSetting: string = CSSettingsSDV3.Slotset[this.ID].NameSetting; | ||||||
|  | 				let free_info_id: number = result.Data; | ||||||
|  | 				let slotSetting: any = CSSettingsSDV3[slotNameSetting]; | ||||||
|  | 				let freeInfo: any = slotSetting.FreeInfo; | ||||||
|  | 				let count: number = freeInfo[free_info_id].Spins; | ||||||
|  | 				return count; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return 0; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	// protected async _getChoiceFreeCount(): Promise<number> { | 	protected _getFreeID(): number { | ||||||
| 	// 	let id: number = this._getFreeID(); | 		return this.FreeID; | ||||||
| 	// 	let request: Slot_ChoiceRequest = new Slot_ChoiceRequest(id); | 	} | ||||||
| 	// 	await request.SendAsync(true); |  | ||||||
| 	// 	var result: INetResponse<number> = request.Result; |  | ||||||
| 	// 	if (result.IsValid) { |  | ||||||
| 	// 		if (this.SlotReqRespIsCount) { |  | ||||||
| 	// 			return result.Data; |  | ||||||
| 	// 		} else { |  | ||||||
| 	// 			let slotNameSetting: string = CSSettingsV3.Slotset[this.ID].NameSetting; |  | ||||||
| 	// 			let free_info_id: number = result.Data; |  | ||||||
| 	// 			let slotSetting: any = CSSettingsV3[slotNameSetting]; |  | ||||||
| 	// 			let freeInfo: any = slotSetting.FreeInfo; |  | ||||||
| 	// 			let count: number = freeInfo[free_info_id].Spins; |  | ||||||
| 	// 			return count; |  | ||||||
| 	// 		} |  | ||||||
| 	// 	} |  | ||||||
| 	// 	return 0; |  | ||||||
| 	// } |  | ||||||
|  |  | ||||||
| 	// protected _getFreeID(): number { |  | ||||||
| 	// 	return this.FreeID; |  | ||||||
| 	// } |  | ||||||
|  |  | ||||||
| 	//#endregion | 	//#endregion | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								src/define/Game/Slot1306.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/define/Game/Slot1306.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | import SlotBase from "./Base/SlotBase"; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | export class Slot1305 extends SlotBase { | ||||||
|  | 	//#region public | ||||||
|  |  | ||||||
|  | 	public get ID(): number { return 1306; } | ||||||
|  | 	public get HasRetriggerFreeSpin(): boolean { return true; } | ||||||
|  |  | ||||||
|  | 	//#endregion | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default Slot1305; | ||||||
| @@ -2,4 +2,5 @@ body { | |||||||
| 	margin: 0; | 	margin: 0; | ||||||
| 	padding: 0; | 	padding: 0; | ||||||
| 	height: 100vh; | 	height: 100vh; | ||||||
|  | 	overflow: hidden; | ||||||
|   } |   } | ||||||
							
								
								
									
										10
									
								
								src/modules/GameManager.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/modules/GameManager.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | import SlotData from "./data/SlotData"; | ||||||
|  |  | ||||||
|  | class GameManager { | ||||||
|  | 	/** SlotData */ | ||||||
|  | 	public readonly SlotData: SlotData = new SlotData(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default new GameManager(); | ||||||
|  |  | ||||||
|  | export { GameManager }; | ||||||
							
								
								
									
										8
									
								
								src/modules/data/SlotData.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/modules/data/SlotData.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | import SlotBase from "@/define/Game/Base/SlotBase"; | ||||||
|  |  | ||||||
|  | export default class SlotData { | ||||||
|  | 	public SlotId: number = undefined; | ||||||
|  | 	public SlotClass: SlotBase = undefined; | ||||||
|  | 	public IsSpin: boolean = false; | ||||||
|  | 	public NowBet: number = undefined; | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								src/utils/Tools.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/utils/Tools.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  |  | ||||||
|  | export class Tools { | ||||||
|  |  | ||||||
|  |     //#region Custom | ||||||
|  |  | ||||||
|  |     public static Sleep(ms: any): Promise<unknown> { | ||||||
|  |         return new Promise(resolve => setTimeout(resolve, ms)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     //#endregion | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user