代码修改

This commit is contained in:
TJH 2026-04-14 16:49:58 +08:00
parent 4f2ca61ec1
commit 954f1be8b6
46 changed files with 2592 additions and 3658 deletions

View File

@ -38,10 +38,13 @@
},
{
"__id__": 82
},
{
"__id__": 84
}
],
"_prefab": {
"__id__": 84
"__id__": 86
},
"_lpos": {
"__type__": "cc.Vec3",
@ -1851,6 +1854,25 @@
"__type__": "cc.CompPrefabInfo",
"fileId": "26ofgGv3dOm7dkVHmvdhjB"
},
{
"__type__": "cc.UIOpacity",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 85
},
"_opacity": 255,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f0oJF5RjlPfa5PwL79vD8J"
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@ -898,6 +898,7 @@
"spineNode": {
"__id__": 26
},
"multiNode": null,
"multiSpriteFrames": [],
"blurMultiSpriteFrames": [],
"_id": ""

View File

@ -1,7 +1,8 @@
import { _decorator, Component, Node, sp, tween, Vec3 } from 'cc';
import { GameDataManager } from '../../Main/Scripts/managers/GameDataManager';
import { NodePoolManager } from '../../Main/Scripts/managers/NodePoolManager';
import { getGameId } from '../../Main/Scripts/main/comm';
import { callGameApi, getGameId } from '../../Main/Scripts/main/comm';
import { AudioManager } from '../../Main/Scripts/managers/AudioManager';
const { ccclass, property } = _decorator;
@ccclass('ChooseDiff')
@ -22,11 +23,13 @@ export class ChooseDiff extends Component {
highBgPos: Vec3 = new Vec3(330, 16, 0);
canClickBtn: boolean = true;
animationCb: Function = null;
confirmCb: Function = null;
open(diff: number, confirmCb: () => void) {
open(diff: number, animationCb?: () => void, confirmCb?: () => void) {
this.chooseDiffSkeleton.setAnimation(0, null, false);
this.currentDiff = diff;
this.animationCb = animationCb;
this.confirmCb = confirmCb;
this.node.getChildByName('grayBg').active = true;
this.canClickBtn = false;
@ -42,7 +45,7 @@ export class ChooseDiff extends Component {
onBtnClose() {
if (!this.canClickBtn) return;
this.canClickBtn = false;
AudioManager.instance.playSFX("Click_Menu");
tween(this.mainNode)
.to(0.2, { scale: new Vec3(0.1, 0.1, 0.1) }, { easing: 'quadOut' })
.call(() => {
@ -60,6 +63,11 @@ export class ChooseDiff extends Component {
onBtnConfirm() {
if (!this.canClickBtn) return;
AudioManager.instance.playSFX("Click_Menu");
if (this.currentDiff === GameDataManager.instance.chooseDiff) {
this.onBtnClose();
return;
}
this.canClickBtn = false;
GameDataManager.instance.chooseDiff = this.currentDiff;
GameDataManager.instance.gamePending = String(getGameId()) + '_' + this.currentDiff;
@ -67,6 +75,7 @@ export class ChooseDiff extends Component {
tween(this.mainNode)
.to(0.2, { scale: new Vec3(0.1, 0.1, 0.1) }, { easing: 'quadOut' })
.call(() => {
if (this.animationCb) this.animationCb();
this.mainNode.active = false;
this.node.getChildByName('grayBg').active = false;
this.chooseDiffSkeleton.setAnimation(0, 'animation', false);
@ -81,6 +90,7 @@ export class ChooseDiff extends Component {
}
onBtnLow() {
AudioManager.instance.playSFX("Click_Menu");
if (this.currentDiff == 1 || !this.canClickBtn) return;
this.currentDiff = 1;
this.canClickBtn = false;
@ -92,6 +102,7 @@ export class ChooseDiff extends Component {
}
onBtnMedium() {
AudioManager.instance.playSFX("Click_Menu");
if (this.currentDiff == 2 || !this.canClickBtn) return;
this.currentDiff = 2;
this.canClickBtn = false;
@ -103,6 +114,7 @@ export class ChooseDiff extends Component {
}
onBtnHigh() {
AudioManager.instance.playSFX("Click_Menu");
if (this.currentDiff == 3 || !this.canClickBtn) return;
this.currentDiff = 3;
this.canClickBtn = false;

View File

@ -30,7 +30,7 @@ export let GAME_STATE = {
export let ICON_WIDTH = 132;
export let ICON_HEIGHT = 160;
export let DELETE_TIME = 2.1;
export let DELETE_TIME = 1.5;
export interface ISpecialIcon {
startPos: number;
@ -44,7 +44,7 @@ export interface IParsedGameData {
RemoveData: number[];
NewIconTop: number[][];
ScatterPos: number[];
BombPos: number[];
MultiPos: number[];
hasSmallGame: boolean;
hasFreeSpinAgain: boolean;
FreeMulMap: { [pos: number]: number };

View File

@ -1,4 +1,4 @@
import { _decorator, Component, Label, Node, sp, Tween, tween, Vec3 } from 'cc';
import { _decorator, Component, Label, Node, sp, Tween, tween, UIOpacity, Vec3 } from 'cc';
import { UIManager } from '../../Main/Scripts/managers/UIManager';
import { AudioManager } from '../../Main/Scripts/managers/AudioManager';
const { ccclass, property } = _decorator;
@ -43,6 +43,14 @@ export class FreeSpinEnterSpine extends Component {
this.mainNode.active = true;
this.envEnterSpineNode.active = true;
AudioManager.instance.playBGM('Change_Free_Bgm');
// 透明度
let opacity = this.node.getComponent(UIOpacity);
opacity.opacity = 0;
tween(opacity)
.to(0.5, { opacity: 255 }, { easing: 'quadIn' })
.start();
tween(this.mainNode)
.set({ scale: new Vec3(1.1, 1.1, 1.1) })
.to(2, { scale: new Vec3(1, 1, 1) })
@ -86,7 +94,6 @@ export class FreeSpinEnterSpine extends Component {
this.unscheduleAllCallbacks();
if (this.hasClickBtn) return;
this.hasClickBtn = true;
AudioManager.instance.playSFX('Click_Small_Game_Start');
// 插入一个放大缩小的动画
tween(this.startBtn)
.to(0.1, { scale: new Vec3(1.1, 1.1, 1.1) })

View File

@ -41,15 +41,15 @@ export class Icon extends Component {
private rollerId: number = 0;
private state: ICON_STATE = ICON_STATE.IDLE;
private isFastMode: boolean = false;
private isWild: boolean = false;
private isMulti: boolean = false;
private isScatter: boolean = false;
set index(id: number) { this.iconId = id; this.isWild = false; this.isScatter = id === 0; }
set index(id: number) { this.iconId = id; this.isMulti = id === 10; this.isScatter = id === 0; }
get index(): number { return this.iconId }
get isWildOrScatter(): boolean {
return this.isWild || this.isScatter;
}
// get isWildOrScatter(): boolean {
// return this.isWild || this.isScatter;
// }
resetState() {
this.unscheduleAllCallbacks();
@ -73,6 +73,7 @@ export class Icon extends Component {
// }
let spine = this.spineNode.getChildByName('spine').getComponent(sp.Skeleton);
spine.timeScale = 1;
if (spine) {
spine.setCompleteListener(null);
}
@ -112,14 +113,43 @@ export class Icon extends Component {
playIdleSpine(bol: boolean) {
let spine = this.spineNode.getChildByName('spine').getComponent(sp.Skeleton);
// if (spine && this.checkHasAnimation(spine, 'chixu')) {
// if (bol) {
// this.normalNode.active = false;
// this.spineNode.active = true;
// spine.setAnimation(0, 'chixu', true);
// } else {
// if (bol) {
// this.normalNode.active = false;
// this.spineNode.active = true;
// spine.setAnimation(0, 'chixu', true);
// } else {
this.normalNode.active = true;
this.spineNode.active = false;
// }
// }
}
playTanSpine(bol: boolean) {
let spine = this.spineNode.getChildByName('spine').getComponent(sp.Skeleton);
// if (spine && this.checkHasAnimation(spine, 'tan')) {
// if (bol) {
// this.normalNode.active = false;
// this.spineNode.active = true;
// spine.setAnimation(0, 'tan', true);
// } else {
// this.normalNode.active = true;
// this.spineNode.active = false;
// }
// }
}
playTanSpineForMsg(bol: boolean) {
let spine = this.spineNode.getChildByName('spine').getComponent(sp.Skeleton);
// if (spine && this.checkHasAnimation(spine, 'tan')) {
// if (bol) {
// this.normalNode.active = false;
// this.spineNode.active = true;
// spine.timeScale = 0.3;
// spine.setAnimation(0, 'tan', true);
// } else {
// this.normalNode.active = true;
// this.spineNode.active = false;
// }
// }
}
@ -129,27 +159,27 @@ export class Icon extends Component {
if (spine && this.checkHasAnimation(spine, 'tan')) {
// this.normalNode.active = false
this.spineNode.active = true;
spine.setAnimation(0, 'tan', isLoop);
// spine.setAnimation(0, 'tan', isLoop);
if (!isLoop) {
spine.setCompleteListener(() => {
spine.setCompleteListener(null);
if (this.checkHasAnimation(spine, 'chixu')) {
this.playIdleSpine(true);
} else {
this.normalNode.active = true;
this.spineNode.active = false;
}
})
// spine.setCompleteListener(() => {
// spine.setCompleteListener(null);
// if (this.checkHasAnimation(spine, 'chixu')) {
// this.playIdleSpine(true);
// } else {
// this.normalNode.active = true;
// this.spineNode.active = false;
// }
// })
}
} else {
spine.setCompleteListener(null);
if (this.checkHasAnimation(spine, 'chixu')) {
this.playIdleSpine(true);
} else {
this.normalNode.active = true;
this.spineNode.active = false;
}
// if (this.checkHasAnimation(spine, 'chixu')) {
// this.playIdleSpine(true);
// } else {
// this.normalNode.active = true;
// this.spineNode.active = false;
// }
}
}
@ -166,14 +196,15 @@ export class Icon extends Component {
playScatterWaitSpine(bol: boolean) {
let spine = this.spineNode.getChildByName('spine').getComponent(sp.Skeleton);
if (this.iconId == 0) {
console.log('播放scatter等待动画');
if (spine && this.checkHasAnimation(spine, 'dengdai')) {
if (bol) {
// this.normalNode.active = false;
this.spineNode.active = true;
spine.setAnimation(0, 'dengdai', true);
} else {
this.playIdleSpine(true);
}
// if (bol) {
// // this.normalNode.active = false;
// this.spineNode.active = true;
// spine.setAnimation(0, 'dengdai', true);
// } else {
// this.playIdleSpine(true);
// }
}
}
}
@ -181,14 +212,16 @@ export class Icon extends Component {
playMultiSpine() {
// this.spineNode.active = true;
// this.normalNode.active = false;
// let spine = this.spineNode.getChildByName('spine').getComponent(sp.Skeleton);
// if (spine) {
// spine.setAnimation(0, 'xiaoshi', false);
// spine.setCompleteListener(() => {
// spine.setCompleteListener(null);
// this.spineNode.active = false;
// this.bombNode.active = true;
// })
// console.log('播放scatter消失动画');
// spine.setAnimation(0, 'xiaoshi', false);
// spine.setCompleteListener(() => {
// spine.setCompleteListener(null);
// this.spineNode.active = false;
// this.bombNode.active = true;
// })
// }
}
@ -251,7 +284,9 @@ export class Icon extends Component {
async onClickIconNode() {
if (GameDataManager.instance.canClickIconMsg) {
AudioManager.instance.playSFX('Click_Icon');
if (this.isMulti) {
return
}
let iconMsg = await NodePoolManager.instance.getNodeFromPoolDynamic('IconMsg', 'Prefab/Others/IconMsg', 'Game');
let gameNode = find('Canvas/main/game');
if (!gameNode) return;

View File

@ -20,6 +20,7 @@ export class IconMsg extends Component {
rightNode: Node = null;
showIconMsg(iconComp: Icon, isLeft: boolean) {
let isScatter = iconComp.index === 0;
this.leftNode.active = isLeft;
this.rightNode.active = !isLeft;
@ -31,7 +32,7 @@ export class IconMsg extends Component {
this.onHideSelf();
})
let isScatter = iconComp.index === 0;
let node = isLeft ? this.leftNode : this.rightNode;
let iconParent = node.getChildByName('icon');
@ -40,7 +41,7 @@ export class IconMsg extends Component {
// insIconNode.getComponent(Icon).index = iconComp.index;
iconParent.addChild(insIconNode);
insIconNode.setPosition(0, 0, 0);
insIconNode.getComponent(Icon).playIdleSpine(true);
insIconNode.getComponent(Icon).playTanSpineForMsg(true);
let msg = node.getChildByName('msg');
msg.active = isScatter ? false : true;

View File

@ -24,6 +24,7 @@ export let Btn_Key = {
HistoryBtn: "HistoryBtn",
CloseL2Btn: "CloseL2Btn",
StopAutoSpinBtn: "StopAutoSpinBtn",
ChooseDiffBtn: "ChooseDiffBtn",
};
// 使用 @ccclass 装饰器
@ -103,9 +104,7 @@ export class SlotBar extends Component {
}
getBtnButton(key: string): Button {
return this.btnTable
.find((btn) => btn.key === key)
?.btnNode.getComponent(Button);
return this.btnTable.find((btn) => btn.key === key)?.btnNode.getComponent(Button);
}
setGameInfo(gameInfo: any) {
@ -122,10 +121,22 @@ export class SlotBar extends Component {
this.setBtnEnable(this.getBtnButton(Btn_Key.SubBetBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.AutoSpinBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.MenuBtn), false);
this.updateChooseDiff();
}
updatePlayerMsg(spinData: any, callBack: () => void) {
updateChooseDiff() {
let diff = GameDataManager.instance.chooseDiff;
this.node.getChildByName('Btn_L1').getChildByName('Choose').children.forEach((child: Node, index: number) => {
child.active = index == diff - 1;
})
this.getBtnNode(Btn_Key.SpinBtn).children.forEach((child: Node, index: number) => {
// child.active = index == diff - 1;
// child.getComponent(sp.Skeleton).setAnimation(0, '1', true);
})
}
updatePlayerMsg(spinData: any, isReconnect: boolean, callBack: () => void) {
if (spinData.AllScore == 0) {
this.setWin(spinData.AllScore);
this.setBalance(spinData.Balance);
@ -133,13 +144,14 @@ export class SlotBar extends Component {
return;
}
this.updateWinMsg(spinData.AllScore);
this.updateBalanceMsg(spinData.Balance, callBack);
this.updateWinMsg(spinData.AllScore, isReconnect);
this.updateBalanceMsg(spinData.Balance, isReconnect, callBack);
}
updateWinMsg(winCount: number) {
updateWinMsg(winCount: number, isReconnect: boolean) {
let time = isReconnect ? 0 : 1;
let startScore = this.curWin;
let tw = UIManager.instance.tweenScorelinear(startScore, winCount, 1);
let tw = UIManager.instance.tweenScorelinear(startScore, winCount, time);
if (tw !== null) {
tw.onUpdate((v) => this.setWin(v))
.onComplete(() => this.setWin(winCount))
@ -147,8 +159,9 @@ export class SlotBar extends Component {
}
}
updateBalanceMsg(balance: number, callBack: () => void) {
let tw = UIManager.instance.tweenScorelinear(this.getBalance(), balance, 1);
updateBalanceMsg(balance: number, isReconnect: boolean, callBack: () => void) {
let time = isReconnect ? 0 : 1;
let tw = UIManager.instance.tweenScorelinear(this.getBalance(), balance, time);
if (tw !== null) {
tw.onUpdate((v) => this.setBalance(v))
.onComplete(() => {
@ -386,20 +399,25 @@ export class SlotBar extends Component {
}
firstClickSpinState() {
let spinBtnSpine = this.getBtnNode(Btn_Key.SpinBtn).getChildByName("SPIN").getComponent(sp.Skeleton);
this.getBtnNode(Btn_Key.SpinBtn).children.forEach(child => {
// child.getComponent(sp.Skeleton).setAnimation(0, "2", true);
})
this.hasClickSpin = true;
spinBtnSpine.setAnimation(0, "2", true);
this.setBtnEnable(this.getBtnButton(Btn_Key.AddBetBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.SubBetBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.AutoSpinBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.MenuBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.ChooseDiffBtn), false);
this.node.getChildByName("stopBtn").active = true;
}
onClickSpin() {
onClickSpin(event, buyType: number = 0, changeDiff: boolean = false) {
if (!this.hasClickSpin && !this.hasClickManualStop) {
AudioManager.instance.playSFX("Click_Spin");
this.node.emit(SLOT_BAR_EVENT.ON_SPIN_CLICK);
this.node.emit(SLOT_BAR_EVENT.ON_SPIN_CLICK, buyType, changeDiff);
this.firstClickSpinState();
}
// 第二次手动停止
@ -422,17 +440,18 @@ export class SlotBar extends Component {
}
manualStop(hasWin: boolean) {
let spineBtnSpine = this.getBtnNode(Btn_Key.SpinBtn).getChildByName("SPIN").getComponent(sp.Skeleton);
if (hasWin) {
spineBtnSpine.setAnimation(0, "1", true);
this.setBtnEnable(this.getBtnButton(Btn_Key.SpinBtn), false);
}
this.getBtnNode(Btn_Key.SpinBtn).children.forEach(child => {
// child.getComponent(sp.Skeleton).setAnimation(0, '1', true);
})
this.setBtnEnable(this.getBtnButton(Btn_Key.SpinBtn), false);
this.hasClickManualStop = true;
}
spinBtnSpineEliminate() {
let spineBtnSpine = this.getBtnNode(Btn_Key.SpinBtn).getChildByName("SPIN").getComponent(sp.Skeleton);
spineBtnSpine.setAnimation(0, "1", true);
this.getBtnNode(Btn_Key.SpinBtn).children.forEach(child => {
// child.getComponent(sp.Skeleton).setAnimation(0, '1', true);
})
this.setBtnEnable(this.getBtnButton(Btn_Key.SpinBtn), false);
}
onClickFastSpin() {
@ -458,37 +477,17 @@ export class SlotBar extends Component {
onClickRules() {
AudioManager.instance.playSFX("Click_Menu");
let param = "rule";
UIManager.instance.showPopup("WebView", "Prefab/WebView", "Game", (prefab) => {
prefab.getComponent(webView).open(param);
}
);
UIManager.instance.showPopup("WebView", "history/prefabs/rules", "Game", null);
}
onClickPaytable() {
AudioManager.instance.playSFX("Click_Menu");
let param = "paytable";
UIManager.instance.showPopup(
"WebView",
"Prefab/WebView",
"Game",
(prefab) => {
prefab.getComponent(webView).open(param);
}
);
UIManager.instance.showPopup("WebView", "history/prefabs/paytable", "Game", null);
}
onClickHistory() {
AudioManager.instance.playSFX("Click_Menu");
let param = "history";
UIManager.instance.showPopup(
"WebView",
"Prefab/WebView",
"Game",
(prefab) => {
prefab.getComponent(webView).open(param);
}
);
UIManager.instance.showPopup("WebView", "history/prefabs/history", "Game", null);
}
isON = true;
@ -573,6 +572,7 @@ export class SlotBar extends Component {
this.setBtnEnable(this.getBtnButton(Btn_Key.AddBetBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.AutoSpinBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.MenuBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.ChooseDiffBtn), false);
this.getBtnButton(Btn_Key.SpinBtn).node.active = false;
this.getBtnButton(Btn_Key.StopAutoSpinBtn).node.active = true;
@ -622,6 +622,7 @@ export class SlotBar extends Component {
this.setBtnEnable(this.getBtnButton(Btn_Key.SubBetBtn), true);
this.setBtnEnable(this.getBtnButton(Btn_Key.AutoSpinBtn), true);
this.setBtnEnable(this.getBtnButton(Btn_Key.MenuBtn), true);
this.setBtnEnable(this.getBtnButton(Btn_Key.ChooseDiffBtn), true);
this.setNodeOpacityForBol(
this.getBtnButton(Btn_Key.AddBetBtn).node,
@ -633,8 +634,9 @@ export class SlotBar extends Component {
);
this.setBtnEnable(this.getBtnButton(Btn_Key.SpinBtn), true);
let spinBtnSpine = this.getBtnNode(Btn_Key.SpinBtn).getChildByName("SPIN").getComponent(sp.Skeleton);
spinBtnSpine.setAnimation(0, "1", true);
this.getBtnNode(Btn_Key.SpinBtn).children.forEach((child: Node, index: number) => {
// child.getComponent(sp.Skeleton).setAnimation(0, '1', true);
})
GameDataManager.instance.canClickIconMsg = true;
}
@ -678,27 +680,10 @@ export class SlotBar extends Component {
}
}
protected onDestroy(): void {
this.getBtnButton(Btn_Key.AutoSpinBtn).node.off(
Node.EventType.TOUCH_START,
this.autoAin,
this
);
this.getBtnButton(Btn_Key.AutoSpinBtn).node.off(
Node.EventType.MOUSE_ENTER,
this.autoAin,
this
);
this.getBtnButton(Btn_Key.FastSpinBtn).node.off(
Node.EventType.TOUCH_START,
this.fastAni,
this
);
this.getBtnButton(Btn_Key.FastSpinBtn).node.off(
Node.EventType.MOUSE_ENTER,
this.fastAni,
this
);
this.getBtnButton(Btn_Key.AutoSpinBtn).node.off(Node.EventType.TOUCH_START, this.autoAin, this);
this.getBtnButton(Btn_Key.AutoSpinBtn).node.off(Node.EventType.MOUSE_ENTER, this.autoAin, this);
this.getBtnButton(Btn_Key.FastSpinBtn).node.off(Node.EventType.TOUCH_START, this.fastAni, this);
this.getBtnButton(Btn_Key.FastSpinBtn).node.off(Node.EventType.MOUSE_ENTER, this.fastAni, this);
}
// =----------------------------------------=
@ -706,7 +691,6 @@ export class SlotBar extends Component {
let betIndex = this.betGrade.indexOf(bet);
if (betIndex == -1) {
betIndex = 0;
// console.error('betIndex is -1,服务器发的信息不对,没有对应的betIndex-->SlotBar');
this.setBet(bet, true);
return;
}
@ -718,6 +702,7 @@ export class SlotBar extends Component {
this.setBtnEnable(this.getBtnButton(Btn_Key.AddBetBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.AutoSpinBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.MenuBtn), false);
this.setBtnEnable(this.getBtnButton(Btn_Key.ChooseDiffBtn), false);
}
setSystemGiftConfirm() {
@ -725,6 +710,7 @@ export class SlotBar extends Component {
this.setBtnEnable(this.getBtnButton(Btn_Key.AddBetBtn), true);
this.setBtnEnable(this.getBtnButton(Btn_Key.AutoSpinBtn), true);
this.setBtnEnable(this.getBtnButton(Btn_Key.MenuBtn), true);
this.setBtnEnable(this.getBtnButton(Btn_Key.ChooseDiffBtn), false);
this.betIndex = 0;
this.setBet(this.betGrade[this.betIndex]);
}

View File

@ -181,7 +181,6 @@ export class SlotGame extends Component {
this.spinData = spinData;
this.upLayer.hideAllLayer();
this.rollerManager.setUpLayer(this.upLayer);
this.updateGameBg(spinData.Mode == 1);
this.parsedData = this.parseGameData(spinData, []);
this._lastRemoveData = this.parsedData.RemoveData.slice(); // 保存本轮消除位置
this.rollerManager.initRollerWithIcon(this.parsedData);
@ -239,9 +238,43 @@ export class SlotGame extends Component {
// });
// flower.setAnimation(0, animationNames[index], false);
// } else {
// let maliao = this.node.getChildByName('FreeGameBg').getChildByName('maliao');
// let leftPos = new Vec3(-580, -310, 0);
// let rightPos = new Vec3(580, -310, 0);
// Tween.stopAllByTarget(maliao);
// maliao.setPosition(leftPos);
// maliao.getComponent(sp.Skeleton).timeScale = 0.5;
// maliao.setScale(1, 1, 0);
// tween(maliao)
// .to(10, { position: rightPos })
// .set({ position: leftPos })
// .union()
// .repeatForever()
// .start();
}
}
updateDiffBg(withAnimation: boolean = false) {
// let diff = GameDataManager.instance.chooseDiff;
// let normalBgDiff = this.node.getChildByName('NormalGameBg1');
// normalBgDiff.getChildByName('diff').children.forEach((child, index) => {
// child.active = index == diff - 1;
// })
// if (!withAnimation) return;
// let mianbanguang = normalBgDiff.getChildByName('mianbanguang');
// mianbanguang.active = true;
// mianbanguang.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
// mianbanguang.getComponent(sp.Skeleton).setCompleteListener(() => {
// mianbanguang.active = false;
// mianbanguang.getComponent(sp.Skeleton).setCompleteListener(null);
// })
}
startScroll(isFreeSpin: boolean) {
this.upLayer.giveBackAllSpecials(this.rollerManager);
if (!isFreeSpin) {
@ -272,19 +305,9 @@ export class SlotGame extends Component {
}
onAllRollerStopped() {
this.upLayer.setReadHandSkeletonActive(false);
let delay = this.parsedData.hasSmallGame ? 2 : 0;
if (this.parsedData.hasSmallGame) {
this.upLayer.playScatterSpine(true);
AudioManager.instance.playSFX('Before_Small_Game');
if (this.rollerManager._isFastSpin) {
AudioManager.instance.playSFX('Stop_Roller_Fast');
}
this.scheduleOnce(() => {
if (this.parsedData.hasSmallGame) {
this.upLayer.playScatterSpine(false);
}
}, delay);
this.node.emit(SLOT_GAME_EVENT.ALL_ROLLER_STOP);
}
@ -329,7 +352,7 @@ export class SlotGame extends Component {
}
}
}
}, 0.6)
}, 0.4)
// 提前返回不执行原本的for循环和删除逻辑
return;
}
@ -344,7 +367,7 @@ export class SlotGame extends Component {
this.upLayer.playIconWinAni(iconNode);
}
}
}, 0.1 * i)
}, 0.05 * i)
}
this.scheduleOnce(() => {
@ -359,7 +382,7 @@ export class SlotGame extends Component {
}
}
}
}, 1.2)
}, 0.6)
this.scheduleOnce(() => {
this.upLayer.setWinGrayNode(false);
@ -390,12 +413,12 @@ export class SlotGame extends Component {
this.rollerManager.iconFallDown();
}
getCurrentBombSettleInfos(): { pos: number, mul: number, iconNode: Node, multiNode: Node }[] {
getCurrentMultiSettleInfos(): { pos: number, mul: number, iconNode: Node, multiNode: Node }[] {
let result: { pos: number, mul: number, iconNode: Node, multiNode: Node }[] = [];
if (!this.parsedData || !this.parsedData.BombPos || !this.parsedData.FreeMulMap) return result;
if (!this.parsedData || !this.parsedData.MultiPos || !this.parsedData.FreeMulMap) return result;
for (let i = 0; i < this.parsedData.BombPos.length; i++) {
let absPos = this.parsedData.BombPos[i];
for (let i = 0; i < this.parsedData.MultiPos.length; i++) {
let absPos = this.parsedData.MultiPos[i];
let mul = this.parsedData.FreeMulMap[absPos];
if (mul == null) continue;
let iconNode = this.rollerManager.getIconNode(absPos);
@ -414,16 +437,6 @@ export class SlotGame extends Component {
onAllRollerIconsFallen() {
this.upLayer.resetAndSyncAllSpecials(this.rollerManager);
let delay = this.parsedData.hasSmallGame ? 2 : 0;
if (this.parsedData.hasSmallGame) {
this.upLayer.playScatterSpine(true);
AudioManager.instance.playSFX('Before_Small_Game');
}
this.scheduleOnce(() => {
if (this.parsedData.hasSmallGame) {
this.upLayer.playScatterSpine(false);
}
}, delay);
this.node.emit(SLOT_GAME_EVENT.ALL_ROLLER_ICONS_FALLEN);
}
@ -504,7 +517,7 @@ export class SlotGame extends Component {
}
let scatterPos: number[] = [];
let bombPos: number[] = [];
let multiPos: number[] = [];
let panData: number[] = [];
for (let i = 0; i < serverPanData.length; i++) {
@ -515,7 +528,7 @@ export class SlotGame extends Component {
for (let i = 0; i < panData.length; i++) {
let iconId = panData[i];
if (iconId == 0) scatterPos.push(i);
if (iconId == 10) bombPos.push(i);
if (iconId == 10) multiPos.push(i);
}
let freeIsSame = Free == null ? false : Free.LeftCount !== Free.MaxCount;
@ -526,7 +539,7 @@ export class SlotGame extends Component {
RemoveData: removeData,
NewIconTop: newIconTop,
ScatterPos: scatterPos,
BombPos: bombPos,
MultiPos: multiPos,
hasSmallGame: scatterPos.length >= 4,
hasFreeSpinAgain: scatterPos.length >= 3 && freeIsSame,
FreeMulMap: freeMulMap,
@ -539,7 +552,7 @@ export class SlotGame extends Component {
// -----------------------------购买相关-----------------------------
onClickFeatureBuy() {
AudioManager.instance.playSFX('Click_FeatureBuy_Btn');
this.setBtnEnableForBol(this.featureBuyNode, false);
this.setBtnEnableForBol(this.doubleWinBtnNode.getChildByName('pt_11'), false);
@ -576,8 +589,6 @@ export class SlotGame extends Component {
});
// });
let flower = this.featureBuyNode.getChildByName('3_2').getComponent(sp.Skeleton);
flower.setAnimation(0, 'animation', false);
}, 0.1)
}
@ -622,4 +633,8 @@ export class SlotGame extends Component {
this.featureBuyBtnEnabled = bol;
this.refreshBuyBtnState(false);
}
setDoubleWinBtnEnable(bol: boolean) {
this.setBtnEnable(this.doubleWinBtnNode, bol);
}
}

View File

@ -6,6 +6,7 @@ import { AudioManager } from '../../Main/Scripts/managers/AudioManager';
import { Icon } from './Icon';
import { SlotGame } from './SlotGame';
import { SlotBar } from './SlotBar';
import { NET_MODE } from 'cc/env';
const { ccclass, property } = _decorator;
@ccclass('SlotMsg')
@ -41,6 +42,9 @@ export class SlotMsg extends Component {
@property(Node)
grayMsgNode: Node = null;
@property(Node)
multiNode: Node = null;
protected onLoad(): void {
this.grayMsgNode.active = false;
}
@ -206,10 +210,10 @@ export class SlotMsg extends Component {
let multiedScore = mulDesc?.Multied; // 最终得到的分数
// let mulValue = mulDesc?.Mul; // 总倍率
let slotGame = director.getScene()?.getComponentInChildren(SlotGame);
let bombInfos = slotGame?.getCurrentBombSettleInfos?.() || []; // 炸弹节点信息
let multiInfos = slotGame?.getCurrentMultiSettleInfos?.() || []; // 炸弹节点信息
if (!bombInfos.length) {
console.error('SlotGame not find bombInfos msg');
if (!multiInfos.length) {
console.error('SlotGame not find multiInfos msg');
return;
}
@ -233,7 +237,7 @@ export class SlotMsg extends Component {
let tweenToAsync = (node: Node, toPos: Vec3, duration: number) => {
return new Promise<void>((resolve) => {
tween(node)
.to(duration, { position: toPos }, { easing: 'quadInOut' })
.to(duration, { position: toPos }, { easing: 'quadIn' })
.call(() => resolve())
.start();
});
@ -261,7 +265,6 @@ export class SlotMsg extends Component {
// 这部分run内部就是完整的队列模式所有动画/节点操作都是await同步执行
let run = async () => {
// 1. 确认总倍率节点,并首先飞入信息栏
// let seedNode = bombInfos[0]?.multiNode;
let centerMulNode = this.node.getChildByName('totalMulti');
this.node.addChild(centerMulNode);
// centerMulNode.setPosition(centerLocalPos);
@ -279,9 +282,9 @@ export class SlotMsg extends Component {
}
let sumMul = this.currTotaleMulti;
// 2. 遍历每一个待结算的bomb多倍icon按顺序“飞入信息栏”, 逐步累加
for (let i = 0; i < bombInfos.length; i++) {
let info = bombInfos[i];
// 2. 遍历每一个待结算的Multi多倍icon按顺序“飞入信息栏”, 逐步累加
for (let i = 0; i < multiInfos.length; i++) {
let info = multiInfos[i];
if (!info?.multiNode?.isValid) continue;
let iconComp = info.iconNode?.getComponent(Icon);
@ -333,7 +336,7 @@ export class SlotMsg extends Component {
// 直接调用回调(如果业务上需要动画结束后再回调可考虑调整)
if (callBack) callBack();
let slotBar = director.getScene()?.getComponentInChildren(SlotBar);
if (slotBar) slotBar.updateWinMsg(spinData.AllScore);
if (slotBar) slotBar.updateWinMsg(spinData.AllScore, false);
};
// 直接触发队列执行不等待run()结束动画流程内部用await限定顺序外部流程不依赖

View File

@ -45,6 +45,7 @@ export class SlotScene extends Component {
isAutoSpin: boolean = false;
isReceiveMsg: boolean = false;
isOneRoundEnd: boolean = false;
isPreviewSpin: boolean = false;
hasEliminate: boolean = false;
isErr = false;
@ -111,10 +112,9 @@ export class SlotScene extends Component {
}
GameDataManager.instance.canClickIconMsg = false;
this.slotBar.setGameInfo(this.gameInfo);
this.slotGame.updateDiffBg();
this.slotMsg.showLabelMsgForTween();
this.node.getChildByName('Choose').children.forEach((child: Node, index: number) => {
child.active = index == GameDataManager.instance.chooseDiff - 1;
})
this.updateGameState();
this.isFreeSpin = this.spinData.Free != null && this.spinData && this.spinData.Free && this.spinData.Free.LeftCount > 0;
if (this.isFreeSpin) {
@ -124,7 +124,7 @@ export class SlotScene extends Component {
if (!this.gameInfo.CloseBuyGame) {
this.slotGame.setFeatureBuyActive(!(this.slotBar.getBet() * this.gameInfo.BuyMul > this.gameInfo.MaxBuyBet));
}
this.updateBg(this.isFreeSpin);
this.updateBg(this.isFreeSpin, true);
let frb = GameDataManager.instance.frb;
if (frb && frb.Ongoing?.Popup) {
@ -140,8 +140,14 @@ export class SlotScene extends Component {
this.isFreeSpin ? AudioManager.instance.playBGM("Free_Bg_Bgm") : AudioManager.instance.playBGM("Normal_Bg_Bgm");
}
updateBg(isFreeSpin: boolean) {
this.slotGame.updateGameBg(isFreeSpin);
updateBg(isFreeSpin: boolean, isReconnect: boolean) {
if (isReconnect) {
if (this.isFirstFreeSpin) return;
this.slotGame.updateGameBg(isFreeSpin);
} else {
this.slotGame.updateGameBg(isFreeSpin);
}
}
async handleReconnect() {
@ -149,7 +155,7 @@ export class SlotScene extends Component {
this.slotBar.manualStop(this.hasEliminate);
this.slotGame.playIconWinAni(this.spinData);
this.slotMsg.showRoundWinMsg(this.spinData.WinInfo.Score);
this.slotBar.updateWinMsg(this.spinData.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, true);
if (this.isDebug) {
this.nextSpinInfo = GAME_DATA;
} else {
@ -168,7 +174,7 @@ export class SlotScene extends Component {
this.slotBar.setDisplayBet(displayBet);
}
async onClickSpin(buyType: number = 0) {
async onClickSpin(buyType: number = 0, changeDiff: boolean = false) {
GameDataManager.instance.canClickIconMsg = false;
this.nextSpinInfo = null;
this.nextSpinInfoPromise = null;
@ -184,8 +190,16 @@ export class SlotScene extends Component {
{ Bet: this.slotBar.getBet(), IsDouble: this.isDoubleWin, }
: { Bet: this.slotBar.getBet(), IsBuy: true, BuyType: buyType, IsDouble: this.isDoubleWin, };
try {
this.spinInfo = !this.isDebug ? await this.spinWithRetryMsg(msg) : GAME_DATA;
this.subBalacne();
if (changeDiff) {
let gameinfo = await callGameApi("gameinfo", {});
GameDataManager.instance.gameInfo = gameinfo;
this.spinInfo = gameinfo;
} else {
this.spinInfo = !this.isDebug ? await this.spinWithRetryMsg(msg) : GAME_DATA;
this.subBalacne(buyType);
}
this.handleSpinResult();
this.slotGame.stopScroll(this.spinData);
} catch (error) {
@ -242,9 +256,11 @@ export class SlotScene extends Component {
onOpenMenu() {
// this.slotGame.hideFeatureBuy();
this.slotGame.setDoubleWinBtnEnable(false);
}
onCloseMenu() {
this.slotGame.setDoubleWinBtnEnable(true);
if (this.gameInfo.CloseBuyGame) return;
// this.slotGame.showFeatureBuy(false);
}
@ -290,7 +306,7 @@ export class SlotScene extends Component {
this.slotBar.setLeftAutoCount(this.autoSpinConfig.count);
this.slotBar.hasClickSpin = false;
this.slotBar.hasClickManualStop = false;
this.slotBar.onClickSpin();
this.onClickSpin(0, false);
if (this.autoSpinConfig.count === 0) {
this.slotBar.closeAutoSpin();
}
@ -343,10 +359,24 @@ export class SlotScene extends Component {
onFeatureBuy(buyType: number) {
this.isFeatureBuySpin = true;
this.slotBar.featureBuySpin();
this.onClickSpin(buyType);
this.onClickSpin(buyType, false);
}
async allRollerStop() {
if (this.isPreviewSpin) {
this.isPreviewSpin = false;
// 停止按钮状态
this.slotBar.manualStop(false);
// 清理表现
this.slotMsg.hideWinSpine();
this.slotBar.setWin(0);
this.slotBar.updateWinMsg(0, true);
this.handlePreviewUIEnd();
return;
}
this.updateGameState();
this.slotBar.manualStop(this.hasEliminate);
@ -355,7 +385,7 @@ export class SlotScene extends Component {
if (this.hasEliminate) {
this.slotGame.playIconWinAni(this.spinData);
this.slotMsg.showRoundWinMsg(this.spinData.WinInfo.Score);
this.slotBar.updateWinMsg(this.spinData.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, false);
if (this.isDebug) {
this.nextSpinInfo = GAME_DATA;
} else {
@ -410,7 +440,7 @@ export class SlotScene extends Component {
if (this.hasEliminate) {
this.slotGame.playIconWinAni(this.spinData);
this.slotMsg.showRoundWinMsg(this.spinData.WinInfo.Score);
this.slotBar.updateWinMsg(this.spinData.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, false);
if (this.isDebug) {
this.nextSpinInfo = GAME_DATA;
} else {
@ -450,11 +480,11 @@ export class SlotScene extends Component {
if (this.isFreeSpin) {
if (this.isFirstFreeSpin) {
// 进入免费前,先给 2 秒展示 scatter 动画并更新信息栏
this.slotBar.updatePlayerMsg(this.spinData, null);
this.slotBar.updatePlayerMsg(this.spinData, false, null);
this.slotGame.upLayer.playScatterWaitSpine(true);
this.scheduleOnce(() => {
this.slotGame.upLayer.playScatterSpine(false);
this.scheduleOnce(() => { this.updateBg(true); this.slotBar.updateIsFreeSpin(true); this.slotBar.setLeftCount(this.spinData.Free.MaxCount); }, 1)
this.slotGame.upLayer.playScatterWaitSpine(false);
this.scheduleOnce(() => { this.updateBg(true, false); this.slotBar.updateIsFreeSpin(true); this.slotBar.setLeftCount(this.spinData.Free.MaxCount); }, 1)
NodePoolManager.instance.getNodeFromPoolDynamic("FreeSpinEnter", "Prefab/FreeSpinEnter", "Game").then((prefab: Node) => {
this.node.addChild(prefab);
let freeCount = this.spinData.Free.MaxCount;
@ -474,7 +504,7 @@ export class SlotScene extends Component {
this.handleFreeSpinAgain(() => {
this.slotBar.setLeftCount(this.spinData.Free.LeftCount);
if (this.isErr) {
this.updateBg(false);
this.updateBg(false, false);
if (
!this.isAutoSpin &&
GameDataManager.instance.frb.Finished == null &&
@ -494,10 +524,11 @@ export class SlotScene extends Component {
this.scheduleOnce(() => {
this.slotMsg.showTotalWinAnimaiton(startScore, this.spinData.AllScore, () => {
NodePoolManager.instance.getNodeFromPoolDynamic("TotalWinSpine", "Prefab/TotalWinSpine", "Game").then((prefab: Node) => {
AudioManager.instance.playBGM("Total_Win_Bgm");
this.node.addChild(prefab);
prefab.getComponent(TotalWinSpine).showTotalWinSpine(this.spinData.AllScore, () => {
this.updateBg(false);
this.slotBar.updatePlayerMsg(this.spinData, false, null);
this.updateBg(false, false);
if (!this.isAutoSpin && GameDataManager.instance.frb.Finished == null && GameDataManager.instance.frb.Ongoing == null) {
this.slotGame.setFeatureBuyBtnEnable(true);
}
@ -523,8 +554,8 @@ export class SlotScene extends Component {
if (this.spinData.Free.LeftCount == 0 && this.spinData.RoundInfo.Current == this.spinData.RoundInfo.Total) {
this.isFreeSpin = false;
this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
this.slotBar.updatePlayerMsg(this.spinData, () => {
this.updateBg(false);
this.slotBar.updatePlayerMsg(this.spinData, isReconnect, () => {
this.updateBg(false, false);
this.slotBar.updateIsFreeSpin(false);
this.slotBar.resetAllBtn();
if (
@ -538,7 +569,7 @@ export class SlotScene extends Component {
}
});
} else {
this.slotBar.updateWinMsg(this.spinData.AllScore);
this.slotBar.updateWinMsg(this.spinData.AllScore, isReconnect);
this.scheduleOnce(() => {
this.handleNextFreeSpin(this.spinData.Free.LeftCount - 1);
}, 1);
@ -547,8 +578,8 @@ export class SlotScene extends Component {
}
} else {
if (isReconnect) {
this.slotBar.updatePlayerMsg(this.spinData, () => {
this.updateBg(false);
this.slotBar.updatePlayerMsg(this.spinData, isReconnect, () => {
this.updateBg(false, true);
this.slotBar.updateIsFreeSpin(false);
this.slotBar.resetAllBtn();
if (GameDataManager.instance.frb.Finished != null || GameDataManager.instance.frb.Ongoing != null) {
@ -563,8 +594,8 @@ export class SlotScene extends Component {
} else {
this.slotMsg.showTotalWinMsg(this.spinData.AllScore);
this.handleBigWin(() => {
this.slotBar.updatePlayerMsg(this.spinData, () => {
this.updateBg(false);
this.slotBar.updatePlayerMsg(this.spinData, false, () => {
this.updateBg(false, false);
if (
!this.isAutoSpin &&
GameDataManager.instance.frb.Finished == null &&
@ -588,7 +619,7 @@ export class SlotScene extends Component {
if (this.spinData.WinInfo.MulDesc == null) {
this.slotMsg.showTotalWinMsg(this.spinData.RoundInfo.Score);
this.slotBar.updateWinMsg(this.spinData.RoundInfo.Score);
this.slotBar.updateWinMsg(this.spinData.RoundInfo.Score, false);
callBack();
return;
}
@ -601,7 +632,7 @@ export class SlotScene extends Component {
}
handleBigWin(callBack: () => void) {
let score = this.isFreeSpin ? this.spinData.SpinScore : this.spinData.AllScore;
let score = this.isFreeSpin ? this.spinData.RoundInfo.Score : this.spinData.AllScore;
let winType = score ? this.checkWinType(score) : WIN_TYPE.NONE;
if (winType >= WIN_TYPE.BIG_WIN) {
NodePoolManager.instance.getNodeFromPoolDynamic("BigWin", "Prefab/BigWin", "Game").then((prefab: Node) => {
@ -647,7 +678,7 @@ export class SlotScene extends Component {
this.isFreeSpin = true;
this.slotBar.setLeftCount(leftCount);
this.onClickSpin();
this.onClickSpin(0, false);
this.slotBar.node.getChildByName("stopBtn").active = true;
}
@ -679,7 +710,7 @@ export class SlotScene extends Component {
this.slotBar.setBalance(this.slotBar.getBalance() - spinCost);
} else {
if (buyType === 1) {
if (buyType == 1) {
this.slotBar.setBalance(this.slotBar.getBalance() - this.slotBar.getBet() * this.gameInfo.BuyMul)
} else {
this.slotBar.setBalance(this.slotBar.getBalance() - this.slotBar.getBet() * 500)
@ -690,16 +721,69 @@ export class SlotScene extends Component {
}
onBtnChooseDiff() {
AudioManager.instance.playSFX("Click_Menu");
NodePoolManager.instance.getNodeFromPoolDynamic("ChooseDiff", "Prefab/ChooseDiff", "Game").then((prefab: Node) => {
this.node.addChild(prefab);
prefab.getComponent(ChooseDiff).open(GameDataManager.instance.chooseDiff, () => {
this.node.getChildByName("Choose").children.forEach((child: Node, index: number) => {
child.active = index == GameDataManager.instance.chooseDiff - 1;
})
});
prefab.getComponent(ChooseDiff).open(GameDataManager.instance.chooseDiff, async () => {
let gameinfo = await callGameApi('gameinfo', {});
GameDataManager.instance.gameInfo = gameinfo;
this.spinInfo = gameinfo;
this.spinData = gameinfo.Data;
this.resetStateForPreview();
this.isPreviewSpin = true;
this.slotGame.startScroll(false);
this.handleSpinResult();
this.slotGame.stopScroll(this.spinData);
this.slotBar.setGameInfo(gameinfo);
this.slotGame.updateDiffBg(true);
},
() => {
this.slotBar.updateChooseDiff();
});
});
}
resetStateForPreview() {
this.isFreeSpin = false;
this.isFirstFreeSpin = false;
this.isFeatureBuySpin = false;
this.isDoubleWin = false;
this.isAutoSpin = false;
this.isReceiveMsg = false;
this.isOneRoundEnd = false;
this.hasEliminate = false;
this.isErr = false;
this.nextSpinInfo = null;
this.nextSpinInfoPromise = null;
}
handlePreviewUIEnd() {
this.checkAutoSpin(false);
this.slotBar.resetAllBtn();
if (this.gameInfo.CloseBuyGame) {
this.slotGame.setFeatureBuyBtnEnable(false);
} else {
this.slotGame.setFeatureBuyBtnEnable(true);
}
this.isAutoSpin = false;
this.slotBar.setLeftAutoCount(0);
this.slotBar.updateIsFreeSpin(false);
}
showErrorTip(errcode: number, errMsg: string, callBack?) {
let title = I18nManager.instance.t("AID_ERROR_TITLE");
let msg = "";

View File

@ -30,7 +30,7 @@ export class TotalWinSpine extends Component {
this.collectBtn.active = false;
this.hasClickBtn = false;
this.node.getChildByName('grayBg').once(Node.EventType.TOUCH_START, this.onClickGrayBg, this);
AudioManager.instance.playBGM("Total_Win_Bgm", false);
tween(this.fsTotalWinSpineNode)
.set({ scale: new Vec3(1.1, 1.1, 1.1) })
.to(5, { scale: new Vec3(1, 1, 1) })
@ -45,13 +45,11 @@ export class TotalWinSpine extends Component {
.to(0.5, { scale: new Vec3(1, 1, 1) }, { easing: 'bounceOut' })
.start();
AudioManager.instance.playSFX('Gold_Up');
this.labelController = UIManager.instance.tweenScorelinear(0, totalWinCount, 2)
.onUpdate((v: number) => {
this.totalWinCount.getComponent(Label).string = gold2cash(v);
})
.onComplete(() => {
AudioManager.instance.playBGM('Total_Win_Last_Bgm');
this.collectBtn.active = true;
this.totalWinCount.getComponent(Label).string = gold2cash(totalWinCount);
this.scheduleOnce(() => {
@ -62,18 +60,16 @@ export class TotalWinSpine extends Component {
}
onClickGrayBg() {
AudioManager.instance.playBGM('Total_Win_Last_Bgm');
AudioManager.instance.playBGM('Total_Win_Jump');
this.node.getChildByName('grayBg').off(Node.EventType.TOUCH_START, this.onClickGrayBg, this);
Tween.stopAllByTarget(this.labelController.holder);
AudioManager.instance.stopSFX('Gold_Up');
this.collectBtn.active = true;
this.totalWinCount.getComponent(Label).string = gold2cash(this.totalWinCountValue);
}
onClickCollectBtn() {
onClickCollectBtn() {
if (this.hasClickBtn) return;
this.hasClickBtn = true;
AudioManager.instance.playSFX('Click_Small_Game_Start');
this.hasClickBtn = true;
tween(this.collectBtn)
.to(0.1, { scale: new Vec3(1.1, 1.1, 1.1) })
.to(0.1, { scale: new Vec3(1, 1, 1) })

View File

@ -6,20 +6,12 @@ let { ccclass, property } = _decorator;
@ccclass('UpLayer')
export class UpLayer extends Component {
@property(Node)
readHandLayer: Node = null;
@property(Node)
wildLayer: Node = null;
@property(Node)
readyHandGrayNode: Node = null;
@property(Node)
scatterLayer: Node = null;
@property(Node)
readyHandNode: Node = null;
MultiLayer: Node = null;
@property(Node)
winLayer: Node = null;
@ -38,12 +30,8 @@ export class UpLayer extends Component {
// 统一隐藏所有层
hideAllLayer() {
this.readHandLayer.active = false;
this.wildLayer.active = false;
this.readyHandGrayNode.active = false;
this.scatterLayer.active = false;
this.readyHandNode.active = false;
this.MultiLayer.active = false;
this.winLayer.active = false;
this.winGrayLayer.active = false;
this.winSpineLayer.active = false;
@ -67,12 +55,12 @@ export class UpLayer extends Component {
this.winGrayLayer.active = bool;
uiOpacity.opacity = 0;
tween(uiOpacity)
.to(0.1, { opacity: 255 })
.to(0.2, { opacity: 255 }, { easing: 'quadOut' })
.start();
} else {
uiOpacity.opacity = 255;
tween(uiOpacity)
.to(0.1, { opacity: 0 })
.to(0.2, { opacity: 0 }, { easing: 'quadOut' })
.call(() => {
this.winLayer.active = false;
this.winSpineLayer.active = false;
@ -109,26 +97,21 @@ export class UpLayer extends Component {
// ---------------------------------------readyHandNode、scatterLayer、wildLayer相关 ---------------------------------------
adopted = new Map<Node, { rollerId: number; startPos: number; height: number; type: 'wild' | 'scatter' }>();
hideReadHandLayer() {
this.readHandLayer.active = false;
}
adopted = new Map<Node, { rollerId: number; startPos: number; height: number; type: 'Multi' | 'scatter' }>();
setSpecialLayersActive() {
let hasWild = Array.from(this.adopted.values()).some(v => v.type === 'wild');
let hasMulti = Array.from(this.adopted.values()).some(v => v.type === 'Multi');
let hasScatter = Array.from(this.adopted.values()).some(v => v.type === 'scatter');
this.readHandLayer.active = hasWild || hasScatter;
this.wildLayer.active = hasWild;
this.MultiLayer.active = hasMulti;
this.scatterLayer.active = hasScatter;
}
adoptSpecial(node: Node, rollerId: number, startPos: number, height: number, type: 'wild' | 'scatter') {
adoptSpecial(node: Node, rollerId: number, startPos: number, height: number, type: 'Multi' | 'scatter') {
if (!node || !node.isValid) return;
if (this.adopted.has(node)) return;
let wp = node.worldPosition.clone();
let layer = type === 'wild' ? this.wildLayer : this.scatterLayer;
let layer = type === 'Multi' ? this.MultiLayer : this.scatterLayer;
layer.active = true;
node.parent = layer;
@ -154,7 +137,7 @@ export class UpLayer extends Component {
let msg = (roller as any).getNodeMsgFromPos(i);
if (!msg) continue;
let type: 'wild' | 'scatter' = icon.index === 0 ? 'wild' : 'scatter';
let type: 'Multi' | 'scatter' = icon.index === 0 ? 'Multi' : 'scatter';
this.adoptSpecial(msg.node, roller.rollerId, msg.start, msg.height, type);
}
}
@ -186,16 +169,8 @@ export class UpLayer extends Component {
for (let i = 0; i < rm.allRollers.length; i++) {
this.syncSpecialFromRoller(rm.allRollers[i]);
}
}
setReadHandSkeletonActive(bol: boolean) {
this.readyHandNode.active = bol;
this.readyHandGrayNode.active = bol;
}
playScatterSpine(bol: boolean) {
this.scatterLayer.children.forEach(child => child.getComponent(Icon).playScatterIdleSpine(bol));
}
playScatterWaitSpine(bol: boolean) {
this.scatterLayer.children.forEach(child => child.getComponent(Icon).playScatterWaitSpine(bol));

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "d1adcd35-4537-4505-87a8-2ea2dca41247",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "be5da60d-5ece-42ca-9d87-fc5b179bdbde",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "b7700aa1-ed12-4ce0-86ca-ae5e32d88022",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "6662d5b9-78fd-40e7-bb9f-5b2cad94ecb3",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "3edbbc79-d019-4575-82a2-2da4ac40c245",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "55c5c9c0-9833-48ff-ba5a-437a8ee0c9f4",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "8c47ed47-d38b-4cc6-9f4a-c47d163de199",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"ver": "1.0.0",
"importer": "audio-clip",
"imported": true,
"uuid": "6675bdde-da0d-4863-825a-3a68c7682ca2",
"files": [
".json",
".mp3"
],
"subMetas": {},
"userData": {
"downloadMode": 0
}
}