倍率瓶子的相关动画显示
This commit is contained in:
parent
940414a9ab
commit
bb84af7753
@ -2387,7 +2387,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 81.058,
|
||||
"x": 91.875,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@ -2545,7 +2545,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 81.058,
|
||||
"x": 87.819,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@ -5127,7 +5127,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -81.058,
|
||||
"x": -90.217,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@ -5285,7 +5285,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -81.058,
|
||||
"x": -90.217,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1066,7 +1066,7 @@
|
||||
"__prefab": {
|
||||
"__id__": 44
|
||||
},
|
||||
"spriteName": "29N",
|
||||
"spriteName": "29",
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
|
||||
9
assets/Game/prefabs/multi.meta
Normal file
9
assets/Game/prefabs/multi.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "e276268c-f1d7-484c-b751-e41887092b96",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
169
assets/Game/prefabs/multi/multi.prefab
Normal file
169
assets/Game/prefabs/multi/multi.prefab
Normal file
@ -0,0 +1,169 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "multi",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"persistent": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "multi",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 4
|
||||
},
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 374.679,
|
||||
"y": 80,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 90,
|
||||
"height": 135
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "0749j4YzhNJY5KwFvvBokn"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "0f50a895-d708-4b4f-9730-14bce4f22988@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 0,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "d0e3jQ8uhFz4UPbgDb0EwR"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UIOpacity",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "a6F1uXFJpIUqWqVFuLG6t1"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "48Zq1lpd1IW6Q3NeV8sWJR",
|
||||
"instance": null,
|
||||
"targetOverrides": null
|
||||
}
|
||||
]
|
||||
13
assets/Game/prefabs/multi/multi.prefab.meta
Normal file
13
assets/Game/prefabs/multi/multi.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "0f44e55e-42b6-4b42-b52a-12896e0562b5",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "multi"
|
||||
}
|
||||
}
|
||||
173
assets/Game/prefabs/multi/multiLabel.prefab
Normal file
173
assets/Game/prefabs/multi/multiLabel.prefab
Normal file
@ -0,0 +1,173 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "multiLabel",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"persistent": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "multiLabel",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 4
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -280,
|
||||
"y": 35,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 69.38,
|
||||
"height": 40
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "a6xKpK1QxLh6taFFOnFezc"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "x2",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 0,
|
||||
"_actualFontSize": 30,
|
||||
"_fontSize": 30,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": {
|
||||
"__uuid__": "de8836c9-9686-4097-9caa-cf0b6749fd1d",
|
||||
"__expectedType__": "cc.BitmapFont"
|
||||
},
|
||||
"_isSystemFontUsed": false,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_enableOutline": false,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
"_enableShadow": false,
|
||||
"_shadowColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_shadowOffset": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 2,
|
||||
"y": 2
|
||||
},
|
||||
"_shadowBlur": 2,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "47Ut397l5AHZ2GrfWD4dUR"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "7fx1PkJxFN1Y8sG6vnwciH",
|
||||
"instance": null,
|
||||
"targetOverrides": null
|
||||
}
|
||||
]
|
||||
13
assets/Game/prefabs/multi/multiLabel.prefab.meta
Normal file
13
assets/Game/prefabs/multi/multiLabel.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "d2fd678d-817b-4730-8c14-a832d34ec3db",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "multiLabel"
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import { _decorator, Animation, Button, Component, Label, Layout, Node, ParticleSystem, Prefab, RichText, Size, sp, Sprite, SpriteFrame, tween, UITransform, v3, Vec3 } from 'cc';
|
||||
import { _decorator, Animation, Button, Component, instantiate, Label, Layout, Node, ParticleSystem, Prefab, RichText, Size, sp, Sprite, SpriteFrame, tween, UIOpacity, UITransform, v3, Vec3 } from 'cc';
|
||||
import { RollerManager } from './game/RollerManager';
|
||||
import { GameInfo, ICON_RATE, ROLLER_COMBINE_EVENT, SLOT_GAME_EVENT, WIN_TYPE } from './game/Define';
|
||||
import { Icon, IconEventBus } from './game/Icon';
|
||||
@ -9,6 +9,16 @@ import { I18nManager } from '../../Loading/scripts/manager/I18nManager';
|
||||
import { AudioManager } from '../../Loading/scripts/manager/AudioManager';
|
||||
let { ccclass, property } = _decorator;
|
||||
|
||||
//倍率瓶子的所在位置
|
||||
const multiPositionArr: Vec3[] = [
|
||||
new Vec3(-280, 35, 0),
|
||||
new Vec3(-110, 35, 0),
|
||||
new Vec3(60, 35, 0),
|
||||
new Vec3(230, 35, 0),
|
||||
new Vec3(380, 80, 0),
|
||||
|
||||
]
|
||||
|
||||
@ccclass('SlotGame')
|
||||
export class SlotGame extends Component {
|
||||
|
||||
@ -19,6 +29,12 @@ export class SlotGame extends Component {
|
||||
@property(Prefab)
|
||||
iconMsgPre: Prefab = null;
|
||||
|
||||
@property(Prefab)
|
||||
multiPre: Prefab = null;
|
||||
|
||||
@property(Prefab)
|
||||
multiLabelPre: Prefab = null;
|
||||
|
||||
@property([SpriteFrame])
|
||||
multiFrame = new Array<SpriteFrame>;
|
||||
|
||||
@ -222,8 +238,8 @@ export class SlotGame extends Component {
|
||||
AudioManager.instance.playSFX('Spin_Button_Click');
|
||||
this.setWaysCount('...');
|
||||
if (!isFree) {
|
||||
this.setMultiLabel([2, 2, 2, 2], false);
|
||||
this.setMultiLabel([2, 2, 2, 2], true);
|
||||
this.setMultiLabel([2, 2, 2, 2], null, 0, 0, false);
|
||||
this.setMultiLabel([2, 2, 2, 2], null, 0, 0, true);
|
||||
}
|
||||
this.showWinScore(false, false, false, false, false);
|
||||
this.rollerManager.resetInfo();
|
||||
@ -243,31 +259,186 @@ export class SlotGame extends Component {
|
||||
this.rollerManager.stopScroll(this.spinData);
|
||||
}
|
||||
|
||||
setMultiLabel(multiArr: Array<number>, isfree: boolean) {
|
||||
setMultiLabel(multiArr, multiPos, winMulti: any, Score: number, isfree: boolean) {
|
||||
|
||||
let multNode = isfree ? this.freeMulti : this.multi
|
||||
let labelNode = isfree ? this.freeMulti.parent.getChildByName('label') : this.multi.parent.getChildByName('label')
|
||||
let posArr = []
|
||||
|
||||
multiArr.push(multiArr[3] + 2)
|
||||
for (let key in multiPos) {
|
||||
let idx = Number.parseInt(key)
|
||||
posArr.push(idx)
|
||||
}
|
||||
|
||||
for (let i = 0; i < multiArr.length; i++) {
|
||||
multNode.children[i].getChildByName('Label').getComponent(Label).string = 'x' + multiArr[i]
|
||||
switch (true) {
|
||||
case multiArr[i] <= 4:
|
||||
multNode.children[i].getComponent(Sprite).spriteFrame = this.multiFrame[0]
|
||||
break
|
||||
case multiArr[i] <= 8 && multiArr[i] > 4:
|
||||
multNode.children[i].getComponent(Sprite).spriteFrame = this.multiFrame[1]
|
||||
break
|
||||
case multiArr[i] <= 16 && multiArr[i] > 8:
|
||||
multNode.children[i].getComponent(Sprite).spriteFrame = this.multiFrame[2]
|
||||
break
|
||||
case multiArr[i] > 16:
|
||||
multNode.children[i].getComponent(Sprite).spriteFrame = this.multiFrame[3]
|
||||
break
|
||||
|
||||
//有倍率中奖
|
||||
if (multiPos) {
|
||||
if (multiArr[4]) {
|
||||
multiArr[4] = multiArr[3] + 2
|
||||
} else {
|
||||
multiArr.push(multiArr[3] + 2)
|
||||
}
|
||||
for (let i = 0; i < multiArr.length; i++) {
|
||||
labelNode.children[i].getComponent(Label).string = 'x' + multiArr[i]
|
||||
multNode.children[i].getComponent(Sprite).spriteFrame = multiArr[i] >= 4 ? this.multiFrame[1] : this.multiFrame[0]
|
||||
}
|
||||
|
||||
for (let key in multiPos) {
|
||||
|
||||
//总时长1.5秒
|
||||
let idx = Number.parseInt(key)
|
||||
multNode.children[idx].getComponent(Sprite).spriteFrame = multiPos[key] >= 4 ? this.multiFrame[3] : this.multiFrame[2]
|
||||
tween(multNode.children[idx])
|
||||
.to(0.5, { scale: new Vec3(1.3, 1.3, 1) })
|
||||
.start()
|
||||
|
||||
tween(multNode.children[idx].getComponent(UIOpacity))
|
||||
.delay(0.5)
|
||||
.to(0.5, { opacity: 0 })
|
||||
.start()
|
||||
|
||||
tween(labelNode.children[idx])
|
||||
.to(0.3, {
|
||||
scale: new Vec3(1.3, 1.3, 1),
|
||||
position: new Vec3(labelNode.children[idx].getPosition().x, 150, 0)
|
||||
})
|
||||
.to(0.7, {
|
||||
position: new Vec3((labelNode.children[posArr[0]].getPosition().x + labelNode.children[posArr[posArr.length - 1]].getPosition().x) / 2, 150, 0)
|
||||
})
|
||||
.call(() => {
|
||||
labelNode.children[idx].active = false
|
||||
if (idx == posArr[posArr.length - 1]) {
|
||||
//数字合并然后飞到信息栏
|
||||
let totalMulti = multNode.parent.getChildByName('totalMulti')
|
||||
totalMulti.active = true
|
||||
totalMulti.setPosition(new Vec3((labelNode.children[posArr[0]].getPosition().x + labelNode.children[posArr[posArr.length - 1]].getPosition().x) / 2 + 115, -65, 0))
|
||||
totalMulti.getComponent(Label).string = "x" + winMulti.toString()
|
||||
tween(totalMulti)
|
||||
.to(0.5, { position: new Vec3(0, isfree ? -395 : -500, 0) })
|
||||
.call(() => {
|
||||
totalMulti.active = false
|
||||
this.showWinScore(
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
Score
|
||||
);
|
||||
})
|
||||
.start()
|
||||
}
|
||||
})
|
||||
.start()
|
||||
}
|
||||
|
||||
} else {
|
||||
if (multiArr[4]) {
|
||||
multiArr[4] = multiArr[3] + 2
|
||||
} else {
|
||||
multiArr.push(multiArr[3] + 2)
|
||||
}
|
||||
for (let i = 0; i < multiArr.length; i++) {
|
||||
labelNode.children[i].getComponent(Label).string = 'x' + multiArr[i]
|
||||
multNode.children[i].getComponent(Sprite).spriteFrame = multiArr[i] >= 4 ? this.multiFrame[1] : this.multiFrame[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getNewMulti(isfree: boolean, multiPos: any) {
|
||||
let multiNode = isfree ? this.freeMulti : this.multi
|
||||
let labelNode = isfree ? this.freeMulti.parent.getChildByName('label') : this.multi.parent.getChildByName('label')
|
||||
let deleteNum = 0
|
||||
|
||||
|
||||
for (let key in multiPos) {
|
||||
let idx = Number.parseInt(key)
|
||||
multiNode.children[idx - deleteNum].removeFromParent()
|
||||
labelNode.children[idx - deleteNum].removeFromParent()
|
||||
deleteNum++
|
||||
}
|
||||
|
||||
//生成新的multi节点
|
||||
for (let key in multiPos) {
|
||||
let newMultiNode = instantiate(this.multiPre)
|
||||
let newMultiLabelNode = instantiate(this.multiLabelPre)
|
||||
newMultiLabelNode.getComponent(Label).string = 'x' + (Number.parseFloat(labelNode.children[labelNode.children.length - 1].getComponent(Label).string.slice(1)) + 2).toString()
|
||||
multiNode.addChild(newMultiNode)
|
||||
labelNode.addChild(newMultiLabelNode)
|
||||
newMultiNode.setPosition(900, 80, 0)
|
||||
newMultiLabelNode.setPosition(900, 80, 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* ratio: 曲线已完成的比例
|
||||
*
|
||||
* controlPos: 曲线拐弯点
|
||||
*
|
||||
* tempVec: 当前位置
|
||||
*/
|
||||
const quadraticCurve = (ratio: number, startPos: Vec3, controlPos: Vec3, endPos: Vec3, tempVec: Vec3) => {
|
||||
|
||||
tempVec.x = (1 - ratio) * (1 - ratio) * startPos.x + 2 * ratio * (1 - ratio) * controlPos.x + ratio * ratio * endPos.x;
|
||||
|
||||
tempVec.y = (1 - ratio) * (1 - ratio) * startPos.y + 2 * ratio * (1 - ratio) * controlPos.y + ratio * ratio * endPos.y;
|
||||
|
||||
tempVec.z = (1 - ratio) * (1 - ratio) * startPos.z + 2 * ratio * (1 - ratio) * controlPos.z + ratio * ratio * endPos.z;
|
||||
|
||||
}
|
||||
const tempVec3 = v3();
|
||||
|
||||
|
||||
let delay = 0
|
||||
multiNode.children.forEach((child, idx) => {
|
||||
if (child.getPosition().y == 35) {
|
||||
tween(child)
|
||||
.to(0.5, { position: multiPositionArr[idx] })
|
||||
.start()
|
||||
tween(labelNode.children[idx])
|
||||
.to(0.5, { position: multiPositionArr[idx] })
|
||||
.start()
|
||||
} else {
|
||||
if (idx != 4) {
|
||||
tween(child)
|
||||
.delay(delay)
|
||||
.to(0.2, { position: multiPositionArr[4] })
|
||||
.to(0.2, { position: multiPositionArr[3] }, {
|
||||
onUpdate: (target, ratio) => {
|
||||
quadraticCurve(ratio, multiPositionArr[4], v3(280, 140, 0), multiPositionArr[3], tempVec3);
|
||||
child.setPosition(tempVec3);
|
||||
|
||||
}
|
||||
})
|
||||
.to(0.3, { position: multiPositionArr[idx] })
|
||||
.start()
|
||||
|
||||
tween(labelNode.children[idx])
|
||||
.delay(delay)
|
||||
.to(0.2, { position: multiPositionArr[4] })
|
||||
.to(0.2, { position: multiPositionArr[3] }, {
|
||||
onUpdate: (target, ratio) => {
|
||||
quadraticCurve(ratio, multiPositionArr[4], v3(280, 140, 0), multiPositionArr[3], tempVec3);
|
||||
labelNode.children[idx].setPosition(tempVec3);
|
||||
|
||||
}
|
||||
})
|
||||
.to(0.3, { position: multiPositionArr[idx] })
|
||||
.start()
|
||||
} else {
|
||||
tween(child)
|
||||
.delay(delay)
|
||||
.to(0.2, { position: multiPositionArr[4] })
|
||||
.start()
|
||||
|
||||
tween(labelNode.children[idx])
|
||||
.delay(delay)
|
||||
.to(0.2, { position: multiPositionArr[4] })
|
||||
.start()
|
||||
}
|
||||
delay += 0.3
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
setWaysCount(ways: any) {
|
||||
@ -597,7 +768,7 @@ export class SlotGame extends Component {
|
||||
this.readyHand.setPosition(posX, 270, 0);
|
||||
this.grayNode.active = true;
|
||||
this.grayNode.children.forEach((child, index) => {
|
||||
if (index <= rollerId) {
|
||||
if (index < rollerId) {
|
||||
child.active = true;
|
||||
} else {
|
||||
child.active = false;
|
||||
|
||||
@ -215,7 +215,7 @@ export class SlotScene extends Component {
|
||||
AudioManager.instance.playBGM("Normal_Mode_BGM");
|
||||
}
|
||||
this.slotGame.setWaysCount(this.spinData.Symbol.WaysNum);
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, this.gameState.isInFreeSpin);
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, this.spinData.WinInfo ? this.spinData.WinInfo.MultPos : null, this.spinData.WinInfo ? this.spinData.WinInfo.Score : null, this.spinData.Symbol.WinMulti, this.gameState.isInFreeSpin);
|
||||
this.slotGame.setRollerIconRule(rollerIconRule);
|
||||
|
||||
let frb = GameDataManager.instance.frb;
|
||||
@ -235,6 +235,8 @@ export class SlotScene extends Component {
|
||||
// 当前盘面有分数,有消除,则播放消除动画
|
||||
if (this.spinData.AllScore != 0 && this.spinData.WinInfo != null) {
|
||||
this.slotGame.deleteIconNode();
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, this.spinData.WinInfo.MultPos, this.spinData.Symbol.WinMulti, this.spinData.WinInfo.Score, this.gameState.isInFreeSpin);
|
||||
|
||||
this.playElemWinAnimation();
|
||||
} else {
|
||||
this.gameState.isInFreeSpin
|
||||
@ -353,7 +355,7 @@ export class SlotScene extends Component {
|
||||
let errCode = parseInt(error.message.split("#")[0]);
|
||||
if (isNaN(errCode)) {
|
||||
this.showErrorTip(4);
|
||||
ErrorManager.instance.reportError("onSpinBtnClick: " + error.message);
|
||||
// ErrorManager.instance.reportError("onSpinBtnClick: " + error.message);
|
||||
} else {
|
||||
this.showErrorTip(errCode);
|
||||
}
|
||||
@ -503,7 +505,10 @@ export class SlotScene extends Component {
|
||||
// return;
|
||||
if (this.checkHasEliminate()) {
|
||||
this.slotGame.deleteIconNode();
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, this.spinData.WinInfo.MultPos, this.spinData.Symbol.WinMulti, this.spinData.WinInfo.Score, this.gameState.isInFreeSpin);
|
||||
|
||||
this.playElemWinAnimation(true);
|
||||
|
||||
} else {
|
||||
if (this.gameState.isInFreeSpin) {
|
||||
if (this.gameState.isFirstFreeSpin) {
|
||||
@ -573,6 +578,9 @@ export class SlotScene extends Component {
|
||||
|
||||
this.lastSpinInfo = this.spinInfo;
|
||||
this.isReceiveMsg = true;
|
||||
|
||||
this.slotGame.getNewMulti(this.gameState.isInFreeSpin, this.spinData.WinInfo.MultPos)
|
||||
|
||||
// 处理数据
|
||||
this.spinData = this.spinInfo.Data;
|
||||
// 改变图标框和图标
|
||||
@ -582,14 +590,13 @@ export class SlotScene extends Component {
|
||||
} else {
|
||||
this.slotGame.playNormalMultiAni(true);
|
||||
}
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, this.gameState.isInFreeSpin);
|
||||
// 创建新图标
|
||||
this.slotGame.createNewIconTop(this.spinData);
|
||||
} catch (error) {
|
||||
this.isErr = true
|
||||
let errCode = parseInt(error.message.split("#")[0]);
|
||||
if (isNaN(errCode)) {
|
||||
ErrorManager.instance.reportError("onIconsDeleted: " + error.message);
|
||||
// ErrorManager.instance.reportError("onIconsDeleted: " + error.message);
|
||||
this.showErrorTip(5, () => {
|
||||
this.deletedRetryCount++;
|
||||
if (this.deletedRetryCount < 5) {
|
||||
@ -607,13 +614,19 @@ export class SlotScene extends Component {
|
||||
}
|
||||
|
||||
onIconsCreated() {
|
||||
this.slotGame.iconFallDown();
|
||||
// let delay = (this.spinData.WinInfo && this.spinData.WinInfo.MultPos) ? 1 : 0
|
||||
this.scheduleOnce(() => {
|
||||
this.slotGame.iconFallDown();
|
||||
|
||||
}, 0.5)
|
||||
}
|
||||
|
||||
onIconsFallen() {
|
||||
this.checkHasGame();
|
||||
if (this.checkHasEliminate()) {
|
||||
this.slotGame.deleteIconNode();
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, this.spinData.WinInfo.MultPos, this.spinData.Symbol.WinMulti, this.spinData.WinInfo.Score, this.gameState.isInFreeSpin);
|
||||
|
||||
this.playElemWinAnimation();
|
||||
} else {
|
||||
if (this.gameState.isInFreeSpin) {
|
||||
@ -676,7 +689,7 @@ export class SlotScene extends Component {
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
this.spinData.Score
|
||||
this.spinData.WinInfo.Score / (this.spinData.Symbol.WinMulti != 0 ? this.spinData.Symbol.WinMulti : 1)
|
||||
);
|
||||
this.slotBar.setWin(this.spinData.AllScore);
|
||||
}
|
||||
@ -784,6 +797,7 @@ export class SlotScene extends Component {
|
||||
);
|
||||
this.slotBar.setWin(this.spinData.AllScore);
|
||||
this.slotGame.changeBg(false);
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, null, null, 0, false)
|
||||
this.checkAutoSpin(true, isReconnect);
|
||||
AudioManager.instance.playBGM("Normal_Mode_BGM");
|
||||
return
|
||||
@ -801,6 +815,7 @@ export class SlotScene extends Component {
|
||||
);
|
||||
this.slotBar.setWin(this.spinData.AllScore);
|
||||
this.slotGame.changeBg(false);
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, null, null, 0, false)
|
||||
this.checkAutoSpin(true, isReconnect);
|
||||
AudioManager.instance.playBGM("Normal_Mode_BGM");
|
||||
});
|
||||
@ -816,12 +831,14 @@ export class SlotScene extends Component {
|
||||
this.slotBar.setWin(this.spinData.AllScore);
|
||||
this.slotBar.setBalance(this.spinData.Balance);
|
||||
this.slotGame.changeBg(false);
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, null, null, 0, false)
|
||||
this.checkAutoSpin(true, isReconnect);
|
||||
AudioManager.instance.playBGM("Normal_Mode_BGM");
|
||||
}
|
||||
} else {
|
||||
this.checkAutoSpin(true, isReconnect);
|
||||
this.slotGame.changeBg(false);
|
||||
this.slotGame.setMultiLabel(this.spinData.Symbol.MultiValue, null, null, 0, false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -853,7 +870,13 @@ export class SlotScene extends Component {
|
||||
}
|
||||
|
||||
// 3,4,5
|
||||
let delay = 0.5
|
||||
// if (this.spinData.Symbol.WinMulti != 0) {
|
||||
// delay = 1.2
|
||||
// }
|
||||
|
||||
this.scheduleOnce(() => {
|
||||
|
||||
let score = isFreeSpin
|
||||
? this.spinData.RoundInfo.Score
|
||||
: this.spinData.AllScore;
|
||||
@ -869,7 +892,7 @@ export class SlotScene extends Component {
|
||||
this.slotBar.setWin(this.spinData.AllScore);
|
||||
callback?.();
|
||||
}
|
||||
}, 0.5);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
// 错误码提示
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { _decorator, Component, Mask, Node, Sprite, SpriteFrame, UITransform, UITransformComponent, v3, Vec3 } from 'cc';
|
||||
import { _decorator, Component, Mask, Node, Sprite, SpriteFrame, UITransform, v3, Vec3 } from 'cc';
|
||||
import { IconFactory } from './IconFactory';
|
||||
import { Roller } from './Roller';
|
||||
import { GameData, ICON_HEIGHT, ICON_WIDTH, ROLLER_COMBINE_EVENT, ROLLER_EVENT } from './Define';
|
||||
@ -111,10 +111,10 @@ export class RollerManager extends Component {
|
||||
maskNode.name = name;
|
||||
|
||||
let comp = maskNode.addComponent(Mask);
|
||||
let UITransform = maskNode.addComponent(UITransformComponent);
|
||||
let UIComponent = maskNode.addComponent(UITransform);
|
||||
comp.type = Mask.Type.GRAPHICS_RECT;
|
||||
|
||||
UITransform.setContentSize(1040, 840)
|
||||
UIComponent.setContentSize(1040, 840)
|
||||
// let spriteCom = maskNode.getComponent(Sprite);
|
||||
// spriteCom.spriteFrame = spriteFrame;
|
||||
// spriteCom.sizeMode = Sprite.SizeMode.CUSTOM;
|
||||
|
||||
@ -7,7 +7,7 @@ import { PREVIEW } from "cc/env"
|
||||
const gameId = "rp_11001";
|
||||
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
||||
let apiaddr = "";
|
||||
let token = "eyJQIjoxMDA5NDksIkUiOjE3NjUzNzQyMzIsIlMiOjk5OSwiRCI6InJwXzExMDAxIn0.cxCgEKYKk9sjtfENxTe-25taZsc3pM_hnRKV6c1rbeg";
|
||||
let token = "eyJQIjoxMDA5NDksIkUiOjE3NjU4MDYyMTEsIlMiOjk5NiwiRCI6InJwXzExMDAxIn0.FcHWgdje9C_7cHjckjt6jD2b9jizz3nfqwxUw0INUkI";
|
||||
|
||||
|
||||
let language = "en"
|
||||
@ -199,6 +199,37 @@ export async function getHistory(argsObj: any) {
|
||||
return obj
|
||||
}
|
||||
|
||||
|
||||
export async function getHistoryDetails(argsObj: any) {
|
||||
|
||||
// https://rpgames-api.rpfafafahkdev.com/gameapi/rp_11001/gameinfo
|
||||
// https://rpgames-api.rpfafafahkdev.com/gameapi/history
|
||||
|
||||
// const resp = await callGameApi("history", argsObj)
|
||||
|
||||
// callGameApi 会多拼一截gameId , history单独写
|
||||
const url = apiaddr + path.join("/gameapi/", "historyDetails")
|
||||
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 cash2gold(v: string): number {
|
||||
v = v.replace(/,/g, '');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user