更新机制

This commit is contained in:
COMPUTER\EDY 2026-04-08 19:24:05 +08:00
parent ed44ca5df1
commit 028de99d14
32 changed files with 3670 additions and 2132 deletions

View File

@ -34,6 +34,7 @@ export default class Avatar extends cc.Component {
avatarKuang: any; avatarKuang: any;
avatarData: any; avatarData: any;
film: any;
@ -47,7 +48,7 @@ export default class Avatar extends cc.Component {
if (data) { if (data) {
this.avatarData = cc.fx.GameTool.getAvatarData(data.headArr); this.avatarData = cc.fx.GameTool.getAvatarData(data.headArr);
} }
this.film = data.film;
// console.log("头像信息", this.avatarData); // console.log("头像信息", this.avatarData);
this.avatar = cc.fx.GameConfig.GM_INFO.useravatarIcon; this.avatar = cc.fx.GameConfig.GM_INFO.useravatarIcon;
this.avatarKuang = cc.fx.GameConfig.GM_INFO.useravaterkuang; this.avatarKuang = cc.fx.GameConfig.GM_INFO.useravaterkuang;
@ -158,7 +159,7 @@ export default class Avatar extends cc.Component {
const jiazaiComp = jiazaiNode.getComponent(JiaZai); const jiazaiComp = jiazaiNode.getComponent(JiaZai);
if (jiazaiComp) { if (jiazaiComp) {
// console.log("获取到JiaZai组件", jiazaiComp); // console.log("获取到JiaZai组件", jiazaiComp);
jiazaiComp.openGacha(null, null, this.avatarData); jiazaiComp.openGacha(null, null, this.avatarData, this.film);
jiazaiComp.closeAvatar(); jiazaiComp.closeAvatar();
} else { } else {

View File

@ -3536,7 +3536,7 @@ export default class JiaZai extends cc.Component {
} }
openGacha(event?: cc.Event, customEventData?: string, data?: any) { openGacha(event?: cc.Event, customEventData?: string, data?: any, film?: any) {
this.openLoad(); this.openLoad();
if (data == null || data == "" || data == undefined) { if (data == null || data == "" || data == undefined) {
Utils.getAvatar(res => { Utils.getAvatar(res => {
@ -3544,7 +3544,7 @@ export default class JiaZai extends cc.Component {
let headArr = [] let headArr = []
if (res.data.headArr != null && res.data.headArr != undefined && res.data.headArr.length > 0) if (res.data.headArr != null && res.data.headArr != undefined && res.data.headArr.length > 0)
headArr = cc.fx.GameTool.getAvatarData(res.data.headArr); headArr = cc.fx.GameTool.getAvatarData(res.data.headArr);
this.runGacha(customEventData, headArr) this.runGacha(customEventData, headArr, res.data.film)
} }
else { else {
this.closeLoad(); this.closeLoad();
@ -3555,12 +3555,12 @@ export default class JiaZai extends cc.Component {
else { else {
this.closeLoad(); this.closeLoad();
if (data) { if (data) {
this.runGacha("Avatar_Jump", data); this.runGacha("Avatar_Jump", data, film);
} }
} }
} }
runGacha(customEventData, data) { runGacha(customEventData, data, film) {
let eventName = ""; let eventName = "";
let btnName = "" let btnName = ""
if (customEventData !== undefined) { if (customEventData !== undefined) {
@ -3595,12 +3595,12 @@ export default class JiaZai extends cc.Component {
this.gachaNode = cc.instantiate(JiaZai.cachedGachaPrefab); this.gachaNode = cc.instantiate(JiaZai.cachedGachaPrefab);
if (this.node && this.gachaNode) if (this.node && this.gachaNode)
this.node.addChild(this.gachaNode); this.node.addChild(this.gachaNode);
this.gachaNode.getComponent("GachaManager").init(data); this.gachaNode.getComponent("GachaManager").init(data, film);
this.closeLoad(); this.closeLoad();
} else { } else {
// 非第一次使用,直接激活节点 // 非第一次使用,直接激活节点
this.gachaNode.active = true; this.gachaNode.active = true;
this.gachaNode.getComponent("GachaManager").init(data); this.gachaNode.getComponent("GachaManager").init(data, film);
this.closeLoad(); this.closeLoad();
} }
}); });
@ -3613,17 +3613,18 @@ export default class JiaZai extends cc.Component {
if (this.node && this.gachaNode) if (this.node && this.gachaNode)
this.node.addChild(this.gachaNode); this.node.addChild(this.gachaNode);
this.gachaNode.active = true; this.gachaNode.active = true;
this.gachaNode.getComponent("GachaManager").init(data); this.gachaNode.getComponent("GachaManager").init(data, film);
this.closeLoad(); this.closeLoad();
} else { } else {
// 非第一次使用,直接激活节点 // 非第一次使用,直接激活节点
this.gachaNode.active = true; this.gachaNode.active = true;
this.gachaNode.getComponent("GachaManager").init(data); this.gachaNode.getComponent("GachaManager").init(data, film);
this.closeLoad(); this.closeLoad();
} }
} }
closeGacha() { closeGacha() {
this.closeLoad();
this.gachaNode.active = false; this.gachaNode.active = false;
this.gachaNode = null; this.gachaNode = null;
JiaZai.cachedGachaPrefab = null; JiaZai.cachedGachaPrefab = null;

View File

@ -1419,6 +1419,16 @@ var GameTool = {
code: data.code, code: data.code,
} }
break; break;
case "avatar_gacha":
eventData = {
pool_id: data.pool_id,
pull_count: data.pull_count,
film_count: data.film_count,
film_left: data.film_left,
is_success: data.is_success,
result: data.result,
}
break;
} }
if (name == "stage_help") { if (name == "stage_help") {
console.log("准备上报完成", data); console.log("准备上报完成", data);

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "8fc88eb4-5bb4-41b0-ac35-b0850b07a343",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 646,
"height": 74,
"platformSettings": {},
"subMetas": {
"finishi": {
"ver": "1.0.6",
"uuid": "b9709165-b8d5-475d-8f70-e606191aa8a7",
"importer": "sprite-frame",
"rawTextureUuid": "8fc88eb4-5bb4-41b0-ac35-b0850b07a343",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 646,
"height": 74,
"rawWidth": 646,
"rawHeight": 74,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "b3e18643-dca6-4ccd-bacd-4b4c58e8e60e",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "f2e66dbc-ccaa-476b-a5df-de67b2ad65dc",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 200,
"height": 200,
"platformSettings": {},
"subMetas": {
"19": {
"ver": "1.0.6",
"uuid": "7c6f64a9-1f63-428b-baa5-560922e19d1d",
"importer": "sprite-frame",
"rawTextureUuid": "f2e66dbc-ccaa-476b-a5df-de67b2ad65dc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -19.5,
"offsetY": -5,
"trimX": 16,
"trimY": 10,
"width": 129,
"height": 190,
"rawWidth": 200,
"rawHeight": 200,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "3f3b1f41-158c-4b8a-8d7a-8ee970e1bd56",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"20": {
"ver": "1.0.6",
"uuid": "a86b04ae-1330-4a80-a2f4-378cbe56dec0",
"importer": "sprite-frame",
"rawTextureUuid": "3f3b1f41-158c-4b8a-8d7a-8ee970e1bd56",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -9.5,
"offsetY": -3,
"trimX": 9,
"trimY": 6,
"width": 143,
"height": 174,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "5c3998b5-364f-4c8a-b3f7-0e44f83065fa",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"21": {
"ver": "1.0.6",
"uuid": "d8b04ceb-34c2-4ca8-8c5b-b553fa5f45b3",
"importer": "sprite-frame",
"rawTextureUuid": "5c3998b5-364f-4c8a-b3f7-0e44f83065fa",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -6,
"offsetY": -7,
"trimX": 22,
"trimY": 14,
"width": 124,
"height": 166,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "90f169e1-0d27-4ed0-82d1-fba09ba6d9c1",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"22": {
"ver": "1.0.6",
"uuid": "6bd79c2f-86bf-4d12-91ba-4d20039c0c7e",
"importer": "sprite-frame",
"rawTextureUuid": "90f169e1-0d27-4ed0-82d1-fba09ba6d9c1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": -1,
"trimX": 19,
"trimY": 2,
"width": 144,
"height": 178,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "18090e5c-6781-4477-8f68-73027f947b88",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"23": {
"ver": "1.0.6",
"uuid": "88ce4864-f1b0-4683-84cc-37240a35a12d",
"importer": "sprite-frame",
"rawTextureUuid": "18090e5c-6781-4477-8f68-73027f947b88",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 11,
"trimY": 0,
"width": 158,
"height": 180,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "363aa2c1-5f12-47cf-ae26-e4ad7ab8df47",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"24": {
"ver": "1.0.6",
"uuid": "0b7d4679-f02d-4fe8-90c4-94cbff6452aa",
"importer": "sprite-frame",
"rawTextureUuid": "363aa2c1-5f12-47cf-ae26-e4ad7ab8df47",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": -16,
"trimX": 15,
"trimY": 32,
"width": 151,
"height": 148,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "8605dd1e-7508-4bab-b916-765519ce6d07",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"25": {
"ver": "1.0.6",
"uuid": "588f0fa7-5e42-4a0d-99cf-8febc00d8915",
"importer": "sprite-frame",
"rawTextureUuid": "8605dd1e-7508-4bab-b916-765519ce6d07",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -11.5,
"offsetY": -3.5,
"trimX": 0,
"trimY": 7,
"width": 157,
"height": 173,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "3b4a6e5f-3b2e-4c16-8da8-3bfd24231b66",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 180,
"height": 180,
"platformSettings": {},
"subMetas": {
"26": {
"ver": "1.0.6",
"uuid": "7a85fcf8-7bfb-4325-bd18-f42fe9a8270c",
"importer": "sprite-frame",
"rawTextureUuid": "3b4a6e5f-3b2e-4c16-8da8-3bfd24231b66",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 5,
"offsetY": -6.5,
"trimX": 10,
"trimY": 13,
"width": 170,
"height": 167,
"rawWidth": 180,
"rawHeight": 180,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "83acc1f2-bc17-4bc2-b183-a2bbac17470a",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 674,
"height": 1044,
"platformSettings": {},
"subMetas": {
"shili": {
"ver": "1.0.6",
"uuid": "71ae0117-c547-4d38-8e86-817ef12602b0",
"importer": "sprite-frame",
"rawTextureUuid": "83acc1f2-bc17-4bc2-b183-a2bbac17470a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 674,
"height": 1044,
"rawWidth": 674,
"rawHeight": 1044,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,38 @@
{
"ver": "2.3.7",
"uuid": "86053def-bac7-459d-b531-4a4d8420b8ad",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 618,
"height": 604,
"platformSettings": {},
"subMetas": {
"shili2": {
"ver": "1.0.6",
"uuid": "0a5c53bd-e5ea-4561-8355-6482db33c07e",
"importer": "sprite-frame",
"rawTextureUuid": "86053def-bac7-459d-b531-4a4d8420b8ad",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 618,
"height": 604,
"rawWidth": 618,
"rawHeight": 604,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -26,37 +26,46 @@ export default class CardFlipEffect extends cc.Component {
// 创建材质 // 创建材质
this.createMaterial(); this.createMaterial();
} }
this.resetFlip();
} }
start() { start() {
// this.node.opacity = 255; // this.init();
// // 初始化材质参数 }
// if (this.material) {
// this.updateMaterialProperties();
// }
// setTimeout(() => { init() {
// cc.tween(this.node.parent) this.resetFlip();
// .to(2, { y: 400 }, { easing: 'quadOut' }) this.node.opacity = 0;
// .start(); this.node.parent.y = 724.514;
// this.startFlip(); this.node.parent.zIndex = 3;
// }, 5000); // 初始化材质参数
if (this.material) {
// this.node.parent.getChildByName("dayinji3").opacity = 255; this.updateMaterialProperties();
// cc.tween(this.node.parent) }
// .to(0.5, { y: 3500 })
// .call(() => {
// this.node.parent.getChildByName("dayinji3").opacity = 0;
// })
// .to(2, { y: 1940 })
// .call(() => {
// this.node.y = 400;
// this.node.opacity = 255;
// this.node.active = true;
// })
// .start();
setTimeout(() => {
cc.tween(this.node.parent)
.to(0.1, { y: 3500 })
.call(() => {
this.node.opacity = 255;
})
.to(1.5, { y: 1940 })
.call(() => {
this.node.parent.zIndex = 50;
// this.node.parent.parent.getChildByName("dayinji3").opacity = 0;
})
.delay(0.2)
.call(() => {
// this.node.parent.parent.getChildByName("dayinji3").opacity = 0;
// this.node.parent.y = 500;
this.updateMaterialProperties();
cc.tween(this.node.parent)
.to(0.8, { y: 400 }, { easing: 'quadOut' })
.start();
this.startFlip();
})
.start();
}, 1000);
} }
/** /**
@ -139,6 +148,11 @@ export default class CardFlipEffect extends cc.Component {
this.isFlipping = false; this.isFlipping = false;
} }
}) })
.call(() => {
// this.node.parent.zIndex = 0;
// this.node.opacity = 0;
this.node.parent.parent.parent.getComponent("GachaManager").showReward();
})
.start(); .start();
} }

View File

@ -9,16 +9,25 @@ export default class GachaManager extends cc.Component {
@property(cc.Node) //用户头像换图 @property(cc.Node) //用户头像换图
avatar: cc.Node = null; avatar: cc.Node = null;
@property({ type: [cc.SpriteFrame], tooltip: "头像图片" })
icon: Array<cc.SpriteFrame> = [];
@property({ type: [cc.SpriteFrame], tooltip: "头像稀有度" })
kuang: Array<cc.SpriteFrame> = [];
avatarData: any = null; avatarData: any = null;
own = 0; own = 0;
reward = 0;
onLoad() { onLoad() {
this.avatarData = []; this.avatarData = [];
this.own = 0; this.own = 0;
this.reward = 0;
// this.init(); // this.init();
} }
//初始化数据 //初始化数据
init(data) { init(data, film) {
this.avatarData = []; this.avatarData = [];
this.own = 0; this.own = 0;
console.log("222222初始化数据", data); console.log("222222初始化数据", data);
@ -38,23 +47,24 @@ export default class GachaManager extends cc.Component {
botoom.getChildByName("yes").active = false; botoom.getChildByName("yes").active = false;
if (this.own >= 8) { if (this.own >= 8) {
botoom.getChildByName("total").active = false; botoom.getChildByName("total").active = false;
botoom.getChildByName("finishi").active = true; botoom.active = false;
this.node.getChildByName("finishi").active = true;
} }
else { else {
let cost = this.getCostFilm(); let cost = this.getCostFilm();
botoom.getChildByName("total").getComponent(cc.Label).string = cost.toString(); botoom.getChildByName("total").getComponent(cc.Label).string = cost.toString();
console.log("抽卡所需film", cost); console.log("抽卡所需film", cost);
if (cc.fx.GameConfig.GM_INFO.film >= cost) { if (film >= cost) {
botoom.getChildByName("yes").active = true; botoom.getChildByName("yes").active = true;
console.log("有足够film"); console.log("有足够film");
botoom.getChildByName("yes").getComponent(cc.Label).string = cc.fx.GameConfig.GM_INFO.film.toString(); botoom.getChildByName("yes").getComponent(cc.Label).string = film.toString();
} }
else { else {
console.log("没有足够film"); console.log("没有足够film");
botoom.getChildByName("no").active = true; botoom.getChildByName("no").active = true;
botoom.getChildByName("no").getComponent(cc.Label).string = cc.fx.GameConfig.GM_INFO.film.toString(); botoom.getChildByName("no").getComponent(cc.Label).string = film.toString();
} }
console.log("拥有film", cc.fx.GameConfig.GM_INFO.film); console.log("拥有film", film);
} }
} }
@ -94,19 +104,43 @@ export default class GachaManager extends cc.Component {
Utils.getGacha(res => { Utils.getGacha(res => {
console.log("抽卡结果", res); console.log("抽卡结果", res);
if (res.code == 1) { if (res.code == 1) {
console.log("抽卡成功"); console.log("抽卡成功");
cc.fx.GameConfig.GM_INFO.film = res.data.film; cc.fx.GameConfig.GM_INFO.film = res.data.film;
console.log("所剩余代币", cc.fx.GameConfig.GM_INFO.film); console.log("所剩余代币", cc.fx.GameConfig.GM_INFO.film);
let headArr = cc.fx.GameTool.getAvatarData(res.data.headArr); let headArr = cc.fx.GameTool.getAvatarData(res.data.headArr);
this.init(headArr); this.init(headArr, cc.fx.GameConfig.GM_INFO.film);
this.openReward(res.data.reward); this.openReward(res.data.reward);
cc.fx.GameTool.shushu_Track("avatar_gacha", {
pool_id: "spring",
pull_count: (this.own + 1),
film_count: (8 - this.own),
film_left: (8 - this.own - 1),
is_success: true,
result: "spring_" + res.data.reward.toString(),
});
} }
else if (res.code == 0) { else if (res.code == 0) {
MiniGameSdk.API.showToast(res.msg); MiniGameSdk.API.showToast(res.msg);
cc.fx.GameTool.shushu_Track("avatar_gacha", {
pool_id: "spring",
pull_count: (this.own + 1),
film_count: (8 - this.own),
film_left: (8 - this.own),
is_success: false,
result: "",
});
} }
else { else {
MiniGameSdk.API.showToast("网络异常,请稍后再试"); MiniGameSdk.API.showToast("网络异常,请稍后再试");
cc.fx.GameTool.shushu_Track("avatar_gacha", {
pool_id: "spring",
pull_count: (this.own + 1),
film_count: (8 - this.own),
film_left: (8 - this.own),
is_success: false,
result: "",
});
} }
this.closeLoad(); this.closeLoad();
}); });
@ -117,20 +151,54 @@ export default class GachaManager extends cc.Component {
} }
openReward(data) { openReward(data) {
this.reward = data;
this.node.getChildByName("geReward").active = true; this.node.getChildByName("geReward").active = true;
this.node.getChildByName("geReward").getChildByName("r").zIndex = 100;
this.node.getChildByName("geReward").getChildByName("sr").zIndex = 100;
this.node.getChildByName("geReward").getChildByName("ssr").zIndex = 100;
this.node.getChildByName("geReward").getChildByName("r").active = false; this.node.getChildByName("geReward").getChildByName("r").active = false;
this.node.getChildByName("geReward").getChildByName("sr").active = false; this.node.getChildByName("geReward").getChildByName("sr").active = false;
this.node.getChildByName("geReward").getChildByName("ssr").active = false; this.node.getChildByName("geReward").getChildByName("ssr").active = false;
let actionName = cc.fx.GameTool.getActionName(data.toString());
if (data < 24) { let kuang = 0;
if (data == 24 || data == 25)
kuang = 1;
else if (data == 26)
kuang = 2;
else
kuang = 0;
this.node.getChildByName("geReward").getChildByName("paper").getChildByName("bg").getComponent(cc.Sprite).spriteFrame = this.kuang[kuang];
this.node.getChildByName("geReward").getChildByName("paper").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.icon[this.reward - 19];
this.node.getChildByName("geReward").getChildByName("paper").opacity = 0;
this.node.getChildByName("geReward").getChildByName("dayin1").opacity = 0;
this.node.getChildByName("geReward").getChildByName("dayin2").opacity = 0;
this.node.getChildByName("geReward").getChildByName("dayin1").zIndex = 2;
this.node.getChildByName("geReward").getChildByName("dayin2").zIndex = 4;
this.node.getChildByName("geReward").getChildByName("paper").getChildByName("bg").getComponent("CardFlipEffect").init();
this.node.getChildByName("geReward").getChildByName("paper").getChildByName("icon").getComponent("CardFlipEffect").init();
cc.tween(this.node.getChildByName("geReward").getChildByName("paper"))
.to(0.2, { opacity: 255 })
.start();
cc.tween(this.node.getChildByName("geReward").getChildByName("dayin1"))
.to(0.2, { opacity: 255 })
.start();
cc.tween(this.node.getChildByName("geReward").getChildByName("dayin2"))
.to(0.2, { opacity: 255 })
.start();
}
showReward() {
let actionName = cc.fx.GameTool.getActionName(this.reward.toString());
if (this.reward < 24) {
this.node.getChildByName("geReward").getChildByName("r").active = true; this.node.getChildByName("geReward").getChildByName("r").active = true;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("geReward").getChildByName("r").getChildByName("sp"), actionName); cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("geReward").getChildByName("r").getChildByName("sp"), actionName);
} }
else if (data == 24 || data == 25) { else if (this.reward == 24 || this.reward == 25) {
this.node.getChildByName("geReward").getChildByName("sr").active = true; this.node.getChildByName("geReward").getChildByName("sr").active = true;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("geReward").getChildByName("sr").getChildByName("sp"), actionName); cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("geReward").getChildByName("sr").getChildByName("sp"), actionName);
} }
else if (data == 26) { else if (this.reward == 26) {
this.node.getChildByName("geReward").getChildByName("ssr").active = true; this.node.getChildByName("geReward").getChildByName("ssr").active = true;
cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("geReward").getChildByName("ssr").getChildByName("sp"), actionName); cc.fx.GameTool.loadSpineSimple(this.node.getChildByName("geReward").getChildByName("ssr").getChildByName("sp"), actionName);
} }