[fix] fixbug
This commit is contained in:
parent
a8b6946ecf
commit
d093c5d533
@ -1,40 +1,38 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { BJ_Casino_Bot } from "../script/BJ_Casino_Bot";
|
import { BJ_Casino_Bot } from "../script/BJ_Casino_Bot";
|
||||||
|
import { BJ_Casino_BotController } from "../script/BJ_Casino_BotController";
|
||||||
import BJ_Casino_Bot_Info from './BJ_Casino_Bot_Info.vue';
|
import BJ_Casino_Bot_Info from './BJ_Casino_Bot_Info.vue';
|
||||||
import BJ_Casino_Bot_Lobby from './BJ_Casino_Bot_Lobby.vue';
|
import BJ_Casino_Bot_Lobby from './BJ_Casino_Bot_Lobby.vue';
|
||||||
import BJ_Casino_Bot_Login from "./BJ_Casino_Bot_Login.vue";
|
import BJ_Casino_Bot_Login from "./BJ_Casino_Bot_Login.vue";
|
||||||
import BJ_Casino_Bot_Slot from './BJ_Casino_Bot_Slot.vue';
|
import BJ_Casino_Bot_Slot from './BJ_Casino_Bot_Slot.vue';
|
||||||
|
|
||||||
const props = defineProps<{ BJ_Casino: any }>()
|
const props = defineProps<{ BJ_Casino_BotController: BJ_Casino_BotController }>()
|
||||||
|
|
||||||
const self = {
|
const Script = new BJ_Casino_Bot();
|
||||||
BJ_Casino: props.BJ_Casino,
|
Script.BotController = props.BJ_Casino_BotController;
|
||||||
}
|
|
||||||
const Script = new BJ_Casino_Bot(self);
|
|
||||||
const disabled = false;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- Info -->
|
<!-- Login -->
|
||||||
<div class="BJ_Casino_Bot" style="float: left;text-align: left;width:10%;" v-show="!Script.IsLogin.value">
|
<div class="BJ_Casino_Bot" style="float: left;text-align: left;width:10%;" v-show="!Script.IsLogin.value">
|
||||||
<BJ_Casino_Bot_Login :Client="self" :Script="Script" />
|
<BJ_Casino_Bot_Login :Script="Script" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Info -->
|
<!-- Info -->
|
||||||
<div class="BJ_Casino_Bot" style="float: left;text-align: left;width:10%;" v-show="Script.IsLogin.value">
|
<div class="BJ_Casino_Bot" style="float: left;text-align: left;width:10%;" v-show="Script.IsLogin.value">
|
||||||
<BJ_Casino_Bot_Info :Client="self" :Script="Script" />
|
<BJ_Casino_Bot_Info :Script="Script" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Game -->
|
<!-- Game -->
|
||||||
<div class="BJ_Casino_Bot" style="float: left;text-align: left;width:40%;">
|
<div class="BJ_Casino_Bot" style="float: left;text-align: left;width:40%;">
|
||||||
<!-- Lobby -->
|
<!-- Lobby -->
|
||||||
<div style="float: left;width:40%;" v-show="Script.LobbyShow.value">
|
<div style="float: left;width:40%;" v-show="Script.LobbyShow.value">
|
||||||
<BJ_Casino_Bot_Lobby :Client="self" :Script="Script" />
|
<BJ_Casino_Bot_Lobby :Script="Script" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Slot -->
|
<!-- Slot -->
|
||||||
<div v-show="Script.SlotShow.value">
|
<div v-show="Script.SlotShow.value">
|
||||||
<BJ_Casino_Bot_Slot :Client="self" :Script="Script" />
|
<BJ_Casino_Bot_Slot :Script="Script" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
|
||||||
import { BJ_Casino_BotController } from "../script/BJ_Casino_BotController";
|
import { BJ_Casino_BotController } from "../script/BJ_Casino_BotController";
|
||||||
import BJ_Casino_Bot from './BJ_Casino_Bot.vue';
|
import BJ_Casino_Bot from './BJ_Casino_Bot.vue';
|
||||||
|
|
||||||
let Title = ref("");
|
const Script = new BJ_Casino_BotController();
|
||||||
const self = {
|
|
||||||
Title: Title,
|
|
||||||
}
|
|
||||||
const aaa = null;
|
|
||||||
const Script = new BJ_Casino_BotController(self);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="BJ_Casino_BotController">
|
<div class="BJ_Casino_BotController">
|
||||||
<BJ_Casino_Bot :BJ_Casino="aaa" />
|
hostport:
|
||||||
|
<el-select v-model="Script.ServerDefault.value" filterable
|
||||||
|
@change="(data: any) => { Script.SelectServer(data) }">
|
||||||
|
<el-option v-for="(item, index) in Script.Hostport" :key="item" :label="item" :value="index" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
<div class="BJ_Casino_BotController">
|
||||||
|
<BJ_Casino_Bot :BJ_Casino_BotController="Script" />
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="BJ_Casino_BotController">
|
|
||||||
<BJ_Casino_Bot :BJ_Casino="aaa" />
|
|
||||||
</div> -->
|
|
||||||
</template>
|
</template>
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">import { BJ_Casino_Bot } from '../script/BJ_Casino_Bot';
|
<script setup lang="ts">import { BJ_Casino_Bot } from '../script/BJ_Casino_Bot';
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps<{ Client: any, Script: BJ_Casino_Bot }>()
|
const props = defineProps<{ Script: BJ_Casino_Bot }>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { BJ_Casino_Bot_Lobby } from '../script/BJ_Casino_Bot_Lobby';
|
import { BJ_Casino_Bot_Lobby } from '../script/BJ_Casino_Bot_Lobby';
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps<{ Client: any, Script: BJ_Casino_Bot }>()
|
const props = defineProps<{ Script: BJ_Casino_Bot }>()
|
||||||
const LobbyScript = new BJ_Casino_Bot_Lobby(props.Script);
|
const LobbyScript = new BJ_Casino_Bot_Lobby(props.Script);
|
||||||
props.Script.LobbyScript = LobbyScript;
|
props.Script.LobbyScript = LobbyScript;
|
||||||
</script>
|
</script>
|
||||||
@ -13,7 +13,7 @@ props.Script.LobbyScript = LobbyScript;
|
|||||||
<el-select v-model="LobbyScript.LobbyDefault.value" filterable
|
<el-select v-model="LobbyScript.LobbyDefault.value" filterable
|
||||||
@change="(data: any) => { LobbyScript.SelectLobby(data) }">
|
@change="(data: any) => { LobbyScript.SelectLobby(data) }">
|
||||||
<el-option v-for="(item, index) in LobbyScript.GetLobby()" :key="item.value" :label="item.label"
|
<el-option v-for="(item, index) in LobbyScript.GetLobby()" :key="item.value" :label="item.label"
|
||||||
:value="item.value" />
|
:value="item.value + 1" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -3,7 +3,7 @@ import { BJ_Casino_Bot } from '../script/BJ_Casino_Bot';
|
|||||||
import { BJ_Casino_Bot_Login } from '../script/BJ_Casino_Bot_Login';
|
import { BJ_Casino_Bot_Login } from '../script/BJ_Casino_Bot_Login';
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps<{ Client: any, Script: BJ_Casino_Bot }>()
|
const props = defineProps<{ Script: BJ_Casino_Bot }>()
|
||||||
const LoginScript = new BJ_Casino_Bot_Login(props.Script);
|
const LoginScript = new BJ_Casino_Bot_Login(props.Script);
|
||||||
props.Script.LoginScript = LoginScript;
|
props.Script.LoginScript = LoginScript;
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,7 +3,7 @@ import { BJ_Casino_Bot } from '../script/BJ_Casino_Bot';
|
|||||||
import { BJ_Casino_Bot_Slot } from '../script/BJ_Casino_Bot_Slot';
|
import { BJ_Casino_Bot_Slot } from '../script/BJ_Casino_Bot_Slot';
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps<{ Client: any, Script: BJ_Casino_Bot }>()
|
const props = defineProps<{ Script: BJ_Casino_Bot }>()
|
||||||
const SlotScript = new BJ_Casino_Bot_Slot(props.Script);
|
const SlotScript = new BJ_Casino_Bot_Slot(props.Script);
|
||||||
props.Script.SlotScript = SlotScript;
|
props.Script.SlotScript = SlotScript;
|
||||||
</script>
|
</script>
|
||||||
@ -11,7 +11,7 @@ props.Script.SlotScript = SlotScript;
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
押注:
|
押注:
|
||||||
<el-select v-model="SlotScript.BetDefault.value" filterable
|
<el-select v-model="SlotScript.BetIndex.value" filterable
|
||||||
@change="(data: any) => { SlotScript.SelectBet(data) }">
|
@change="(data: any) => { SlotScript.SelectBet(data) }">
|
||||||
<el-option v-for="(item, index) in SlotScript.BetGroup" :key="item" :label="item" :value="index" />
|
<el-option v-for="(item, index) in SlotScript.BetGroup" :key="item" :label="item" :value="index" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -2,6 +2,7 @@ import dayjs from "dayjs";
|
|||||||
import { Ref, ref } from "vue";
|
import { Ref, ref } from "vue";
|
||||||
import CSMessage from "./Base/CSMessage";
|
import CSMessage from "./Base/CSMessage";
|
||||||
import { AccountLoginRequest, CustomLoginRequest } from "./Base/Request/AccountRequest";
|
import { AccountLoginRequest, CustomLoginRequest } from "./Base/Request/AccountRequest";
|
||||||
|
import { BJ_Casino_BotController } from "./BJ_Casino_BotController";
|
||||||
import { BJ_Casino_Bot_Lobby } from "./BJ_Casino_Bot_Lobby";
|
import { BJ_Casino_Bot_Lobby } from "./BJ_Casino_Bot_Lobby";
|
||||||
import { BJ_Casino_Bot_Login } from "./BJ_Casino_Bot_Login";
|
import { BJ_Casino_Bot_Login } from "./BJ_Casino_Bot_Login";
|
||||||
import { BJ_Casino_Bot_Slot } from "./BJ_Casino_Bot_Slot";
|
import { BJ_Casino_Bot_Slot } from "./BJ_Casino_Bot_Slot";
|
||||||
@ -16,6 +17,8 @@ export class BJ_Casino_Bot {
|
|||||||
|
|
||||||
public UserData: BJ_Casino_UserData = null;
|
public UserData: BJ_Casino_UserData = null;
|
||||||
|
|
||||||
|
public BotController: BJ_Casino_BotController = null;
|
||||||
|
|
||||||
public LoginScript: BJ_Casino_Bot_Login = null;
|
public LoginScript: BJ_Casino_Bot_Login = null;
|
||||||
|
|
||||||
public LobbyScript: BJ_Casino_Bot_Lobby = null;
|
public LobbyScript: BJ_Casino_Bot_Lobby = null;
|
||||||
@ -45,8 +48,6 @@ export class BJ_Casino_Bot {
|
|||||||
|
|
||||||
//#region private
|
//#region private
|
||||||
|
|
||||||
private _client: any;
|
|
||||||
|
|
||||||
private _conn: NetConnector = null;
|
private _conn: NetConnector = null;
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -56,8 +57,7 @@ export class BJ_Casino_Bot {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
constructor(client: any) {
|
constructor() {
|
||||||
this._client = client;
|
|
||||||
this.onLoad();
|
this.onLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,15 +71,16 @@ export class BJ_Casino_Bot {
|
|||||||
|
|
||||||
public async Login(a: string, p: string): Promise<void> {
|
public async Login(a: string, p: string): Promise<void> {
|
||||||
let self: this = this;
|
let self: this = this;
|
||||||
|
this.IsLogin.value = true;
|
||||||
// const URL: string = "https://game.online-bj.com";
|
// const URL: string = "https://game.online-bj.com";
|
||||||
// const Port: string = "9005";
|
// const Port: string = "9005";
|
||||||
const URL: string = "http://220.134.195.1";
|
// const URL: string = "http://220.134.195.1";
|
||||||
const Port: string = "19005";
|
// const Port: string = "19005";
|
||||||
|
const { host: URL, port: Port } = this.BotController.GetServer();
|
||||||
await this.ConnectAsync(URL, +Port);
|
await this.ConnectAsync(URL, +Port);
|
||||||
// 取得帳號資料
|
// 取得帳號資料
|
||||||
let resp: any = await this._accountLogin(a, p);
|
let resp: any = await this._accountLogin(a, p);
|
||||||
await this._getAccountInfo(resp.a, resp.pw);
|
await this._getAccountInfo(resp.a, resp.pw);
|
||||||
this.IsLogin.value = true;
|
|
||||||
this.LobbyShow.value = true;
|
this.LobbyShow.value = true;
|
||||||
this.SetUI();
|
this.SetUI();
|
||||||
}
|
}
|
||||||
@ -87,7 +88,13 @@ export class BJ_Casino_Bot {
|
|||||||
public async Logout(): Promise<void> {
|
public async Logout(): Promise<void> {
|
||||||
NetManager.Disconnect();
|
NetManager.Disconnect();
|
||||||
this.IsLogin.value = false;
|
this.IsLogin.value = false;
|
||||||
|
|
||||||
this.LobbyShow.value = false;
|
this.LobbyShow.value = false;
|
||||||
|
this.LobbyScript.IsSlotIn.value = false;
|
||||||
|
|
||||||
|
this.SlotShow.value = false;
|
||||||
|
this.SlotScript.IsSpin.value = false;
|
||||||
|
this.SlotScript.IsRun = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _accountLogin(account: string, password: string): Promise<any> {
|
private async _accountLogin(account: string, password: string): Promise<any> {
|
||||||
@ -95,6 +102,7 @@ export class BJ_Casino_Bot {
|
|||||||
await req.SendAsync(true);
|
await req.SendAsync(true);
|
||||||
let resp: INetResponse<any> = req.Result;
|
let resp: INetResponse<any> = req.Result;
|
||||||
if (!resp.IsValid) {
|
if (!resp.IsValid) {
|
||||||
|
this.IsLogin.value = false;
|
||||||
CSMessage.NetError(resp.Method, resp.Status, "Registe Account Error!");
|
CSMessage.NetError(resp.Method, resp.Status, "Registe Account Error!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -107,6 +115,7 @@ export class BJ_Casino_Bot {
|
|||||||
await req.SendAsync(true);
|
await req.SendAsync(true);
|
||||||
let resp: INetResponse<any> = req.Result;
|
let resp: INetResponse<any> = req.Result;
|
||||||
if (!resp.IsValid) {
|
if (!resp.IsValid) {
|
||||||
|
this.IsLogin.value = false
|
||||||
CSMessage.NetError(resp.Method, resp.Status, "Login Account Error!");
|
CSMessage.NetError(resp.Method, resp.Status, "Login Account Error!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -121,14 +130,18 @@ export class BJ_Casino_Bot {
|
|||||||
this.Exp.value = this.UserData.Exp;
|
this.Exp.value = this.UserData.Exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AddLog(log: string): void {
|
public AddLog(log: string, ...args: any[]): void {
|
||||||
let AIDLog: string = ``;
|
let AIDLog: string = ``;
|
||||||
if (this.UserData?.AID) {
|
if (this.UserData?.AID) {
|
||||||
AIDLog = `AID: ${this.UserData.AID} `;
|
AIDLog = `AID: ${this.UserData.AID} `;
|
||||||
}
|
}
|
||||||
console.log(`${AIDLog}${log}`);
|
console.log(`${AIDLog}${log}`, ...args);
|
||||||
let time: string = dayjs().format("YYYY/MM/DD HH:mm:ss.SSS");
|
let time: string = dayjs().format("YYYY/MM/DD HH:mm:ss.SSS");
|
||||||
this.Log.value += `${time} ${log}\n`;
|
if (args.length > 0) {
|
||||||
|
this.Log.value += `${time} ${log}, ${args}\n`;
|
||||||
|
} else {
|
||||||
|
this.Log.value += `${time} ${log}\n`;
|
||||||
|
}
|
||||||
const textarea: HTMLElement | null = document.getElementById("DIV_LOG");
|
const textarea: HTMLElement | null = document.getElementById("DIV_LOG");
|
||||||
if (textarea) {
|
if (textarea) {
|
||||||
textarea.scrollTop = textarea.scrollHeight;
|
textarea.scrollTop = textarea.scrollHeight;
|
||||||
|
@ -1,16 +1,22 @@
|
|||||||
// import { BJ_Casino_Data } from "./BJ_Casino_Data";
|
// import { BJ_Casino_Data } from "./BJ_Casino_Data";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { Ref, ref } from "vue";
|
||||||
|
|
||||||
export class BJ_Casino_BotController {
|
export class BJ_Casino_BotController {
|
||||||
//#region Lifecycle
|
//#region Lifecycle
|
||||||
|
|
||||||
// public BJ_Casino: BJ_Casino_Data | undefined;
|
public Hostport: any[] = ["不選擇環境", "內版", "肉乾", "賴宏", "40", "送審", "外版", "testing1", "testing2", "testing3"];
|
||||||
|
|
||||||
|
public ServerIndedx: number = 6;
|
||||||
|
|
||||||
|
public ServerDefault: Ref<string> = ref(this.Hostport[this.ServerIndedx]);
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region private
|
//#region get set
|
||||||
|
|
||||||
private _client: any;
|
// public get Host(): string { return this.Host; }
|
||||||
|
// public get Port(): string { return this.Port; }
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -19,8 +25,7 @@ export class BJ_Casino_BotController {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
constructor(client: any) {
|
constructor() {
|
||||||
this._client = client;
|
|
||||||
import("dayjs/locale/zh-tw");
|
import("dayjs/locale/zh-tw");
|
||||||
dayjs.locale("zh-tw");
|
dayjs.locale("zh-tw");
|
||||||
// this.BJ_Casino = client.BJ_Casino;
|
// this.BJ_Casino = client.BJ_Casino;
|
||||||
@ -43,9 +48,84 @@ export class BJ_Casino_BotController {
|
|||||||
|
|
||||||
//#region Custom
|
//#region Custom
|
||||||
|
|
||||||
// public SendData() {
|
public GetServer(): any {
|
||||||
// this._client.RankData.value = this.BJ_Casino?.RankWinMoneyData;
|
let resp: Object = {};
|
||||||
// }
|
switch (this.ServerIndedx) {
|
||||||
|
// 不選擇環境
|
||||||
|
case 0:
|
||||||
|
// 外網連內版
|
||||||
|
case 1: {
|
||||||
|
resp["host"] = "http://220.134.195.1";
|
||||||
|
resp["port"] = "19005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 肉乾
|
||||||
|
case 2: {
|
||||||
|
resp["host"] = "http://192.168.5.230";
|
||||||
|
resp["port"] = "9006";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 賴宏
|
||||||
|
case 3: {
|
||||||
|
resp["host"] = "http://192.168.5.134";
|
||||||
|
resp["port"] = "9005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 40
|
||||||
|
case 4: {
|
||||||
|
resp["host"] = "http://192.168.5.12";
|
||||||
|
resp["port"] = "9487";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 送審
|
||||||
|
case 5: {
|
||||||
|
resp["host"] = "https://submit.online-bj.com";
|
||||||
|
resp["port"] = "9005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 外版
|
||||||
|
case 6: {
|
||||||
|
resp["host"] = "https://game.online-bj.com";
|
||||||
|
resp["port"] = "9005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// testing1
|
||||||
|
case 7: {
|
||||||
|
resp["host"] = "http://bj-testing1.casino.catan.com.tw";
|
||||||
|
resp["port"] = "9005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// testing2
|
||||||
|
case 8: {
|
||||||
|
resp["host"] = "http://bj-testing2.casino.catan.com.tw";
|
||||||
|
resp["port"] = "9005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// testing3
|
||||||
|
case 9: {
|
||||||
|
resp["host"] = "http://bj-testing3.casino.catan.com.tw";
|
||||||
|
resp["port"] = "9005";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectServer(data: number): void {
|
||||||
|
this.ServerIndedx = data;
|
||||||
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,7 @@ import { Tools } from "./Tools";
|
|||||||
export class BJ_Casino_Bot_Lobby {
|
export class BJ_Casino_Bot_Lobby {
|
||||||
//#region public
|
//#region public
|
||||||
|
|
||||||
public LobbyCongig: any[] = [2, [
|
public LobbyCongig: any[] = [1, [
|
||||||
"不選擇資源路徑",
|
|
||||||
"體驗聽",
|
"體驗聽",
|
||||||
"一般聽",
|
"一般聽",
|
||||||
"高手聽",
|
"高手聽",
|
||||||
@ -18,11 +17,11 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
]];
|
]];
|
||||||
|
|
||||||
public LobbyShow: Ref<boolean> = ref(false);
|
public LobbyShow: Ref<boolean> = ref(false);
|
||||||
public Lobby: Ref<number> = ref(0);
|
public Lobby: Ref<number> = ref(1);
|
||||||
|
public LobbyDefault: Ref<string> = ref(this.LobbyCongig[1][this.Lobby.value]);
|
||||||
public InputSlot: Ref<string> = ref("");
|
public InputSlot: Ref<string> = ref("");
|
||||||
public Slot: number;
|
public Slot: number;
|
||||||
public Table: Ref<number> = ref(0);
|
public Table: Ref<number> = ref(0);
|
||||||
public LobbyDefault: Ref<string> = ref("");
|
|
||||||
|
|
||||||
public IsSlotIn: Ref<boolean> = ref(false);
|
public IsSlotIn: Ref<boolean> = ref(false);
|
||||||
|
|
||||||
@ -45,8 +44,7 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async onLoad(): Promise<void> {
|
public async onLoad(): Promise<void> {
|
||||||
this.Lobby.value = this.LobbyCongig[0];
|
//
|
||||||
this.LobbyDefault.value = this.LobbyCongig[1][this.Lobby.value];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -76,9 +74,10 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
//#region Onclick
|
//#region Onclick
|
||||||
|
|
||||||
public async OnclickSlotIn(hall: number, slot: number): Promise<void> {
|
public async OnclickSlotIn(hall: number, slot: number): Promise<void> {
|
||||||
if (this.IsSlotIn.value) {
|
if (this.IsSlotIn.value || slot === 0 || slot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
hall += 1;
|
||||||
this.IsSlotIn.value = true;
|
this.IsSlotIn.value = true;
|
||||||
let table: number = 1;
|
let table: number = 1;
|
||||||
let req: SeatListRequest = new SeatListRequest(hall, slot);
|
let req: SeatListRequest = new SeatListRequest(hall, slot);
|
||||||
@ -93,16 +92,20 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
const element: any = data[i];
|
const element: any = data[i];
|
||||||
if (element[0].length > 0) {
|
if (element[0].length > 0) {
|
||||||
let aid: string = element[0][0];
|
let aid: string = element[0][0];
|
||||||
if (aid === this._bj_Casino_Bot.UserData.AID) {
|
if (+aid === +this._bj_Casino_Bot.UserData.AID) {
|
||||||
table = i + 1;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
table = i + 1;
|
table = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
table = i + 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let resp_slotIn: any = await this._slotIn(hall, slot, table);
|
let resp_slotIn: any = await this._slotIn(hall, slot, table);
|
||||||
|
if (!resp_slotIn.IsValid) {
|
||||||
|
this.IsSlotIn.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.Slot = slot;
|
this.Slot = slot;
|
||||||
this.Table.value = table;
|
this.Table.value = table;
|
||||||
this._bj_Casino_Bot.SlotScript.GameIn(resp_slotIn);
|
this._bj_Casino_Bot.SlotScript.GameIn(resp_slotIn);
|
||||||
@ -119,7 +122,7 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
await Tools.Sleep(0.5);
|
await Tools.Sleep(0.5);
|
||||||
}
|
}
|
||||||
await this._slotOut();
|
await this._slotOut();
|
||||||
this.Slot = null!;
|
this.Slot = null;
|
||||||
this.Table.value = 0;
|
this.Table.value = 0;
|
||||||
this._bj_Casino_Bot.SlotShow.value = false;
|
this._bj_Casino_Bot.SlotShow.value = false;
|
||||||
}
|
}
|
||||||
@ -137,8 +140,7 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
await req.SendAsync(true);
|
await req.SendAsync(true);
|
||||||
let resp: INetResponse<JSON> = req.Result;
|
let resp: INetResponse<JSON> = req.Result;
|
||||||
if (resp.IsValid) {
|
if (resp.IsValid) {
|
||||||
this._bj_Casino_Bot.AddLog(`進機台成功 slot: ${slot}, hall: ${hall}, table: ${uid}`);
|
this._bj_Casino_Bot.AddLog(`進機台成功 slot: ${slot}, hall: ${this.LobbyDefault.value}, table: ${uid}`);
|
||||||
return resp;
|
|
||||||
} else {
|
} else {
|
||||||
switch (resp.Status) {
|
switch (resp.Status) {
|
||||||
case 11:
|
case 11:
|
||||||
@ -150,8 +152,10 @@ export class BJ_Casino_Bot_Lobby {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this._bj_Casino_Bot.AddLog(resp.Method, resp.Status, "進遊戲失敗");
|
||||||
CSMessage.NetError(resp.Method, resp.Status, "進遊戲失敗");
|
CSMessage.NetError(resp.Method, resp.Status, "進遊戲失敗");
|
||||||
}
|
}
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _slotOut(): Promise<any> {
|
private async _slotOut(): Promise<any> {
|
||||||
|
@ -6,17 +6,17 @@ import { Tools } from "./Tools";
|
|||||||
export class BJ_Casino_Bot_Slot {
|
export class BJ_Casino_Bot_Slot {
|
||||||
//#region public
|
//#region public
|
||||||
|
|
||||||
public BetDefault: Ref<string> = ref("");
|
public BetIndex: Ref<string> = ref("");
|
||||||
|
|
||||||
public SpinDelay: Ref<number> = ref(1);
|
public SpinDelay: Ref<number> = ref(1);
|
||||||
|
|
||||||
public Slot: SlotBase = null!;
|
public Slot: SlotBase = null;
|
||||||
|
|
||||||
public GameInData: any = null!;
|
public GameInData: any = null;
|
||||||
|
|
||||||
public BetGroup: number[] = [];
|
public BetGroup: number[] = [];
|
||||||
|
|
||||||
public NowBetIndex: number = null!;
|
public NowBetIndex: number = null;
|
||||||
|
|
||||||
public IsSpin: Ref<boolean> = ref(false);
|
public IsSpin: Ref<boolean> = ref(false);
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ export class BJ_Casino_Bot_Slot {
|
|||||||
|
|
||||||
//#region get set
|
//#region get set
|
||||||
|
|
||||||
public get NowBet(): number { return this.BetGroup[this.NowBetIndex]; }
|
public get NowBet(): number { return +this.BetGroup[this.NowBetIndex]; }
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export class BJ_Casino_Bot_Slot {
|
|||||||
let Data: any = gameInData.Data;
|
let Data: any = gameInData.Data;
|
||||||
this.BetGroup = Data.br;
|
this.BetGroup = Data.br;
|
||||||
this.NowBetIndex = Data.db;
|
this.NowBetIndex = Data.db;
|
||||||
this.BetDefault.value = this.BetGroup[Data.db].toString();
|
this.BetIndex.value = this.BetGroup[Data.db].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -63,6 +63,10 @@ export class BJ_Casino_Bot_Slot {
|
|||||||
//#region Custom
|
//#region Custom
|
||||||
|
|
||||||
public async Spin(): Promise<void> {
|
public async Spin(): Promise<void> {
|
||||||
|
if (this._bj_Casino_Bot.UserData.Money < this.NowBet) {
|
||||||
|
this.NoMoney();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.IsRun = true;
|
this.IsRun = true;
|
||||||
await this.Slot.Spin();
|
await this.Slot.Spin();
|
||||||
await Tools.Sleep(this.SpinDelay.value * 1000);
|
await Tools.Sleep(this.SpinDelay.value * 1000);
|
||||||
@ -78,6 +82,12 @@ export class BJ_Casino_Bot_Slot {
|
|||||||
this._bj_Casino_Bot.AddLog(`改變Bet: ${this.NowBet}`);
|
this._bj_Casino_Bot.AddLog(`改變Bet: ${this.NowBet}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NoMoney(): void {
|
||||||
|
this.IsSpin.value = false;
|
||||||
|
this.IsRun = false;
|
||||||
|
this._bj_Casino_Bot.AddLog(`金額不足: ${this._bj_Casino_Bot.UserData.Money}`);
|
||||||
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Onclick
|
//#region Onclick
|
||||||
|
@ -24,7 +24,7 @@ export class BJ_Casino_Data {
|
|||||||
|
|
||||||
//#region private
|
//#region private
|
||||||
|
|
||||||
private _conn: NetConnector = null!;
|
private _conn: NetConnector = null;
|
||||||
private _ws: any;
|
private _ws: any;
|
||||||
|
|
||||||
private _rankMagnificationData: any[] = [];
|
private _rankMagnificationData: any[] = [];
|
||||||
|
@ -68,17 +68,17 @@ export default class BusinessTypeSetting {
|
|||||||
public static IsB2B: boolean = false;
|
public static IsB2B: boolean = false;
|
||||||
|
|
||||||
/** 商業LOGO圖代碼(讀同一張表但UI有改的設定) */
|
/** 商業LOGO圖代碼(讀同一張表但UI有改的設定) */
|
||||||
public static Logo: number = null!;
|
public static Logo: number = null;
|
||||||
/** 連線IP(網頁版會接網址參數所以要多開變數直接指定) */
|
/** 連線IP(網頁版會接網址參數所以要多開變數直接指定) */
|
||||||
public static UseHost: string = null!;
|
public static UseHost: string = null;
|
||||||
/** 連接阜(網頁版會接網址參數所以要多開變數直接指定) */
|
/** 連接阜(網頁版會接網址參數所以要多開變數直接指定) */
|
||||||
public static UsePort: number = null!;
|
public static UsePort: number = null;
|
||||||
/** 資源伺服器網址 */
|
/** 資源伺服器網址 */
|
||||||
public static UsePatch: string = null!;
|
public static UsePatch: string = null;
|
||||||
/** 帳號 */
|
/** 帳號 */
|
||||||
public static Account: string = null!;
|
public static Account: string = null;
|
||||||
/** 密碼 */
|
/** 密碼 */
|
||||||
public static Password: string = null!;
|
public static Password: string = null;
|
||||||
|
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
/** 執行環境ProductEnum.ServerType */
|
/** 執行環境ProductEnum.ServerType */
|
||||||
|
@ -17,7 +17,7 @@ export class NetConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _host: string;
|
private _host: string;
|
||||||
private _ws: WebSocket = null!;
|
private _ws: WebSocket = null;
|
||||||
private _waitings: WsRequestEnumerator[] = [];
|
private _waitings: WsRequestEnumerator[] = [];
|
||||||
|
|
||||||
constructor(host: string, port: number, ip: string) {
|
constructor(host: string, port: number, ip: string) {
|
||||||
@ -119,7 +119,7 @@ export class NetConnector {
|
|||||||
this._ws.onopen = null;
|
this._ws.onopen = null;
|
||||||
this._ws.onmessage = null;
|
this._ws.onmessage = null;
|
||||||
this._ws.onclose = () => { };
|
this._ws.onclose = () => { };
|
||||||
this._ws = null!;
|
this._ws = null;
|
||||||
|
|
||||||
this.CleanWaitings();
|
this.CleanWaitings();
|
||||||
this.OnDisconnected.DispatchCallback();
|
this.OnDisconnected.DispatchCallback();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user