点击快速停止。开始滚动后时间如果超过0.8s,直接停止,如果没超过0.8s,延迟一会才停止

This commit is contained in:
TJH 2025-10-13 14:42:38 +08:00
parent 2fc2885c71
commit edf5909a33
2 changed files with 89 additions and 61 deletions

View File

@ -2294,7 +2294,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "36/hgbuL9IMrK8Mtl1IMVw"
"fileId": "96MLnfjEtAi4b6uJnykcDB"
},
{
"__type__": "cc.PrefabInfo",
@ -2304,7 +2304,7 @@
"asset": {
"__id__": 0
},
"fileId": "91WOH/VS5OzYrKcQC+AYpK",
"fileId": "e5Rbn5A6NHiodenRWoj/Qs",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -2335,7 +2335,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "ccrDQPFlJC+bruTEodPDf9"
"fileId": "6btVXoPndM97FlNHbG3z84"
},
{
"__type__": "cc.PrefabInfo",
@ -2345,7 +2345,7 @@
"asset": {
"__id__": 0
},
"fileId": "a0aj38rrZDbIGDKwY/5G9k",
"fileId": "ea3FITMjpAFL+wheKPLImZ",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -2376,7 +2376,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8fVzKzrgxFzb0MW3fX/o/C"
"fileId": "0d6korPC5FkZUMNv9ICwZN"
},
{
"__type__": "5fc10Zl7lVO97/rr2J1uxWH",
@ -2400,7 +2400,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0bHKYXmw9LzqXcZ30l/b1g"
"fileId": "a8bzvo+AZGvoIZY1dJmrB8"
},
{
"__type__": "5fd13+Xa69CZogb3Q/F1lnC",
@ -2573,7 +2573,7 @@
"asset": {
"__id__": 0
},
"fileId": "27Bwq4K1ZJHrOQ2HVBDwD4",
"fileId": "76L4Z0qz9LE6DNE5ao1QqQ",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -2598,7 +2598,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "181vzPIzRHBIrYsoJgSS+a"
"fileId": "20ckLk7g1Bj4XHUDk0iTe7"
},
{
"__type__": "cc.UITransform",
@ -2626,7 +2626,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "31LH3ucypO1LLHZvOy/mCL"
"fileId": "72EvQeMXBHVJjOlxKNXX2a"
},
{
"__type__": "cc.Sprite",
@ -2671,7 +2671,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d1VDevPYtKNbgn98zMEQVy"
"fileId": "55pXkLUU5AFqDQsjXTveUy"
},
{
"__type__": "cc.PrefabInfo",
@ -2681,7 +2681,7 @@
"asset": {
"__id__": 0
},
"fileId": "1eTuPljnNHGZQ+OP0nzAKk",
"fileId": "62U3hvxLdJqo66wzDeIVgB",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -2936,7 +2936,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "73vZ5jykpLFogTcFjT9JrO"
"fileId": "efwkZDG6VAoKB8yy/NjWKf"
},
{
"__type__": "cc.PrefabInfo",
@ -2946,7 +2946,7 @@
"asset": {
"__id__": 0
},
"fileId": "26Hf1hjVFPqrn67xLxkhpG",
"fileId": "f9LF6VRn5GU5UrTV9wz76y",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -2977,7 +2977,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "51GeHrpSBMWZa3pByCG8U1"
"fileId": "c36TSwlS1OTaQM8581ZxVE"
},
{
"__type__": "cc.PrefabInfo",
@ -2987,7 +2987,7 @@
"asset": {
"__id__": 0
},
"fileId": "74wUqcYpNNdqMxwX0m7UUx",
"fileId": "3dMfN9OupGEpzzfWTYzNSJ",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3018,7 +3018,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fcfICkj4NNIrEKzFwFnkNO"
"fileId": "deCmi+rEJPQqjki5Aya+vh"
},
{
"__type__": "45522uB1sdFu4FJAojtnha4",
@ -3042,7 +3042,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "62GyOk1IJB75PrvIzUWhLo"
"fileId": "06X/tYgzxEV4G/8F/4tY5M"
},
{
"__type__": "cc.PrefabInfo",
@ -3052,7 +3052,7 @@
"asset": {
"__id__": 0
},
"fileId": "4aTPaEf4FMk50BQdcpUxCt",
"fileId": "4cyydghzVLVoleu66PGZlg",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3235,7 +3235,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8dc7YCwA9MgqJ+Z04tQdOu"
"fileId": "adMfKGBU9MMorY9A/Zzdc7"
},
{
"__type__": "cc.PrefabInfo",
@ -3245,7 +3245,7 @@
"asset": {
"__id__": 0
},
"fileId": "43dKTwJ5FKl5R4z/wQvFgC",
"fileId": "a3CNi/9SZCOoOC2GCBRhsz",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3276,7 +3276,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "93UPVSZOVGAbHraBw3xdJX"
"fileId": "ae9vlaJAJHB5zheG/jXKAY"
},
{
"__type__": "cc.PrefabInfo",
@ -3286,7 +3286,7 @@
"asset": {
"__id__": 0
},
"fileId": "ffeCIrbntJs5/hELI6aCzk",
"fileId": "40BzCRD8VJxqpdi2JerDAW",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3317,7 +3317,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "48HaVP9GpFWrO6FC7Z2G8l"
"fileId": "5d7yl9LOtLLLFW4DPzcxRY"
},
{
"__type__": "45522uB1sdFu4FJAojtnha4",
@ -3341,7 +3341,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "ea9X4w7OtOlojtkXC4mOyz"
"fileId": "96fSi/+HZDC51Eh1WIzZQW"
},
{
"__type__": "cc.PrefabInfo",
@ -3351,7 +3351,7 @@
"asset": {
"__id__": 0
},
"fileId": "c5IT89S01FNY3uD2KSbBpT",
"fileId": "5bAwT5xx1NHpA4MYBmiftu",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3534,7 +3534,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b8GvHExuNB445+aueio+Ox"
"fileId": "688/+8/zpHoJ0hNGSQS9la"
},
{
"__type__": "cc.PrefabInfo",
@ -3544,7 +3544,7 @@
"asset": {
"__id__": 0
},
"fileId": "f9aCEzhAdCo5nxXIQpgjWr",
"fileId": "34cmNMH4tIJLmuwb9uEIjU",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3575,7 +3575,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "10QJOBeqBN96BJTMed2ZZN"
"fileId": "fbsUHwYUhDZpL6gsUrZ4CZ"
},
{
"__type__": "cc.PrefabInfo",
@ -3585,7 +3585,7 @@
"asset": {
"__id__": 0
},
"fileId": "c5gxmVSjNKVrEQnExUwzCY",
"fileId": "72atkhvc5Pm7d/O669Q8J6",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3616,7 +3616,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c6foaGcgZE7p2qf5Wm/6yt"
"fileId": "1b32uXkTJM2qiLO7SerCAH"
},
{
"__type__": "45522uB1sdFu4FJAojtnha4",
@ -3640,7 +3640,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a1nkNrtC9EGYq3Yy+sm+jq"
"fileId": "726ZpFn4dJ/77G02VUSBgm"
},
{
"__type__": "cc.PrefabInfo",
@ -3650,7 +3650,7 @@
"asset": {
"__id__": 0
},
"fileId": "cbs6iwYZVNtqPnQgU8Cuio",
"fileId": "fd63IBg7xH4qNq3LOAUsCY",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3833,7 +3833,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fddQC6wwFLq65rD91x9wkV"
"fileId": "dajcBHFI5EY4mfnn2UXTsC"
},
{
"__type__": "cc.PrefabInfo",
@ -3843,7 +3843,7 @@
"asset": {
"__id__": 0
},
"fileId": "6bIUExco1EEYrKbf2FE7PX",
"fileId": "30LaHWAG9PNpFm7Z7d4lL6",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3874,7 +3874,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2bhfG3aXlBoYKXja+LX1Lu"
"fileId": "70H2zRUQNFoK1DU2t5qBNs"
},
{
"__type__": "cc.PrefabInfo",
@ -3884,7 +3884,7 @@
"asset": {
"__id__": 0
},
"fileId": "b6iUeGSyZNQIrCVICGLr0N",
"fileId": "e7mktnJCZMAKLBicFrZWUb",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -3915,7 +3915,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "115aYgrMpCObFLPGKadMIy"
"fileId": "479dS/AGJDU4fR5Z+dbrik"
},
{
"__type__": "45522uB1sdFu4FJAojtnha4",
@ -3939,7 +3939,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "aa3dHLRS1BnqvMMKIeOZHi"
"fileId": "76/kijLyVIrqpW5tBxkKbZ"
},
{
"__type__": "cc.PrefabInfo",
@ -3949,7 +3949,7 @@
"asset": {
"__id__": 0
},
"fileId": "0aCNKvi+RGw5av+rAacAMv",
"fileId": "ecOPFB7+hGRIyPF+/Nutjl",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4132,7 +4132,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b0c06hiK9KMahmQIcOvCvH"
"fileId": "72Utrsf2tB9KSKvG+pxRAk"
},
{
"__type__": "cc.PrefabInfo",
@ -4142,7 +4142,7 @@
"asset": {
"__id__": 0
},
"fileId": "603XGNOrlKWqQlcEYB8Y8s",
"fileId": "22wFBDJm9HZ53HPyQsZOcJ",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4173,7 +4173,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c95AxGEjFHX7vEy2h+2SfK"
"fileId": "d5lb8U7LBOgo4It5OfNZTq"
},
{
"__type__": "cc.PrefabInfo",
@ -4183,7 +4183,7 @@
"asset": {
"__id__": 0
},
"fileId": "0eCAkd/+1F1aYLYUsDqJmy",
"fileId": "81wTKbEnZNPYJARX77tLcM",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4214,7 +4214,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "38cas4p3BD5KSam2gYvkC5"
"fileId": "8baFNQ0tZEY5KVJj7arUMo"
},
{
"__type__": "45522uB1sdFu4FJAojtnha4",
@ -4238,7 +4238,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8fyNIbJ4pJYaCt6IWUBEN2"
"fileId": "6csI0r9CVJTbyxzGUBbCrJ"
},
{
"__type__": "cc.PrefabInfo",
@ -4248,7 +4248,7 @@
"asset": {
"__id__": 0
},
"fileId": "39jjsh6DNIabd80zeipjyI",
"fileId": "36hDWHDodAAausmMoZOkS1",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4431,7 +4431,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "89wSxaKBdCUJ/i702wGeQ7"
"fileId": "91ax0uBV5IlqnpeYxKRF2J"
},
{
"__type__": "cc.PrefabInfo",
@ -4441,7 +4441,7 @@
"asset": {
"__id__": 0
},
"fileId": "0b4PI7+9ZDZZNzqkRGr3en",
"fileId": "42eYvObzxNLKsZEYiC6Awd",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4472,7 +4472,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5ccW4dawlBHLSS/pH8LAGN"
"fileId": "25t2C1Gt1GOJsYDFYF1Fqg"
},
{
"__type__": "cc.PrefabInfo",
@ -4482,7 +4482,7 @@
"asset": {
"__id__": 0
},
"fileId": "c6cDh5S9xHJo0JN+kRo08F",
"fileId": "b3/l/OBQ9FhbQf+aQFW84y",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4513,7 +4513,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "4c7XxjcB9AuaSRVenQnyMp"
"fileId": "cdCO8bRQpPuL2vUis9qZ3b"
},
{
"__type__": "45522uB1sdFu4FJAojtnha4",
@ -4537,7 +4537,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "07nf1f7RxAz6sedy+K4mHW"
"fileId": "1dmSIJ3K5D4LxRD2GceGO0"
},
{
"__type__": "cc.PrefabInfo",
@ -4547,7 +4547,7 @@
"asset": {
"__id__": 0
},
"fileId": "66AOaLoiZLybDooEPKqVbZ",
"fileId": "05azKCuPhI46+3LeJXao/L",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -4572,7 +4572,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d7eD3+9cVGDYEgmy0PlqdU"
"fileId": "3bowkinSVFB5hlw/A52QNK"
},
{
"__type__": "cc.UITransform",
@ -4600,7 +4600,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "66ERiAPeNJz7eCKFl45P6q"
"fileId": "12Kv+4W2VD55ehjEfI2pZS"
},
{
"__type__": "cc.Sprite",
@ -4645,7 +4645,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "44NclXuHRE0LgYYr9mskjX"
"fileId": "c2sAKfoBBPTJYlC21LXaxk"
},
{
"__type__": "cc.PrefabInfo",
@ -4655,7 +4655,7 @@
"asset": {
"__id__": 0
},
"fileId": "c60ZJ4WeBNpKIuFSLQW4Qo",
"fileId": "26XGQ69WJFfZLtvDfBhfjT",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null

View File

@ -63,6 +63,7 @@ export class SlotBar extends Component {
private curBet: number = 0; // 当前下注区间
private curWin: number = 0; // 当前赢分
private betIndex: number = 0; // 下注区间下标
private thisRotateTime: number = 0; // 当前次滚动已经持续的时间
private tweenIsEnd: boolean = true; // 动画是否完成
isAuto: boolean = false;
@ -205,6 +206,14 @@ export class SlotBar extends Component {
}
protected update(dt: number): void {
if (this.hasClickSpin) {
this.thisRotateTime += dt
} else {
this.thisRotateTime = 0
}
}
onBtnSpin() {
// 第一次点击 旋转
@ -221,7 +230,11 @@ export class SlotBar extends Component {
this.setBtnEnable(this.menuBtn, false);
}
// 第二次点击 手动停止
else if (this.hasClickSpin && !this.hasClickManualStop) {
else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime < 0.5) {
this.scheduleOnce(() => {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}, 0.3)
} else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime >= 0.5) {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}
@ -240,7 +253,11 @@ export class SlotBar extends Component {
this.setBtnEnable(this.menuBtn, false);
}
// 第二次点击 手动停止
else if (this.hasClickSpin && !this.hasClickManualStop) {
else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime < 0.8) {
this.scheduleOnce(() => {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}, 0.5)
} else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime >= 0.8) {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}
@ -259,14 +276,24 @@ export class SlotBar extends Component {
this.setBtnEnable(this.menuBtn, false);
}
// 第二次点击 手动停止
else if (this.hasClickSpin && !this.hasClickManualStop) {
else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime < 0.8) {
this.scheduleOnce(() => {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}, 0.5)
} else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime >= 0.8) {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}
}
onBtnManualStop() {
if (this.hasClickSpin && !this.hasClickManualStop) {
if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime < 0.8) {
this.scheduleOnce(() => {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}, 0.5)
} else if (this.hasClickSpin && !this.hasClickManualStop && this.thisRotateTime >= 0.8) {
this.node.emit(SLOT_BAR_EVENT.ON_MANUAL_STOP);
}
}
@ -529,6 +556,7 @@ export class SlotBar extends Component {
resetAllState() {
this.hasClickSpin = false;
this.hasClickManualStop = false;
this.thisRotateTime = 0
this.manualStopNode.active = false
this.isAuto = false;
this.setBtnVisible(this.spinBtn, true);