Compare commits

..

No commits in common. "master" and "v0.0.94" have entirely different histories.

9 changed files with 808 additions and 1002 deletions

View File

@ -19,9 +19,7 @@ jobs:
echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: npm i
run: |
echo 'npm i'
npm i
echo "✅ npm i done"
- name: build
run: |
echo 'build'

File diff suppressed because it is too large Load Diff

View File

@ -1160,7 +1160,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -83.523,
"y": -70,
"z": 0
},
"_lrot": {
@ -1201,7 +1201,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 167.19189453125,
"height": 80
"height": 54.18
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -1243,7 +1243,7 @@
"_fontSize": 43,
"_fontFamily": "Arial",
"_lineHeight": 43,
"_overflow": 2,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,

View File

@ -5,13 +5,12 @@ import { SLOT_BAR_EVENT } from './game/Define';
import { AutoSpinPanel } from './game/AutoSpinPanel';
import { NodePoolManager } from '../../Loading/scripts/manager/NodePoolManager';
import { webView } from './game/WebView';
import { callGameBalanceApi, cash2gold, getGameId, getHistoryUrl, getOddsUrl, getSupportUrl, gold2cash } from '../../Loading/scripts/comm';
import { cash2gold, getHistoryUrl, getOddsUrl, getSupportUrl, gold2cash } from '../../Loading/scripts/comm';
import { GameDataManager } from '../../Loading/scripts/manager/GameDataManager';
import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
import { LocalizedSprite } from '../../Loading/scripts/i18n/LocalizedSprite';
import { AudioManager } from '../../Loading/scripts/manager/AudioManager';
import { SpinAni } from './game/SpinAni';
import { SlotGame } from './SlotGame';
const { ccclass, property } = _decorator;
@ccclass('SlotBar')
@ -23,9 +22,6 @@ export class SlotBar extends Component {
@property({ type: Prefab })
private autoSpinPanel: Prefab = null;
@property(SlotGame)
private slotGame: SlotGame = null;
@property(Node)
private tipSmall_turbo: Node = null;
@property(Node)
@ -411,38 +407,6 @@ export class SlotBar extends Component {
this.setBet(this.betGrade[this.betIndex]);
}
private isGetBalance: boolean = false;
async onClickBalance(): Promise<number | null> {
if (this.isGetBalance) return
this.isGetBalance = true;
try {
let balacneData = await this.refreshBalanceFromServer();
this.setBalance(balacneData)
return balacneData;
} catch (err) {
console.log('获取余额失败')
return null;
} finally {
this.scheduleOnce(() => {
this.isGetBalance = false;
}, 0.5)
}
}
async onConfirmErr2(): Promise<number | null> {
try {
let balacneData = await this.refreshBalanceFromServer();
this.setBalance(balacneData)
return balacneData;
} catch (err) {
console.log('获取余额失败')
return null;
} finally {
this.isGetBalance = false;
}
}
private currentTipTween: Tween<Node> = null;
private hideTimer: number = null;
showTipSmall(str: string, openTurbo?: boolean) {
@ -609,8 +573,6 @@ export class SlotBar extends Component {
this.setBtnEnable(this.menuBtn, false);
this.setBtnEnable(this.spinBtn, false);
this.slotGame.showFeatureBuy(true)
this.setBtnVisible(this.spinBtn, false);
this.setBtnVisible(this.stopAutoBtn, true);
@ -631,7 +593,6 @@ export class SlotBar extends Component {
this.setBtnVisible(this.spinBtn, true);
this.setBtnVisible(this.stopAutoBtn, false);
this.setBtnEnable(this.spinBtn, false);
this.slotGame.showFeatureBuy(this.getBet() * this.gameInfo.BuyMul > this.gameInfo.MaxBuyBet)
}
reconnectState(hasDelete: boolean = false) {
@ -651,7 +612,6 @@ export class SlotBar extends Component {
this.manualStopNode.active = false
this.isAuto = false;
this.setBtnVisible(this.spinBtn, true);
this.spinAniStop()
this.setBtnVisible(this.stopAutoBtn, false);
this.setBtnEnable(this.spinBtn, true);
@ -809,27 +769,5 @@ export class SlotBar extends Component {
this.setBet(this.betGrade[this.betIndex], true);
}
}
// private _refreshingBalance: boolean = false;
async refreshBalanceFromServer(): Promise<number | null> {
// if (this._refreshingBalance) return this.getBalance();
// this._refreshingBalance = true;
try {
const res = await callGameBalanceApi({});
const balance = Number(res.Balance);
if (!Number.isFinite(balance)) {
console.warn("[SlotBar] invalid balance response:", res);
return this.getBalance();
}
this.setBalance(balance);
return balance;
} catch (err) {
console.error("[SlotBar] refresh balance failed:", err);
return this.getBalance();
} finally {
// this.scheduleOnce(() => {
// this._refreshingBalance = false;
// }, 1)
}
}
}

View File

@ -4,7 +4,7 @@ import { SlotBar } from './SlotBar';
import { SlotGame } from './SlotGame';
import { BigWinUI } from './game/BigWinUI';
import { GameDataManager } from '../../Loading/scripts/manager/GameDataManager';
import { callGameApi, callGameBalanceApi, getGameId, getIsFrom } from '../../Loading/scripts/comm';
import { callGameApi, getIsFrom } from '../../Loading/scripts/comm';
import { TipPanel } from './game/TipPanel';
import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
import { TotalWin } from './game/TotalWin';
@ -78,7 +78,6 @@ export class SlotScene extends Component {
private lastSpinInfo: any = null;
private spinData: any = null;
private isReceiveMsg: boolean = false;
private isErr2: boolean = false;
private objectId: string[] = [];
@ -124,6 +123,8 @@ export class SlotScene extends Component {
this.lastSpinInfo = this.gameInfo;
this.spinData = this.gameInfo.Data;
this.slotGame.showFeatureBuy(this.gameInfo.CloseBuyGame);
// 注册事件监听
this.slotBar.node.on(SLOT_BAR_EVENT.ON_SPIN_CLICK, this.spinBtnClick, this);
// this.slotBar.node.on(SLOT_BAR_EVENT.ON_TEST_SPIN_CLICK, this.spinBtnClick2, this);
@ -225,7 +226,7 @@ export class SlotScene extends Component {
}
async spinBtnClick(isFreeSpin: boolean = false, isFeatureBuy: boolean = false) {
try {
this.gameState.isOnReconnect = false;
this.isReceiveMsg = false;
@ -238,19 +239,6 @@ export class SlotScene extends Component {
if (!isFreeSpin) {
this.slotBar.setWin(0);
}
let curBalanceData = await this.slotBar.refreshBalanceFromServer()
if (!curBalanceData) {
curBalanceData = this.slotBar.getBalance()
}
if (curBalanceData < (isFeatureBuy ? this.slotBar.getBet() * this.gameInfo.BuyMul : this.slotBar.getBet()) && !isFreeSpin && !GameDataManager.instance.frb.Ongoing) {
//余额不足不经过服务器,在客户端拦截
this.showErrorTip(2, () => { this.slotBar.onConfirmErr2() });
this.handleErrSpin(true);
this.isErr2 = true;
return
}
try {
// 如果有frb就不会扣除金额
let frb = GameDataManager.instance.frb;
if (frb && frb.Ongoing != null) {
@ -382,21 +370,16 @@ export class SlotScene extends Component {
this.slotGame.manualStop();
}
private handleErrSpin(isErr2 = false) {
private handleErrSpin() {
this.spinInfo = this.lastSpinInfo;
this.spinData = this.spinInfo.Data;
this.slotGame.setRollerIconRule(this.spinData.Mode == 0 ? ROLLER_RULE : FREE_SPIN_ROLLER_RULE);
this.gameState.isAutoSpin = false;
this.spinData.AllScore = 0;
if (this.spinData.RoundInfo) {
this.spinData.RoundInfo.AllScore = 0;
}
this.slotGame.stopScroll(this.spinData, false, null);
// this.slotGame.manualStop();
this.slotBar.setBalance(isErr2 ? this.slotBar.getBalance() : this.spinInfo.Balance);
this.slotBar.closeAutoSpin();
this.slotGame.setFeatureBuyInteractable(true)
this.slotGame.manualStop();
this.slotBar.setBalance(this.spinInfo.Balance);
}
private async handleSpinResult() {
@ -691,13 +674,8 @@ export class SlotScene extends Component {
}
private async normalStop(isReconnect: boolean = false) {
if (this.isErr2) {
this.isErr2 = false;
this.slotBar.setBalance(this.slotBar.getBalance());
} else {
this.slotBar.setBalance(this.spinData.Balance);
} let winType = this.slotGame.checkWinType(this.spinData.AllScore);
let winType = this.slotGame.checkWinType(this.spinData.AllScore);
await this.handleWinResult(winType, isReconnect, false, () => {
this.checkAutoSpin(winType !== WIN_TYPE.NONE, isReconnect);
@ -895,7 +873,7 @@ export class SlotScene extends Component {
msg2 = I18nManager.instance.t('AID_ERROR_CODE_2');
tip = `${msg1}\n${msg2}`;
if (!this.TipPanel.getHasTip()) {
this.TipPanel.showTip(title, tip, callback, null, I18nManager.instance.t('AID_ERROR_OK_BUTTON'), null, false);
this.TipPanel.showTip(title, tip, null, null, I18nManager.instance.t('AID_ERROR_OK_BUTTON'), null, false);
}
break;
case 3:

View File

@ -1,9 +1,7 @@
import { _decorator, Node, Component, screen, view, ResolutionPolicy, Sprite, sys, Label, Widget, Vec3, UITransform } from 'cc';
import { LocalizedLabel } from './i18n/LocalizedLabel';
import { getLanguage } from './comm';
import { installLabelAlignmentCenterFix } from 'common_tools';
installLabelAlignmentCenterFix();
const { ccclass, property } = _decorator;
export let SWITCH_PROTRAIT_MODE = {
"da": "Skift venligst til portrættilstand",

View File

@ -9,7 +9,7 @@ const qs = new URLSearchParams(location.search)
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
let apiaddr = "";
let token = "eyJQIjoxMDA5NDksIkUiOjE3ODI3NjA2MTIsIlMiOjEwMDQsIkQiOiJycF8xMDAxMiJ9.f8r8mMsNIh9XSXq-Ni_h2KRw4EBDu9pTWIfwAQw7O7U";
let token = "eyJQIjoxMDA5NDksIkUiOjE3NzA2NzA4MTEsIlMiOjk5OCwiRCI6InJwXzEwMDEyIn0.8IGbHU3d63mIZPXD96UTHmDndTb2zf7JYMRpAvH4kGs";
let language = "en"
let currency = "THB"
let isfrom = null
@ -49,7 +49,7 @@ export function getGameId() {
}
export function initReqAddr() {
let partHost = ".rpenenenhkdev.com";
let partHost = ".rpfafafahkdev.com";
if (!PREVIEW) {
const qs = new URLSearchParams(location.search)
@ -113,29 +113,6 @@ export async function callGameApi(action: string, argsObj: any) {
return obj
}
export async function callGameBalanceApi(argsObj: any) {
const url = apiaddr + path.join("/gameapi/getPlayerBalance")
const payload = JSON.stringify(argsObj)
const res = await fetch(url, {
signal: AbortSignal.timeout(10000),
headers: {
"Content-Type": "application/json",
"X-Rp-Token": token,
},
method: "POST",
body: payload,
mode: 'cors',
})
if (res.status != 200) {
const errstr = await res.text()
throw new Error(errstr || res.statusText)
}
const obj = await res.json()
return obj
}
export function gold2cash(v: number): string {
v /= 10000
return v.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');

6
package-lock.json generated
View File

@ -9,15 +9,9 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"common_tools": "git+ssh://git@gitea.rpfafafahkdev.com:taotao/common_tools.git",
"nosleep.js": "^0.12.0"
}
},
"node_modules/common_tools": {
"version": "1.0.0",
"resolved": "git+ssh://git@gitea.rpfafafahkdev.com:taotao/common_tools.git#c49bf2990a6f348489505ac4998683c814b58dde",
"license": "MIT"
},
"node_modules/nosleep.js": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz",

View File

@ -14,7 +14,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"common_tools": "git+ssh://git@gitea.rpfafafahkdev.com:taotao/common_tools.git",
"nosleep.js": "^0.12.0"
}
}