Commit 436e3050 authored by wjf's avatar wjf

l

parent 8584e29e
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"success": true,
"data":"啊是大"
}
\ No newline at end of file
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"isMember": true,
"memberUrl": "https://www.tmall.com"
}
}
\ No newline at end of file
{
"success":true,
"code":"000000",
"message":"成功",
"data":true
}
\ No newline at end of file
{
"success":true,
"code":"000000",
"message":"成功",
"data":true
}
\ No newline at end of file
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"upgradeExp":9000,
"exp": 2000,
"level": 3,
"leftTime": 120,
"endCredits": 20
}
}
\ No newline at end of file
{
"success": true,
"code": "000000",
"message": "成功",
"data": true
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": true
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"startTime": 1590732971345,
"endTime": 1653012000000,
"rule": "活动规则",
"noticeInfo": {
"image": "https://yun.duiba.com.cn/db_games/activity/wengyang/share_1_1.png",
"link": "https://www.tmall.com"
}
}
}
\ No newline at end of file
{
"success":true,
"code":"000000",
"message":"成功",
"data":{
"credits":6666
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"signTotal": 4,
"curDay": 4,
"signPrize": {
"prize2": false,
"prize3": false,
"prize4": false
},
"signStatus": [
{
"day": 1,
"status": true,
"credits": 100
},
{
"day": 2,
"status": false,
"credits": 200
},
{
"day": 3,
"status": true,
"credits": 1
},
{
"day": 4,
"status": true,
"credits": 22
},
{
"day": 5,
"status": false,
"credits": 9999
},
{
"day": 6,
"status": false,
"credits": 600
},
{
"day": 7,
"status": false,
"credits": 700
}
]
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"squirrelType": 3,
"squirrelName": "阿三的",
"level": 3,
"credits": 120,
"exp": 0,
"upgradeExp": 1000,
"feedStatus": {
"leftTime": 0,
"leftCredits": 0,
"endCredits": 36,
"totalTime":120
},
"dress": [
{
"id": "dress1",
"status": 2
}
],
"tools": {
"speedCard": {
"count": 1
}
}
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"taskList": {
"attentionStoreTask": {
"value": 10,
"status": 2
},
"browseTask": {
"type": 1,
"value": 10,
"taskTotal": 3,
"taskCount": 0,
"status": 1
},
"collectTask": {
"type": 2,
"value": 10,
"taskTotal": 3,
"taskCount": 0,
"status": 2
},
"inviteTask": {
"type": 2,
"value": 10,
"taskTotal": 1,
"taskCount": 0,
"status": 3
},
"secretTask": {
"url": "https://www.tmall.com"
},
"messageTask": {
"url": "https://www.tmall.com"
},
"buyTask": {
"url": "https://www.tmall.com"
}
}
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"id": "abc123",
"image": "//yun.duiba.com.cn/images/202003/5d7lemv4ws.jpg",
"name": "奖品名112e1231称",
"type": 1
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"credits": 100
}
}
{
"success":true,
"code":"000000",
"message":"成功",
"data":{
"speedTime":50
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": true
}
{
"success":true,
"code":"000000",
"message":"成功",
"data":null
}
{
"success":true,
"code":"000000",
"message":"成功",
"data":true
}
{
"code": "000000",
"data": {
"image": "https://img.alicdn.com/imgextra/i2/676606897/O1CN01FAbkRm20osGd7qUlz_!!676606897-2-miniprogram.png",
"name": "看i的味道完成",
"id": "5ede07641cea440ff72c816b",
"type": 1
},
"success": true,
"message": "成功"
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"total": 100,
"list": [
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 2,
"message": "动态消息",
"createTime": "1592250649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1512550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1192550649378"
},
{
"value": 10,
"valueStatus": 2,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1292550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 2,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1512554297711"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592552297711"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592554297211"
},
{
"value": 10,
"valueStatus": 2,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592552297711"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592154297711"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592554287711"
},
{
"type": 1,
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592550649378"
},
{
"value": 10,
"valueStatus": 1,
"message": "动态消息",
"createTime": "1592554197711"
},
{
"value": 10,
"valueStatus": 2,
"message": "动态消息",
"createTime": "1592553297711"
}
]
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": {
"needRecordTime": true,
"dress": [
{
"id": "dress1",
"image": "//yun.duiba.com.cn/taobaomini/squirrelAdopt/dress1.png",
"name": "装扮1名称",
"desc": "装扮1描述说明",
"status": 1,
"value": 1111,
"itemId": null,
"type": 1
},
{
"id": "dress2",
"image": "//yun.duiba.com.cn/taobaomini/squirrelAdopt/dress1.png",
"name": "装扮2名称",
"desc": "装扮2描述说明",
"status": 1,
"value": 1000,
"itemId": 1111,
"type": 2
},
{
"id": "dress3",
"image": "//yun.duiba.com.cn/taobaomini/squirrelAdopt/dress1.png",
"name": "装扮3名称",
"desc": "装扮3描述说明",
"status": 1,
"value": 1000,
"itemId": null,
"type": 1
}
],
"tools": [
{
"id": "resignCard",
"name": "补签卡",
"value": 66666,
"count": 11,
"desc": "补签卡描述补签卡描述补签卡描述签卡描述补签卡描述补签卡描述",
"type": 1
},
{
"id": "speedCard",
"name": "加速卡",
"value": 88888,
"count": 111,
"desc": "补签卡描述",
"type": 2
}
]
}
}
{
"success": true,
"code": "000000",
"message": "成功",
"data": true
}
{
"code": "000000",
"data": {
"list": [
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "11",
"name": "兑换奖品1",
"status": 1,
"level": 4,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "23",
"name": "兑换奖",
"status": 2,
"level": 4,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "24563456345",
"name": "兑换奖品1",
"status": 2,
"level": 2,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "111",
"name": "兑品1",
"status": 1,
"level": 1,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "898678",
"name": "奖品1",
"status": 1,
"level": 1,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "645",
"name": "兑换1",
"status": 1,
"level": 1,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "3",
"name": "换奖品1",
"status": 1,
"level": 111,
"desc": "兑换描述"
},
{
"id": "5ea7d803e02b025431aeeb85",
"image": "//yun.dui88.com/images/201907/xsit2cvmyl.jpeg",
"type": 1,
"credits": "4567678",
"name": "兑换奖品1",
"status": 1,
"level": 1,
"desc": "兑换描述"
}
]
},
"success": true,
"message": "成功"
}
{
"success":true,
"code":"000000",
"message":"成功",
"data":true
}
{
"success":true,
"code":"000000",
"message":"成功",
"data":true
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
resource/common/关闭按钮.png

5.39 KB | W: | H:

resource/common/关闭按钮.png

10.2 KB | W: | H:

resource/common/关闭按钮.png
resource/common/关闭按钮.png
resource/common/关闭按钮.png
resource/common/关闭按钮.png
  • 2-up
  • Swipe
  • Onion skin
{ {
"groups": [ "groups": [
{ {
"keys": "comCloseBtn.png,jumpAdBtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,立即领取.png", "keys": "关闭按钮.png,增加体力背景.png,无字按钮底.png",
"name": "common" "name": "BuyPowerPanel"
},
{
"keys": "guide1.png,guide2.png,guide3.png,guide4.png,guideHand.png,guideKnowBtn.png,nextStep.png",
"name": "guide"
},
{
"keys": "proBg.png,头1.png,头2.png,头3.png,进度条.png",
"name": "loading"
},
{
"keys": "rule1.jpg,rule2.jpg,rule3.jpg,ruleReturnBtn.png",
"name": "rulePanel"
},
{
"keys": "butterfly0.svga,butterfly1.svga,genParticles.svga,xiaojian_a_c.svga,xiaojian_a_f.svga,xiaojian_k_c.svga,xiaojian_k_f.svga,xiaoku_a_c.svga,xiaoku_a_f.svga,xiaoku_k_c.svga,xiaoku_k_f.svga,xiaomei_a_c.svga,xiaomei_a_f.svga,xiaomei_k_c.svga,xiaomei_k_f.svga",
"name": "svgas"
},
{
"keys": "task_bg.png,task_item_bg.png,task_今日签到.png,task_任务完成松子币.png,task_关注店铺.png,task_分享好友.png,task_加入会员.png,task_去完成.png,task_去看看.png,task_完善资料.png,task_已完成.png,task_待领取.png,task_收藏商品.png,task_松鼠密令.png,task_浏览商品.png,task_购买商品.png",
"name": "taskPanel"
},
{
"keys": "jianf_body_1.png,jianf_body_2.png,jianf_body_3.png,jianf_face_3.png,jianf_head_1.png,jianf_head_2.png,jianf_head_3.png,jianf_heye_2.png,jianf_leftHando_1.png,jianf_leftHando_3.png,jianf_leftHand_1.png,jianf_leftHand_3.png,jianf_rightHando_1.png,jianf_rightHando_3.png,jianf_rightHand_1.png,jianf_rightHand_3.png,jian_body_1.png,jian_body_2.png,jian_body_3.png,jian_head_1.png,jian_head_2.png,jian_head_3.png,jian_leftEar_3.png,jian_leftHand0_3.png,jian_leftHando_1.png,jian_leftHand_1.png,jian_leftHand_3.png,jian_rightHand_1.png,jian_rightHand_3.png",
"name": "xiaojianDress"
},
{
"keys": "kuf_bodyo_1.png,kuf_bodyo_2.png,kuf_body_1.png,kuf_body_2.png,kuf_body_3.png,kuf_head_1.png,kuf_head_2.png,kuf_head_3.png,kuf_leftEar_2.png,kuf_rightEar_2.png,kuf_wing_1.png,kuf_wing_2.png,ku_body_1.png,ku_body_2.png,ku_body_3.png,ku_head_1.png,ku_head_2.png,ku_head_3.png,ku_leftHando_2.png,ku_rightHando_2.png,ku_wing_1.png,ku_wing_2.png",
"name": "xiaokuDress"
},
{
"keys": "meif_body_1.png,meif_body_2.png,meif_body_3.png,meif_head_1.png,meif_head_2.png,meif_head_3.png,meif_leftHando_1.png,meif_leftHando_2.png,meif_leftHand_2.png,meif_rightHando_1.png,meif_rightHando_2.png,meif_rightHand_2.png,meif_wing_3.png,mei_body_1.png,mei_body_2.png,mei_body_3.png,mei_face_2.png,mei_face_3.png,mei_head_1.png,mei_head_2.png,mei_head_3.png,mei_leftHand_1.png,mei_leftHand_2.png,mei_leftHand_3.png,mei_rightHand_1.png,mei_rightHand_2.png,mei_rightHand_3.png,mei_wing_3.png",
"name": "xiaomeiDress"
},
{
"keys": "兑换成功背景.png",
"name": "兑换成功弹窗"
},
{
"keys": "我要加入会员按钮.png,松鼠头.png",
"name": "加入会员弹窗"
}, },
{ {
"keys": "升级toast.png,升级弹窗背景.png,好的.png,小美.png,小贱.png,小酷.png", "keys": "comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "升级弹窗" "name": "common"
},
{
"keys": "productItemBg.png,商城背景.png,已兑完.png,我的奖品商城.png,无法兑换按钮.png,矩形1669.png,矩形3.png,立即兑换.png,赚松子币商城.png",
"name": "商城弹窗"
},
{
"keys": "跳过按钮.png",
"name": "广告位弹窗"
},
{
"keys": "小美领养状态.png,小贱领养状态.png,小酷领养状态.png,成功领养背景.png",
"name": "成功领养弹窗"
}, },
{ {
"keys": "part1.png,part2.png,part3.png,star.png,starP1.png,starP2.png,故事页跳过.png,星星眼睛1.png,星星眼睛3.png", "keys": "关闭按钮.png,积分不足背景.png,赚取积分.png",
"name": "故事页" "name": "CreditsOutPanel"
}, },
{ {
"keys": "取消.png,松子币不足背景.png,确认.png", "keys": "兑换成功背景.png,关闭按钮.png,知道啦.png",
"name": "松子币不足弹窗" "name": "ExchangeSucPanel"
}, },
{ {
"keys": "松鼠动态背景.png,矩形半圆角.png", "keys": "关闭按钮.png,失败Bg.png,失败重新闯关.png",
"name": "松鼠动态弹窗" "name": "FailedPanel"
}, },
{ {
"keys": "adoptBg.jpg,图层 1487.png,小美card.png,小贱card.png,小酷card.png,立即领养按钮.png,领养页文案.png", "keys": "关闭按钮.png,圆圈.png,开心收下.png",
"name": "松鼠领养页" "name": "FreePowerPanel"
}, },
{ {
"keys": "bubbleBg.png,coin1.png,coin2.png,coin3.png,coin4.png,coin5.png,coin6.png,coin7.png,coin8.png,coinLight.png,noGenLightBg.png,proIcon.png,xiaojianS.png,xiaokuS.png,xiaomeiS.png,任务.png,可收取松子币.png,商店.png,喂食.png,头像底图.png,小游戏.png,未生成松子币toast.png,松子币底图.png,松子币生成背景.png,松鼠动态.png,松鼠攻略.png,每日打卡.png,生成器未解锁.png,生成进度底图.png,秒针.png,背包.png,进食倒计时底图.png,首页背景.jpg", "keys": "体力不足Bg.png,体力不足按钮.png,关闭按钮.png",
"name": "活动首页" "name": "NoEnergyPanel"
}, },
{ {
"keys": "再想想.png,确认使用.png,确认使用道具背景.png", "keys": "关闭按钮.png,步数耗尽Bg.png,步数耗尽复活.png,步数耗尽结束按钮.png",
"name": "确认使用道具卡弹窗" "name": "NoStepBtn"
}, },
{ {
"keys": "圆角矩形2053.png,所需兑换等级:.png,确认兑换商品按钮.png", "keys": "关闭按钮.png,活动规则背景.png",
"name": "确认兑换弹窗" "name": "RulePanel"
}, },
{ {
"keys": "兑换失败toast.png,兑换成功toast.png,确认兑换.png,确认兑换道具弹窗.png", "keys": "关闭按钮.png,动物.png,开始闯关Bg.png,开始闯关不要能量.png,开始闯关要能量.png",
"name": "确认兑换道具弹窗" "name": "StartPanel"
}, },
{ {
"keys": "再想想按钮.png,确认为你的小松鼠换上新装扮吗?.png,确认装扮按钮.png", "keys": "prize.png,关卡弹窗Bg.png,关闭按钮.png,动物.png,开始闯关要能量.png",
"name": "确认装扮弹窗" "name": "StartPanelPrize"
}, },
{ {
"keys": "小美头像.png,小贱头像.png,小酷头像.png,确认领养.png,确认领养弹窗背景.png,重新选择.png", "keys": "star.png,关闭按钮.png,继续闯关大.png,继续闯关小.png,闯关成功Bg.png,闯关成功不满星按钮.png",
"name": "确认领养弹窗" "name": "SuccessNoPrizePanel"
}, },
{ {
"keys": "0.png,1.png,2.png,3.png,4.png,5.png,6.png,7.png,8.png,9.png,signItemBg.png,sign_progress_fill.png,周一.png,周三.png,周二.png,周五.png,周六.png,周四.png,周日.png,圆角矩形20533.png,子.png,宝箱点亮.png,宝箱置灰.png,已签到按钮.png,币.png,松.png,立即签到按钮.png,签到完成状态.png,签到背景.png,补签.png", "keys": "star.png,关闭按钮.png,圆角矩形 648.png,按钮-继续闯关.png,红包奖励.png,继续闯关大.png,继续闯关小.png,道具.png,闯关成功.png",
"name": "签到弹窗" "name": "SuccessPrizePanel"
}, },
{ {
"keys": "propItemBg.png,兑换失败toast.png,兑换成功toast.png,兑换成功特殊字体toast.png,加速卡.png,去下单得装扮按钮.png,取消装扮.png,已解锁.png,当前不需要补签哦,留着下次用吧~.png,正在加速生成松子币~.png,正在加速生成松子币中,请稍后再用.png,矩形 2.png,立即使用道具按钮.png,立即兑换装扮按钮.png,立即兑换道具按钮.png,立即装扮按钮.png,背包弹框背景.png,补签卡.png,补签成功toast.png,装扮未选中.png,装扮选中.png,赚松子币.png,道具未选中.png,道具选中.png,锁.png,需要升级才能装扮toast.png", "keys": "任务背景.png,关闭按钮.png,去完成.png,去完成灰.png",
"name": "背包弹窗" "name": "TaskPanel"
}, },
{ {
"keys": "快去装扮吧.png,解锁装扮背景.png", "keys": "关闭按钮.png,再想想.png,确定.png,道具不足背景.png",
"name": "解锁装扮弹窗" "name": "ToolsOutPanel"
}, },
{ {
"keys": "signCredits.png,连续签到背景.png", "keys": "使用道具背景.png,关闭按钮.png,再想想.png,确定.png",
"name": "连续签到奖励弹窗" "name": "UseToolPanel"
} }
], ],
"path": "./resource/" "path": "./resource/"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,7 +16,7 @@ let arg = process.argv.splice(2); ...@@ -16,7 +16,7 @@ let arg = process.argv.splice(2);
//类名 //类名
var className = arg[0]; var className = arg[0];
//皮肤名字 //皮肤名字
var skinName = arg[1]; var skinName = arg[0]; //arg[1];
//是否弹框,存在参数就是场景 //是否弹框,存在参数就是场景
var moduleType = className.indexOf("Scene") > -1 ? "Scene" : "Panel"; var moduleType = className.indexOf("Scene") > -1 ? "Scene" : "Panel";
// console.log('类名:',className) // console.log('类名:',className)
......
...@@ -3,7 +3,7 @@ var PSD = require('psd'); ...@@ -3,7 +3,7 @@ var PSD = require('psd');
var path = require('path'); var path = require('path');
// const mkdirp = require('mkdirp'); // const mkdirp = require('mkdirp');
//千万别再执行,否则覆盖 //千万别再执行,否则覆盖
return // return
var options = { var options = {
//导出图片的目录,没有就导在psd所在目录 //导出图片的目录,没有就导在psd所在目录
outImgDir: "./resource/", outImgDir: "./resource/",
......
...@@ -8,10 +8,6 @@ import { changeScene, showWaiting, destroyAllCtrls } from "../module/ctrls"; ...@@ -8,10 +8,6 @@ import { changeScene, showWaiting, destroyAllCtrls } from "../module/ctrls";
import { ResJson } from "./ResJson"; import { ResJson } from "./ResJson";
import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet"; import { destroyNetData, sendTbNet, TbNetName } from "./TaoBaoNet";
import { SkinJson } from "./SkinJson"; import { SkinJson } from "./SkinJson";
import { LoadingScene } from "./scenes/LoadingScene";
import { MainScene } from "./scenes/MainScene";
import { StoryScene } from "./scenes/StoryScene";
import { AdoptScene } from "./scenes/AdoptScene";
import { G_EVENT } from "./common/G_EVENT"; import { G_EVENT } from "./common/G_EVENT";
FYGE.Rectangle.createFromRects = function (...arg: FYGE.Rectangle[]): FYGE.Rectangle { FYGE.Rectangle.createFromRects = function (...arg: FYGE.Rectangle[]): FYGE.Rectangle {
...@@ -117,7 +113,7 @@ export class Main { ...@@ -117,7 +113,7 @@ export class Main {
//隐藏加载中 //隐藏加载中
// if (document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none"; // if (document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
//打开开始场景 //打开开始场景
changeScene(LoadingScene); // changeScene(LoadingScene);
// changeScene(MainScene); // changeScene(MainScene);
// changeScene(SStartScene); // changeScene(SStartScene);
// changeScene(StoryScene); // changeScene(StoryScene);
......
export const ResJson = { export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "comCloseBtn.png,jumpAdBtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,立即领取.png", "keys": "关闭按钮.png,增加体力背景.png,无字按钮底.png",
"name": "common", "name": "BuyPowerPanel"
"atlas": {
"comCloseBtn.png": {
"x": 108,
"y": 461,
"w": 48,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 48,
"ro": false
},
"jumpAdBtn.png": {
"x": 464,
"y": 2,
"w": 111,
"h": 31,
"ox": 0,
"oy": 0,
"sw": 111,
"sh": 31,
"ro": true
},
"toastBg.png": {
"x": 2,
"y": 2,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": false
},
"waitingBg.png": {
"x": 108,
"y": 134,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": false
},
"waitingRot.png": {
"x": 108,
"y": 403,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"关闭按钮.png": {
"x": 108,
"y": 316,
"w": 85,
"h": 75,
"ox": 0,
"oy": 0,
"sw": 85,
"sh": 75,
"ro": true
},
"立即领取.png": {
"x": 2,
"y": 134,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": true
}
}
}, },
{ {
"keys": "guide1.png,guide2.png,guide3.png,guide4.png,guideHand.png,guideKnowBtn.png,nextStep.png", "keys": "comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "guide", "name": "common"
"atlas": {
"guide1.png": {
"x": 2,
"y": 408,
"w": 205,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 205,
"sh": 66,
"ro": false
},
"guide2.png": {
"x": 125,
"y": 2,
"w": 273,
"h": 29,
"ox": 0,
"oy": 0,
"sw": 273,
"sh": 29,
"ro": true
},
"guide3.png": {
"x": 2,
"y": 2,
"w": 404,
"h": 65,
"ox": 0,
"oy": 0,
"sw": 404,
"sh": 65,
"ro": true
},
"guide4.png": {
"x": 209,
"y": 2,
"w": 450,
"h": 29,
"ox": 0,
"oy": 0,
"sw": 450,
"sh": 29,
"ro": true
},
"guideHand.png": {
"x": 69,
"y": 298,
"w": 84,
"h": 95,
"ox": 0,
"oy": 0,
"sw": 84,
"sh": 95,
"ro": false
},
"guideKnowBtn.png": {
"x": 69,
"y": 2,
"w": 156,
"h": 54,
"ox": 0,
"oy": 0,
"sw": 156,
"sh": 54,
"ro": true
},
"nextStep.png": {
"x": 69,
"y": 160,
"w": 136,
"h": 54,
"ox": 0,
"oy": 0,
"sw": 136,
"sh": 54,
"ro": true
}
}
}, },
{ {
"keys": "proBg.png,头1.png,头2.png,头3.png,进度条.png", "keys": "关闭按钮.png,积分不足背景.png,赚取积分.png",
"name": "loading", "name": "CreditsOutPanel"
"atlas": {
"proBg.png": {
"x": 2,
"y": 414,
"w": 541,
"h": 107,
"ox": 0,
"oy": 0,
"sw": 541,
"sh": 107,
"ro": true
},
"头1.png": {
"x": 2,
"y": 2,
"w": 146,
"h": 137,
"ox": 0,
"oy": 0,
"sw": 146,
"sh": 137,
"ro": false
},
"头2.png": {
"x": 2,
"y": 141,
"w": 146,
"h": 135,
"ox": 0,
"oy": 0,
"sw": 146,
"sh": 135,
"ro": false
},
"头3.png": {
"x": 2,
"y": 278,
"w": 146,
"h": 134,
"ox": 0,
"oy": 0,
"sw": 146,
"sh": 134,
"ro": false
},
"进度条.png": {
"x": 150,
"y": 2,
"w": 530,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 530,
"sh": 37,
"ro": true
}
}
}, },
{ {
"keys": "rule1.jpg,rule2.jpg,rule3.jpg,ruleReturnBtn.png", "keys": "兑换成功背景.png,关闭按钮.png,知道啦.png",
"name": "rulePanel", "name": "ExchangeSucPanel"
"atlas": {
"ruleReturnBtn.png": {
"x": 2,
"y": 2,
"w": 106,
"h": 53,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 53,
"ro": true
}
}
}, },
{ {
"keys": "butterfly0.svga,butterfly1.svga,genParticles.svga,xiaojian_a_c.svga,xiaojian_a_f.svga,xiaojian_k_c.svga,xiaojian_k_f.svga,xiaoku_a_c.svga,xiaoku_a_f.svga,xiaoku_k_c.svga,xiaoku_k_f.svga,xiaomei_a_c.svga,xiaomei_a_f.svga,xiaomei_k_c.svga,xiaomei_k_f.svga", "keys": "关闭按钮.png,失败Bg.png,失败重新闯关.png",
"name": "svgas" "name": "FailedPanel"
}, },
{ {
"keys": "task_bg.png,task_item_bg.png,task_今日签到.png,task_任务完成松子币.png,task_关注店铺.png,task_分享好友.png,task_加入会员.png,task_去完成.png,task_去看看.png,task_完善资料.png,task_已完成.png,task_待领取.png,task_收藏商品.png,task_松鼠密令.png,task_浏览商品.png,task_购买商品.png", "keys": "关闭按钮.png,圆圈.png,开心收下.png",
"name": "taskPanel", "name": "FreePowerPanel"
"atlas": {
"task_bg.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 906,
"ox": 0,
"oy": 718,
"sw": 750,
"sh": 1624,
"ro": false
},
"task_item_bg.png": {
"x": 804,
"y": 172,
"w": 700,
"h": 154,
"ox": 0,
"oy": 0,
"sw": 700,
"sh": 154,
"ro": true
},
"task_今日签到.png": {
"x": 704,
"y": 910,
"w": 98,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 102,
"ro": false
},
"task_任务完成松子币.png": {
"x": 804,
"y": 2,
"w": 168,
"h": 171,
"ox": 0,
"oy": 0,
"sw": 168,
"sh": 171,
"ro": true
},
"task_关注店铺.png": {
"x": 604,
"y": 910,
"w": 98,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 102,
"ro": false
},
"task_分享好友.png": {
"x": 504,
"y": 910,
"w": 98,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 102,
"ro": false
},
"task_加入会员.png": {
"x": 404,
"y": 910,
"w": 98,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 102,
"ro": false
},
"task_去完成.png": {
"x": 754,
"y": 398,
"w": 130,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 48,
"ro": true
},
"task_去看看.png": {
"x": 754,
"y": 266,
"w": 130,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 48,
"ro": true
},
"task_完善资料.png": {
"x": 804,
"y": 874,
"w": 96,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 102,
"ro": false
},
"task_已完成.png": {
"x": 754,
"y": 134,
"w": 130,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 48,
"ro": true
},
"task_待领取.png": {
"x": 754,
"y": 2,
"w": 130,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 48,
"ro": true
},
"task_收藏商品.png": {
"x": 304,
"y": 910,
"w": 98,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 102,
"ro": false
},
"task_松鼠密令.png": {
"x": 104,
"y": 910,
"w": 98,
"h": 103,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 103,
"ro": false
},
"task_浏览商品.png": {
"x": 204,
"y": 910,
"w": 98,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 102,
"ro": false
},
"task_购买商品.png": {
"x": 2,
"y": 910,
"w": 100,
"h": 105,
"ox": 0,
"oy": 0,
"sw": 100,
"sh": 105,
"ro": false
}
}
}, },
{ {
"keys": "jianf_body_1.png,jianf_body_2.png,jianf_body_3.png,jianf_face_3.png,jianf_head_1.png,jianf_head_2.png,jianf_head_3.png,jianf_heye_2.png,jianf_leftHando_1.png,jianf_leftHando_3.png,jianf_leftHand_1.png,jianf_leftHand_3.png,jianf_rightHando_1.png,jianf_rightHando_3.png,jianf_rightHand_1.png,jianf_rightHand_3.png,jian_body_1.png,jian_body_2.png,jian_body_3.png,jian_head_1.png,jian_head_2.png,jian_head_3.png,jian_leftEar_3.png,jian_leftHand0_3.png,jian_leftHando_1.png,jian_leftHand_1.png,jian_leftHand_3.png,jian_rightHand_1.png,jian_rightHand_3.png", "keys": "体力不足Bg.png,体力不足按钮.png,关闭按钮.png",
"name": "xiaojianDress", "name": "NoEnergyPanel"
"atlas": {
"jian_body_1.png": {
"x": 343,
"y": 666,
"w": 175,
"h": 181,
"ox": 0,
"oy": 0,
"sw": 175,
"sh": 181,
"ro": true
},
"jian_body_2.png": {
"x": 686,
"y": 518,
"w": 222,
"h": 181,
"ox": 0,
"oy": 0,
"sw": 222,
"sh": 181,
"ro": false
},
"jian_body_3.png": {
"x": 159,
"y": 701,
"w": 219,
"h": 182,
"ox": 0,
"oy": 0,
"sw": 219,
"sh": 182,
"ro": true
},
"jian_head_1.png": {
"x": 353,
"y": 206,
"w": 228,
"h": 258,
"ox": 0,
"oy": 0,
"sw": 228,
"sh": 258,
"ro": true
},
"jian_head_2.png": {
"x": 2,
"y": 219,
"w": 250,
"h": 252,
"ox": 0,
"oy": 0,
"sw": 250,
"sh": 252,
"ro": true
},
"jian_head_3.png": {
"x": 353,
"y": 2,
"w": 342,
"h": 202,
"ox": 0,
"oy": 0,
"sw": 342,
"sh": 202,
"ro": false
},
"jian_leftEar_3.png": {
"x": 613,
"y": 254,
"w": 60,
"h": 77,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 77,
"ro": true
},
"jian_leftHand0_3.png": {
"x": 983,
"y": 64,
"w": 36,
"h": 57,
"ox": 0,
"oy": 0,
"sw": 36,
"sh": 57,
"ro": false
},
"jian_leftHand_1.png": {
"x": 613,
"y": 383,
"w": 65,
"h": 74,
"ox": 0,
"oy": 0,
"sw": 65,
"sh": 74,
"ro": true
},
"jian_leftHand_3.png": {
"x": 951,
"y": 277,
"w": 64,
"h": 69,
"ox": 0,
"oy": 0,
"sw": 64,
"sh": 69,
"ro": true
},
"jian_leftHando_1.png": {
"x": 951,
"y": 459,
"w": 59,
"h": 64,
"ox": 0,
"oy": 0,
"sw": 59,
"sh": 64,
"ro": true
},
"jian_rightHand_1.png": {
"x": 613,
"y": 316,
"w": 75,
"h": 65,
"ox": 0,
"oy": 0,
"sw": 75,
"sh": 65,
"ro": false
},
"jian_rightHand_3.png": {
"x": 256,
"y": 392,
"w": 73,
"h": 63,
"ox": 0,
"oy": 0,
"sw": 73,
"sh": 63,
"ro": false
},
"jianf_body_1.png": {
"x": 566,
"y": 450,
"w": 118,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 118,
"sh": 222,
"ro": false
},
"jianf_body_2.png": {
"x": 2,
"y": 701,
"w": 155,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 155,
"sh": 222,
"ro": false
},
"jianf_body_3.png": {
"x": 2,
"y": 471,
"w": 146,
"h": 224,
"ox": 0,
"oy": 0,
"sw": 146,
"sh": 224,
"ro": true
},
"jianf_face_3.png": {
"x": 331,
"y": 436,
"w": 233,
"h": 228,
"ox": 0,
"oy": 0,
"sw": 233,
"sh": 228,
"ro": false
},
"jianf_head_1.png": {
"x": 692,
"y": 277,
"w": 239,
"h": 257,
"ox": 0,
"oy": 0,
"sw": 239,
"sh": 257,
"ro": true
},
"jianf_head_2.png": {
"x": 697,
"y": 2,
"w": 284,
"h": 273,
"ox": 0,
"oy": 0,
"sw": 284,
"sh": 273,
"ro": false
},
"jianf_head_3.png": {
"x": 2,
"y": 2,
"w": 349,
"h": 215,
"ox": 0,
"oy": 0,
"sw": 349,
"sh": 215,
"ro": false
},
"jianf_heye_2.png": {
"x": 256,
"y": 219,
"w": 121,
"h": 95,
"ox": 0,
"oy": 0,
"sw": 121,
"sh": 95,
"ro": true
},
"jianf_leftHand_1.png": {
"x": 951,
"y": 402,
"w": 68,
"h": 55,
"ox": 0,
"oy": 0,
"sw": 68,
"sh": 55,
"ro": false
},
"jianf_leftHand_3.png": {
"x": 951,
"y": 343,
"w": 69,
"h": 57,
"ox": 0,
"oy": 0,
"sw": 69,
"sh": 57,
"ro": false
},
"jianf_leftHando_1.png": {
"x": 256,
"y": 457,
"w": 46,
"h": 63,
"ox": 0,
"oy": 0,
"sw": 46,
"sh": 63,
"ro": true
},
"jianf_leftHando_3.png": {
"x": 983,
"y": 2,
"w": 38,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 38,
"sh": 60,
"ro": false
},
"jianf_rightHand_1.png": {
"x": 256,
"y": 342,
"w": 48,
"h": 83,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 83,
"ro": true
},
"jianf_rightHand_3.png": {
"x": 613,
"y": 206,
"w": 46,
"h": 81,
"ox": 0,
"oy": 0,
"sw": 46,
"sh": 81,
"ro": true
},
"jianf_rightHando_1.png": {
"x": 228,
"y": 505,
"w": 52,
"h": 47,
"ox": 0,
"oy": 0,
"sw": 52,
"sh": 47,
"ro": false
},
"jianf_rightHando_3.png": {
"x": 282,
"y": 505,
"w": 47,
"h": 50,
"ox": 0,
"oy": 0,
"sw": 47,
"sh": 50,
"ro": false
}
}
}, },
{ {
"keys": "kuf_bodyo_1.png,kuf_bodyo_2.png,kuf_body_1.png,kuf_body_2.png,kuf_body_3.png,kuf_head_1.png,kuf_head_2.png,kuf_head_3.png,kuf_leftEar_2.png,kuf_rightEar_2.png,kuf_wing_1.png,kuf_wing_2.png,ku_body_1.png,ku_body_2.png,ku_body_3.png,ku_head_1.png,ku_head_2.png,ku_head_3.png,ku_leftHando_2.png,ku_rightHando_2.png,ku_wing_1.png,ku_wing_2.png", "keys": "关闭按钮.png,步数耗尽Bg.png,步数耗尽复活.png,步数耗尽结束按钮.png",
"name": "xiaokuDress", "name": "NoStepBtn"
"atlas": {
"ku_body_1.png": {
"x": 165,
"y": 461,
"w": 241,
"h": 157,
"ox": 0,
"oy": 0,
"sw": 241,
"sh": 157,
"ro": true
},
"ku_body_2.png": {
"x": 435,
"y": 735,
"w": 136,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 136,
"sh": 222,
"ro": false
},
"ku_body_3.png": {
"x": 573,
"y": 615,
"w": 145,
"h": 214,
"ox": 0,
"oy": 0,
"sw": 145,
"sh": 214,
"ro": false
},
"ku_head_1.png": {
"x": 740,
"y": 272,
"w": 241,
"h": 255,
"ox": 0,
"oy": 0,
"sw": 241,
"sh": 255,
"ro": true
},
"ku_head_2.png": {
"x": 412,
"y": 2,
"w": 356,
"h": 217,
"ox": 0,
"oy": 0,
"sw": 356,
"sh": 217,
"ro": false
},
"ku_head_3.png": {
"x": 2,
"y": 735,
"w": 244,
"h": 231,
"ox": 0,
"oy": 0,
"sw": 244,
"sh": 231,
"ro": true
},
"ku_leftHando_2.png": {
"x": 740,
"y": 252,
"w": 17,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 17,
"sh": 24,
"ro": true
},
"ku_rightHando_2.png": {
"x": 740,
"y": 221,
"w": 29,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 29,
"sh": 24,
"ro": true
},
"ku_wing_1.png": {
"x": 412,
"y": 221,
"w": 326,
"h": 221,
"ox": 0,
"oy": 0,
"sw": 326,
"sh": 221,
"ro": false
},
"ku_wing_2.png": {
"x": 324,
"y": 444,
"w": 302,
"h": 169,
"ox": 0,
"oy": 0,
"sw": 302,
"sh": 169,
"ro": false
},
"kuf_body_1.png": {
"x": 2,
"y": 615,
"w": 115,
"h": 161,
"ox": 0,
"oy": 0,
"sw": 115,
"sh": 161,
"ro": true
},
"kuf_body_2.png": {
"x": 628,
"y": 444,
"w": 106,
"h": 100,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 100,
"ro": false
},
"kuf_body_3.png": {
"x": 573,
"y": 831,
"w": 189,
"h": 219,
"ox": 0,
"oy": 0,
"sw": 189,
"sh": 219,
"ro": true
},
"kuf_bodyo_1.png": {
"x": 324,
"y": 615,
"w": 112,
"h": 112,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 112,
"ro": false
},
"kuf_bodyo_2.png": {
"x": 2,
"y": 461,
"w": 133,
"h": 126,
"ox": 0,
"oy": 0,
"sw": 133,
"sh": 126,
"ro": true
},
"kuf_head_1.png": {
"x": 736,
"y": 515,
"w": 248,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 248,
"sh": 218,
"ro": false
},
"kuf_head_2.png": {
"x": 2,
"y": 2,
"w": 408,
"h": 236,
"ox": 0,
"oy": 0,
"sw": 408,
"sh": 236,
"ro": false
},
"kuf_head_3.png": {
"x": 770,
"y": 2,
"w": 268,
"h": 248,
"ox": 0,
"oy": 0,
"sw": 268,
"sh": 248,
"ro": true
},
"kuf_leftEar_2.png": {
"x": 324,
"y": 240,
"w": 81,
"h": 99,
"ox": 0,
"oy": 0,
"sw": 81,
"sh": 99,
"ro": false
},
"kuf_rightEar_2.png": {
"x": 324,
"y": 341,
"w": 76,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 76,
"sh": 90,
"ro": false
},
"kuf_wing_1.png": {
"x": 2,
"y": 240,
"w": 320,
"h": 219,
"ox": 0,
"oy": 0,
"sw": 320,
"sh": 219,
"ro": false
},
"kuf_wing_2.png": {
"x": 235,
"y": 735,
"w": 236,
"h": 198,
"ox": 0,
"oy": 0,
"sw": 236,
"sh": 198,
"ro": true
}
}
}, },
{ {
"keys": "meif_body_1.png,meif_body_2.png,meif_body_3.png,meif_head_1.png,meif_head_2.png,meif_head_3.png,meif_leftHando_1.png,meif_leftHando_2.png,meif_leftHand_2.png,meif_rightHando_1.png,meif_rightHando_2.png,meif_rightHand_2.png,meif_wing_3.png,mei_body_1.png,mei_body_2.png,mei_body_3.png,mei_face_2.png,mei_face_3.png,mei_head_1.png,mei_head_2.png,mei_head_3.png,mei_leftHand_1.png,mei_leftHand_2.png,mei_leftHand_3.png,mei_rightHand_1.png,mei_rightHand_2.png,mei_rightHand_3.png,mei_wing_3.png", "keys": "关闭按钮.png,活动规则背景.png",
"name": "xiaomeiDress", "name": "RulePanel"
"atlas": {
"mei_body_1.png": {
"x": 444,
"y": 2,
"w": 413,
"h": 204,
"ox": 0,
"oy": 0,
"sw": 413,
"sh": 204,
"ro": false
},
"mei_body_2.png": {
"x": 859,
"y": 2,
"w": 143,
"h": 190,
"ox": 0,
"oy": 0,
"sw": 143,
"sh": 190,
"ro": false
},
"mei_body_3.png": {
"x": 904,
"y": 672,
"w": 106,
"h": 203,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 203,
"ro": false
},
"mei_face_2.png": {
"x": 717,
"y": 472,
"w": 217,
"h": 198,
"ox": 0,
"oy": 0,
"sw": 217,
"sh": 198,
"ro": false
},
"mei_face_3.png": {
"x": 493,
"y": 442,
"w": 229,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 229,
"sh": 222,
"ro": true
},
"mei_head_1.png": {
"x": 754,
"y": 896,
"w": 141,
"h": 86,
"ox": 0,
"oy": 0,
"sw": 141,
"sh": 86,
"ro": false
},
"mei_head_2.png": {
"x": 723,
"y": 208,
"w": 235,
"h": 262,
"ox": 0,
"oy": 0,
"sw": 235,
"sh": 262,
"ro": false
},
"mei_head_3.png": {
"x": 493,
"y": 673,
"w": 259,
"h": 248,
"ox": 0,
"oy": 0,
"sw": 259,
"sh": 248,
"ro": false
},
"mei_leftHand_1.png": {
"x": 936,
"y": 551,
"w": 40,
"h": 63,
"ox": 0,
"oy": 0,
"sw": 40,
"sh": 63,
"ro": false
},
"mei_leftHand_2.png": {
"x": 960,
"y": 194,
"w": 47,
"h": 85,
"ox": 0,
"oy": 0,
"sw": 47,
"sh": 85,
"ro": false
},
"mei_leftHand_3.png": {
"x": 409,
"y": 890,
"w": 51,
"h": 71,
"ox": 0,
"oy": 0,
"sw": 51,
"sh": 71,
"ro": false
},
"mei_rightHand_1.png": {
"x": 936,
"y": 616,
"w": 40,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 40,
"sh": 62,
"ro": true
},
"mei_rightHand_2.png": {
"x": 222,
"y": 891,
"w": 43,
"h": 88,
"ox": 0,
"oy": 0,
"sw": 43,
"sh": 88,
"ro": false
},
"mei_rightHand_3.png": {
"x": 960,
"y": 281,
"w": 49,
"h": 68,
"ox": 0,
"oy": 0,
"sw": 49,
"sh": 68,
"ro": false
},
"mei_wing_3.png": {
"x": 2,
"y": 324,
"w": 405,
"h": 277,
"ox": 0,
"oy": 0,
"sw": 405,
"sh": 277,
"ro": false
},
"meif_body_1.png": {
"x": 444,
"y": 208,
"w": 277,
"h": 232,
"ox": 0,
"oy": 0,
"sw": 277,
"sh": 232,
"ro": false
},
"meif_body_2.png": {
"x": 754,
"y": 672,
"w": 148,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 148,
"sh": 222,
"ro": false
},
"meif_body_3.png": {
"x": 2,
"y": 891,
"w": 119,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 119,
"sh": 218,
"ro": true
},
"meif_head_1.png": {
"x": 904,
"y": 877,
"w": 112,
"h": 89,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 89,
"ro": false
},
"meif_head_2.png": {
"x": 252,
"y": 603,
"w": 239,
"h": 285,
"ox": 0,
"oy": 0,
"sw": 239,
"sh": 285,
"ro": false
},
"meif_head_3.png": {
"x": 2,
"y": 603,
"w": 248,
"h": 286,
"ox": 0,
"oy": 0,
"sw": 248,
"sh": 286,
"ro": false
},
"meif_leftHand_2.png": {
"x": 936,
"y": 481,
"w": 39,
"h": 68,
"ox": 0,
"oy": 0,
"sw": 39,
"sh": 68,
"ro": false
},
"meif_leftHando_1.png": {
"x": 960,
"y": 351,
"w": 53,
"h": 65,
"ox": 0,
"oy": 0,
"sw": 53,
"sh": 65,
"ro": false
},
"meif_leftHando_2.png": {
"x": 977,
"y": 481,
"w": 43,
"h": 61,
"ox": 0,
"oy": 0,
"sw": 43,
"sh": 61,
"ro": false
},
"meif_rightHand_2.png": {
"x": 267,
"y": 890,
"w": 81,
"h": 64,
"ox": 0,
"oy": 0,
"sw": 81,
"sh": 64,
"ro": false
},
"meif_rightHando_1.png": {
"x": 350,
"y": 890,
"w": 57,
"h": 71,
"ox": 0,
"oy": 0,
"sw": 57,
"sh": 71,
"ro": false
},
"meif_rightHando_2.png": {
"x": 960,
"y": 418,
"w": 49,
"h": 61,
"ox": 0,
"oy": 0,
"sw": 49,
"sh": 61,
"ro": false
},
"meif_wing_3.png": {
"x": 2,
"y": 2,
"w": 440,
"h": 320,
"ox": 0,
"oy": 0,
"sw": 440,
"sh": 320,
"ro": false
}
}
}, },
{ {
"keys": "兑换成功背景.png", "keys": "关闭按钮.png,动物.png,开始闯关Bg.png,开始闯关不要能量.png,开始闯关要能量.png",
"name": "兑换成功弹窗", "name": "StartPanel"
"atlas": {
"兑换成功背景.png": {
"x": 2,
"y": 2,
"w": 719,
"h": 766,
"ox": 0,
"oy": 0,
"sw": 719,
"sh": 766,
"ro": false
}
}
}, },
{ {
"keys": "我要加入会员按钮.png,松鼠头.png", "keys": "prize.png,关卡弹窗Bg.png,关闭按钮.png,动物.png,开始闯关要能量.png",
"name": "加入会员弹窗", "name": "StartPanelPrize"
"atlas": {
"我要加入会员按钮.png": {
"x": 597,
"y": 2,
"w": 378,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 378,
"sh": 104,
"ro": false
},
"松鼠头.png": {
"x": 2,
"y": 2,
"w": 593,
"h": 713,
"ox": 0,
"oy": 0,
"sw": 593,
"sh": 713,
"ro": false
}
}
}, },
{ {
"keys": "升级toast.png,升级弹窗背景.png,好的.png,小美.png,小贱.png,小酷.png", "keys": "star.png,关闭按钮.png,继续闯关大.png,继续闯关小.png,闯关成功Bg.png,闯关成功不满星按钮.png",
"name": "升级弹窗", "name": "SuccessNoPrizePanel"
"atlas": {
"升级toast.png": {
"x": 770,
"y": 2,
"w": 231,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 231,
"sh": 48,
"ro": false
},
"升级弹窗背景.png": {
"x": 2,
"y": 2,
"w": 719,
"h": 766,
"ox": 0,
"oy": 0,
"sw": 719,
"sh": 766,
"ro": true
},
"好的.png": {
"x": 770,
"y": 52,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": true
},
"小美.png": {
"x": 2,
"y": 1005,
"w": 401,
"h": 288,
"ox": 0,
"oy": 0,
"sw": 401,
"sh": 288,
"ro": false
},
"小贱.png": {
"x": 471,
"y": 723,
"w": 419,
"h": 281,
"ox": 0,
"oy": 0,
"sw": 419,
"sh": 281,
"ro": false
},
"小酷.png": {
"x": 2,
"y": 723,
"w": 467,
"h": 280,
"ox": 0,
"oy": 0,
"sw": 467,
"sh": 280,
"ro": false
}
}
}, },
{ {
"keys": "productItemBg.png,商城背景.png,已兑完.png,我的奖品商城.png,无法兑换按钮.png,矩形1669.png,矩形3.png,立即兑换.png,赚松子币商城.png", "keys": "star.png,关闭按钮.png,圆角矩形 648.png,按钮-继续闯关.png,红包奖励.png,继续闯关大.png,继续闯关小.png,道具.png,闯关成功.png",
"name": "商城弹窗", "name": "SuccessPrizePanel"
"atlas": {
"productItemBg.png": {
"x": 2,
"y": 1171,
"w": 309,
"h": 348,
"ox": 0,
"oy": 0,
"sw": 309,
"sh": 348,
"ro": false
},
"商城背景.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1167,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1167,
"ro": false
},
"已兑完.png": {
"x": 754,
"y": 274,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": false
},
"我的奖品商城.png": {
"x": 754,
"y": 195,
"w": 150,
"h": 38,
"ox": 0,
"oy": 0,
"sw": 150,
"sh": 38,
"ro": false
},
"无法兑换按钮.png": {
"x": 948,
"y": 155,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": true
},
"矩形1669.png": {
"x": 907,
"y": 155,
"w": 117,
"h": 39,
"ox": 1,
"oy": 1,
"sw": 119,
"sh": 41,
"ro": true
},
"矩形3.png": {
"x": 754,
"y": 2,
"w": 247,
"h": 151,
"ox": 0,
"oy": 0,
"sw": 247,
"sh": 151,
"ro": false
},
"立即兑换.png": {
"x": 754,
"y": 235,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": false
},
"赚松子币商城.png": {
"x": 754,
"y": 155,
"w": 151,
"h": 38,
"ox": 0,
"oy": 0,
"sw": 151,
"sh": 38,
"ro": false
}
}
}, },
{ {
"keys": "跳过按钮.png", "keys": "任务背景.png,关闭按钮.png,去完成.png,去完成灰.png",
"name": "广告位弹窗", "name": "TaskPanel"
"atlas": {
"跳过按钮.png": {
"x": 2,
"y": 2,
"w": 111,
"h": 31,
"ox": 0,
"oy": 0,
"sw": 111,
"sh": 31,
"ro": true
}
}
}, },
{ {
"keys": "小美领养状态.png,小贱领养状态.png,小酷领养状态.png,成功领养背景.png", "keys": "关闭按钮.png,再想想.png,确定.png,道具不足背景.png",
"name": "成功领养弹窗", "name": "ToolsOutPanel"
"atlas": {
"小美领养状态.png": {
"x": 728,
"y": 538,
"w": 250,
"h": 296,
"ox": 0,
"oy": 0,
"sw": 250,
"sh": 296,
"ro": false
},
"小贱领养状态.png": {
"x": 728,
"y": 2,
"w": 247,
"h": 294,
"ox": 0,
"oy": 0,
"sw": 247,
"sh": 294,
"ro": true
},
"小酷领养状态.png": {
"x": 728,
"y": 251,
"w": 286,
"h": 285,
"ox": 0,
"oy": 0,
"sw": 286,
"sh": 285,
"ro": false
},
"成功领养背景.png": {
"x": 2,
"y": 2,
"w": 724,
"h": 626,
"ox": 0,
"oy": 0,
"sw": 724,
"sh": 626,
"ro": false
}
}
}, },
{ {
"keys": "part1.png,part2.png,part3.png,star.png,starP1.png,starP2.png,故事页跳过.png,星星眼睛1.png,星星眼睛3.png", "keys": "使用道具背景.png,关闭按钮.png,再想想.png,确定.png",
"name": "故事页", "name": "UseToolPanel"
"atlas": {
"part1.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 983,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 983,
"ro": true
},
"part2.png": {
"x": 2,
"y": 1278,
"w": 750,
"h": 339,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 339,
"ro": true
},
"part3.png": {
"x": 2,
"y": 754,
"w": 750,
"h": 522,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 522,
"ro": false
},
"star.png": {
"x": 987,
"y": 2,
"w": 34,
"h": 36,
"ox": 18,
"oy": 18,
"sw": 72,
"sh": 72,
"ro": false
},
"starP1.png": {
"x": 828,
"y": 804,
"w": 68,
"h": 72,
"ox": 4,
"oy": 0,
"sw": 72,
"sh": 72,
"ro": true
},
"starP2.png": {
"x": 754,
"y": 804,
"w": 72,
"h": 72,
"ox": 0,
"oy": 0,
"sw": 72,
"sh": 72,
"ro": false
},
"故事页跳过.png": {
"x": 754,
"y": 754,
"w": 200,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 200,
"sh": 48,
"ro": false
},
"星星眼睛1.png": {
"x": 1007,
"y": 40,
"w": 14,
"h": 15,
"ox": 0,
"oy": 0,
"sw": 14,
"sh": 15,
"ro": true
},
"星星眼睛3.png": {
"x": 987,
"y": 40,
"w": 18,
"h": 16,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 16,
"ro": false
}
}
},
{
"keys": "取消.png,松子币不足背景.png,确认.png",
"name": "松子币不足弹窗",
"atlas": {
"取消.png": {
"x": 2,
"y": 687,
"w": 222,
"h": 115,
"ox": 0,
"oy": 0,
"sw": 222,
"sh": 115,
"ro": true
},
"松子币不足背景.png": {
"x": 2,
"y": 2,
"w": 683,
"h": 446,
"ox": 0,
"oy": 0,
"sw": 683,
"sh": 446,
"ro": true
},
"确认.png": {
"x": 119,
"y": 687,
"w": 221,
"h": 115,
"ox": 0,
"oy": 0,
"sw": 221,
"sh": 115,
"ro": true
}
}
},
{
"keys": "松鼠动态背景.png,矩形半圆角.png",
"name": "松鼠动态弹窗",
"atlas": {
"松鼠动态背景.png": {
"x": 2,
"y": 2,
"w": 752,
"h": 924,
"ox": 0,
"oy": 0,
"sw": 752,
"sh": 924,
"ro": false
},
"矩形半圆角.png": {
"x": 756,
"y": 2,
"w": 701,
"h": 114,
"ox": 1,
"oy": 1,
"sw": 703,
"sh": 116,
"ro": true
}
}
},
{
"keys": "adoptBg.jpg,图层 1487.png,小美card.png,小贱card.png,小酷card.png,立即领养按钮.png,领养页文案.png",
"name": "松鼠领养页",
"atlas": {
"图层 1487.png": {
"x": 2,
"y": 629,
"w": 531,
"h": 592,
"ox": 0,
"oy": 0,
"sw": 531,
"sh": 592,
"ro": false
},
"小美card.png": {
"x": 1259,
"y": 2,
"w": 531,
"h": 592,
"ox": 0,
"oy": 0,
"sw": 531,
"sh": 592,
"ro": true
},
"小贱card.png": {
"x": 2,
"y": 96,
"w": 531,
"h": 592,
"ox": 0,
"oy": 0,
"sw": 531,
"sh": 592,
"ro": true
},
"小酷card.png": {
"x": 665,
"y": 2,
"w": 531,
"h": 592,
"ox": 0,
"oy": 0,
"sw": 531,
"sh": 592,
"ro": true
},
"立即领养按钮.png": {
"x": 1853,
"y": 2,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": true
},
"领养页文案.png": {
"x": 2,
"y": 2,
"w": 661,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 661,
"sh": 92,
"ro": false
}
}
},
{
"keys": "bubbleBg.png,coin1.png,coin2.png,coin3.png,coin4.png,coin5.png,coin6.png,coin7.png,coin8.png,coinLight.png,noGenLightBg.png,proIcon.png,xiaojianS.png,xiaokuS.png,xiaomeiS.png,任务.png,可收取松子币.png,商店.png,喂食.png,头像底图.png,小游戏.png,未生成松子币toast.png,松子币底图.png,松子币生成背景.png,松鼠动态.png,松鼠攻略.png,每日打卡.png,生成器未解锁.png,生成进度底图.png,秒针.png,背包.png,进食倒计时底图.png,首页背景.jpg",
"name": "活动首页",
"atlas": {
"bubbleBg.png": {
"x": 422,
"y": 916,
"w": 366,
"h": 103,
"ox": 0,
"oy": 0,
"sw": 366,
"sh": 103,
"ro": false
},
"coin1.png": {
"x": 340,
"y": 932,
"w": 80,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 80,
"sh": 80,
"ro": false
},
"coin2.png": {
"x": 594,
"y": 804,
"w": 78,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 78,
"sh": 80,
"ro": false
},
"coin3.png": {
"x": 674,
"y": 804,
"w": 70,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 70,
"sh": 80,
"ro": false
},
"coin4.png": {
"x": 796,
"y": 804,
"w": 48,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 80,
"ro": false
},
"coin5.png": {
"x": 319,
"y": 932,
"w": 19,
"h": 81,
"ox": 0,
"oy": 0,
"sw": 19,
"sh": 81,
"ro": false
},
"coin6.png": {
"x": 746,
"y": 804,
"w": 48,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 80,
"ro": false
},
"coin7.png": {
"x": 237,
"y": 946,
"w": 70,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 70,
"sh": 80,
"ro": true
},
"coin8.png": {
"x": 514,
"y": 804,
"w": 78,
"h": 80,
"ox": 0,
"oy": 0,
"sw": 78,
"sh": 80,
"ro": false
},
"coinLight.png": {
"x": 2,
"y": 2,
"w": 740,
"h": 750,
"ox": 0,
"oy": 0,
"sw": 740,
"sh": 750,
"ro": false
},
"noGenLightBg.png": {
"x": 130,
"y": 946,
"w": 73,
"h": 105,
"ox": 0,
"oy": 0,
"sw": 73,
"sh": 105,
"ro": true
},
"proIcon.png": {
"x": 993,
"y": 163,
"w": 18,
"h": 18,
"ox": 0,
"oy": 0,
"sw": 18,
"sh": 18,
"ro": false
},
"xiaojianS.png": {
"x": 846,
"y": 804,
"w": 63,
"h": 61,
"ox": 0,
"oy": 0,
"sw": 63,
"sh": 61,
"ro": true
},
"xiaokuS.png": {
"x": 66,
"y": 963,
"w": 62,
"h": 58,
"ox": 0,
"oy": 0,
"sw": 62,
"sh": 58,
"ro": false
},
"xiaomeiS.png": {
"x": 2,
"y": 963,
"w": 62,
"h": 58,
"ox": 0,
"oy": 0,
"sw": 62,
"sh": 58,
"ro": false
},
"任务.png": {
"x": 744,
"y": 598,
"w": 114,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 114,
"sh": 120,
"ro": false
},
"可收取松子币.png": {
"x": 993,
"y": 94,
"w": 67,
"h": 19,
"ox": 0,
"oy": 0,
"sw": 67,
"sh": 19,
"ro": true
},
"商店.png": {
"x": 744,
"y": 189,
"w": 114,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 114,
"sh": 120,
"ro": true
},
"喂食.png": {
"x": 71,
"y": 754,
"w": 190,
"h": 170,
"ox": 0,
"oy": 0,
"sw": 190,
"sh": 170,
"ro": true
},
"头像底图.png": {
"x": 744,
"y": 305,
"w": 291,
"h": 77,
"ox": 0,
"oy": 0,
"sw": 291,
"sh": 77,
"ro": true
},
"小游戏.png": {
"x": 870,
"y": 186,
"w": 117,
"h": 124,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 124,
"ro": true
},
"未生成松子币toast.png": {
"x": 514,
"y": 754,
"w": 477,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 477,
"sh": 48,
"ro": false
},
"松子币底图.png": {
"x": 2,
"y": 754,
"w": 207,
"h": 67,
"ox": 0,
"oy": 0,
"sw": 207,
"sh": 67,
"ro": true
},
"松子币生成背景.png": {
"x": 243,
"y": 754,
"w": 145,
"h": 176,
"ox": 0,
"oy": 0,
"sw": 145,
"sh": 176,
"ro": false
},
"松鼠动态.png": {
"x": 744,
"y": 70,
"w": 117,
"h": 124,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 124,
"ro": true
},
"松鼠攻略.png": {
"x": 429,
"y": 754,
"w": 156,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 156,
"sh": 48,
"ro": true
},
"每日打卡.png": {
"x": 790,
"y": 886,
"w": 117,
"h": 124,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 124,
"ro": false
},
"生成器未解锁.png": {
"x": 479,
"y": 754,
"w": 156,
"h": 33,
"ox": 0,
"oy": 0,
"sw": 156,
"sh": 33,
"ro": true
},
"生成进度底图.png": {
"x": 390,
"y": 754,
"w": 160,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 37,
"ro": true
},
"秒针.png": {
"x": 993,
"y": 70,
"w": 22,
"h": 22,
"ox": 0,
"oy": 0,
"sw": 22,
"sh": 22,
"ro": false
},
"背包.png": {
"x": 870,
"y": 70,
"w": 114,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 114,
"sh": 120,
"ro": true
},
"进食倒计时底图.png": {
"x": 744,
"y": 2,
"w": 269,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 269,
"sh": 66,
"ro": false
}
}
},
{
"keys": "再想想.png,确认使用.png,确认使用道具背景.png",
"name": "确认使用道具卡弹窗",
"atlas": {
"再想想.png": {
"x": 109,
"y": 700,
"w": 225,
"h": 105,
"ox": 0,
"oy": 0,
"sw": 225,
"sh": 105,
"ro": true
},
"确认使用.png": {
"x": 2,
"y": 700,
"w": 227,
"h": 105,
"ox": 0,
"oy": 0,
"sw": 227,
"sh": 105,
"ro": true
},
"确认使用道具背景.png": {
"x": 2,
"y": 2,
"w": 696,
"h": 436,
"ox": 0,
"oy": 0,
"sw": 696,
"sh": 436,
"ro": true
}
}
},
{
"keys": "圆角矩形2053.png,所需兑换等级:.png,确认兑换商品按钮.png",
"name": "确认兑换弹窗",
"atlas": {
"圆角矩形2053.png": {
"x": 2,
"y": 867,
"w": 532,
"h": 60,
"ox": 1,
"oy": 1,
"sw": 534,
"sh": 62,
"ro": false
},
"所需兑换等级:.png": {
"x": 2,
"y": 2,
"w": 665,
"h": 863,
"ox": 0,
"oy": 0,
"sw": 665,
"sh": 863,
"ro": false
},
"确认兑换商品按钮.png": {
"x": 669,
"y": 2,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": false
}
}
},
{
"keys": "兑换失败toast.png,兑换成功toast.png,确认兑换.png,确认兑换道具弹窗.png",
"name": "确认兑换道具弹窗",
"atlas": {
"兑换失败toast.png": {
"x": 2,
"y": 856,
"w": 500,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 500,
"sh": 48,
"ro": false
},
"兑换成功toast.png": {
"x": 2,
"y": 906,
"w": 200,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 200,
"sh": 48,
"ro": false
},
"确认兑换.png": {
"x": 669,
"y": 2,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": false
},
"确认兑换道具弹窗.png": {
"x": 2,
"y": 2,
"w": 665,
"h": 852,
"ox": 0,
"oy": 0,
"sw": 665,
"sh": 852,
"ro": false
}
}
},
{
"keys": "再想想按钮.png,确认为你的小松鼠换上新装扮吗?.png,确认装扮按钮.png",
"name": "确认装扮弹窗",
"atlas": {
"再想想按钮.png": {
"x": 2,
"y": 719,
"w": 244,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 244,
"sh": 104,
"ro": true
},
"确认为你的小松鼠换上新装扮吗?.png": {
"x": 2,
"y": 2,
"w": 715,
"h": 485,
"ox": 0,
"oy": 0,
"sw": 715,
"sh": 485,
"ro": true
},
"确认装扮按钮.png": {
"x": 108,
"y": 719,
"w": 243,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 243,
"sh": 104,
"ro": true
}
}
},
{
"keys": "小美头像.png,小贱头像.png,小酷头像.png,确认领养.png,确认领养弹窗背景.png,重新选择.png",
"name": "确认领养弹窗",
"atlas": {
"小美头像.png": {
"x": 654,
"y": 626,
"w": 296,
"h": 257,
"ox": 0,
"oy": 0,
"sw": 296,
"sh": 257,
"ro": false
},
"小贱头像.png": {
"x": 654,
"y": 367,
"w": 325,
"h": 257,
"ox": 0,
"oy": 0,
"sw": 325,
"sh": 257,
"ro": false
},
"小酷头像.png": {
"x": 654,
"y": 108,
"w": 329,
"h": 257,
"ox": 0,
"oy": 0,
"sw": 329,
"sh": 257,
"ro": false
},
"确认领养.png": {
"x": 654,
"y": 2,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": false
},
"确认领养弹窗背景.png": {
"x": 2,
"y": 2,
"w": 650,
"h": 648,
"ox": 0,
"oy": 0,
"sw": 650,
"sh": 648,
"ro": false
},
"重新选择.png": {
"x": 981,
"y": 367,
"w": 140,
"h": 39,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 39,
"ro": true
}
}
},
{
"keys": "0.png,1.png,2.png,3.png,4.png,5.png,6.png,7.png,8.png,9.png,signItemBg.png,sign_progress_fill.png,周一.png,周三.png,周二.png,周五.png,周六.png,周四.png,周日.png,圆角矩形20533.png,子.png,宝箱点亮.png,宝箱置灰.png,已签到按钮.png,币.png,松.png,立即签到按钮.png,签到完成状态.png,签到背景.png,补签.png",
"name": "签到弹窗",
"atlas": {
"0.png": {
"x": 1012,
"y": 165,
"w": 10,
"h": 13,
"ox": 0,
"oy": 4,
"sw": 10,
"sh": 23,
"ro": false
},
"1.png": {
"x": 1018,
"y": 2,
"w": 4,
"h": 11,
"ox": 1,
"oy": 6,
"sw": 6,
"sh": 23,
"ro": false
},
"2.png": {
"x": 1012,
"y": 210,
"w": 9,
"h": 13,
"ox": 0,
"oy": 4,
"sw": 9,
"sh": 23,
"ro": false
},
"3.png": {
"x": 1012,
"y": 255,
"w": 8,
"h": 13,
"ox": 0,
"oy": 5,
"sw": 8,
"sh": 23,
"ro": false
},
"4.png": {
"x": 1011,
"y": 595,
"w": 11,
"h": 11,
"ox": 0,
"oy": 6,
"sw": 11,
"sh": 23,
"ro": false
},
"5.png": {
"x": 1012,
"y": 240,
"w": 8,
"h": 13,
"ox": 0,
"oy": 4,
"sw": 8,
"sh": 23,
"ro": false
},
"6.png": {
"x": 1012,
"y": 195,
"w": 9,
"h": 13,
"ox": 0,
"oy": 5,
"sw": 9,
"sh": 23,
"ro": false
},
"7.png": {
"x": 1012,
"y": 180,
"w": 9,
"h": 13,
"ox": 0,
"oy": 4,
"sw": 9,
"sh": 23,
"ro": false
},
"8.png": {
"x": 1012,
"y": 225,
"w": 8,
"h": 13,
"ox": 0,
"oy": 5,
"sw": 8,
"sh": 23,
"ro": false
},
"9.png": {
"x": 1012,
"y": 150,
"w": 10,
"h": 13,
"ox": 0,
"oy": 5,
"sw": 10,
"sh": 23,
"ro": false
},
"signItemBg.png": {
"x": 702,
"y": 286,
"w": 140,
"h": 191,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 191,
"ro": true
},
"sign_progress_fill.png": {
"x": 352,
"y": 992,
"w": 607,
"h": 25,
"ox": 0,
"oy": 0,
"sw": 607,
"sh": 25,
"ro": false
},
"周一.png": {
"x": 303,
"y": 992,
"w": 47,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 47,
"sh": 27,
"ro": false
},
"周三.png": {
"x": 204,
"y": 992,
"w": 48,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 27,
"ro": false
},
"周二.png": {
"x": 254,
"y": 992,
"w": 47,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 47,
"sh": 27,
"ro": false
},
"周五.png": {
"x": 154,
"y": 992,
"w": 48,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 27,
"ro": false
},
"周六.png": {
"x": 53,
"y": 992,
"w": 49,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 49,
"sh": 27,
"ro": false
},
"周四.png": {
"x": 2,
"y": 992,
"w": 49,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 49,
"sh": 27,
"ro": false
},
"周日.png": {
"x": 104,
"y": 992,
"w": 48,
"h": 27,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 27,
"ro": false
},
"圆角矩形20533.png": {
"x": 961,
"y": 150,
"w": 443,
"h": 49,
"ox": 1,
"oy": 1,
"sw": 445,
"sh": 51,
"ro": true
},
"子.png": {
"x": 986,
"y": 919,
"w": 18,
"h": 17,
"ox": 0,
"oy": 3,
"sw": 18,
"sh": 23,
"ro": false
},
"宝箱点亮.png": {
"x": 961,
"y": 76,
"w": 72,
"h": 55,
"ox": 0,
"oy": 0,
"sw": 72,
"sh": 55,
"ro": true
},
"宝箱置灰.png": {
"x": 961,
"y": 2,
"w": 72,
"h": 55,
"ox": 0,
"oy": 0,
"sw": 72,
"sh": 55,
"ro": true
},
"已签到按钮.png": {
"x": 961,
"y": 757,
"w": 160,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 48,
"ro": true
},
"币.png": {
"x": 1006,
"y": 919,
"w": 15,
"h": 17,
"ox": 0,
"oy": 3,
"sw": 15,
"sh": 23,
"ro": false
},
"松.png": {
"x": 961,
"y": 919,
"w": 21,
"h": 23,
"ox": 0,
"oy": 0,
"sw": 21,
"sh": 23,
"ro": true
},
"立即签到按钮.png": {
"x": 961,
"y": 595,
"w": 160,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 48,
"ro": true
},
"签到完成状态.png": {
"x": 702,
"y": 144,
"w": 140,
"h": 191,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 191,
"ro": true
},
"签到背景.png": {
"x": 2,
"y": 2,
"w": 698,
"h": 988,
"ox": 0,
"oy": 0,
"sw": 698,
"sh": 988,
"ro": false
},
"补签.png": {
"x": 702,
"y": 2,
"w": 140,
"h": 191,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 191,
"ro": true
}
}
},
{
"keys": "propItemBg.png,兑换失败toast.png,兑换成功toast.png,兑换成功特殊字体toast.png,加速卡.png,去下单得装扮按钮.png,取消装扮.png,已解锁.png,当前不需要补签哦,留着下次用吧~.png,正在加速生成松子币~.png,正在加速生成松子币中,请稍后再用.png,矩形 2.png,立即使用道具按钮.png,立即兑换装扮按钮.png,立即兑换道具按钮.png,立即装扮按钮.png,背包弹框背景.png,补签卡.png,补签成功toast.png,装扮未选中.png,装扮选中.png,赚松子币.png,道具未选中.png,道具选中.png,锁.png,需要升级才能装扮toast.png",
"name": "背包弹窗",
"atlas": {
"propItemBg.png": {
"x": 2,
"y": 1704,
"w": 340,
"h": 506,
"ox": 0,
"oy": 0,
"sw": 340,
"sh": 506,
"ro": true
},
"兑换失败toast.png": {
"x": 510,
"y": 1704,
"w": 500,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 500,
"sh": 48,
"ro": false
},
"兑换成功toast.png": {
"x": 754,
"y": 818,
"w": 200,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 200,
"sh": 48,
"ro": false
},
"兑换成功特殊字体toast.png": {
"x": 754,
"y": 768,
"w": 200,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 200,
"sh": 48,
"ro": false
},
"加速卡.png": {
"x": 754,
"y": 371,
"w": 245,
"h": 213,
"ox": 0,
"oy": 0,
"sw": 245,
"sh": 213,
"ro": false
},
"去下单得装扮按钮.png": {
"x": 754,
"y": 985,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": false
},
"取消装扮.png": {
"x": 754,
"y": 946,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": false
},
"已解锁.png": {
"x": 754,
"y": 1063,
"w": 91,
"h": 31,
"ox": 0,
"oy": 0,
"sw": 91,
"sh": 31,
"ro": false
},
"当前不需要补签哦,留着下次用吧~.png": {
"x": 962,
"y": 1145,
"w": 557,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 557,
"sh": 48,
"ro": true
},
"正在加速生成松子币~.png": {
"x": 847,
"y": 1063,
"w": 392,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 392,
"sh": 48,
"ro": true
},
"正在加速生成松子币中,请稍后再用.png": {
"x": 967,
"y": 586,
"w": 557,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 557,
"sh": 48,
"ro": true
},
"矩形 2.png": {
"x": 2,
"y": 1193,
"w": 314,
"h": 395,
"ox": 0,
"oy": 0,
"sw": 314,
"sh": 395,
"ro": false
},
"立即使用道具按钮.png": {
"x": 754,
"y": 652,
"w": 211,
"h": 64,
"ox": 0,
"oy": 0,
"sw": 211,
"sh": 64,
"ro": false
},
"立即兑换装扮按钮.png": {
"x": 754,
"y": 907,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": false
},
"立即兑换道具按钮.png": {
"x": 754,
"y": 586,
"w": 211,
"h": 64,
"ox": 0,
"oy": 0,
"sw": 211,
"sh": 64,
"ro": false
},
"立即装扮按钮.png": {
"x": 754,
"y": 868,
"w": 144,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 144,
"sh": 37,
"ro": false
},
"背包弹框背景.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1167,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1167,
"ro": false
},
"补签卡.png": {
"x": 754,
"y": 156,
"w": 245,
"h": 213,
"ox": 0,
"oy": 0,
"sw": 245,
"sh": 213,
"ro": false
},
"补签成功toast.png": {
"x": 754,
"y": 718,
"w": 200,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 200,
"sh": 48,
"ro": false
},
"装扮未选中.png": {
"x": 2,
"y": 1590,
"w": 68,
"h": 34,
"ox": 7,
"oy": 0,
"sw": 80,
"sh": 46,
"ro": true
},
"装扮选中.png": {
"x": 754,
"y": 1145,
"w": 80,
"h": 46,
"ox": 0,
"oy": 0,
"sw": 80,
"sh": 46,
"ro": false
},
"赚松子币.png": {
"x": 754,
"y": 1024,
"w": 130,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 37,
"ro": false
},
"道具未选中.png": {
"x": 897,
"y": 1427,
"w": 66,
"h": 35,
"ox": 6,
"oy": 0,
"sw": 80,
"sh": 47,
"ro": true
},
"道具选中.png": {
"x": 754,
"y": 1096,
"w": 80,
"h": 47,
"ox": 0,
"oy": 0,
"sw": 80,
"sh": 47,
"ro": false
},
"锁.png": {
"x": 754,
"y": 2,
"w": 259,
"h": 152,
"ox": 0,
"oy": 0,
"sw": 259,
"sh": 152,
"ro": false
},
"需要升级才能装扮toast.png": {
"x": 900,
"y": 868,
"w": 557,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 557,
"sh": 60,
"ro": true
}
}
},
{
"keys": "快去装扮吧.png,解锁装扮背景.png",
"name": "解锁装扮弹窗",
"atlas": {
"快去装扮吧.png": {
"x": 352,
"y": 2,
"w": 330,
"h": 104,
"ox": 0,
"oy": 0,
"sw": 330,
"sh": 104,
"ro": true
},
"解锁装扮背景.png": {
"x": 2,
"y": 2,
"w": 593,
"h": 348,
"ox": 0,
"oy": 0,
"sw": 593,
"sh": 348,
"ro": true
}
}
},
{
"keys": "signCredits.png,连续签到背景.png",
"name": "连续签到奖励弹窗",
"atlas": {
"signCredits.png": {
"x": 2,
"y": 723,
"w": 588,
"h": 464,
"ox": 0,
"oy": 0,
"sw": 588,
"sh": 464,
"ro": false
},
"连续签到背景.png": {
"x": 2,
"y": 2,
"w": 719,
"h": 766,
"ox": 0,
"oy": 0,
"sw": 719,
"sh": 766,
"ro": true
}
}
} }
], ],
"path": "https://yun.duiba.com.cn/db_games/activity/threeSquirrels/1593770323/resource/" "path": "./resource/"
} }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
import { SquirrelType } from "./parts/Squirrels";
export class SquirrelInfo {
/**
* 事件回调池
*/
private static callbackPool: any = {};
/**
* 事件作用域池
*/
private static thisObjPool: any = {};
private static data: {
"level": number,
"credits": number,
"exp": number,
// "upgradeExp": number,
"dressId": string,
// "type": SquirrelType,//额外加的,暂时只有话语里用到
} = {
"level": null,//1,
"credits": null,// 0,
"exp": null,//0,
// "upgradeExp": null,//1,
"dressId": null,
// "type": null,
};
//为了能访问类型,后面的init回覆盖
static level: number;
static credits: number;
static exp: number;
// static upgradeExp: number;
static dressId: string;
//只记录用
static type: SquirrelType;
static upgradeExp: number;//不会挂方法,就记录在外面吧
static floorExp: number; //当前等级的最低经验值
static init() {
let self = SquirrelInfo
for (let key in SquirrelInfo.data) {
Object.defineProperty(self, key, {
set: function (value) {
if (self.data[key] === value) return;
self.data[key] = value;
self.emit(key, value);
},
get: function () {
return self.data[key]
}
})
}
}
public static on(name: "level" | "credits" | "exp" | "dressId", callback, thisObj?: any) {
if (!this.callbackPool[name]) {
this.callbackPool[name] = [];
this.thisObjPool[name] = [];
}
const index: number = this.callbackPool[name].indexOf(callback);
if (index != -1) {//本来就有,覆盖
this.callbackPool[name][index] = callback;
this.thisObjPool[name][index] = thisObj;
} else {
this.callbackPool[name].push(callback);
this.thisObjPool[name].push(thisObj);
}
}
public static off(name: string, callback, thisObj?: any) {
if (this.callbackPool[name]) {
var len = this.callbackPool[name].length;
for (let i = len - 1; i >= 0; i--) {
if (this.callbackPool[name][i] === callback && this.thisObjPool[name][i] == thisObj) {
this.callbackPool[name].splice(i, 1);
this.thisObjPool[name].splice(i, 1);
}
}
}
}
private static emit(name: string, ...args) {
const callbacks: Function[] = this.callbackPool[name];
const thisObjs: any = this.thisObjPool[name];
if (callbacks) {
let i = 0;
const len: number = callbacks.length;
for (i; i < len; i++) {
callbacks[i].apply(thisObjs[i], args);
}
}
}
}
//初始化先
SquirrelInfo.init();
// SquirrelInfo.on("level",(e)=>{console.log(e)})
// SquirrelInfo.level=999
\ No newline at end of file
...@@ -3,82 +3,9 @@ import { GDispatcher } from "./Main"; ...@@ -3,82 +3,9 @@ import { GDispatcher } from "./Main";
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分 //接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export enum TbNetName { export enum TbNetName {
/** /**
* 获取活动基本信息 activityId后续全放在invoke里 * 埋点统计 到时改名字
* activityId
*/
getActivityInfo = "squirrelsAdopt2c.getActivityInfo",
getExchangeGoodsList = "squirrelsAdoptRest2c.getExchangeGoodsList",
getBagGoodsList = "squirrelsAdoptRest2c.getBagGoodsList",
useTool = "squirrelsAdopt2c.useTool",
exchangeBag = "squirrelsAdoptRest2c.exchangeBag",
exchangeGood = "squirrelsAdoptRest2c.exchangeGood",
doDressUp = "squirrelsAdoptRest2c.doDressUp",
getTaskList = "squirrelsAdopt2c.getTaskList",
getSignInfo = "squirrelsAdopt2c.getSignInfo",
doSign = "squirrelsAdopt2c.doSign",
takeSignPrize = "squirrelsAdopt2c.takeSignPrize",
dressOrderClick = "squirrelsAdoptRest2c.dressOrderClick",
doTaskComplete = "squirrelsAdopt2c.doTaskComplete",
takeTaskPrize = "squirrelsAdopt2c.takeTaskPrize",
// 领取非实物
receivePrize = "squirrelsAdoptRest2c.receivePrize",
// 领取实物
receiveObjectPrize = "squirrelsAdoptRest2c.receiveObjectPrize",
getDressOrderStatus = "squirrelsAdoptRest2c.getDressOrderStatus",
/**
* 获取我的动态列表
* activityId,pageNo,pageSize
*/
getActionInfo = "squirrelsAdoptRest2c.getActionInfo",
/**
* 获取松鼠信息
* activityId
*/
getSquirrelInfo = "squirrelsAdopt2c.getSquirrelInfo",
/**
* 领养松鼠
* activityId,squirrelType,squirrelName, inviteId
*/
doAdopt = "squirrelsAdopt2c.doAdopt",
/**
* 收取松子
* activityId
*/
doCollect = "squirrelsAdopt2c.doCollect",
/**
* 获取松子(积分数)
* activityId
*/
getCredits = "squirrelsAdopt2c.getCredits",
/**
* 喂食
* activityId
*/
doFeed = "squirrelsAdopt2c.doFeed",
/**
* 判断是否是会员
*/
checkMember = "squirrelsAdopt2c.checkMember",
/**
* 埋点统计
* activityId params elemType * activityId params elemType
*/ */
trackingReport = "squirrelsAdoptRest2c.trackingReport", trackingReport = "squirrelsAdoptRest2c.trackingReport",
......
...@@ -4,7 +4,6 @@ import Tween = FYGE.Tween; ...@@ -4,7 +4,6 @@ import Tween = FYGE.Tween;
import DisplayObject = FYGE.DisplayObject; import DisplayObject = FYGE.DisplayObject;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import { sendTbNet, TbNetName } from "./TaoBaoNet"; import { sendTbNet, TbNetName } from "./TaoBaoNet";
import { SquirrelInfo } from "./SquirrelInfo";
/** /**
* 定制,记录一些全局量和方法 * 定制,记录一些全局量和方法
...@@ -60,11 +59,11 @@ export class Tool { ...@@ -60,11 +59,11 @@ export class Tool {
/** /**
* 刷新积分信息 * 刷新积分信息
*/ */
public static getCredits() { // public static getCredits() {
sendTbNet(TbNetName.getCredits).then((d) => { // sendTbNet(TbNetName.getCredits).then((d) => {
SquirrelInfo.credits = d.data.credits; // SquirrelInfo.credits = d.data.credits;
}) // })
} // }
/** /**
* 询问权限用 * 询问权限用
*/ */
...@@ -74,7 +73,7 @@ export class Tool { ...@@ -74,7 +73,7 @@ export class Tool {
if (!tbMy) return; if (!tbMy) return;
//@ts-ignore //@ts-ignore
const { cloud } = getApp(); const { cloud } = getApp();
//测试地址//到时云存储传一个小json //测试地址//到时云存储传一个小json,,改路径
var url = "cloud://B4F0300E5148F478B506DEDC26EA4C6C//butterfly0.svga"; var url = "cloud://B4F0300E5148F478B506DEDC26EA4C6C//butterfly0.svga";
//获取临时地址 //获取临时地址
var urls = await cloud.file.getTempFileURL({ fileId: [url] }) var urls = await cloud.file.getTempFileURL({ fileId: [url] })
......
import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import { Tool } from "../Tools";
import { getTbData, TbNetName, sendTbNet } from "../TaoBaoNet";
import { wait } from "../../module/ctrls";
import { clickLog, LogEnum } from "../log";
/**
* 广告弹框 548*832
*/
export class AdPanel extends Panel {
initUi() {
let noticeInfo: { image: string, link: string } = getTbData(TbNetName.getActivityInfo).data.noticeInfo;
var image = this.addChild(FYGE.Sprite.fromUrl(noticeInfo.image))
.addEventListener(FYGE.MouseEvent.CLICK, () => {
this.enableMouseEvt(false);
wait(() => { this.enableMouseEvt(true) }, 3000);
clickLog(LogEnum.AD);
wait(() => {
//跳转广告
sendTbNet(TbNetName.navigateToOutside, { url: noticeInfo.link });
}, 1000)
}, this);
image.position.set((750 - 548) / 2, Tool.panelOffsetY + (1624 - 832) / 2);
image.width = 548;
image.height = 832;
//文案
//跳过按钮
var btn = this.addChild(new CountDownBtn())
.addEventListener(FYGE.MouseEvent.CLICK, () => {
btn.removeCount();
this.hidePanel();
}, this)
btn.position.set((750 - 111) / 2, Tool.panelOffsetY + (1624 - 832) / 2 + 832 + 45)
btn.startCount(() => {
this.hidePanel();
})
}
}
class CountDownBtn extends FYGE.Button {
private timeObj;
private timeTxt: FYGE.TextField;
/**
*
* @param resName 按钮资源名
*/
constructor() {
super(RES.getRes("jumpAdBtn.png"))
this.timeTxt = this.addChild(Tool.getText(
"10s",
30,
"#ebe6c5",
FYGE.TEXT_ALIGN.RIGHT,
60,
55,
0
))
}
/**
* 开始倒计时
* @param callback 倒计时结束后执行的
*/
startCount(callback: Function) {
//倒计时
this.timeObj = { a: 10 * 1000 };
FYGE.Tween.get(this.timeObj, {
onChange: () => {
this.timeTxt.text = "" + Math.round(this.timeObj.a / 1000) + "s"
if (this.timeObj.a < 100) {
//自己移除一次,以防callback里面没有
this.removeCount();
callback();
}
}
})
.to({ a: 0 }, 10000)
}
/**
* 移除倒计时
*/
removeCount() {
FYGE.Tween.removeTweens(this.timeObj)
}
}
\ No newline at end of file
import { Panel } from "../../module/views/Panel";
import { SquirrelType } from "../parts/Squirrels";
export class AdoptSucPanel extends Panel {
get groupNames() { return ["成功领养弹窗"] }
get skinName() { return "成功领养弹窗" }
closeBtn: FYGE.Button;
xiaomei: FYGE.Sprite;
xiaojian: FYGE.Sprite;
xiaoku: FYGE.Sprite;
data: {
type: SquirrelType
closeFun: () => void
}
timeObj;
start(data) {
super.start();
this.xiaojian.visible = this.xiaomei.visible = this.xiaoku.visible = false;
this[SquirrelType[this.data.type]].visible = true;
//倒计时
var timeTxt = this.getChildByName("5s", true, true);
//倒计时
this.timeObj = { a: 5 * 1000 };
FYGE.Tween.get(this.timeObj, {
onChange: () => {
timeTxt.text = Math.round(this.timeObj.a / 1000) + "s"
if (this.timeObj.a < 100) this.hidePanel();
}
})
.to({ a: 0 }, 5000)
}
hidePanel() {
FYGE.Tween.removeTweens(this.timeObj)
if (this.data && this.data.closeFun) {
this.data.closeFun();
}
super.hidePanel();
}
initEvents() {
super.initEvents();
}
removeEvents() {
super.removeEvents();
}
}
import { Item } from "../../module/views/Item";
import { Panel } from "../../module/views/Panel";
import { layers } from "../../module/views/layers";
import { RES } from "../../module/RES";
import { getTbData, sendTbNet, TbNetName } from "../TaoBaoNet";
import { showConfirm, showPanel, showToast } from "../../module/ctrls";
import { ConfirmUseProp } from "./ConfirmUseProp";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { ConfirmExchangeProp } from "./ConfirmExchangeProp";
import { ConfirmDress } from "./ConfirmDress";
import { SignPanel } from "./SignPanel";
import { SquirrelInfo } from "../SquirrelInfo";
import { ConfirmExchangeDress } from "./ConfirmExchangeDress";
import { Tool } from "../Tools";
import { TaskPanel } from "./TaskPanel";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import MouseEvent = FYGE.MouseEvent;
import ScrollPage = FYGE.ScrollPage;
import Texture = FYGE.Texture;
import Sprite = FYGE.Sprite;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Button = FYGE.Button;
import Container = FYGE.Container;
const enum BAG_CARD {
PROP = 'prop',
DRESS = 'dress'
}
export class BagPanel extends Panel {
get groupNames() {
return ["背包弹窗"]
}
get skinName() {
return "背包弹窗"
}
exSuccessToast: Container;
exFailedToast: Container;
addSpeedIng: Container;
addSpeedTip: Container;
levelToast: Container;
bagToast: Container;
tipTxt: FYGE.TextField;
closeBtn: FYGE.Button;
earnBtn: FYGE.Button;
proBtnSpr: FYGE.Sprite;
dressBtnSpr: FYGE.Sprite;
private dressScroll: ScrollPage;
private propScroll: ScrollPage;
private dress_enable: Texture = null;
private dress_disable: Texture = null;
private prop_enable: Texture = null;
private prop_disable: Texture = null;
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
this.y = 1624 - layers.stageOffsetY + 100;
const _y = 1624 - this.height - layers.stageOffsetY + 100 - 420 / 2 - 55;
Tween.get(this)
.to({y: _y}, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
}
initUi() {
this.dress_enable = RES.getRes("装扮选中.png");
this.dress_disable = RES.getRes("装扮未选中.png");
this.prop_enable = RES.getRes("道具选中.png");
this.prop_disable = RES.getRes("道具未选中.png");
this.tipTxt.textWidth = 750;
this.tipTxt.x = 0;
this.tipTxt.textAlign = TEXT_ALIGN.CENTER;
this.dressScroll = this.addChild(new ScrollPage(667, 705, 716));
this.dressScroll.visible = true;
this.dressScroll.position.set(45, 930);
this.propScroll = this.addChild(new ScrollPage(694, 655, 716));
this.propScroll.visible = false;
this.propScroll.position.set(34, 950);
this.exSuccessToast = this.bagToast.getChildByName('exSuccess');
this.exFailedToast = this.bagToast.getChildByName('exFailed');
this.addSpeedIng = this.bagToast.getChildByName('addSpeedIng');
this.addSpeedTip = this.bagToast.getChildByName('addSpeedTip');
this.levelToast = this.bagToast.getChildByName('levelToast');
this.exSuccessToast.visible = false;
this.exFailedToast.visible = false;
this.addSpeedIng.visible = false;
this.addSpeedTip.visible = false;
this.levelToast.visible = false;
this.swapChildren(this.propScroll, this.bagToast);
}
start(data) {
super.start();
this.changeCardState(BAG_CARD.DRESS);
this.updateBag();
}
/**
* 更新背包数据
*/
private updateBag() {
const orderDressIds = ['dress1', 'dress5', 'dress9'];
const dress = getTbData(TbNetName.getBagGoodsList).data.dress;
const needRecordTime = getTbData(TbNetName.getBagGoodsList).data.needRecordTime;
let flag = true;
for (let i = 0; i < dress.length; i++) {
if (orderDressIds.indexOf(dress[i].id) > -1 && dress[i].status != 1) {
flag = false;
break;
}
}
if (flag && !needRecordTime) {
sendTbNet(TbNetName.getDressOrderStatus, {},
(success, res) => {
sendTbNet(TbNetName.getBagGoodsList,
{},
(success, res) => {
if (!success || !res || !res.data) return;
this.updateDress(res.data.dress || []);
this.updateProp(res.data.tools || []);
}
);
}, true
);
} else {
sendTbNet(TbNetName.getBagGoodsList,
{},
(success, res) => {
if (!success || !res || !res.data) return;
this.updateDress(res.data.dress || []);
this.updateProp(res.data.tools || []);
}
);
}
}
/**
* 更新装扮
* @param {Array} dressList
*/
private updateDress(dressList: any[]) {
this.dressScroll.view.removeChildren();
dressList.forEach((v, index) => {
let nItem = this.dressScroll.view.addChild(new DesItem());
nItem.position.set(index % 2 ? 352 : 0, ~~(index / 2) * 418);
nItem.updateData(v);
});
this.dressScroll.maxDistance = (~~(dressList.length / 2) + dressList.length % 2) * 418;
}
/**
* 更新道具
* @param {Array} toolList
*/
private updateProp(toolList: any[]) {
this.propScroll.view.removeChildren();
toolList.forEach((v, index) => {
let nItem = this.propScroll.view.addChild(new PropItem());
nItem.position.set(index % 2 ? 353 : 0, ~~(index / 2) * 530);
nItem.updateData(v);
});
this.propScroll.maxDistance = (~~(toolList.length / 2) + toolList.length % 2) * 530;
if (this.propScroll.maxDistance < 716) {
this.propScroll.maxSpeed = 0;
}
}
private clickBtn(e) {
switch (e.target) {
case this.earnBtn:
this.hidePanel();
showPanel(TaskPanel);
console.log('赚松子币');
break;
}
}
private cardState: BAG_CARD = null;
private switchCar(e) {
switch (e.target) {
case this.dressBtnSpr:
this.changeCardState(BAG_CARD.DRESS);
break;
case this.proBtnSpr:
this.changeCardState(BAG_CARD.PROP);
break;
}
}
private changeCardState(state) {
if (state == this.cardState) {
return;
}
this.cardState = state;
switch (this.cardState) {
case BAG_CARD.DRESS:
this.dressScroll.visible = true;
this.propScroll.visible = false;
this.dressBtnSpr.texture = this.dress_enable;
this.proBtnSpr.texture = this.prop_disable;
this.tipTxt.text = '需要升级大松鼠才能进行装扮哦~';
break;
case BAG_CARD.PROP:
this.dressScroll.visible = false;
this.propScroll.visible = true;
this.dressBtnSpr.texture = this.dress_disable;
this.proBtnSpr.texture = this.prop_enable;
this.tipTxt.text = '可用松子币兑换道具';
break;
}
}
initEvents() {
super.initEvents();
this.earnBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.dressBtnSpr.addEventListener(MouseEvent.CLICK, this.switchCar, this);
this.proBtnSpr.addEventListener(MouseEvent.CLICK, this.switchCar, this);
GDispatcher.addEventListener(G_EVENT.UPDATE_BAG, this.updateBag, this);
GDispatcher.addEventListener(G_EVENT.ON_SHOW, this.updateBag, this);
}
removeEvents() {
super.removeEvents();
this.earnBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.dressBtnSpr.removeEventListener(MouseEvent.CLICK, this.switchCar, this);
this.proBtnSpr.removeEventListener(MouseEvent.CLICK, this.switchCar, this);
GDispatcher.removeEventListener(G_EVENT.UPDATE_BAG, this.updateBag, this);
GDispatcher.removeEventListener(G_EVENT.ON_SHOW, this.updateBag, this);
}
public destroy() {
super.destroy();
}
}
/**
* 装扮
*/
class DesItem extends Item {
get skinName() {
return "desItem"
}
data: any = null;
image: FYGE.Sprite;
nameTxt: FYGE.TextField;
desTxt: FYGE.TextField;
orderBtn: FYGE.Button;
exBtn: FYGE.Button;
desBtn: FYGE.Button;
cancelBtn: Button;
lock: Sprite;
lockTip: Sprite;
initUi(data?) {
this.nameTxt.textWidth = 312;
this.nameTxt.x = 0;
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.desTxt.textWidth = 312;
this.desTxt.x = 0;
this.desTxt.textAlign = TEXT_ALIGN.CENTER;
// 搞个遮罩
// const imgMask = this.addChild(new Graphics());
// imgMask.drawRect(this.lock.x, this.lock.y, this.lock.width, this.lock.height);
// this.image.mask = imgMask;
this.initEvent();
}
updateData(data?) {
this.data = data;
this.desTxt.text = data.desc;
this.nameTxt.text = data.name;
this.image.texture = Texture.fromUrl(data.image || data.img);
this.image.x = (312 - 258) / 2;
this.image.y = 50;
// 258 * 151
this.lock.visible = (data.status == 1);
this.lockTip.visible = !(data.status == 1);
this.orderBtn.visible = false;
this.exBtn.visible = false;
this.desBtn.visible = false;
this.cancelBtn.visible = false;
this.desTxt.visible = (+data.status == 1);
switch (+data.status) {
case 1: // 未解锁
if (+data.type == 1) { // 积分兑换
this.exBtn.visible = true;
} else {
this.orderBtn.visible = true;
}
break;
case 2: // 未装扮
this.desBtn.visible = true;
break;
case 3: // 已装扮
this.cancelBtn.visible = true;
break;
}
}
private clickDress() {
Tool.btnDelay(this.desBtn);
console.log('穿装扮');
if (SquirrelInfo.level < 2) {
Tool.customToast(this.parent.parent.parent.levelToast);
return;
}
showConfirm(ConfirmDress, this.data).then(
(r) => {
// GDispatcher.dispatchEvent(G_EVENT.UPDATE_BAG);
SquirrelInfo.dressId = this.data.id;
this.parent.parent.parent.hidePanel();
},
(e) => {
}
);
}
private cancelDress() {
Tool.btnDelay(this.cancelBtn);
console.log('取消装扮');
if (SquirrelInfo.level < 2) {
Tool.customToast(this.parent.parent.parent.levelToast);
return;
}
showConfirm(ConfirmDress, this.data).then(
(r) => {
// GDispatcher.dispatchEvent(G_EVENT.UPDATE_BAG);
SquirrelInfo.dressId = null;
this.parent.parent.parent.hidePanel();
},
(e) => {
}
);
}
private clickOrder() {
Tool.btnDelay(this.orderBtn);
console.log(this.data);
if (getTbData(TbNetName.getBagGoodsList).data.needRecordTime) {
sendTbNet(TbNetName.dressOrderClick, {itemId: this.data.itemId},
(success, res) => {
},
true
);
}
console.log('跳转到商品详情页');
sendTbNet(TbNetName.openDetail, {itemId: '' + this.data.itemId},
(success, res) => {
}
);
}
private clickExchange() {
Tool.btnDelay(this.exBtn);
console.log('兑换装扮');
showConfirm(ConfirmExchangeDress, this.data).then(
(r) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_BAG);
Tool.customToast(this.parent.parent.parent.exSuccessToast);
},
(e) => {
console.log(e);
if (e == '松子币不足') {
Tool.customToast(this.parent.parent.parent.exFailedToast);
}
}
);
}
initEvent() {
this.desBtn.addEventListener(MouseEvent.CLICK, this.clickDress, this);
this.orderBtn.addEventListener(MouseEvent.CLICK, this.clickOrder, this);
this.exBtn.addEventListener(MouseEvent.CLICK, this.clickExchange, this);
this.cancelBtn.addEventListener(MouseEvent.CLICK, this.cancelDress, this);
}
removeEvent() {
this.desBtn.removeEventListener(MouseEvent.CLICK, this.clickDress, this);
this.orderBtn.removeEventListener(MouseEvent.CLICK, this.clickOrder, this);
this.exBtn.removeEventListener(MouseEvent.CLICK, this.clickExchange, this);
this.cancelBtn.removeEventListener(MouseEvent.CLICK, this.cancelDress, this);
}
public destroy() {
this.removeEvent();
super.destroy();
}
initData(id: number, data: any): void {
}
}
/**
* 道具
*/
class PropItem extends Item {
get skinName() {
return "propItem"
}
data: any = null;
costTxt: FYGE.TextField;
nameTxt: FYGE.TextField;
image: FYGE.Sprite;
exBtn: FYGE.Button;
useBtn: FYGE.Button;
initUi(data?) {
this.nameTxt.textWidth = this.width;
this.nameTxt.x = 0;
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.initEvent();
}
updateData(data?) {
this.data = data;
switch (+data.type) {
case 1: // 补签卡
this.image.texture = RES.getRes('补签卡.png');
this.nameTxt.text = '补签卡' + ` ×${data.count}`;
break;
case 2: // 加速卡
this.image.texture = RES.getRes('加速卡.png');
this.nameTxt.text = '加速卡' + ` ×${data.count}`;
break
}
this.costTxt.text = data.value;
this.exBtn.visible = (+data.type == 1) || !(+data.count > 0);
this.useBtn.visible = (+data.type != 1) && (+data.count > 0);
}
private clickUse() {
Tool.btnDelay(this.useBtn);
if (+this.data.type == 1) {
showPanel(SignPanel);
} else {
console.log(this.data);
showConfirm(ConfirmUseProp, this.data).then(
(r) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_BAG);
},
(e) => {
console.log(e);
if (e == '不在喂食') {
// Tool.customToast(this.parent.parent.parent.)
showToast('在喂食中才可以加速哦~');
}
}
);
}
}
private clickExchange() {
Tool.btnDelay(this.exBtn);
console.log('兑换道具');
showConfirm(ConfirmExchangeProp, this.data).then(
(r) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_BAG);
},
(e) => {
console.log(e);
}
);
}
initEvent() {
this.useBtn.addEventListener(MouseEvent.CLICK, this.clickUse, this);
this.exBtn.addEventListener(MouseEvent.CLICK, this.clickExchange, this);
}
removeEvent() {
this.useBtn.removeEventListener(MouseEvent.CLICK, this.clickUse, this);
this.exBtn.removeEventListener(MouseEvent.CLICK, this.clickExchange, this);
}
public destroy() {
this.removeEvent();
super.destroy();
}
initData(id: number, data: any): void {
}
}
import { Panel } from "../../module/views/Panel";
import { changeScene, showWaiting, hideWaiting } from "../../module/ctrls";
import { MainScene } from "../scenes/MainScene";
import { Tool } from "../Tools";
import { layers } from "../../module/views/layers";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { RES } from "../../module/RES";
import { SquirrelType, SquirrelsData } from "../parts/Squirrels";
export class ConfirmAdoptPanel extends Panel {
get groupNames() { return ["确认领养弹窗"] }
get skinName() { return "确认领养弹窗" }
closeBtn: FYGE.Button;
confirmBtn: FYGE.Button;
reChooseBtn: FYGE.Button;
nameTxt: FYGE.TextField;
xiaomei: FYGE.Sprite;
xiaoku: FYGE.Sprite;
xiaojian: FYGE.Sprite;
data: {
type: SquirrelType
}
showAni() {
//统一修改从中心缩放进入
this.anchor.set(375, 1624 / 2);
this.scale.set(0.1, 0.1)
FYGE.Tween.get(this).to({ scaleX: 1, scaleY: 1 }, 500, FYGE.Ease.backOut);
}
initUi() {
//这个为了效果,直接加入场景里
}
start(data) {
super.start();
this.xiaomei.visible = this.xiaoku.visible = this.xiaojian.visible = false
this[SquirrelType[data.type]].visible = true;
Tool.changeTextAlign(this.nameTxt, FYGE.TEXT_ALIGN.CENTER, 200)
this.nameTxt.text = SquirrelsData[data.type].name;
}
initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, () => { this.hidePanel(); }, this)
this.reChooseBtn.addEventListener(FYGE.MouseEvent.CLICK, () => { this.hidePanel(); }, this)
this.confirmBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
//发接口,领养
showWaiting();
const { success: doAdopt } = await sendTbNet(TbNetName.doAdopt, {
squirrelType: this.data.type,
inviteId: Tool.globalData.inviteId,
squirrelName: "测试用"
});
//打开游戏场景,传入type,判断是否是刚领取的,新领取的就
if (doAdopt) {
await Promise.all([
RES.loadGroup("guide"),//首次必有引导
sendTbNet(TbNetName.getSquirrelInfo),
sendTbNet(TbNetName.getBagGoodsList), // 背包
])
changeScene(MainScene, {});//随便传点,证明是刚领养,需要弹窗引导
} else {
hideWaiting();
//报错统一处理了
}
// this.hidePanel();
}, this)
}
removeEvents() {
}
}
import ConfirmPanel from "../common/IConfirmPanel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import MouseEvent = FYGE.MouseEvent;
import TextField = FYGE.TextField;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Container = FYGE.Container;
export class ConfirmDress extends ConfirmPanel {
get groupNames() {
return ["确认装扮弹窗"]
}
get skinName() {
return "确认装扮弹窗"
}
closeBtn: FYGE.Button;
confirmBtn: FYGE.Button;
thinkBtn: FYGE.Button;
tipTxt: TextField;
initUi() {
console.log(this.data);
this.tipTxt.textWidth = 750;
this.tipTxt.x = 0;
this.tipTxt.textAlign = TEXT_ALIGN.CENTER;
if (+this.data.status == 2) {
this.tipTxt.text = '确认为你的小松鼠换上新装扮吗?';
} else if (+this.data.status == 3) {
this.tipTxt.text = '确认为你的小松鼠取消装扮吗?';
}
}
start(data) {
super.start();
}
private clickBtn(e) {
switch (e.target) {
case this.confirmBtn:
sendTbNet(TbNetName.doDressUp,
{id: this.data.id, status: this.data.status == 2 ? 3 : 2},
(success, res) => {
this.resolve(true);
this.hidePanel();
if (!success || !res) return;
}
);
break;
case this.thinkBtn:
case this.closeBtn:
this.reject('点击关闭或再想想');
this.hidePanel();
break;
}
}
initEvents() {
this.closeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.confirmBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.thinkBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.confirmBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.thinkBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
import ConfirmPanel from "../common/IConfirmPanel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
import MouseEvent = FYGE.MouseEvent;
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import Texture = FYGE.Texture;
import { SquirrelInfo } from "../SquirrelInfo";
import { showPanel } from "../../module/ctrls";
import { UnlockDressPanel } from "./UnlockDressPanel";
export class ConfirmExchangeDress extends ConfirmPanel {
get groupNames() {
return ["确认兑换道具弹窗"]
}
get skinName() {
return "确认兑换道具弹窗"
}
closeBtn: FYGE.Button;
confirmBtn: FYGE.Button;
desTxt: FYGE.TextField;
nameTxt: FYGE.TextField;
costTxt: FYGE.TextField;
private image: Sprite;
initUi() {
this.image = this.addChild(Tool.getSprite(`${this.data.name}.png`));
// 258 * 151
this.image.width = 450;
this.image.height = 450 / 258 * 151;
this.image.position.set((750 - 450) / 2, 735);
this.nameTxt.textWidth = 750;
this.nameTxt.x = 0;
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.desTxt.lineType = TEXT_lINETYPE.MULTI;
this.desTxt.textWidth = 550;
}
start(data) {
super.start();
this.image.texture = Texture.fromUrl(data.image || data.img);
this.nameTxt.text = this.data.name;
this.desTxt.text = this.data.desc;
this.costTxt.text = this.data.value;
}
private clickBtn(e) {
switch (e.target) {
case this.closeBtn:
this.reject('点击关闭');
this.hidePanel();
break;
case this.confirmBtn:
if (SquirrelInfo.credits < +this.data.value) {
this.reject('松子币不足');
this.hidePanel();
return;
}
sendTbNet(TbNetName.exchangeBag,
{id: this.data.id, type: 'dress'},
(success, res) => {
this.resolve(true); // 不管接口成功失败都要刷新
Tool.getCredits();
let _d = JSON.parse(JSON.stringify(this.data));
this.hidePanel();
if (!success || !res || !res.data) return;
showPanel(UnlockDressPanel, _d);
}
);
break;
}
}
initEvents() {
this.closeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.confirmBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.confirmBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
import ConfirmPanel from "../common/IConfirmPanel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { showPanel } from "../../module/ctrls";
import { ExSuccessPanel } from "./ExSuccessPanel";
import { SquirrelInfo } from "../SquirrelInfo";
import { Tool } from "../Tools";
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
import Texture = FYGE.Texture;
import MouseEvent = FYGE.MouseEvent;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import VERTICAL_ALIGN = FYGE.VERTICAL_ALIGN;
export class ConfirmExchangePanel extends ConfirmPanel {
get groupNames() {
return ["确认兑换弹窗"]
}
get skinName() {
return "确认兑换弹窗"
}
closeBtn: FYGE.Button;
exBtn: FYGE.Button;
desTxt: FYGE.TextField;
nameTxt: FYGE.TextField;
levelTxt: FYGE.TextField;
costTxt: FYGE.TextField;
toastLabel: FYGE.TextField;
image: FYGE.Sprite;
toast: FYGE.Container;
initUi() {
this.desTxt.lineType = TEXT_lINETYPE.MULTI;
this.desTxt.textWidth = 544;
this.nameTxt.textWidth = 750;
this.nameTxt.x = 0;
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.y -= 130; // 不知道为什么这个弹窗偏下
}
start(data) {
super.start();
this.desTxt.text = data.desc;
this.nameTxt.text = data.name;
this.costTxt.text = data.credits;
this.levelTxt.text = `LV.${data.level}`;
this.toast.visible = false;
this.toastLabel.textWidth = this.toast.width;
this.toastLabel.textHeight = this.toast.height;
this.toastLabel.textAlign = TEXT_ALIGN.CENTER;
this.toastLabel.verticalAlign = VERTICAL_ALIGN.MIDDLE;
this.toastLabel.position.set(0, 2);
this.toastLabel.text = `该商品需lv.${data.level}可兑换,快去升级吧`;
this.image.texture = Texture.fromUrl(data.image);
this.image.width = this.image.height = 280;
this.image.x = (750 - 280) / 2;
}
private clickBtn(e) {
switch (e.target) {
case this.exBtn:
this.btnDelay(this.exBtn);
console.log("兑换");
if (this.data.level > SquirrelInfo.level) { // 如果登记不够就不能兑换
Tool.customToast(this.toast);
break;
}
// 兑换商品
sendTbNet(TbNetName.exchangeGood, {id: this.data.id},
(success, res) => {
this.resolve(true); // 不管接口成功失败都要刷新
Tool.getCredits();
if (!success || !res || !res.data) return;
this.hidePanel();
showPanel(ExSuccessPanel, res.data);
}
);
break;
case this.closeBtn:
this.hidePanel();
this.reject("点击关闭");
break;
}
}
initEvents() {
this.closeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.exBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.exBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
import ConfirmPanel from "../common/IConfirmPanel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
import MouseEvent = FYGE.MouseEvent;
import { sendTbNet, TbNetName } from "../TaoBaoNet";
export class ConfirmExchangeProp extends ConfirmPanel {
get groupNames() {
return ["确认兑换道具弹窗"]
}
get skinName() {
return "确认兑换道具弹窗"
}
closeBtn: FYGE.Button;
confirmBtn: FYGE.Button;
desTxt: FYGE.TextField;
nameTxt: FYGE.TextField;
costTxt: FYGE.TextField;
private image: Sprite;
initUi() {
this.image = this.addChild(Tool.getSprite(`${this.data.name}.png`));
this.image.width = 331;
this.image.height = 286;
this.image.position.set((750 - 331) / 2, 735);
this.nameTxt.text = this.data.name;
this.nameTxt.textWidth = 750;
this.nameTxt.x = 0;
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.desTxt.text = this.data.desc;
this.desTxt.lineType = TEXT_lINETYPE.MULTI;
this.desTxt.textWidth = 550;
this.costTxt.text = this.data.value;
}
start(data) {
super.start();
}
private clickBtn(e) {
switch (e.target) {
case this.closeBtn:
this.reject('点击关闭');
this.hidePanel();
break;
case this.confirmBtn:
sendTbNet(TbNetName.exchangeBag,
{id: this.data.id, type: 'tools'},
(success, res) => {
this.resolve(true); // 不管接口成功失败都要刷新
Tool.getCredits();
this.hidePanel();
if (!success || !res || !res.data) return;
}
);
break;
}
}
initEvents() {
this.closeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.confirmBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.confirmBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
import { getTbData, sendTbNet, TbNetName } from "../TaoBaoNet";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import MouseEvent = FYGE.MouseEvent;
import ConfirmPanel from "../common/IConfirmPanel";
import { closeAllPanels, getCurrentScene } from "../../module/ctrls";
import log10 = FYGE.log10;
import { SquirrelInfo } from "../SquirrelInfo";
import { MainScene } from "../scenes/MainScene";
export class ConfirmUseProp extends ConfirmPanel {
get groupNames() {
return ["确认使用道具卡弹窗"]
}
get skinName() {
return "确认使用道具卡弹窗"
}
closeBtn: FYGE.Button;
useBtn: FYGE.Button;
thinkBtn: FYGE.Button;
txt: FYGE.TextField;
initUi() {
this.txt.textWidth = 750;
this.txt.x = 0;
this.txt.textAlign = TEXT_ALIGN.CENTER;
}
start(data) {
super.start();
console.log(data);
switch (+data.type) {
case 1: // 补签卡
this.txt.text = '确认使用补签卡么';
break;
case 2: // 加速卡
this.txt.text = '确认使用加速卡么';
break;
}
}
private clickBtn(e) {
switch (e.target) {
case this.useBtn:
if (this.data.count <= 0) { // 道具不足就返回
this.reject('道具不足');
this.hidePanel();
return;
}
const curScene: MainScene = getCurrentScene();
if (+this.data.type == 2 && !curScene.isFeeding) { // 不在喂食就返回
this.reject('不在喂食');
this.hidePanel();
return;
}
if(+this.data.type == 1){
this.resolve(true); // 不管接口成功失败都要刷新
this.hidePanel();
return;
}
// 使用道具
sendTbNet(TbNetName.useTool,
{id: this.data.id},
(success, res) => {
this.resolve(true); // 不管接口成功失败都要刷新
if (!success || !res) {
this.hidePanel();
return;
}
if (+this.data.type == 2) { // 如果是加速卡就去加速
console.log('通知加速');
curScene.useSpeedCard(res.data.speedTime);
}
// this.hidePanel();
closeAllPanels();
}
);
break;
case this.thinkBtn:
this.reject('点击再想想');
this.hidePanel();
break;
case this.closeBtn:
this.reject('点击关闭');
this.hidePanel();
break;
}
}
initEvents() {
this.useBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.thinkBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.closeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.useBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.thinkBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
import { Panel } from "../../module/views/Panel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { closeAllPanels, showToast } from "../../module/ctrls";
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import MouseEvent = FYGE.MouseEvent;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import { Tool } from "../Tools";
export class ExSuccessPanel extends Panel {
get groupNames() {
return ["兑换成功弹窗"]
}
get skinName() {
return "兑换成功弹窗"
}
useBtn: FYGE.Button;
nameTxt: FYGE.TextField;
closeBtn: FYGE.Button;
prizeImg: Sprite;
initUi() {
this.prizeImg.width = this.prizeImg.height = 191
this.prizeImg.x = (750 - 191) / 2;
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.nameTxt.textWidth = 500;
this.nameTxt.x = (750 - 500) / 2;
this.y -= 120;
}
start(data) {
super.start();
this.prizeImg.texture = Texture.fromUrl(this.data.image);
this.nameTxt.text = this.data.name;
}
private clickUse() {
this.btnDelay(this.useBtn);
switch (this.data.type) {
case 1: // 权益
sendTbNet(TbNetName.receivePrize, {id: this.data.id},
(success, res) => {
if (!success || !res) return;
if (res.data) {
showToast('奖品发放成功\n请前往我的奖品处查看');
} else {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
}
this.hidePanel();
// closeAllPanels();
}
);
break;
case 3: // 实物
sendTbNet(TbNetName.getUserAddress, {prizeId: this.data.id},
(success, res) => {
if (!success) {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
return;
}
showToast('奖品发放成功\n请前往我的奖品处查看');
}
);
break;
case 2: // 积分
Tool.needShowCoinEffect = 2;
case 5: // 谢谢参与
this.hidePanel();
// closeAllPanels();
break;
}
}
public hidePanel() {
super.hidePanel();
Tool.getCredits();
}
initEvents() {
super.initEvents();
this.useBtn.addEventListener(MouseEvent.CLICK, this.clickUse, this);
}
removeEvents() {
super.removeEvents();
this.useBtn.removeEventListener(MouseEvent.CLICK, this.clickUse, this);
}
public destroy() {
super.destroy();
}
}
import { Panel } from "../../module/views/Panel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { wait } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
export class JoinMemberPanel extends Panel {
get groupNames() { return ["加入会员弹窗"] }
get skinName() { return "加入会员弹窗" }
closeBtn: FYGE.Button;
joinBtn: FYGE.Button;
initUi() {
}
start(data) {
super.start();
}
initEvents() {
super.initEvents();
this.joinBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
this.enableMouseEvt(false);
wait(() => { this.enableMouseEvt(true); }, 2000)
sendTbNet(TbNetName.navigateToOutside, { url: this.data.memberUrl });
//返回时关闭吧
GDispatcher.once(G_EVENT.ON_SHOW, () => { this.hidePanel(); }, this)
}, this)
}
removeEvents() {
super.removeEvents();
}
}
import { Panel } from "../../module/views/Panel";
/**
* 解锁弹框
*/
export class JoinPanel extends Panel {
get groupNames() { return ["加入会员"] }
get skinName() { return "加入会员" }
closeBtn: FYGE.Button; joinBtn: FYGE.Button; txt: FYGE.TextField;
initUi() {
}
start(data) {
super.start();
}
initEvents() {
}
removeEvents() {
}
}
import { Panel } from "../../module/views/Panel";
import { SquirrelInfo } from "../SquirrelInfo";
export class LevelUpPanel extends Panel {
get groupNames() { return ["升级弹窗"] }
get skinName() { return "升级弹窗" }
closeBtn: FYGE.Button;
okBtn: FYGE.Button;
start(data) {
super.start();
var arr: FYGE.Sprite[] = [];
arr[0] = this.getChildByName("小贱", true, true);
arr[1] = this.getChildByName("小美", true, true);
arr[2] = this.getChildByName("小酷", true, true);
arr.forEach((e, index) => {
e.visible = index + 1 == SquirrelInfo.type
})
//toast
var toast = this.getChildByName("升级toast", true, true);
toast.alpha = 0;
FYGE.Tween.get(toast)
.to({ alpha: 1 }, 500)
.wait(1000)
.to({ alpha: 0 }, 500)
}
initEvents() {
[this.okBtn, this.closeBtn].forEach((e) => {
e.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
})
}
removeEvents() {
[this.okBtn, this.closeBtn].forEach((e) => {
e.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
})
}
}
import ConfirmPanel from "../common/IConfirmPanel";
import MouseEvent = FYGE.MouseEvent;
import { Panel } from "../../module/views/Panel";
export class NoCreditsPanel extends Panel {
get groupNames() {
return ["松子币不足弹窗"]
}
get skinName() {
return "松子币不足弹窗"
}
closeBtn: FYGE.Button;
conBtn: FYGE.Button;
cancelBtn: FYGE.Button;
initUi() {
}
start(data) {
super.start();
}
private clickBtn(e){
switch (e.target) {
case this.conBtn:
// this.resolve(false);
this.hidePanel();
break;
case this.cancelBtn:
case this.closeBtn:
// this.resolve(false);
this.hidePanel();
}
}
initEvents() {
this.conBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.cancelBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.closeBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
removeEvents() {
this.conBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.cancelBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
}
}
import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import { Tool } from "../Tools";
import { layers } from "../../module/views/layers";
export class RulePanel extends Panel {
get groupNames() {
return ["rulePanel"]
}
showAni() {
this.alpha = 0;
FYGE.Tween.get(this)
.to({ alpha: 1 }, 500);
}
initUi() {
this.y = -layers.popupLayer.y+layers.stageOffsetY
var scroll = this.addChild(new FYGE.ScrollPage(750, layers.stageHeight, 100, true, true))
scroll.isSpringBack = false;
var arr = [0, 1500, 1040, 1067];
var sumH = 0;
arr.forEach((y, i) => {
sumH += y;
if (i != 3) scroll.view.addChild(Tool.getSprite("rule" + (i + 1) + ".jpg", 0, sumH));
})
scroll.maxDistance = 1500+ 1040+ 1067;
//加个返回按钮
this.addChild(new FYGE.Button(RES.getRes("ruleReturnBtn.png")))
.addEventListener(FYGE.MouseEvent.CLICK, () => {
this.hidePanel();
}, this)
.position.set(0, 60)
}
}
\ No newline at end of file
import { Item } from "../../module/views/Item";
import { Panel } from "../../module/views/Panel";
import { layers } from "../../module/views/layers";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { showConfirm, showPanel } from "../../module/ctrls";
import { ConfirmExchangePanel } from "./ConfirmExchangePanel";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { SquirrelInfo } from "../SquirrelInfo";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import ScrollPage = FYGE.ScrollPage;
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import { TaskPanel } from "./TaskPanel";
import { Tool } from "../Tools";
export class ShopPanel extends Panel {
get groupNames() {
return ["商城弹窗"]
}
get skinName() {
return "商城弹窗"
}
closeBtn: FYGE.Button;
earnBtn: FYGE.Button;
recordBtn: FYGE.Button;
myCoinTxt: FYGE.TextField;
myLevelTxt: FYGE.TextField;
private scrollPage: ScrollPage;
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
this.y = 1624 - layers.stageOffsetY + 100;
const _y = 1624 - this.height - layers.stageOffsetY + 100 - 420 / 2 - 85;
Tween.get(this)
.to({ y: _y }, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
}
initUi() {
this.scrollPage = this.addChild(new ScrollPage(638, 770, 716));
this.scrollPage.position.set(65, 895);
this.myCoinTxt.textAlign = TEXT_ALIGN.CENTER;
this.myCoinTxt.textWidth = 185
this.myCoinTxt.x = 420;
this.myCoinTxt.text = SquirrelInfo.credits + '';
this.myLevelTxt.textAlign = TEXT_ALIGN.CENTER;
this.myLevelTxt.textWidth = 175;
this.myLevelTxt.x = 155;
this.myLevelTxt.text = 'Lv.' + SquirrelInfo.level;
}
start(data) {
super.start();
this.updateShopList();
}
/**
* 更新商店列表
*/
private updateShopList() {
sendTbNet(TbNetName.getExchangeGoodsList, {},
(success, res) => {
if (!success) return;
// 先移除重新加
this.scrollPage.view.removeChildren();
res.data.list.forEach((v, index) => {
let nItem = this.scrollPage.view.addChild(new ProductItem());
nItem.position.set(index % 2 ? 330 : 0, ~~(index / 2) * 366);
nItem.updateData(v);
});
this.scrollPage.maxDistance = (~~(res.data.list.length / 2) + res.data.list.length % 2) * 366;
}
);
}
private clickBtn(e) {
switch (e.target) {
case this.recordBtn:
console.log('我的奖品');
sendTbNet(TbNetName.navigateTo, { url: "/pages/myprize/myprize" },
(success, res) => {
}
);
break;
case this.earnBtn:
this.hidePanel();
showPanel(TaskPanel);
console.log('赚松子币');
break;
}
}
initEvents() {
super.initEvents();
this.recordBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.earnBtn.addEventListener(MouseEvent.CLICK, this.clickBtn, this);
GDispatcher.addEventListener(G_EVENT.UPDATE_SHOP, this.updateShopList, this);
}
removeEvents() {
super.removeEvents();
this.recordBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
this.earnBtn.removeEventListener(MouseEvent.CLICK, this.clickBtn, this);
GDispatcher.removeEventListener(G_EVENT.UPDATE_SHOP, this.updateShopList, this);
}
}
/**
* 商品Item
*/
class ProductItem extends Item {
get skinName() {
return "productItem"
}
nameTxt: FYGE.TextField;
levelLabel: FYGE.TextField;
creditsLabel: FYGE.TextField;
prizeImg: Sprite;
exEnd: Sprite;
exBtn: Button;
initUi(data?) {
this.exBtn.addEventListener(MouseEvent.CLICK, this.clickExBtn, this);
// Tool.changeTextAlign(this.nameTxt,FYGE.TEXT_ALIGN.CENTER,250)
}
updateData(data?) {
this.data = data;
Tool.changeTextAlign(this.nameTxt, FYGE.TEXT_ALIGN.CENTER, 250)
this.nameTxt.text = data.name;
// console.log(this.nameTxt)
this.levelLabel.text = `lv.${data.level}可兑换`;
this.creditsLabel.text = data.credits;
this.prizeImg.texture = Texture.fromUrl(data.image);
// this.prizeImg.width = 247;
this.prizeImg.width = 151;
this.prizeImg.height = 151;
this.prizeImg.x = (this.width - 12 - 151) / 2;
this.exBtn.visible = (data.status == 1);
this.exEnd.visible = !(data.status == 1);
this.exBtn.enabled = SquirrelInfo.credits >= data.credits;
}
/**
* 点击兑换
*/
private clickExBtn() {
showConfirm(ConfirmExchangePanel, this.data).then(
(r) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_SHOP);
},
(e) => {
console.log(e);
}
);
}
public destroy() {
super.destroy();
this.exBtn.removeEventListener(MouseEvent.CLICK, this.clickExBtn, this);
}
initData(id: number, data: any): void {
}
}
import { Item } from "../../module/views/Item";
import { Panel } from "../../module/views/Panel";
import { getTbData, sendTbNet, TbNetName } from "../TaoBaoNet";
import { RES } from "../../module/RES";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { Tool } from "../Tools";
import TextField = FYGE.TextField;
import Sprite = FYGE.Sprite;
import BitmapText = FYGE.BitmapText;
import MouseEvent = FYGE.MouseEvent;
import Container = FYGE.Container;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import VERTICAL_ALIGN = FYGE.VERTICAL_ALIGN;
import { showConfirm, showPanel } from "../../module/ctrls";
import { ConfirmUseProp } from "./ConfirmUseProp";
import { SignPrizePanel } from "./SignPrizePanel";
import Graphics = FYGE.Graphics;
export class SignPanel extends Panel {
get groupNames() {
return ["签到弹窗"]
}
get skinName() {
return "签到弹窗"
}
signToast: FYGE.Container;
closeBtn: FYGE.Button;
signBtn: FYGE.Button;
fill: Sprite;
private prize2: SignBox = null;
private prize3: SignBox = null;
private prize4: SignBox = null;
private signItems: SignItem[] = [];
private curDayData = null;
private fill_mask: Graphics;
initUi() {
this.fill_mask = this.addChild(new Graphics());
// this.fill_mask.beginFill(0xff0000);
this.fill_mask.drawRoundedRect(this.fill.x, this.fill.y, this.fill.width, this.fill.height, 14);
// this.fill_mask.endFill();
this.fill.mask = this.fill_mask;
// signItem
[
[82, 875],
[231, 875],
[380, 875],
[529, 875],
[156, 1126],
[305, 1126],
[454, 1126],
].forEach((v) => {
let newItem = this.addChild(new SignItem());
newItem.position.set(v[0], v[1]);
this.signItems.push(newItem);
});
// signBox
this.prize2 = this.addChild(new SignBox());
this.prize2.position.set(224, 738);
this.prize3 = this.addChild(new SignBox());
this.prize3.position.set(453, 738);
this.prize4 = this.addChild(new SignBox());
this.prize4.position.set(609, 739);
// this.prize2.visible = false;
// this.prize3.visible = false;
// this.prize4.visible = false;
this.addChild(this.removeChild(this.signToast));
this.signToast.visible = false;
let toastText: TextField = this.signToast.getChildByName('text');
toastText.textAlign = TEXT_ALIGN.CENTER;
toastText.verticalAlign = VERTICAL_ALIGN.MIDDLE;
toastText.textWidth = this.signToast.width;
toastText.textHeight = this.signToast.height;
toastText.position.set(0, 2);
}
start(data) {
super.start();
this.updateSignInfo();
}
hidePanel() {
super.hidePanel();
Tool.getCredits();
}
/**
* 更新签到信息
*/
private updateSignInfo() {
sendTbNet(TbNetName.getSignInfo, {},
(success, res) => {
if (!success || !res || !res.data) return;
let { signPrize, signStatus, signTotal, curDay } = res.data;
// console.log(signTotal / 7 - 1);
this.fill_mask.x = (signTotal / 7 - 1) * this.fill.width;
signStatus.forEach((v) => {
v.signTotal = signTotal;
v.curDay = curDay;
if (+v.day == +curDay) {
this.curDayData = v;
this.signBtn.enabled = !v.status;
}
this.signItems[v.day - 1].updateData(v);
});
this.prize2.updateData({ prizeType: 2, day: 2, status: signPrize.prize2 });
this.prize3.updateData({ prizeType: 3, day: 5, status: signPrize.prize3 });
this.prize4.updateData({ prizeType: 4, day: 7, status: signPrize.prize4 });
}
);
}
/**
* 签到
*/
private doSign() {
this.enableMouseEvt(false);
sendTbNet(TbNetName.doSign, {
// day: getTbData(TbNetName.getSignInfo).data.curDay,
reSign: false
},
(success, res) => {
this.enableMouseEvt(true);
if (!success || !res || !res.data) return;
GDispatcher.dispatchEvent(G_EVENT.UPDATE_SIGN);
Tool.needShowCoinEffect = 2;
// Tool.getCredits()
let toastText: TextField = this.signToast.getChildByName('text');
toastText.text = `签到成功,奖励${this.curDayData.credits}松子币`;
this.enableMouseEvt(false);
Tool.customToast(this.signToast, () => {
this.enableMouseEvt(true);
}, 2000, 300);
}
);
}
initEvents() {
super.initEvents();
GDispatcher.addEventListener(G_EVENT.UPDATE_SIGN, this.updateSignInfo, this);
this.signBtn.addEventListener(MouseEvent.CLICK, this.doSign, this);
}
removeEvents() {
super.removeEvents();
GDispatcher.removeEventListener(G_EVENT.UPDATE_SIGN, this.updateSignInfo, this);
this.signBtn.removeEventListener(MouseEvent.CLICK, this.doSign, this);
}
}
const dayMap = {
1: '一', 2: '二', 3: '三', 4: '四', 5: '五', 6: '六', 7: '日',
}
class SignItem extends Item {
get skinName() {
return "signItem"
}
data: any = null;
signDay: FYGE.Sprite;
buQian: FYGE.Sprite;
signStatus: FYGE.Sprite;
prizeValue: BitmapText;
toast: Container;
initUi(data?) {
let ks = {};
['松', '子', '币',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].forEach(value => {
ks[value] = RES.getRes(`${value}.png`);
});
this.prizeValue = this.addChild(new BitmapText(ks));
this.prizeValue.x = (this.width - this.prizeValue.width) / 2;
this.prizeValue.y = 145;
this.prizeValue.width = this.width;
this.prizeValue.textAlign = TEXT_ALIGN.CENTER;
this.swapChildren(this.prizeValue, this.signStatus);
this.buQian.addEventListener(MouseEvent.CLICK, this.reSign, this);
this.signStatus.visible = false;
//默认隐藏
this.buQian.visible = false;
}
/**
* 补签
*/
private reSign() {
let toolData = getTbData(TbNetName.getBagGoodsList).data.tools;
let reSignCarData = null;
for (let i = 0; i < toolData.length; i++) {
if (+toolData[i].type == 1) {
reSignCarData = toolData[i];
}
}
showConfirm(ConfirmUseProp, reSignCarData).then(
(r) => {
this.parent.enableMouseEvt(false);
sendTbNet(TbNetName.doSign, {
day: this.data.day,
reSign: true
},
(success, res) => {
this.parent.enableMouseEvt(true);
if (!success || !res || !res.data) return;
GDispatcher.dispatchEvent(G_EVENT.UPDATE_BAG); // 背包信息
GDispatcher.dispatchEvent(G_EVENT.UPDATE_SIGN); // 更新下签到
Tool.needShowCoinEffect = 2; // 标记需要动画
// Tool.getCredits()
let toastText: TextField = this.parent.signToast.getChildByName('text');
toastText.text = `补签成功,奖励${this.data.credits}松子币`;
// 自定义toast
Tool.customToast(this.parent.signToast, () => {
this.parent.enableMouseEvt(true);
}, 2000, 300);
}
);
},
(e) => {
console.log(e);
if (e == '道具不足') {
let toastText: TextField = this.parent.signToast.getChildByName('text');
toastText.text = `补签卡不足,快去兑换补签卡吧~`;
this.parent.enableMouseEvt(false);
Tool.customToast(this.parent.signToast, () => {
this.parent.enableMouseEvt(true);
}, 2000, 300);
}
}
);
}
updateData(data?) {
this.data = data;
this.signDay.texture = RES.getRes(`周${dayMap[data.day]}.png`);
this.signStatus.visible = data.status;
this.buQian.visible = (!data.status && +data.day < +data.curDay);
this.prizeValue.text = `松子币${data.credits}`;
}
initData(id: number, data: any): void {
super.initData(id, data);
}
resetData() {
}
}
class SignBox extends Item {
data: any;
public dayText: TextField;
public boxEnable: Sprite;
public boxDisable: Sprite;
get skinName() {
return "signBox"
}
initUi(data?) {
this.boxEnable.addEventListener(MouseEvent.CLICK, this.takeSignPrize, this);
}
updateData(data?) {
this.data = data;
this.dayText.text = `${data.day}天`;
let signTotal = this.parent.curDayData.signTotal;
if (data.status) {
this.dayText.alpha = 0.5;
this.boxEnable.visible = false;
this.boxDisable.visible = true;
} else {
if (signTotal >= this.data.day) {
this.dayText.alpha = 1;
this.boxEnable.visible = true;
this.boxDisable.visible = false;
} else {
this.dayText.alpha = 0.5;
this.boxEnable.visible = false;
this.boxDisable.visible = true;
}
}
}
initData(id: number, data: any): void {
super.initData(id, data);
}
private takeSignPrize() {
let signTotal = this.parent.curDayData.signTotal;
if (signTotal < this.data.day) {
return;
}
this.parent.enableMouseEvt(false);
const prizeType = {
2: 2,
5: 3,
7: 4
}
sendTbNet(TbNetName.takeSignPrize, { prizeType: prizeType[this.data.day] },
(success, res) => {
this.parent.enableMouseEvt(true);
if (!success || !res || !res.data) return;
res.data.day = this.data.day;
showPanel(SignPrizePanel, res.data);
GDispatcher.dispatchEvent(G_EVENT.UPDATE_SIGN);
}
);
}
resetData() {
}
}
import { Panel } from "../../module/views/Panel";
import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import MouseEvent = FYGE.MouseEvent;
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { showToast } from "../../module/ctrls";
import Button = FYGE.Button;
import TextField = FYGE.TextField;
import { Tool } from "../Tools";
import { RES } from "../../module/RES";
export class SignPrizePanel extends Panel {
get groupNames() {
return ["连续签到奖励弹窗"]
}
get skinName() {
return "连续签到奖励弹窗"
}
useBtn: Button;
nameTxt: TextField;
tipsTxt: TextField;
closeBtn: Button;
prizeImg: Sprite;
initUi() {
this.nameTxt.textAlign = TEXT_ALIGN.CENTER;
this.nameTxt.textWidth = 750;
this.nameTxt.x = 0;
this.tipsTxt.textAlign = TEXT_ALIGN.CENTER;
this.tipsTxt.textWidth = 750;
this.tipsTxt.x = 0;
}
start(data) {
super.start();
if (+data.type == 2) {
// 588 * 464
this.prizeImg.texture = RES.getRes('signCredits.png');
this.prizeImg.width = 554;
this.prizeImg.height = 464;
this.prizeImg.y = 830;
} else {
this.prizeImg.texture = Texture.fromUrl(data.image);
this.prizeImg.width = this.prizeImg.height = 191;
this.prizeImg.y = 960;
}
this.prizeImg.x = (750 - this.prizeImg.width) / 2;
this.tipsTxt.text = `连续签到${data.day}天,送你一个小礼物`;
this.nameTxt.text = data.name;
}
private clickUse() {
this.btnDelay(this.useBtn);
switch (this.data.type) {
case 1: // 权益
sendTbNet(TbNetName.receivePrize, {},
(success, res) => {
if (!success || !res) return;
if (res.data) {
showToast('奖品发放成功\n请前往我的奖品处查看');
} else {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
}
this.hidePanel();
}
);
break;
case 3: // 实物
sendTbNet(TbNetName.getUserAddress, {prizeId: this.data.id},
(success, res) => {
if (!success) {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
return;
}
showToast('奖品发放成功\n请前往我的奖品处查看');
}
);
break;
case 2: // 积分
Tool.needShowCoinEffect = 2;
case 5: // 谢谢参与
this.hidePanel();
break;
}
}
public hidePanel() {
super.hidePanel();
Tool.getCredits();
}
initEvents() {
super.initEvents();
this.useBtn.addEventListener(MouseEvent.CLICK, this.clickUse, this);
}
removeEvents() {
super.removeEvents();
this.useBtn.removeEventListener(MouseEvent.CLICK, this.clickUse, this);
}
public destroy() {
super.destroy();
}
}
import { Item } from "../../module/views/Item";
import { Panel } from "../../module/views/Panel";
import { layers } from "../../module/views/layers";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import ScrollList = FYGE.ScrollList;
import Event = FYGE.Event;
import { hideWaiting, showWaiting } from "../../module/ctrls";
export class SquirrelNewsPanel extends Panel {
get groupNames() {
return ["松鼠动态弹窗"]
}
get skinName() {
return "松鼠动态弹窗"
}
closeBtn: FYGE.Button;
private scroll: ScrollList;
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
this.y = 1624 - layers.stageOffsetY + 100;
const _y = 1624 - this.height - layers.stageOffsetY + 100 - 420 / 2 - 280;
Tween.get(this)
.to({ y: _y }, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
}
initUi() {
this.scroll = this.addChild(
new ScrollList(
DongtaiItem,
703, 116,
703, 774)
);
this.scroll.position.set((750 - 703) / 2, 845);
this.scroll.visible = false;
}
private pageNo: number = 1;
private total: number = 0;
private loadFull: boolean = false;
private updateScrollList() {
if (this.loadFull) {
return;
}
const pageSize = 20;
showWaiting("加载中");
sendTbNet(TbNetName.getActionInfo,
{ pageNo: this.pageNo++, pageSize: 20 },
(success, res) => {
hideWaiting();
if (!success || !res || !res.data) return;
this.total += pageSize; // 加上pageSize
if (this.total >= res.data.total) { // 如果超过了总数则下次不继续加载
this.loadFull = true;
}
// 更新列表
this.scroll.updateData(res.data.list, false);
this.scroll.visible = true;
}
);
}
start(data) {
super.start();
this.updateScrollList();
}
initEvents() {
super.initEvents();
this.scroll.addEventListener(Event.SCROLL_TO_END, this.updateScrollList, this);
}
removeEvents() {
super.removeEvents();
this.scroll.removeEventListener(Event.SCROLL_TO_END, this.updateScrollList, this);
}
}
class DongtaiItem extends Item {
get skinName() {
return "dongtaiItem"
}
time: FYGE.TextField;
done: FYGE.TextField;
things: FYGE.TextField;
rect2: FYGE.Graphics;
rect1: FYGE.Graphics;
rect0: FYGE.Sprite;
initUi(data?) {
this.rect0.y += 2;
this.rect0.width += 4;
this.rect0.x -= 2;
}
updateData(data?) {
}
resetData() {
this.rect0.visible = this.rect1.visible = this.rect2.visible = false;
}
initData(id: number, data: any): void {
if (id < 0 || !data) {
return;
}
this.resetData();
(id == 0)
? this.rect0.visible = true
: (
(id % 2 == 1)
? this.rect1.visible = true
: this.rect2.visible = true
);
this.done.text = data.message;
this.things.text = `${+data.valueStatus == 1 ? "获得" : "消耗"}${data.value}松子币`;
this.things.fillColor = +data.valueStatus == 1 ? "#e95d5f" : "#5de95f";
let now = new Date();
let date = new Date(+data.createTime);
if (now.getDate() == date.getDate()) {
this.time.text = '今天';
} else if (now.getDate() == date.getDate() - 1) {
this.time.text = '昨天';
} else {
this.time.text = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
}
}
}
import { Panel } from "../../module/views/Panel";
export class SucAdoptPanel extends Panel {
get groupNames() { return ["成功领养弹窗"] }
get skinName() { return "成功领养弹窗" }
closeBtn:FYGE.Button;
xiaomei:FYGE.Sprite;
xiaojian:FYGE.Sprite;
xiaoku:FYGE.Sprite;
initUi() {
}
start(data) {
super.start();
}
initEvents() {
}
removeEvents() {
}
}
import { Item } from "../../module/views/Item";
import { Panel } from "../../module/views/Panel";
import { layers } from "../../module/views/layers";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { RES } from "../../module/RES";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { showToast } from "../../module/ctrls";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import ScrollList = FYGE.ScrollList;
import Button = FYGE.Button;
import Sprite = FYGE.Sprite;
import TextField = FYGE.TextField;
import MouseEvent = FYGE.MouseEvent;
import { Tool } from "../Tools";
import { clickLog, LogEnum } from "../log";
enum TaskEnum {
attentionStoreTask = 'attentionStoreTask',
browseTask = 'browseTask',
collectTask = 'collectTask',
inviteTask = 'inviteTask',
secretTask = 'secretTask',
messageTask = 'messageTask',
buyTask = 'buyTask',
}
const staticTaskData = {
[TaskEnum.attentionStoreTask]: {
icon: "task_关注店铺.png", // icon
title: '关注店铺',
isLook: false, // 是否是去看看任务
},
[TaskEnum.browseTask]: {
icon: "task_浏览商品.png", // icon
title: '浏览商品',
isLook: false, // 是否是去看看任务
},
[TaskEnum.collectTask]: {
icon: "task_收藏商品.png", // icon
title: '收藏商品',
isLook: false, // 是否是去看看任务
},
[TaskEnum.inviteTask]: {
icon: "task_分享好友.png", // icon
title: '分享好友',
isLook: false, // 是否是去看看任务
},
[TaskEnum.secretTask]: {
icon: "task_松鼠密令.png", // icon
title: '松鼠密令',
isLook: true, // 是否是去看看任务
},
[TaskEnum.messageTask]: {
icon: "task_完善资料.png", // icon
title: '完善资料',
isLook: true, // 是否是去看看任务
},
[TaskEnum.buyTask]: {
icon: "task_购买商品.png", // icon
title: '购买商品',
isLook: true, // 是否是去看看任务
},
}
export class TaskPanel extends Panel {
get groupNames() {
return ["taskPanel"]
}
get skinName() {
return "taskPanel"
}
closeBtn: Button;
private scroll: ScrollList;
public showAni() {
if (this.isShowing) return;
this.isShowing = true;
this.y = 1624 - layers.stageOffsetY + 100;
const _y = 1624 - this.height - layers.stageOffsetY + 420 / 2;
Tween.get(this)
.to({y: _y}, 500, Ease.quartOut)
.call(() => {
this.isShowing = false;
});
}
initUi() {
this.scroll = this.addChild(
new ScrollList(
TaskItem,
700, 174,
700, 775)
);
this.scroll.position.set((750 - 700) / 2, 849);
}
private updateTaskList() {
sendTbNet(TbNetName.getTaskList, {},
(success, res) => {
if (!success || !res || !res.data) return;
const taskList = [];
for (let k in staticTaskData) {
let taskData = res.data.taskList[k];
if (k == TaskEnum.attentionStoreTask && taskData.status == 3) {
continue;
}
if (taskData) {
taskData.id = k;
taskList.push(taskData);
}
}
// 更新列表
this.scroll.updateData(taskList, true);
}
);
}
start(data) {
super.start();
this.updateTaskList();
}
hidePanel() {
super.hidePanel();
//为了引导
GDispatcher.dispatchEvent("guideStep");
}
initEvents() {
super.initEvents();
GDispatcher.addEventListener(G_EVENT.UPDATE_TASK, this.updateTaskList, this);
GDispatcher.addEventListener(G_EVENT.ON_SHOW, this.updateTaskList, this);
}
removeEvents() {
super.removeEvents();
GDispatcher.removeEventListener(G_EVENT.UPDATE_TASK, this.updateTaskList, this);
GDispatcher.removeEventListener(G_EVENT.ON_SHOW, this.updateTaskList, this);
}
}
class TaskItem extends Item {
data: any;
public taskIcon: Sprite;
public taskPro: TextField;
public taskDesc: TextField;
public taskTitle: TextField;
public done: Sprite;
public goBtn: Button;
public getBtn: Button;
public lookBtn: Button;
get skinName() {
return "taskItem"
}
initUi(data?) {
this.goBtn.addEventListener(MouseEvent.CLICK, this.goTask, this);
this.getBtn.addEventListener(MouseEvent.CLICK, this.getPrize, this);
this.lookBtn.addEventListener(MouseEvent.CLICK, this.goLook, this);
}
private goTask() {
Tool.btnDelay(this.goBtn);
switch (this.data.id) {
case TaskEnum.attentionStoreTask:
clickLog(LogEnum.FOLLOW_SHOP);
sendTbNet(TbNetName.favorShop, {},
(success, res) => {
if (!success) {
return;
}
sendTbNet(TbNetName.doTaskComplete, {taskName: this.data.id},
(success, res) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
if (!success) return;
}
);
}
);
break;
case TaskEnum.browseTask:
clickLog(LogEnum.BROWSE_PRODUCT);
sendTbNet(TbNetName.navigateTo, {url: "/pages/browse/browse"},
(success, res) => {
}
);
break;
case TaskEnum.collectTask:
clickLog(LogEnum.COLLECTION_PRODUCT);
sendTbNet(TbNetName.navigateTo, {url: "/pages/collection/collection"},
(success, res) => {
}
);
break;
case TaskEnum.inviteTask:
clickLog(LogEnum.INVITE_FRIEND);
sendTbNet(TbNetName.showSharePanel, {openId: Tool.globalData.openId},
(success, res) => {
}
);
break;
}
}
private getPrize() {
Tool.btnDelay(this.getBtn);
sendTbNet(TbNetName.takeTaskPrize, {taskName: this.data.id},
(success, res) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
if (!success) return;
const count = ~~(res.data.credits / this.data.value);
(this.data.id == TaskEnum.inviteTask)
? showToast(`成功邀请${count}名好友,获得${res.data.credits}个松子`)
: showToast(`任务完成,获得${res.data.credits}个松子`);
}
);
}
private goLook() {
if (this.data.id == TaskEnum.buyTask) {
clickLog(LogEnum.BUY_PRODUCT);
} else if (this.data.id == TaskEnum.secretTask) {
clickLog(LogEnum.SECRET_ORDER);
} else if (this.data.id == TaskEnum.messageTask) {
clickLog(LogEnum.IMPROVE_INFORMATION);
}
Tool.btnDelay(this.lookBtn);
console.log('去看看');
sendTbNet(TbNetName.navigateToOutside, {url: this.data.url},
(success, res) => {
if (!success) return;
}
);
}
public destroy() {
super.destroy();
this.goBtn.removeEventListener(MouseEvent.CLICK, this.goTask, this);
this.getBtn.removeEventListener(MouseEvent.CLICK, this.getPrize, this);
this.lookBtn.removeEventListener(MouseEvent.CLICK, this.goLook, this);
}
resetData() {
this.goBtn.visible = false;
this.lookBtn.visible = false;
this.getBtn.visible = false;
this.done.visible = false;
}
initData(id: number, data: any): void {
if (id < 0 || !data) {
return;
}
this.data = data;
this.resetData();
const staticData = staticTaskData[data.id];
this.taskIcon.texture = RES.getRes(staticData.icon);
this.taskTitle.text = staticData.title;
if (staticData.isLook) { // 是去看看
this.lookBtn.visible = true;
this.taskDesc.text = '';
this.taskPro.text = '';
} else {
this.goBtn.visible = (data.status == 1);
this.getBtn.visible = (data.status == 2);
this.done.visible = (data.status == 3);
// if (+data.type == 1) {
// this.taskDesc.text = `可获得${data.value}松子币`;
// this.taskPro.text = `永久${data.taskTotal || 1}次`;
// } else
this.taskDesc.text = `可获得${data.value}松子币`;
if (+data.type == 2) {
this.taskPro.text = `今日剩余次数${data.taskCount}/${data.taskTotal}`;
} else {
// this.taskDesc.text = `可获得${data.value}松子币`;
this.taskPro.text = `永久${data.taskTotal || 1}次`;
}
}
// if (data.id == TaskEnum.attentionStoreTask && +data.status == 1 && Tool.globalData.isFollow) {
// sendTbNet(TbNetName.doTaskComplete, {taskName: this.data.id},
// (success, res) => {
// GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
// if (!success) return;
// }
// );
// }
}
updateData(data?) {
}
}
import { Panel } from "../../module/views/Panel";
import MouseEvent = FYGE.MouseEvent;
import TextField = FYGE.TextField;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
export class UnlockDressPanel extends Panel {
get groupNames() {
return ["解锁装扮弹窗"]
}
get skinName() {
return "解锁装扮弹窗"
}
closeBtn: FYGE.Button;
designBtn: FYGE.Button;
tipsLabel: TextField;
initUi() {
this.tipsLabel.textWidth = 750;
this.tipsLabel.textAlign = TEXT_ALIGN.CENTER;
this.tipsLabel.x = 0;
this.tipsLabel.size = 30;
}
start(data) {
super.start();
console.log(data);
this.tipsLabel.text = `兑换成功,已解锁装扮${this.data.name}`;
}
initEvents() {
super.initEvents();
this.designBtn.addEventListener(MouseEvent.CLICK, this.hidePanel, this);
}
removeEvents() {
super.removeEvents();
this.designBtn.removeEventListener(MouseEvent.CLICK, this.hidePanel, this);
}
}
import { Tool } from "../Tools";
import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import { Light } from "../parts/Light";
const foodData: {
[key: number]: { name: string, des: string }
} = {
8: { name: "爆浆麻薯150g*2袋", des: "" },
16: { name: "面筋卷120g*2袋", des: "" },
32: { name: "岩焗乳酪吐司500g", des: "" },
64: { name: "鱼豆腐170g", des: "" },
128: { name: "猪肉脯200g", des: "解锁后可在首页领取奖励哦~" },
256: { name: "卤藕168g*2袋", des: "解锁后可在首页领取奖励哦~" },
512: { name: "手撕面包1050g", des: "解锁后可在首页领取奖励哦~" },
1024: { name: "枣夹核桃700g", des: "解锁后可在首页领取奖励哦~" },
2048: { name: "甜辣鸭脖190g", des: "解锁后可在首页领取奖励哦~" },
}
/**
* 解锁弹框
*/
export class UnlockPanel extends Panel {
get groupNames() { return ["unlockPanel"] }
closeBtn:FYGE. Button;
data: {
grade: number,
closeFun:Function
}
initUi() {
//加光
this.addChild(new Light()).position.set(375, 735);
//背景
this.addChild(Tool.getSprite("unlockPanelBg.png"));
//关闭按钮
this.closeBtn = new FYGE.Button(RES.getRes("comCloseBtn.png"));
this.closeBtn.position.set(614, 460);
this.addChild(this.closeBtn);
//继续游戏
this.addChild(new FYGE.Button(RES.getRes("zailaiyiju.png")))
.once(FYGE.MouseEvent.CLICK, this.onClick_closeBtn, this)
.position.set((750 - 233) / 2, 938)
//标题文案
// this.addChild(new Title(this.data.grade))
//奖品图片 246;
this.addChild(new FYGE.Sprite(RES.getRes("unlock" + this.data.grade + ".png")))
.position.set((750 - 449) / 2-20, 580+20)
//名字
// this.addChild(Tool.addText(
// foodData[this.data.grade].name,
// 28,
// "#ffffff",
// undefined,
// 560,
// (750 - 560) / 2,
// 890
// ))
//描述
// this.addChild(Tool.addText(
// foodData[this.data.grade].des,
// 22,
// "#dac5fc",
// undefined,
// 560,
// (750 - 560) / 2,
// 931
// ))
}
start(data) {
super.start();
}
initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK,this.onClick_closeBtn, this)
}
onClick_closeBtn() {
this.data.closeFun()
this.hidePanel();
}
removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK,this.onClick_closeBtn, this)
}
}
class Title extends FYGE.Container {
grade: number
constructor(grade: number) {
super();
var msg = new FYGE.Sprite(RES.getRes("unlockMsg.png"))
this.addChild(msg);
var textures = {}
for (var i = 0; i < 10; i++)textures[i] = RES.getRes("n" + i + ".png");
var num = new FYGE.BitmapText(textures);
num.textAlign = FYGE.TEXT_ALIGN.LEFT;
num.text = grade + "";
this.addChild(num);
var w = msg.width + num.width;
msg.position.set((750 - w) / 2, 548);
num.position.set(msg.x + msg.width, 548 + 4)
}
}
\ No newline at end of file
import { Tool } from "../Tools";
import { SquirrelType } from "./Squirrels"
import { SquirrelInfo } from "../SquirrelInfo";
import { GTool } from "../../module/tools/GTool";
/**
* 话语
*/
const msg = {
[SquirrelType.xiaojian]: [
"嘻嘻,吃零食我是专业的!",
"主人来看我了好开心!",
"主人好呀!",
"主人,快来和我一起玩耍!",
"主人,我想你啦~",
"主人,我想一直陪在您身边呢",
"主人 ~你终于来看小贱啦",// "主人 ~你终于来看小美/贱/酷啦",
"哇喔,我可喜欢吃啦",
"吃饱饱喝饱饱好幸福呀",
],
[SquirrelType.xiaomei]: [
"主人,来一起看书嘛~",
"吃果干我是专业呦!",
"主人,多喝热水呦~",
"主人,快来和我一起玩~",
"主人我好想你呀~",
"主人,我想要您陪在身边呢",
"主人,我要认真看会书啦!",
"吃饱饱喝饱饱好幸福呀",
"主人最喜欢哪本书呀!",
"主人好呀!"
],
[SquirrelType.xiaoku]: [
"动人的旋律送给主人",
"嘻嘻,吃坚果我是专业的!",
"主人来看我了好开心!",
"主人,快来和我一起玩耍吧!",
"主人 我想你啦!",
"小酷想弹首吉他给主人听听呢",
"小酷最近有学新歌喔\n想弹给主人听听~",
"吃饱饱喝饱饱好幸福呀!",
"思考人生ing",
"主人好呀!"
],
}
/**
* 间隔时间和动效,外面定?
*/
export class Bubble extends FYGE.Container {
// set txt(value) {
// this._txt = value;
// }
private _txt: FYGE.TextField;
constructor() {
super();
this.addChild(Tool.getSprite("bubbleBg.png"))
this._txt = this.addChild(Tool.getText(
"",
26,
"#ffffff",
FYGE.TEXT_ALIGN.CENTER,
366
));
this._txt.verticalAlign = FYGE.VERTICAL_ALIGN.MIDDLE;
this._txt.textHeight = 86;
this._txt.lineSpacing = 7;
this.anchor.set(159, 103);
}
/**
* 随机文案
*/
randomTxt() {
this._txt.text = GTool.randomT(msg[SquirrelInfo.type]);
}
}
\ No newline at end of file
import { RES } from "../../module/RES";
import { Tool } from "../Tools";
import { MainScene } from "../scenes/MainScene";
import { removeTweens } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { GTool } from "../../module/tools/GTool";
/**
* 游戏引导
*/
export class Guide extends FYGE.Container {
/**
* 背景黑色蒙层
*/
private bg: FYGE.Shape;
private bgF: FYGE.Graphics;
private guideImg: FYGE.Sprite;
private btn: FYGE.Button;
private hand: Hand;
private _step: GuideStep;
get step() {
return this._step;
}
set step(value: GuideStep) {
if (this._step != value) {
this._step = value;
if (this._step > GuideStep.shop) {
//结束后,直接destroy
this.destroy();
} else {
if (this._step == GuideStep.task) { //喂食的过了,写缓存
GTool.writeCache(Tool.cacheKey, "true")
}
FYGE.Tween.removeTweens(this)
this.alpha = 0;
FYGE.Tween.get(this)
.to({ alpha: 1 }, 500)
this.showGuide();
}
}
}
/**
* 直接把this传入得了
* @param thisObj
*/
constructor() {
super();
// this.touchEnabled = true;
this.bg = new FYGE.Shape()
this.addChild(this.bg);
this.bgF = new FYGE.Graphics();
this.addChild(this.bgF).alpha = 0;
this.guideImg = new FYGE.Sprite();
this.addChild(this.guideImg);
this.btn = new FYGE.Button(RES.getRes("guideKnowBtn.png"))
this.addChild(this.btn);
this.hand = this.addChild(new Hand());
this.hand.visible = false;
this.hand.mouseEnable = false;
this.btn.addEventListener(FYGE.MouseEvent.CLICK, this.stepEvent, this)
this.step = 0;
GDispatcher.addEventListener("guideStep", this.stepEvent, this);
}
stepEvent() {
this.step++;
}
/**
* 显示引导
*/
showGuide() {
var config = guideConfigs[this._step];
//引导图片的位置
this.guideImg.visible = !!config.img
if (config.img) {
this.guideImg.texture = RES.getRes(config.img.res);
this.guideImg.x = config.img.p[0];
this.guideImg.y = config.img.p[1];
}
//按钮
this.btn.visible = !!config.btn
if (config.btn) {
this.btn.x = config.btn.p[0];
this.btn.y = config.btn.p[1];
this.btn.textureUp = RES.getRes(config.btn.res);
this.btn.texture = RES.getRes(config.btn.res);
}
//手势
this.hand.visible = !!config.hand;
if (config.hand) {
this.hand.position.set(config.hand.p[0], config.hand.p[1]);
this.hand.rotation = config.hand.rotation;
}
//先画背景
this.bg.clear();
this.bg.beginFill(0x000000, 0.7);
this.drawRect();
for (var i = 0; i < config.circles.length; i++) {
var c = config.circles[i];
this.bg.moveTo(c.p[0] + c.radius, c.p[1]);
this.bg.drawCircle(c.p[0], c.p[1], c.radius, false);
}
this.bg.endFill();
//临时添加
this.bg.updateShape()
this.bg["_onTextureUpdate"]();
//临时方案
if (FYGE.osType != "ios") return;
this.bgF.clear();
this.bgF.beginFill(0x000000);
this.bgF.drawRect(0, 0, 750, 1624);
this.bgF.endFill();
for (var i = 0; i < config.circles.length; i++) {
var c = config.circles[i];
// this.bgF.moveTo(c.p[0] + c.radius, c.p[1]);
this.bgF.beginHole();
this.bgF.drawCircle(c.p[0], c.p[1], c.radius);
this.bgF.endHole();
}
}
private drawRect() {
//逆时针
this.bg.moveTo(0, 0);
this.bg.lineTo(0, 1624);
this.bg.lineTo(750, 1624);
this.bg.lineTo(750, 0);
this.bg.lineTo(0, 0);
}
destroy() {
this.guideImg = null;
this.hand = null;
this.bg = null;
this.btn = null;
removeTweens(this);
GDispatcher.removeEventListener("guideStep", this.stepEvent, this);
super.destroy();
}
}
/**
* 游戏引导的几步操作
*/
export enum GuideStep {
feed = 0,
task,
closeTask,
generate,
shop,
}
/**
* 引导参数
*/
const guideConfigs: { [guideStep: number]: guideConfigInt } = {
//喂食
[GuideStep.feed]: {
img: {
res: "guide1.png",
p: [300, 1304]
},
circles: [
{ radius: 246, p: [369, 1040] },
{ radius: 105, p: [640, 1448] },
],
hand: {
rotation: 180,
p: [660, 1343]
}
},
//点击任务
[GuideStep.task]: {
img: {
res: "guide2.png",
p: [294, 1334]
},
circles: [
{ radius: 87, p: [422, 1466] },
],
hand: {
rotation: 250,
p: [484, 1470]
}
},
//点击关闭任务
[GuideStep.closeTask]: {
circles: [
{ radius: 60, p: [685, 1624 - 908 - 420 / 2 + 143] },
],
hand: {
rotation: 0,
p: [685 - 20, 1624 - 908 - 420 / 2 + 143 + 60]
}
},
[GuideStep.generate]: {
img: {
res: "guide3.png",
p: [(750 - 404) / 2, 1348]
},
circles: [
{ radius: 118, p: [140, 1214] },
],
btn: {
res: "nextStep.png",
p: [306, 1427]
}
},
[GuideStep.shop]: {
img: {
res: "guide4.png",
p: [(750 - 450) / 2, 1334]
},
circles: [
{ radius: 90, p: [270, 1472] },
],
btn: {
res: "guideKnowBtn.png",
p: [294, 1262]
}
},
// [GuideStep.block]: {
// btn: [(750 - 195) / 2, 1030],
// img: [0, 0],
// res: "guide3.png",
// },
// [GuideStep.hole]: {
// btn: [(750 - 195) / 2, 1100],
// img: [0, 0],
// res: "guide4.png",
// },
// [GuideStep.zongzi]: {
// btn: [(750 - 195) / 2, 1030],
// img: [0, 0],
// res: "guide5.png",
// },
}
interface guideConfigInt {
btn?: {
res: string,
p: [number, number],
},
img?: {
res: string//引导图片,
p: [number, number]//图片位置
},
hand?: {
rotation?: number//手势旋转
p?: [number, number]//手势位置
}
/**
* 所有的洞
*/
circles: {
radius: number,
p: [number, number]
}[]
}
/**
* 手势
*/
class Hand extends FYGE.Container {
constructor() {
super();
var hand = this.addChild(Tool.getSprite("guideHand.png"))
FYGE.Tween.get(hand, { loop: true })
.to({ y: -50 }, 300)
.to({ y: 0 }, 300)
.wait(400)
}
}
\ No newline at end of file
import { RES } from "../../module/RES";
import { Tool } from "../Tools";
import { MainScene } from "../scenes/MainScene";
import { removeTweens } from "../../module/ctrls";
import { GDispatcher } from "../Main";
import { GTool } from "../../module/tools/GTool";
/**
* 游戏引导
*/
export class Guide extends FYGE.Container {
/**
* 背景黑色蒙层
*/
private bg: FYGE.Graphics;
private guideImg: FYGE.Sprite;
private btn: FYGE.Button;
private hand: Hand;
private _step: GuideStep;
get step() {
return this._step;
}
set step(value: GuideStep) {
if (this._step != value) {
this._step = value;
if (this._step > GuideStep.shop) {
//结束后,直接destroy
this.destroy();
} else {
if (this._step == GuideStep.task) { //喂食的过了,写缓存
GTool.writeCache(Tool.cacheKey, "true")
}
FYGE.Tween.removeTweens(this)
this.alpha = 0;
FYGE.Tween.get(this)
.to({ alpha: 1 }, 500)
this.showGuide();
}
}
}
/**
* 直接把this传入得了
* @param thisObj
*/
constructor() {
super();
// this.touchEnabled = true;
this.bg = new FYGE.Graphics()
this.addChild(this.bg);
this.guideImg = new FYGE.Sprite();
this.addChild(this.guideImg);
this.btn = new FYGE.Button(RES.getRes("guideKnowBtn.png"))
this.addChild(this.btn);
this.hand = this.addChild(new Hand());
this.hand.visible = false;
this.hand.mouseEnable = false;
this.btn.addEventListener(FYGE.MouseEvent.CLICK, this.stepEvent, this)
this.step = 0;
GDispatcher.addEventListener("guideStep", this.stepEvent, this);
}
stepEvent() {
this.step++;
}
/**
* 显示引导
*/
showGuide() {
var config = guideConfigs[this._step];
//引导图片的位置
this.guideImg.visible = !!config.img
if (config.img) {
this.guideImg.texture = RES.getRes(config.img.res);
this.guideImg.x = config.img.p[0];
this.guideImg.y = config.img.p[1];
}
//按钮
this.btn.visible = !!config.btn
if (config.btn) {
this.btn.x = config.btn.p[0];
this.btn.y = config.btn.p[1];
this.btn.textureUp = RES.getRes(config.btn.res);
this.btn.texture = RES.getRes(config.btn.res);
}
//手势
this.hand.visible = !!config.hand;
if (config.hand) {
this.hand.position.set(config.hand.p[0], config.hand.p[1]);
this.hand.rotation = config.hand.rotation;
}
//先画背景
this.bg.clear();
this.bg.beginFill(0x000000, 0.7);
this.drawRect();
for (var i = 0; i < config.circles.length; i++) {
var c = config.circles[i];
this.bg.beginHole();
// this.bg.moveTo(c.p[0] + c.radius, c.p[1]);
this.bg.drawCircle(c.p[0], c.p[1], c.radius);
this.bg.endHole();
}
this.bg.endFill();
//临时添加
// this.bg.updateShape()
// this.bg["_onTextureUpdate"]()
}
private drawRect() {
//逆时针
this.bg.moveTo(0, 0);
this.bg.lineTo(750, 0);
this.bg.lineTo(750, 1624);
this.bg.lineTo(0, 1624);
this.bg.lineTo(0, 0);
}
destroy() {
this.guideImg = null;
this.hand = null;
this.bg = null;
this.btn = null;
removeTweens(this);
GDispatcher.removeEventListener("guideStep", this.stepEvent, this);
super.destroy();
}
}
/**
* 游戏引导的几步操作
*/
export enum GuideStep {
feed = 0,
task,
closeTask,
generate,
shop,
}
/**
* 引导参数
*/
const guideConfigs: { [guideStep: number]: guideConfigInt } = {
//喂食
[GuideStep.feed]: {
img: {
res: "guide1.png",
p: [300, 1304]
},
circles: [
{ radius: 246, p: [369, 1040] },
{ radius: 105, p: [640, 1448] },
],
hand: {
rotation: 180,
p: [660, 1343]
}
},
//点击任务
[GuideStep.task]: {
img: {
res: "guide2.png",
p: [294, 1334]
},
circles: [
{ radius: 87, p: [422, 1466] },
],
hand: {
rotation: 250,
p: [484, 1470]
}
},
//点击关闭任务
[GuideStep.closeTask]: {
circles: [
{ radius: 60, p: [685, 1624 - 908 - 420 / 2 + 143] },
],
hand: {
rotation: 0,
p: [685 - 20, 1624 - 908 - 420 / 2 + 143 + 60]
}
},
[GuideStep.generate]: {
img: {
res: "guide3.png",
p: [(750 - 404) / 2, 1348]
},
circles: [
{ radius: 118, p: [140, 1214] },
],
btn: {
res: "nextStep.png",
p: [306, 1427]
}
},
[GuideStep.shop]: {
img: {
res: "guide4.png",
p: [(750 - 450) / 2, 1334]
},
circles: [
{ radius: 90, p: [270, 1472] },
],
btn: {
res: "guideKnowBtn.png",
p: [294, 1262]
}
},
// [GuideStep.block]: {
// btn: [(750 - 195) / 2, 1030],
// img: [0, 0],
// res: "guide3.png",
// },
// [GuideStep.hole]: {
// btn: [(750 - 195) / 2, 1100],
// img: [0, 0],
// res: "guide4.png",
// },
// [GuideStep.zongzi]: {
// btn: [(750 - 195) / 2, 1030],
// img: [0, 0],
// res: "guide5.png",
// },
}
interface guideConfigInt {
btn?: {
res: string,
p: [number, number],
},
img?: {
res: string//引导图片,
p: [number, number]//图片位置
},
hand?: {
rotation?: number//手势旋转
p?: [number, number]//手势位置
}
/**
* 所有的洞
*/
circles: {
radius: number,
p: [number, number]
}[]
}
/**
* 手势
*/
class Hand extends FYGE.Container {
constructor() {
super();
var hand = this.addChild(Tool.getSprite("guideHand.png"))
FYGE.Tween.get(hand, { loop: true })
.to({ y: -50 }, 300)
.to({ y: 0 }, 300)
.wait(400)
}
}
\ No newline at end of file
import { loadSvga, SvgaUrls } from "../svga";
import { RES } from "../../module/RES";
export enum SquirrelType {
xiaojian = 1,
xiaomei,
xiaoku,
}
//资源组用xiaojianDress , xiaomeiDress , xiaokuDress
export const SquirrelsData = {
[SquirrelType.xiaojian]: {
name: "小贱",
cusName: "xiaojian",
// des: "藐视大圣诞期温柔哇容器温热去微软去微软奇瑞奇瑞去容器容器文如其人哦亲我让",
dressIds: ["dress1", "dress2", "dress3"] //取装扮数据,直接根据id索引
},
[SquirrelType.xiaomei]: {
name: "小美",
cusName: "xiaomei",
// des: "藐视大圣诞期温柔哇容器温热去微软去微软奇瑞奇瑞去容器容器文如其人",
dressIds: ["dress4", "dress5", "dress6"]
},
[SquirrelType.xiaoku]: {
name: "小酷",
cusName: "xiaoku",
// des: "藐视大圣诞期温柔哇容器温热去微软去微软奇瑞奇瑞去容器容器文",
dressIds: ["dress7", "dress8", "dress9"]
},
}
/**
* 缓存的松鼠mv,key类似xiaomei_k_c_dress1
*/
const SquirrelsCaches = {
}
export async function createSquirrel(
squirrelType: SquirrelType,
isKid: boolean,
isFeeding: boolean,
dressId?: string,
): Promise<FYGE.MovieClip> {
console.log(isKid)
var urlKey = SquirrelType[squirrelType] + "_" + (isKid ? "k" : "a") + "_" + (isFeeding ? "f" : "c");
//装扮数据
//取装扮数据
var dressData = !dressId ? null : designJson
[
SquirrelType[squirrelType]//取松鼠类型
][
isFeeding ? 1 : 0 //判断是否喂养状态下标
][
SquirrelsData[squirrelType].dressIds.indexOf(dressId) //找对应装扮的下标
]
var cacheKey = urlKey + (dressId && !isKid && dressData ? "_" + dressId : "");
//有缓存过就直接返回
if (SquirrelsCaches[cacheKey]) return SquirrelsCaches[cacheKey];
var time = Date.now();
var svga = await loadSvga(SvgaUrls[urlKey]);
console.log(Date.now() - time)
var mv = new FYGE.MovieClip(svga);
//如果没有装扮id,缓存自身,并返回
if (!dressId || isKid || !dressData) {
SquirrelsCaches[cacheKey] = mv;
return mv;
}
//考虑资源加载
await RES.loadGroup(SquirrelType[squirrelType] + "Dress")
//开始换装
dressUp(dressData, mv);
//缓存
SquirrelsCaches[cacheKey] = mv;
return mv
}
function dressUp(data: designJsonInt, mv: FYGE.MovieClip) {
//添加的装扮
if (data.adds) {
for (var i = 0; i < data.adds.length; i++) {
var str = data.adds[i] //psd_aa&bb&10&20
var arr = str.split("&");
//找对应的sprite
var spr = getSpriteByImageKey(arr[0], mv);
//执行添加,必须之前加载好过的装扮数据
spr.addChild(FYGE.Sprite.fromFrame(arr[1] + ".png"))
.position.set(+arr[2], +arr[3])
}
}
//添加进同级的装扮
if (data.addedToPs) {
for (var i = 0; i < data.addedToPs.length; i++) {
var str = data.addedToPs[i] //psd_aa&bb&10&20
var arr = str.split("&");
//找对应的动画数据的sprite
var spr = getSpriteByImageKey(arr[0], mv);
var addSpr = FYGE.Sprite.fromFrame(arr[1] + ".png");
//@ts-ignore
addSpr.frames = deepCopyFrames(spr.frames, +arr[2], +arr[3]);
mv.addChildAt(addSpr, +arr[4])
}
}
//隐藏的装扮
data.hides && data.hides.forEach((e) => { getSpriteByImageKey(e, mv).texture = null });
}
/**
* 暂时假定imageKey不会重复
* @param imageKey
* @param mv
*/
function getSpriteByImageKey(imageKey: string, mv: FYGE.MovieClip): FYGE.Sprite {
for (var i = 0; i < mv.children.length; i++) if (mv.children[i].imageKey == imageKey) return mv.children[i]
}
/**
* 装扮数据,
*
*/
export const designJson: {
[key: string]: designJsonInt[][]
} = {
xiaojian: [//0下标表示正常状态,1下标表示喂食状态
[//012分别对应装扮的配置数据
{ "adds": ["psd_2878&jian_rightHand_1&0&-4", "psd_2880&jian_body_1&0&0", "psd_2882&jian_leftHando_1&-7&0", "psd_2884&jian_leftHand_1&-6&-14", "psd_2892&jian_head_1&-4&-52"], "hides": ["psd_2878", "psd_2880", "psd_2882", "psd_2884", "psd_2888", "psd_2894"] },
{ "hides": ["psd_2878", "psd_2880", "psd_2882", "psd_2884", "psd_2888", "psd_2890", "psd_2894"], "adds": ["psd_2880&jian_body_2&1&0", "psd_2892&jian_head_2&-12&-46"] },
{ "adds": ["psd_2878&jian_rightHand_3&0&-2", "psd_2880&jian_body_3&0&0", "psd_2882&jian_leftHand0_3&0&0", "psd_2884&jian_leftHand_3&-5&-4", "psd_2888&jian_leftEar_3&0&0", "psd_2892&jian_head_3&-58&-55"], "hides": ["psd_2880", "psd_2888", "psd_2894"] }
],
[
{ "adds": ["psd_2926&jianf_leftHando_1&0&0", "psd_2928&jianf_leftHand_1&-8&-2", "psd_2930&jianf_rightHando_1&2&2", "psd_2932&jianf_body_1&-6&1", "psd_2832&jianf_head_1&-5&-29", "psd_2972&jianf_rightHand_1&-13&-1"], "hides": ["psd_2926", "psd_2928", "psd_2930", "psd_2932", "psd_2834", "psd_2972"] },
{ "adds": ["psd_2932&jianf_body_2&-23&5", "psd_2832&jianf_head_2&-15&-49"], "hides": ["psd_2932", "psd_2834"], "addedToPs": ["psd_2928&jianf_heye_2&9&-73&20"] },
{ "adds": ["psd_2926&jianf_leftHando_3&13&-5", "psd_2928&jianf_leftHand_3&-3&-9", "psd_2930&jianf_rightHando_3&10&-11", "psd_2932&jianf_body_3&-1&1", "psd_2832&jianf_face_3&0&-2", "psd_2832&jianf_head_3&-59&-36", "psd_2972&jianf_rightHand_3&-5&-3"], "hides": ["psd_2926", "psd_2928", "psd_2930", "psd_2932", "psd_2832", "psd_2834", "psd_2972"] }
],
],
xiaomei: [
[
{ "adds": ["psd_3861&mei_body_1&-143&-1", "psd_3875&mei_head_1&39&-49"], "hides": ["psd_3861"] },
{ "adds": ["psd_3857&mei_rightHand_2&-1&0", "psd_3859&mei_leftHand_2&4&0", "psd_3861&mei_body_2&-16&9", "psd_3875&mei_face_2&1&29", "psd_3875&mei_head_2&-8&-23"], "hides": ["psd_3857", "psd_3859", "psd_3871", "psd_3873", "psd_3875", "psd_3877"] },
{ "addedToPs": ["psd_3861&mei_wing_3&-151&-123&2"], "adds": ["psd_3861&mei_body_3&-1&-7", "psd_3875&mei_face_3&-5&2", "psd_3875&mei_head_3&-19&-49"], "hides": ["psd_3861", "psd_3871", "psd_3873", "psd_3875", "psd_3877"] }
],
[
{ "adds": ["psd_3907&meif_leftHando_1&9&2", "psd_3909&meif_body_1&-88&-4", "psd_3921&meif_head_1&56&-60"], "hides": ["psd_3907", "psd_3909", "psd_3911"], "addedToPs": ["psd_3909&meif_rightHando_1&-26&7&3"] },
{ "adds": ["psd_3907&meif_leftHando_2&17&10", "psd_3909&meif_body_2&-20&-4", "psd_3911&meif_rightHando_2&12&2", "psd_3913&meif_rightHand_2&3&-15", "psd_3919&meif_head_2&-13&-36", "psd_3953&meif_leftHand_2&0&-1"], "hides": ["psd_3907", "psd_3909", "psd_3911", "psd_3913", "psd_3919", "psd_3921", "psd_3923", "psd_3953"] },
{ "addedToPs": ["psd_3909&meif_wing_3&-200&-140&1"], "adds": ["psd_3909&meif_body_3&-10&-2", "psd_3919&meif_head_3&-24&-48"], "hides": ["psd_3909", "psd_3917", "psd_3919", "psd_3921", "psd_3923"] }
],
],
xiaoku: [
[
{ "addedToPs": ["psd_2391&ku_wing_1&-112&-24&4"], "adds": ["psd_2391&ku_body_1&-111&3", "psd_2407&ku_head_1&-23&-47"], "hides": ["psd_2391", "psd_2403", "psd_2405"] },
{ "hides": ["psd_2385", "psd_2387", "psd_2391", "psd_2403", "psd_2405"], "adds": ["psd_2391&ku_body_2&0&-5", "psd_2391&ku_wing_2&-104&42", "psd_2407&ku_head_2&-85&-67"], "addedToPs": ["psd_2391&ku_rightHando_2&6&8&36", "psd_2391&ku_leftHando_2&85&11&37"] },
{ "hides": ["psd_2385", "psd_2387"], "adds": ["psd_2391&ku_body_3&-9&3", "psd_2407&ku_head_3&-18&-10"] }
],
[
{ "addedToPs": ["psd_2441&kuf_wing_1&-101&-130&2", "psd_2449&kuf_body_1&-9&-3&10"], "adds": ["psd_2441&kuf_bodyo_1&-2&1", "psd_2457&kuf_head_1&-13&-35"], "hides": ["psd_2441", "psd_2449", "psd_2112", "psd_2114"] },
{ "addedToPs": ["psd_2449&kuf_wing_2&-52&9&2"], "adds": ["psd_2441&kuf_bodyo_2&-16&-11", "psd_2449&kuf_body_2&-4&2", "psd_2112&kuf_rightEar_2&0&0", "psd_2114&kuf_leftEar_2&0&0", "psd_2457&kuf_head_2&-98&-88"], "hides": ["psd_2441", "psd_2449", "psd_2112", "psd_2114"] },
{ "hides": ["psd_2441", "psd_2449", "psd_2112", "psd_2114"], "addedToPs": ["psd_2449&kuf_body_3&-13&8&9"], "adds": ["psd_2457&kuf_head_3&-39&-6"] }
],
]
}
interface designJsonInt {
/**
* 需要隐藏的图
* psd_aa
*/
hides?: string[],
/**
* 添加进一个部件的图片
* psd_aa&bb&10&20 //&分割,0是原图,1添加的图。2x偏移,3y偏移
*/
adds?: string[],
/**
* 需要进同级的图片,多一个层级index
* psd_aa&bb&&10&20&1
*/
addedToPs?: string[]
}
function deepCopyFrames(
frames,
x = 0,
y = 0,
scaleX = 1,
scaleY = 1,
rotation = 0,
anchorX = 0,
anchorY = 0
) {
var cf = [];
rotation *= Math.PI / 180;
var lt: any = {};
lt.a = Math.cos(rotation) * scaleX;
lt.b = Math.sin(rotation) * scaleX;
lt.c = -Math.sin(rotation) * scaleY;
lt.d = Math.cos(rotation) * scaleY;
lt.tx = x + anchorX - ((anchorX * lt.a) + (anchorY * lt.c));
lt.ty = y + anchorY - ((anchorX * lt.b) + (anchorY * lt.d));
for (var j = 0; j < frames.length; j++) {
var frame = frames[j];
const pt = frame.transform;
var f = { alpha: 0, transform: null };
//透明度
f.alpha = frame.alpha;
f.transform = {
a: (lt.a * pt.a) + (lt.b * pt.c),
b: (lt.a * pt.b) + (lt.b * pt.d),
c: (lt.c * pt.a) + (lt.d * pt.c),
d: (lt.c * pt.b) + (lt.d * pt.d),
tx: (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx,
ty: (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty,
};
cf.push(f)
}
return cf;
}
\ No newline at end of file
import { GPool } from "../../module/tools/GPool";
import { RES } from "../../module/RES";
import { wait } from "../../module/ctrls";
import { Tool } from "../Tools";
export function coinEffect(
needShowCoinEffect: 1 | 2,//1生成器 2中间生成
// startP: [number, number],
endP: [number, number],
): FYGE.Container {
var isGenerate = needShowCoinEffect == 1;
//执行一边后标记
Tool.needShowCoinEffect = 0;
var startP = isGenerate ? [108, 1163] : [375, 932]// [375, 932]
let con = new FYGE.Container();
// con.position.set(startP[0], startP[1]);
//光
let light: FYGE.Sprite = GPool.takeOut("light");
if (!light) {
light = FYGE.Sprite.fromFrame("coinLight.png");
light.anchorTexture.set(0.5, 0.5);
}
light.position.set(startP[0], startP[1]);
con.addChild(light);
light.scale.set(0.1, 0.1);
light.alpha = isGenerate ? 0.5 : 1;
FYGE.Tween.get(light)
.to({ scaleX: 1.1, scaleY: 1.1 }, 230)
.to({ scaleX: 1, scaleY: 1 }, 100)
.wait(170)
.to({ alpha: 0 }, 170)
.call(() => {
con.removeChild(light);
GPool.recover("light", light);
})
var obj = { x: 0 };
let count = 0;
//金币效果
FYGE.Tween.get(obj, {
onChange: () => {
if (count++ % 7) return
let coin = GPool.takeOut("coin");
if (!coin) coin = new Coin();
con.addChild(coin).position.set(startP[0], startP[1]);
coin.scale.set(1, 1);
FYGE.Tween.get(coin)
.to({ scaleX: 0.7, scaleY: 0.7, x: endP[0] }, 1000)
.call(() => {
con.removeChild(coin);
GPool.recover("coin", coin);
})
FYGE.Tween.get(coin)
.to({ y: endP[1] }, 1000, FYGE.Ease.sineOut)
}
}).to({ x: 100 }, 1000)
.call(() => {
FYGE.Tween.removeTweens(obj);
wait(() => {
con.parent.removeChild(con);
}, 1000)
})
return con
}
class Coin extends FYGE.FrameAni {
constructor() {
var arr = [];
for (var i = 1; i <= 8; i++)arr.push(RES.getRes("coin" + i + ".png"));
super(arr);
this.frameRate = 60;
this.play(-1);
}
}
\ No newline at end of file
import { Scene } from "../../module/views/Scene";
import { Item } from "../../module/views/Item";
import { Tool } from "../Tools";
import { showPanel, wait, showWaiting, hideWaiting, changeScene } from "../../module/ctrls";
import { ConfirmAdoptPanel } from "../panels/ConfirmAdoptPanel";
import { layers } from "../../module/views/layers";
import { SquirrelType } from "../parts/Squirrels";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { JoinMemberPanel } from "../panels/JoinMemberPanel";
import { RES } from "../../module/RES";
import { MainScene } from "./MainScene";
export class AdoptScene extends Scene {
get groupNames() { return ["松鼠领养页"] }
get skinName() { return "松鼠领养页" }
title: FYGE.Sprite;
adoptBtn: FYGE.Button;
showAni(callback: () => void) {
this.alpha = 0;
FYGE.Tween.get(this)
.to({ alpha: 1 }, 1000)
.call(callback)
// this.x = 750;
// FYGE.Tween.get(this)
// .to({ x: 0 }, 1000)
// .call(callback)
}
initUi() {
}
scroll: CusScroll
start(data) {
super.start();
//标题适配下
this.title.y = Tool.getAdjustHeight(this.title.y, this.title.y - 176)
//每项卡片适配 504 228
var scroll = this.addChild(new CusScroll());
scroll.x = 2;
scroll.y = Tool.getAdjustHeight(504, 228)
this.scroll = scroll;
}
initEvents() {
this.adoptBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
//判断是否加入会员
if (!Tool.isMember) {
showWaiting()
const memberData = await sendTbNet(TbNetName.checkMember)
hideWaiting();
if (!memberData.success) return;
//未加入会员
if (!memberData.data.isMember) {
showPanel(JoinMemberPanel, { memberUrl: memberData.data.memberUrl });
return
} else {
Tool.isMember = true;
}
}
//用dom的弹框
sendTbNet(TbNetName.getAdoptName, { type: this.scroll.currentType }, async (s, data) => {
if (!s) return;
//发接口,领养
showWaiting();
const { success: doAdopt } = await sendTbNet(TbNetName.doAdopt, {
squirrelType: this.scroll.currentType,
inviteId: Tool.globalData.inviteId,
squirrelName: data.data
});
//打开游戏场景,传入type,判断是否是刚领取的,新领取的就
if (doAdopt) {
await Promise.all([
RES.loadGroup("guide"),//首次必有引导
sendTbNet(TbNetName.getSquirrelInfo),
sendTbNet(TbNetName.getBagGoodsList), // 背包
])
changeScene(MainScene, {});//随便传点,证明是刚领养,需要弹窗引导
} else {
hideWaiting();
//报错统一处理了
}
}, true)
// showPanel(ConfirmAdoptPanel, {
// type: this.scroll.currentType
// })
// var bg = this.addChild(Tool.getRect(750, layers.stageHeight, 0, 1, 0, 0, -layers.sceneLayer.y * 2))
// bg.visible = false;
// var ca = this.addChild(new ConfirmAdoptPanel({ type: this.scroll.currentType }))
// ca.y = layers.stageOffsetY - Tool.panelOffsetY;
// ca.onLoaded = () => {
// bg.visible = true;
// bg.alpha = 0;
// FYGE.Tween.get(bg).to({ alpha: 0.7 }, 200, FYGE.Ease.cubicOut);
// ca.showAni();
// ca.start({ type: this.scroll.currentType });
// wait(() => {
// ca.addChildAt(bg, 0);
// bg.y -= ca.y
// }, 200)
// }
})
}
removeEvents() {
}
}
//到时性能如果差,文案也加到图片里,到时候确定要把文案加入背景图里
class CardItem extends Item {
get skinName() { return "cardItem" }
xiaojian: FYGE.Sprite;
xiaomei: FYGE.Sprite;
xiaoku: FYGE.Sprite;
// desTxt: FYGE.TextField;
// nameTxt: FYGE.TextField;
type: SquirrelType
initUi(data?: SquirrelType) {
this.type = data;
this.anchor.set(531 / 2, 592 / 2);
//名字文案设定下居中
// Tool.changeTextAlign(this.nameTxt, FYGE.TEXT_ALIGN.CENTER, 300);
this.xiaojian.visible = this.xiaomei.visible = this.xiaoku.visible = false;
this[SquirrelType[data]].visible = true;
// this.nameTxt.text = SquirrelsData[data].name;
// this.desTxt.text = SquirrelsData[data].des;
// this.desTxt.textWidth = 410;
// this.desTxt.lineType = FYGE.TEXT_lINETYPE.MULTI
// this.children[this.children.length - 1].visible = false
}
updateData(data?) {
}
initData(id: number, data: any): void {
}
}
/**
* 滚动缩放
* 以后封装吧,现在应付先
*/
class CusScroll extends FYGE.Container {
view: FYGE.Container;
currentItemIndex: number;
noOprTime: number;
stopScroll: boolean;
get currentType(): SquirrelType {
return this.view.children[this.currentItemIndex].type
}
constructor() {
super();
this.view = new FYGE.Container();
this.addChild(this.view);
let s: CusScroll = this;
s.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, s.onMouseEvent, s);
s.addEventListener(FYGE.MouseEvent.MOUSE_MOVE, s.onMouseEvent, s);
s.addEventListener(FYGE.MouseEvent.MOUSE_UP, s.onMouseEvent, s);
s.addEventListener(FYGE.MouseEvent.MOUSE_OUT, s.onMouseEvent, s);
//直接加三个
this.updateData([SquirrelType.xiaojian, SquirrelType.xiaomei, SquirrelType.xiaoku])
}
/**
* 更新数据,会修改view的子级和view的位置
* @param dataArr
*/
updateData(dataArr) {
this.view.removeChildren();
this.view.x = 0;
for (var i = 0; i < dataArr.length; i++) {
var data = dataArr[i];
var item = new CardItem(data);
item.x = i * (531 - 50) - 375
item.y = 6.5;
this.view.addChild(item)
}
if (!dataArr.length) return
if (dataArr.length == 1) {
this.currentItemIndex = 0;
} else {
this.currentItemIndex = 1;
}
this.scrollAni(this.currentItemIndex);
//曝光
// productShowLog()
}
/**
* 鼠标状态
* 0弹起
* 1按下
* 2移动
*/
private isMouseDownState: 0 | 1 | 2;
private lastValue: number
/**
*
*/
onMouseEvent(e: FYGE.MouseEvent) {
let s = this;
s.noOprTime = Date.now()
if (e.type == FYGE.MouseEvent.MOUSE_DOWN) {
// e.stopPropagation()
s.lastValue = e.stageX - s.view.x;
s.isMouseDownState = 1;
}
else if (e.type == FYGE.MouseEvent.MOUSE_MOVE) {
if (s.isMouseDownState == 0) return;
s.isMouseDownState = 2;
this.view.x = e.stageX - s.lastValue;
var limitLeftX = 700, limitRightX = -680
//判断位置
if (this.view.x > limitLeftX) this.view.x = limitLeftX;
if (this.view.x < limitRightX) this.view.x = limitRightX;
//判断缩放;
this.changeScale()
} else {
//弹起时判断,最终位置
this.stay();
//弹起时
s.isMouseDownState = 0;
}
}
changeScale() {
var bp = new FYGE.Point(375, 0)
this.stage.worldMatrix.transformPoint(bp.x, bp.y, bp)
var midX = this.view.globalToLocal(bp).x - 531 / 2;
//判断midX和每一项的距离,越近的越大,超过一定距离就是0.8;
for (var i = 0; i < this.view.children.length; i++) {
var c: CardItem = this.view.children[i];
var mask: FYGE.Sprite = c.children[c.children.length - 1];
mask.alpha = 0
var dis = Math.abs(c.x - midX);
if (dis > 200) {
c.scale.set(0.8, 0.8);
mask.alpha = 0.5
// c[SquirrelType[c.type]].tint = 0x333333
} else {
var sc = 0.8 + ((200 - dis) / 200) * 0.2;
c.scale.set(sc, sc)
mask.alpha = 0.5 - ((200 - dis) / 200) * 0.5;
}
}
}
/**
* 判断哪一项最接近
*/
stay() {
var bp = new FYGE.Point(375, 0)
this.stage.worldMatrix.transformPoint(bp.x, bp.y, bp)
var midX = this.view.globalToLocal(bp).x - 531 / 2;
var item, lastDis;
for (var i = 0; i < this.view.children.length; i++) {
var c = this.view.children[i];
var dis = Math.abs(c.x - midX);
if (lastDis == undefined || dis < lastDis) {
lastDis = dis;
item = i;
}
}
if (item != undefined) {
//不相等时曝光
// if (this.currentItemIndex != item) {
// productShowLog()
// }
this.currentItemIndex = item;
this.scrollAni(this.currentItemIndex);
}
}
scrollOne() {
if (this.currentItemIndex >= this.view.children.length - 1) return;
this.currentItemIndex++;
this.scrollAni(this.currentItemIndex);
}
private scrollAni(index) {
var endX = (375 - 531 / 2) - this.view.children[index].x;
FYGE.Tween.removeTweens(this.view);
FYGE.Tween.get(this.view, {
onChange: function () {
this.changeScale();
}, onChangeObj: this
}).to({ x: endX }, 200)
}
}
import { Scene } from "../../module/views/Scene";
import TextField = FYGE.TextField;
import Sprite = FYGE.Sprite;
import { ProgressBarS } from "../common/ProgressBarS";
import { GDispatcher } from "../Main";
import { showToast, changeScene, showPanel, hideWaiting } from "../../module/ctrls";
import { TbNetName, sendTbNet } from "../TaoBaoNet";
import { StoryScene } from "./StoryScene";
import { Tool } from "../Tools";
import { MainScene } from "./MainScene";
import { RES } from "../../module/RES";
import { SquirrelInfo } from "../SquirrelInfo";
export class LoadingScene extends Scene {
get groupNames() {
return ["loading"]
}
get skinName() {
return "loading"
}
proTxt: TextField;
pro: Sprite;
progressBar: ProgressBarS
initUi() {
//头像动画,三个一样的动画,交替出现
var heads: FYGE.Sprite[] = [
this.getChildByName("头1", true, true),
this.getChildByName("头2", true, true),
this.getChildByName("头3", true, true),
]
// 0s(100%,100%)-0.1s(105%,95%)-0.37s(90%,110%)-0.6s(100%,100%);
// 位置:0.1s(原位)-0.37s(上移10px)-0.6s(下移10px至原位);
// 透明度:0.57s(100%)-0.6s(0%);
let count = 0;
for (let i = 0; i < heads.length; i++) {
let head = heads[i]
head.anchor.set(head.width / 2, head.height);
FYGE.Tween.get(head, { loop: true })
.call(() => {
if (i == 0) {
//切换谁显示
heads.forEach((c) => {
c.visible = false
});
heads[count++ % 3].visible = true;
}
})
.to({ scaleX: 1.05, scaleY: 0.95 }, 100)
.to({ scaleX: 0.9, scaleY: 1.1 }, 270)
.to({ scaleX: 1, scaleY: 1 }, 230)
}
//进度条托管
this.progressBar = new ProgressBarS(this.pro, this.proTxt)
FYGE.Tween.get(this.progressBar)
.to({ value: 1 }, 2000)
}
//加载完成后打开的页面
scene;
async start() {
super.start()
GDispatcher.addEventListener(FYGE.Event.PROGRESS, this.progressEvent, this)
//首次进度一点
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.2)
//发授权接口,必须授权先,否则数据拿不到
// const { success: hasAuthorized } = await sendTbNet(TbNetName.authorize);
// //未授权,不进入,啥信息都没
// if (!hasAuthorized) return
// //授权成功
// GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.3)
//获取app数据
const { data } = await sendTbNet(TbNetName.getAppData);
Tool.globalData = data;
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.3)
//询问读取权限,不阻止进程
Tool.checkPermission();
// const { 0: getActivityInfo, 1: getSquirrelInfo }
const [getActivityInfo, getSquirrelInfo] = await Promise.all([
sendTbNet(TbNetName.getActivityInfo),//获取活动信息
sendTbNet(TbNetName.getSquirrelInfo),//获取松鼠信息
// sendTbNet(TbNetName.getBagGoodsList), // 背包
])
console.log(getActivityInfo, getSquirrelInfo)
if (!getActivityInfo.success || !getSquirrelInfo.success) return
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.5);
//判断是否有松鼠,如果有松鼠,直接进首页
if (getSquirrelInfo.data && getSquirrelInfo.data.squirrelType) {
//@ts-ignore
// for (let key in SquirrelInfo.data) SquirrelInfo.data[key] = getSquirrelInfo.data[key];
//加载首页资源
await Promise.all([
RES.loadGroup("活动首页"),
sendTbNet(TbNetName.getBagGoodsList), // 背包
])
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 1)
this.scene = MainScene;
}
//故事页
else {
console.log(98545555)
await RES.loadGroup("故事页")
GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 1)
this.scene = StoryScene;
}
//按数据加载后续资源
// //获取游戏数据
// await Tool.getIndex().catch(() => { console.log(55456) })
// FYGE.GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.5)
// //判断是否加载引导资源
// if (Tool.isFirst) await RES.loadGroup("guide");
// FYGE.GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 0.6)
// //加载游戏资源
// await RES.loadGroup("playScene");
// GDispatcher.dispatchEvent(FYGE.Event.PROGRESS, 1)//弄个假的loading吧,吃豆人动效不好弄
}
// private lastP=0
progressEvent(e: FYGE.Event) {
FYGE.Tween.get(this.progressBar, null, null, true)
.to({ value: e.data }, 2000/**(p-this.lastP)*/)
.call(() => {
if (e.data >= 1) {
GDispatcher.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this);
// console.log(11123)
changeScene(this.scene)
hideWaiting()
}
})
// this.lastP=p
}
destroy() {
//动效要去掉
// FYGE.Tween.removeTweens()
super.destroy()
//到时如果内存炸了,考虑销毁用过的贴图缓存,待测试,在RES里写个根据销毁组内贴图的方法
}
}
import { Item } from "../../module/views/Item";
import { Scene } from "../../module/views/Scene";
import { hideWaiting, removeTweens, showPanel, showToast, showWaiting, wait } from "../../module/ctrls";
import { BagPanel } from "../panels/BagPanel";
import { ShopPanel } from "../panels/ShopPanel";
import { SquirrelNewsPanel } from "../panels/SquirrelNewsPanel";
import { Tool } from "../Tools";
import { getTbData, sendTbNet, TbNetName } from "../TaoBaoNet";
import { GTool } from "../../module/tools/GTool";
import { SquirrelInfo } from "../SquirrelInfo";
import { loadSvga, SvgaUrls } from "../svga";
import { createSquirrel, SquirrelType } from "../parts/Squirrels";
import { SignPanel } from "../panels/SignPanel";
import { TaskPanel } from "../panels/TaskPanel";
import { RES } from "../../module/RES";
import { coinEffect } from "../parts/coinEffect";
import { RulePanel } from "../panels/RulePanel";
import { AdoptSucPanel } from "../panels/AdoptSucPanel";
import { layers } from "../../module/views/layers";
import { Guide } from "../parts/Guide";
import { GDispatcher } from "../Main";
import { Bubble } from "../parts/Bubble";
import { AdPanel } from "../panels/AdPanel";
import { LevelUpPanel } from "../panels/LevelUpPanel";
import { clickLog, LogEnum } from "../log";
import MouseEvent = FYGE.MouseEvent;
import { NoCreditsPanel } from "../panels/NoCreditsPanel";
export class MainScene extends Scene {
get groupNames() {
return ["活动首页"]
}
get skinName() {
return "活动首页"
}
feedBtn: FYGE.Button;
taskBtn: FYGE.Button;
shopBtn: FYGE.Button;
bagBtn: FYGE.Button;
topBtnCon: FYGE.Container;
dyInfoBtn: FYGE.Button;
signBtn: FYGE.Button;
gameBtn: FYGE.Button;
ruleBtn: FYGE.Button;
coinCon: FYGE.Container;
coinTxt: FYGE.TextField;
nickName: FYGE.TextField;
showAni(callback: () => void) {
this.x = 750;
this.enableMouseEvt(false)
FYGE.Tween.get(this)
.to({ x: 0 }, 500, FYGE.Ease.quadOut)
.call(() => {
this.enableMouseEvt(true);
callback && callback();
})
}
coinGenerator: CoinGenerator;
feedCountTime: FeedCountTime;
/**
* 当前的松鼠,做切换时移除的指向
*/
curSquirrel: FYGE.MovieClip;
/**
* 松鼠类型,不会改变
*/
squirrelType: SquirrelType
/**
* 判断是否喂食种
*/
get isFeeding(): boolean {
return !!this.feedCountTime.leftTime
}
async initUi() {
//ui适配
this.topBtnCon.y = Tool.getAdjustHeight(197, 18);
var feedStatus = getTbData(TbNetName.getSquirrelInfo).data.feedStatus;
//松子生成器
this.coinGenerator = this.addChild(new CoinGenerator(feedStatus));
//喂食倒计时
this.feedCountTime = this.addChild(new FeedCountTime());
//喂食倒计时时间
this.feedCountTime.leftTime = feedStatus.leftTime ? feedStatus.leftTime * 1000 : 0;
//喂食完成的回调,应该是统一的方法,切换状态
this.feedCountTime.callback = () => {
this.changeSquirrel();
};
//小游戏的隐藏先
this.gameBtn.visible = false;
// var aa= ["xiaojian","xiaomei","xiaoku"]
// for(var i = 0; i<aa.length;i++){
// loadSvga(SvgaUrls[aa[i]+"_k_c"])
// loadSvga(SvgaUrls[aa[i]+"_k_f"])
// loadSvga(SvgaUrls[aa[i]+"_a_c"])
// loadSvga(SvgaUrls[aa[i]+"_a_f"])
// }
//根据数据添加当前的松鼠
// var squirrelData = getTbData(TbNetName.getSquirrelInfo).data;
// // var isKid = level
// this.curSquirrel = this.addChild(await createSquirrel(SquirrelType.xiaojian, true, false))
// console.log(this.curSquirrel)
//测试网络图片
// var s = new FYGE.Sprite();
// // s.width=s.height=300
// this.addChild(s).position.set(375, 500)
// s.texture = FYGE.Texture.from("https://source.unsplash.com/user/erondu/210x190")
// s.texture = FYGE.Texture.from("https://source.unsplash.com/user/erondu/500x500")
// s.texture = FYGE.Texture.from("https://source.unsplash.com/user/erondu/210x190")
}
//切换松鼠
async changeSquirrel() {
showWaiting();
var mv = await createSquirrel(
this.squirrelType,
SquirrelInfo.level < 2,
this.isFeeding,
SquirrelInfo.dressId
)
hideWaiting();
if (this.curSquirrel) {
this.removeChild(this.curSquirrel);
this.curSquirrel.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.showBubble, this)
}
this.curSquirrel = this.addChildAt(mv, 1);
this.curSquirrel.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.showBubble, this)
}
start(data) {
super.start();
// showPanel(LevelUpPanel);
var squirrelData = getTbData(TbNetName.getSquirrelInfo).data;
//如果没传数据,说明原先有宠物,直接赋值
this.squirrelType = squirrelData.squirrelType;
//记录一个类型
SquirrelInfo.type = squirrelData.squirrelType;
//头像根据类型定
[SquirrelType[1], SquirrelType[2], SquirrelType[3]].forEach((element) => {
this.getChildByName(element + "S", true, true).visible = element == SquirrelType[this.squirrelType];
});
//昵称和lv和一起,昵称变成输入的
this.nickName.text = (function (str) {
var strR = str.substr(0, 4);
return str.length > 4 ? strR + "..." : strR;
})(squirrelData.squirrelName/*Tool.globalData.nickName*/) + " LV." + squirrelData.level;
SquirrelInfo.level = squirrelData.level;
SquirrelInfo.on("level", (value) => {//后面再监听,后续有level改变触发
//主场景进入就一直在了,不考虑移除,
var str = this.nickName.text;
var index = str.lastIndexOf(" LV.");
this.nickName.text = str.substring(0, index + 4) + value;
//还要变装,用这个data判断有风险
// if (squirrelData.level == 1 && value > 1) {//暂时只有喂食才会等级变更,到时有其他途径,要判断喂食状态
// this.changeSquirrel();
// squirrelData.level = value;
// showPanel(LevelUpPanel)
// }
}, this)
//能量值,下一级
SquirrelInfo.upgradeExp = squirrelData.upgradeExp;
SquirrelInfo.floorExp = squirrelData.floorExp;
var expBar: FYGE.Graphics = this.getChildByName("头像条", true, true).addChildAt(new FYGE.Graphics(), 3);
expBar.position.set(146, 46);
SquirrelInfo.on("exp", (value) => {
//要先设置upgradeExp,再设置exp,
var p = SquirrelInfo.upgradeExp == Infinity || !SquirrelInfo.upgradeExp ? 1 :
(value - SquirrelInfo.floorExp) / (SquirrelInfo.upgradeExp - SquirrelInfo.floorExp);
expBar.clear()
.beginFill(0xff9460, 1)
.drawRoundedRect(0, 0, 123 * p, 20, 50)
.endFill();
this.getChildByName("expTxt", true, true).text = ((p * 100) >> 0) + "%";
}, this)
SquirrelInfo.exp = squirrelData.exp;
//松子币
Tool.changeTextAlign(this.coinTxt, FYGE.TEXT_ALIGN.CENTER, 140)
this.coinTxt.text = "";
SquirrelInfo.on("credits", (value) => {
//判断是否加动画
if (Tool.needShowCoinEffect == 0) {
this.coinTxt.text = value + "";
}
//播动效
else {
FYGE.Tween.removeTweens(this.coinCon);
this.coinCon.anchor.set(207 / 2, 67 / 2);
this.coinCon.scale.set(1, 1);
this.coinCon["cusText"] = +this.coinTxt.text;
FYGE.Tween.get(this.coinCon, { loop: true })
.wait(1000)
.call(() => {
FYGE.Tween.get(this.coinCon, { loop: true })
.to({ scaleX: 1.1, scaleY: 0.9 }, 200)
.to({ scaleX: 1, scaleY: 1 }, 200)
FYGE.Tween.get(this.coinCon, {
onChange: () => {
var text = (this.coinCon["cusText"] + 0.5) >> 0;
this.coinTxt.text = text + "";
}, onChangeObj: this
})
// .wait(500)
.to({ cusText: value }, 1000)
.call(() => {
FYGE.Tween.removeTweens(this.coinCon)
this.coinCon.scale.set(1, 1);
this.coinTxt.text = value + "";
})
})
//正宗动效开始放
this.addChild(coinEffect(
Tool.needShowCoinEffect,
[this.coinCon.x + 207 / 2 + this.topBtnCon.x, this.coinCon.y + 67 / 2 + this.topBtnCon.y]
))
}
//FYGE.aaa=999
}, this)
SquirrelInfo.credits = squirrelData.credits;
//装扮id 2未装扮 3已装扮
var dressId: string = null;
var dressData: { id: string, status: 2 | 3 }[] = squirrelData.dress || [];
for (var i = 0; i < dressData.length; i++) {
if (dressData[i].status == 3) {
dressId = dressData[i].id;
break
}
}
SquirrelInfo.dressId = dressId;
SquirrelInfo.on("dressId", (value) => {
this.changeSquirrel()
//接口通知后端
}, this)
//统一的一次松鼠初始化
wait(() => {
this.changeSquirrel();
}, 500)
//蝴蝶的动效,延后点吧
wait(async () => {
var b0 = await loadSvga(SvgaUrls.butterfly0);
var b1 = await loadSvga(SvgaUrls.butterfly1);
let m0 = this.addChildAt(new FYGE.MovieClip(b0), 2)
.addEventListener(FYGE.Event.END_FRAME, () => {
m0.stop();
wait(() => {
m0.gotoAndPlay(1)
}, 2000)
}, this)
//延时一秒播放下一个
wait(() => {
let m1 = this.addChildAt(new FYGE.MovieClip(b1), 2)
.addEventListener(FYGE.Event.END_FRAME, () => {
m1.stop();
wait(() => {
m1.gotoAndPlay(1)
}, 2000)
}, this)
}, 1000)
}, 2000)
//话语
wait(() => {
this.showBubble()
}, 10000)
//引导判断
this.judgeGuide();
// showPanel(ExSuccessPanel);
// RES.loadGroup("xiaojianDress")
// RES.loadGroup("xiaomeiDress")
// RES.loadGroup("xiaokuDress")
// window["aaa"] = async function (squirrelType, isKid, isFeeding, dressId) {
// showWaiting();
// var mv = await createSquirrel(
// squirrelType,
// isKid,
// isFeeding,
// dressId
// )
// hideWaiting();
// if (this.curSquirrel) this.removeChild(this.curSquirrel);
// this.curSquirrel = this.addChildAt(mv, 1);
// }.bind(this)
}
judgeGuide() {
wait(() => {
if (this.data) {
showPanel(AdoptSucPanel, {
type: getTbData(TbNetName.getSquirrelInfo).data.squirrelType,
closeFun: () => {
this.showGuide()
}
})
}
//单纯引导,没有缓存,且没有经验
else if (!GTool.readCache(Tool.cacheKey) && !SquirrelInfo.exp) {
this.showGuide()
}
//判断广告
else if (!GTool.returnTodayTimes("adThreeSquirrels")) {
GTool.writeCache("adThreeSquirrels", 1);
showPanel(AdPanel);
}
}, 500)
}
async showGuide() {
await RES.loadGroup("guide");
layers.shareLayer.addChild(new Guide())
}
bubble: Bubble;
/**
* 显示卖萌的话
*/
showBubble(isTouch: boolean = false) {
if (!this.bubble) {
this.bubble = this.addChildAt(new Bubble(), 2);
this.bubble.position.set(183, 790);
this.bubble.anchor.set(159, 103);
}
FYGE.Tween.removeTweens(this.bubble);
this.bubble.visible = true;
this.bubble.scale.set(0.1, 0.1);
if (isTouch) {//互动的加个延时
this.curSquirrel.mouseEnable = false;
wait(() => {
this.curSquirrel.mouseEnable = true
}, 2000)
}
//先试一般的
FYGE.Tween.get(this.bubble, { loop: true })
.call(() => {
this.bubble.visible = true;
this.bubble.randomTxt()
})
.to({ scaleX: 1, scaleY: 1 }, 500, FYGE.Ease.backOut)
.wait(5000)
.to({ scaleX: 0.1, scaleY: 0.1 }, 500)
.call(() => {
this.bubble.visible = false;
})
.wait(10000);
}
/**
*
* @param time 减少的时间,秒计数
*/
public useSpeedCard(time: number) {
this.feedCountTime.cutTime(time);
this.coinGenerator.cutTime(time);
}
private clickMainBtn(e) {
switch (e.target) {
case this.bagBtn: // 背包
clickLog(LogEnum.BAG_ICON);
showPanel(BagPanel);
break;
case this.shopBtn: // 商城
showPanel(ShopPanel);
//为了引导
GDispatcher.dispatchEvent("guideStep");
break;
case this.taskBtn: // 任务
showPanel(TaskPanel);
clickLog(LogEnum.TASK_ICON);
//为了引导
GDispatcher.dispatchEvent("guideStep");
break;
case this.dyInfoBtn: // 松鼠动态
showPanel(SquirrelNewsPanel);
break;
case this.signBtn: // 签到
clickLog(LogEnum.SIGN_ICON);
showPanel(SignPanel);
break;
case this.ruleBtn: // 松鼠攻略
showPanel(RulePanel)
break;
}
};
private getEvents() {
return [
[this.bagBtn, MouseEvent.CLICK, this.clickMainBtn, this],
[this.shopBtn, MouseEvent.CLICK, this.clickMainBtn, this],
[this.taskBtn, MouseEvent.CLICK, this.clickMainBtn, this],
[this.dyInfoBtn, MouseEvent.CLICK, this.clickMainBtn, this],
[this.signBtn, MouseEvent.CLICK, this.clickMainBtn, this],
[this.ruleBtn, MouseEvent.CLICK, this.clickMainBtn, this],
];
}
initEvents() {
super.initEvents();
this.getEvents().forEach((v: any[]) => {
v[0].addEventListener(v[1], v[2], v[3]);
});
//喂食,,接口后刷新积分,喂食倒计时,生成器状态,修改松鼠状态,
this.feedBtn.addEventListener(MouseEvent.CLICK, async () => {
//为了引导
GDispatcher.dispatchEvent("guideStep");
// 判断喂食状态
if (this.isFeeding) {
showToast("正在喂食中\n结束后才能进行下次喂食哦")
} else {
showWaiting();
//发送喂食接口
var doFeed = await sendTbNet(TbNetName.doFeed);
hideWaiting();
//成功后
if (doFeed.code == '210008') {
showPanel(NoCreditsPanel);
return;
}
if (doFeed.success) {
// 上限会改变
SquirrelInfo.upgradeExp = doFeed.data.upgradeExp;
SquirrelInfo.floorExp = doFeed.data.floorExp;
//经验值增加,
SquirrelInfo.exp = doFeed.data.exp;
//等级从1到2
if (SquirrelInfo.level == 1 && doFeed.data.level > 1) showPanel(LevelUpPanel);
//等级可能更新
SquirrelInfo.level = doFeed.data.level;
//喂食倒计时
this.feedCountTime.leftTime = doFeed.data.leftTime * 1000;
//生成器状态修改
this.coinGenerator.updateData({
leftTime: doFeed.data.leftTime,
leftCredits: this.coinGenerator.leftCredits,
endCredits: doFeed.data.endCredits,
totalTime: doFeed.data.leftTime,
})
//切换喂食
this.changeSquirrel();
}
//静默刷新积分
Tool.getCredits();
}
}, this)
}
removeEvents() {
super.removeEvents();
this.getEvents().forEach((v: any[]) => {
v[0].removeEventListener(v[1], v[2], v[3]);
});
}
destroy() {
// SquirrelInfo.off()
super.destroy()
}
}
/**
* 喂食倒计时
*/
class FeedCountTime extends Item {
get skinName() {
return "feedCountTime"
}
time: FYGE.TextField;
private _leftTime: number;
get leftTime(): number {
return this._leftTime
}
//自行赋值时间
set leftTime(value: number) {
this._leftTime = value || 0;
this.time.text = GTool.getShiFenMiaoByTimeStamp(value)
this.visible = !!value;
//剩余时间为0,置空this.lastTime
if (!this._leftTime) this.lastTime = null;
}
//自行添加回调
callback: () => void;
/**
* 外部使用加速卡时调用,减少leftTime时间
* @param time 减少时间,秒计
*/
cutTime(time: number) {
if (this.leftTime) {
this.leftTime = Math.max(0, this.leftTime - time * 1000)
//如果这会为0了
if (!this.leftTime) this.callback && this.callback();
}
}
private lastTime: number
initUi(data?) {
//文本居中
Tool.changeTextAlign(this.time, FYGE.TEXT_ALIGN.CENTER, 200);
//位置自己定了
this.position.set(232, 720);
//指针转圈
var n: FYGE.Sprite = this.getChildByName("秒针");
n.anchor.set(4.5, 18.5)
this.addEventListener(FYGE.Event.ENTER_FRAME, () => {
n.rotation += 1;
if (this.leftTime) {
var now = Date.now();
var deltaTime = this.lastTime ? now - this.lastTime : 16.7;
this.lastTime = now;
this.leftTime -= deltaTime;
//为0回调执行
if (this.leftTime <= 0) {
this.leftTime = 0;
this.callback && this.callback();
}
}
}, this)
}
}
/**
* 生成器要传的数据,后续再写,和后端字段尽量一致
*/
interface GeneratorDataInt {
leftTime: number //剩余喂养时间(秒)
leftCredits: number //之前未领取的松子数
endCredits: number //结束时奖励的松子币(积分)
totalTime?: number //总喂食时间(秒)
}
enum GeneratorStatus {
}
/**
* 松子生成器
*/
class CoinGenerator extends Item {
get skinName() {
return "coinGenerator"
}
//总生成时间,默认2小时,毫秒
private totalTime: number = 2 * 60 * 60 * 1000;
// private maxLength: number = 156;//不挂了
countTxt: FYGE.TextField;
proTxt: FYGE.TextField;
cantToast: FYGE.Sprite;
pro: FYGE.Graphics;
//一个动画,有生成的松子币时,需要显示,没有时需要隐藏
private ani: FYGE.MovieClip
//记录可领取松子的数量
private _leftCredits: number;
get leftCredits() {
return this._leftCredits;
}
set leftCredits(value: number) {
this._leftCredits = value;
//动画
if (this.ani) this.ani.visible = !!value;
//文案
this.countTxt.visible = !!value;
this.countTxt.text = this.leftCredits + "";
}
private _leftTime: number;
get leftTime(): number {
return this._leftTime
}
/**
* value毫秒计数
*/
set leftTime(value: number) {
this._leftTime = value;
//剩余时间为0,置空this.lastTime
if (!this._leftTime) this.lastTime = null;
//当前时间
value = this.totalTime - value;
//时间戳变成分钟
var min = Math.floor((value / (1000 * 60)));
// if (this.proTxt.text == min + "/120min") return;
// this.proTxt.text = min + "/120min"
if (this.proTxt.text == ((value + 0.5) >> 0) + "/120min") return;//到时改回分钟
this.proTxt.text = ((value + 0.5) >> 0) + "/120min"
//百分比进度条
this.pro.clear()
.beginFill(0xff5d5f)
// .drawRoundedRect(0, 0, 156 * min / 120, 32, 33)
.drawRoundedRect(0, 0, 156 * value / this.totalTime, 32, 33)
.endFill()
}
private lastTime: number;
private countTime: number = 0;
private genTime: number;//生成时间间隔
/**
* 外部使用加速卡时调用,减少leftTime时间
* @param time 减少时间,秒计
*/
cutTime(time: number) {
//还有剩余时间
if (this.leftTime) {
//需要减少的时间
var deltaTime = Math.min(this.leftTime, time * 1000)
this.leftTime = Math.max(0, this.leftTime - time * 1000)
if (this.leftTime) {
this.countTime += time * 1000;
}
//减到0了,额外处理下
else {
//所有deltaTime及原先累计的countTime变成计数
this.leftCredits += Math.round((deltaTime + this.countTime) / this.genTime);
this.countTime = 0;
//显示可领取
this.hideShowDis("可收取松子币", true);
}
}
}
initUi(data?) {
//粒子动画加上,延迟2秒
wait(() => {
loadSvga(SvgaUrls.genParticles).then((r) => {
this.ani = this.addChildAt(new FYGE.MovieClip(r), 0)
.addEventListener(FYGE.Event.END_FRAME, () => {
this.ani.stop();
wait(() => {
this.ani.gotoAndPlay(1)
}, 2000)
}, this)
this.ani.position.set(-60, 0);
this.ani.visible = !!this.leftCredits
})
}, 4000)
//隐藏先
this.cantToast.visible = false;
//文本居中
Tool.changeTextAlign(this.countTxt, FYGE.TEXT_ALIGN.CENTER, 70)
//文本放入松子币未生成背景里
var bg: FYGE.Sprite = this.getChildByName("松子币未生成背景", true, true)
bg.addChild(this.countTxt).position.set(
this.countTxt.x - bg.x,
this.countTxt.y - bg.y
)
bg.anchor.set(36, 105);
//进度条 // 3
this.pro = this.addChildAt(new FYGE.Graphics(), 3)
this.pro.beginFill(0xff5d5f).drawRoundedRect(0, 0, 156, 32, 33)
this.pro.position.set(7, 244)
//有剩余松子币的动画
//位置固定,自己的位置直接给了吧
this.position.set(31, 997);
//生成背景需要给个透明度改变
var bb: FYGE.Sprite = this.getChildByName("松子币生成背景");
bb.anchor.set(73, 142);
bb.alpha = 0;
FYGE.Tween.get(bb, { loop: true })
.to({ alpha: 1 }, 1000)
.wait(330)
.to({ alpha: 0 }, 670)
//监听点击事件
this.addEventListener(FYGE.MouseEvent.CLICK, async () => {
//未解锁
if (SquirrelInfo.level < 2) {
showToast("lv2才能解锁哦")
}
//有能领取的
else if (this.leftCredits > 0) {
showWaiting()
var doCollectData = await sendTbNet(TbNetName.doCollect)
if (!doCollectData.success) {
//未成功
hideWaiting();
return
}
var getCredits = await sendTbNet(TbNetName.getCredits);
if (!getCredits.success) {
//未成功
hideWaiting();
return
}
hideWaiting();
//新的积分数
// getCredits.data.credits;
this.mouseEnable = false;
wait(() => {
this.mouseEnable = true;
}, 1000);
//发接口,发完后,有动效
[bb, bg].forEach((e) => {
FYGE.Tween.get(e)
.to({ rotation: -10 }, 100)
.to({ rotation: 10 }, 230)
.to({ rotation: 0 }, 100)
})
wait(() => {
//金币动效
this.leftCredits = 0;
Tool.needShowCoinEffect = 1;
SquirrelInfo.credits = getCredits.data.credits;
//如果没有剩余时间,不会生成了,
if (!this.leftTime) {
this.hideShowDis("可收取松子币", false);
this.pro.visible = false;
// this.proTxt.visible = true;
this.hideShowDis("生成进度底图", false)
}
}, 430)
}
//正在喂食中
else if (this.leftTime) {
FYGE.Tween.removeTweens(this.cantToast);
this.cantToast.visible = true;
this.cantToast.alpha = 0;
FYGE.Tween.get(this.cantToast)
.to({ alpha: 1 }, 500)
.wait(800)
.to({ alpha: 0 }, 300)
.call(() => {
this.cantToast.visible = false;
})
}
}, this)
//监听循环事件计时
this.addEventListener(FYGE.Event.ENTER_FRAME, () => {
if (this.leftTime) {
var now = Date.now();
var deltaTime = this.lastTime ? now - this.lastTime : 16.7;
this.lastTime = now;
//deltaTime最后不能超过leftTime
deltaTime = Math.min(deltaTime, this.leftTime)
this.countTime += deltaTime;
//超过一颗的时间
if (this.countTime > this.genTime) {
let count = Math.floor(this.countTime / this.genTime);
this.countTime -= this.genTime * count;
this.leftCredits += count;//加上
}
this.leftTime -= deltaTime;
if (this.leftTime <= 0) {
this.leftTime = 0;
//到0后显示可收取
this.hideShowDis("可收取松子币", true);
//清除果实生成时间计数
this.countTime = 0;
//是否需要发接口
// sendTbNet()
}
}
}, this)
//首次更新数据
this.updateData(data);
}
/**
* 通过该方法更新数据及ui
* 只有在初始化initUi里调用,或者喂食后调用
* @param data
*/
updateData(data: GeneratorDataInt) {
//判断是否有总时间
if (data.totalTime) this.totalTime = data.totalTime * 1000;
//先都隐藏
this.hideAll();
this.hideShowDis("松子币未生成背景", true);//这张图一直显示,文案在里面
//带上
this.leftCredits = data.leftCredits || 0;
//等级小于2,未解锁
if (SquirrelInfo.level < 2) {
this.hideShowDis("生成器未解锁", true);
return
}
//没有可领取的松子币,也没有在喂食
if (!data.leftTime && !data.leftCredits) return
this.hideShowDis("松子币生成背景", true);
//完全是可领取的状态,没有倒计时
if (data.leftCredits && !data.leftTime) {
this.hideShowDis("生成进度底图", true)
this.pro.visible = true;//进度条满
this.pro.clear()
.beginFill(0xff5d5f)
.drawRoundedRect(0, 0, 156, 32, 33)
.endFill();
//显示可收取
this.hideShowDis("可收取松子币", true);
return
}
//清零吧
this.countTime = 0;
//喂养状态
if (data.leftTime) {
// this.hideShowDis("proIcon", true);
this.pro.visible = true;
// this.proTxt.visible = true;
this.hideShowDis("生成进度底图", true)
this.leftTime = data.leftTime * 1000;
//计算每颗生成时间间隔
this.genTime = this.totalTime / data.endCredits
//累计时间也要加上剩余时间中的部分
if (data.leftTime * 1000 < this.totalTime) {
let count = Math.floor(data.leftTime * 1000 / this.genTime);
this.countTime += (data.leftTime * 1000 - this.genTime * count)
}
return
}
//其他
}
hideShowDis(name: string, visible: boolean) {
this.getChildByName(name, true, true).visible = visible;
}
hideAll() {
this.children.forEach((e) => {
e.visible = false;
})
}
destroy() {
removeTweens(this)
super.destroy()
}
}
import { Scene } from "../../module/views/Scene";
import { layers } from "../../module/views/layers";
import Button = FYGE.Button;
import TextField = FYGE.Button;
import { showPanel } from "../../module/ctrls";
import { JoinPanel } from "../panels/JoinPanel";
export class SStartScene extends Scene {
get groupNames() { return ["开始页"] }
get skinName() { return "开始页" }
recordBtn:Button;rankBtn:Button;ruleBtn:Button;countTxt:TextField;startBtn:Button;
initUi(){
this.y = layers.stageOffsetY
console.log(this.recordBtn)
console.log(this.startBtn)
console.log(this.countTxt)
}
start(){
super.start()
showPanel(JoinPanel)
}
}
\ No newline at end of file
import { Scene } from "../../module/views/Scene";
import { Tool } from "../Tools";
import { layers } from "../../module/views/layers";
import { RES } from "../../module/RES";
import { wait, removeTweens, changeScene } from "../../module/ctrls";
import { AdoptScene } from "./AdoptScene";
export class StoryScene extends Scene {
get groupNames() { return ["故事页"] }
get skinName() { return "故事页" }
/**
* 入场动效,需要带回调
* 这个还带开场的动效,不合适
* @param callback
*/
// showAni(callback: () => void) {
// this.alpha = 0;
// FYGE.Tween.get(this)
// .to({ alpha: 1 }, 1000)
// .call(callback)
// // this.x = 750;
// // FYGE.Tween.get(this)
// // .to({ x: 0 }, 1000)
// // .call(callback)
// }
initUi() {
//加个颜色图
this.addChildAt(Tool.getRect(750, layers.stageHeight, 0x54301f), 0)
.position.set(0, layers.stageOffsetY * 2)
}
async start(data) {
super.start();
//开场动画,三块
var parts: FYGE.Sprite[] = (() => {
var arr = [];
for (var i = 0; i < 3; i++)arr.push(this.getChildByName("part" + (i + 1)))
return arr
})()
//眼睛是在part3里的
var eyes: FYGE.Sprite[] = (() => {
var arr = [];
for (var i = 0; i < 4; i++)arr.push(this.getChildByName("星星眼睛" + (i + 1)))
return arr
})()
eyes.forEach((e) => {
parts[2].addChild(e)
e.position.set(e.x - parts[2].x, e.y - parts[2].y);
e.anchor.set(e.width / 2, e.height / 2)
})
//都隐藏
parts.forEach((e) => {
e.visible = false;
e.anchor.set(e.width / 2, e.height / 2);
})
//透明度动效
await new Promise((r) => {
this.alpha = 0;
FYGE.Tween.get(this)
.to({ alpha: 1 }, 330)
.call(() => { r(); })
})
//三个移入的动画
await this.moveIn(parts[0], 833, true);
await this.moveIn(parts[1], 789, false);
await this.moveIn(parts[2], 821, true, true);
//眼睛的动画
eyes.forEach((e) => {
FYGE.Tween.get(e, { loop: true })
.to({ scaleX: 1.4, scaleY: 1.4 }, 330)
.to({ scaleX: 1, scaleY: 1 }, 670)
})
//四个星星的位置,只有位置,没有图
var ps: FYGE.Point[] = (() => {
var arr: FYGE.Point[] = [];
for (var i = 0; i < 4; i++)arr.push(this.getChildByName("star" + (i + 1)).position)
return arr
})();
for (var i = 0; i < ps.length; i++) {
let p = ps[i]
wait(() => {
this.addChild(new Star()).position.copy(p)
}, 170 * i)
}
//出现跳过按钮
wait(() => {
var btn = this.addChild(new CountDownBtn())
//这个是要适配的
btn.position.set(528, Tool.getAdjustHeight(194, 20));
btn.alpha = 0;
btn.mouseEnable = false;
let fun = () => {
btn.removeCount();
changeScene(AdoptScene)
}
FYGE.Tween.get(btn)
.to({ alpha: 1 }, 340)
.call(() => {
btn.mouseEnable = true;
btn.startCount(fun);
})
btn.addEventListener(FYGE.MouseEvent.CLICK, fun)
}, 830)
}
private moveIn(part: FYGE.Sprite, dis: number, isLeft: boolean = true, isLast: boolean = false) {
part.visible = true;
part.x = dis * (isLeft ? -1 : 1);
part.rotation = 20 * (isLeft ? -1 : 1);
return new Promise((r) => {
FYGE.Tween.get(part)
.to({ x: 0 }, 670)
FYGE.Tween.get(part)
.to({ rotation: 10 * (isLeft ? 1 : -1) }, 500)
.to({ rotation: 0 }, 170)
.wait(isLast ? 0 : 330)
.call(() => { r(); })
})
}
initEvents() {
}
removeEvents() {
}
}
/**
* 星星类
*/
class Star extends FYGE.Container {
constructor() {
super();
var stars: FYGE.Sprite[] = [
this.addChild(Tool.getSprite("star.png")),
this.addChild(Tool.getSprite("starP2.png")),
this.addChild(Tool.getSprite("starP1.png")),
];
stars.forEach((e, index) => {
this.addScaleAni(e, index == 0 ? 0 : 170)
})
wait(() => {
//循环透明度
FYGE.Tween.get(stars[1], { loop: true })
.to({ alpha: 0.4 }, 100)
.to({ alpha: 1 }, 100)
stars[2].alpha = 0.4;
FYGE.Tween.get(stars[2], { loop: true })
.to({ alpha: 1 }, 100)
.to({ alpha: 0.4 }, 100)
}, 500)
}
private addScaleAni(star: FYGE.Sprite, wait: number) {
star.anchor.set(star.width / 2, star.height / 2);
star.scale.set(0.01, 0.01)
FYGE.Tween.get(star)
.wait(wait)
.to({ scaleX: 1.1, scaleY: 1.1 }, 230)
.to({ scaleX: 1, scaleY: 1 }, 100)
}
destroy() {
removeTweens(this);
super.destroy()
}
}
class CountDownBtn extends FYGE.Button {
private timeObj;
private timeTxt: FYGE.TextField;
constructor() {
super(RES.getRes("故事页跳过.png"))
//时间加入
this.timeTxt = new FYGE.TextField();
this.timeTxt.text = "10s";
this.timeTxt.size = 30;
this.timeTxt.fillColor = "#4d2716";
this.timeTxt.x = 120;
this.timeTxt.y = 10;
this.addChild(this.timeTxt);
}
/**
* 开始倒计时
* @param callback 倒计时结束后执行的
*/
startCount(callback: Function) {
//倒计时
this.timeObj = { a: 10 * 1000 };
FYGE.Tween.get(this.timeObj, {
onChange: () => {
this.timeTxt.text = "" + Math.round(this.timeObj.a / 1000) + "s"
if (this.timeObj.a < 100) {
//自己移除一次,以防callback里面没有
this.removeCount();
callback();
}
}
})
.to({ a: 0 }, 10 * 1000)
}
/**
* 移除倒计时
*/
removeCount() {
FYGE.Tween.removeTweens(this.timeObj)
}
destroy() {
removeTweens(this);
super.destroy()
}
}
//@ts-ignore
var tbMy = my;
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 显示时长
*/
export const commonToast = (content, duration = 3000) => {
if (!tbMy) {
console.log(content)
return
}
tbMy.showToast({
content: content || '换个姿势再试一次~',
duration
});
};
/**
* 获取授权用户信息
* @returns {object} 用户登录信息
*/
export function getAuthUserInfo(): Promise<{ avatar: string, nickName: string }> {
return new Promise((resolve, reject) => {
if (!tbMy) {
resolve({ avatar: "//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png", nickName: "啊是大" })
return
}
tbMy.authorize({
scopes: 'scope.userInfo',
success: res => {
tbMy.getAuthUserInfo({
success: userInfo => { resolve(userInfo); }
});
},
fail: err => {
reject(err);
}
});
});
};
//例子
// async function getAuth() {
// const userInfo = await getAuthUserInfo().catch(() => {
// commonToast('未授权成功')
// })
// if (!userInfo) return
// const { nickName, avatar } = userInfo
// var app =getApp()//挂到app上
// app.nickName = nickName
// app.avatar = avatar
// }
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export function favorShop(sellerId: number): Promise<boolean> {
return new Promise((resolve, reject) => {
if (!tbMy) {
resolve(true);
return
}
tbMy.tb.favorShop({
id: sellerId,
success: res => {
resolve(res);
},
fail: err => {
// error code 11 为用户取消操作不认作失败场景
if (err.error !== 11) {
reject(err);
}
}
});
})
};
//例子
// async function doFavorShop() {
// const { sellerId } = getApp()//这种id最好挂getApp();
// const success = await favorShop(sellerId).catch(err => {
// commonToast(err.errorMessage || '活动太火爆,请稍后重试')
// console.log("关注失败")
// })
// if (success) {
// console.log("关注成功")
// }
// }
/**
* 判断是否关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export function checkShopFavoredStatus(sellerId: number): Promise<boolean> {
return new Promise((resolve, reject) => {
if (!tbMy) {
resolve(true);
return
}
tbMy.tb.checkShopFavoredStatus({
id: sellerId,
success: res => {
resolve(res.isFavor);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export function navigateToOutside(url: string) {
if (!tbMy) {
console.log("执行外页面跳转")
return
}
tbMy.call("navigateToOutside", { url })
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export function navigateTo(url: string): void {
if (!tbMy) {
console.log("执行页面跳转")
return
}
tbMy.navigateTo({ url })
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export function redirectTo(url: string) {
if (!tbMy) {
console.log("执行重定向页面跳转")
return
}
tbMy.redirectTo({ url })
};
/**
* 获取服务器时间
* @returns {number} 服务器时间戳
*/
export function getServerTime(): Promise<number> {
return new Promise((resolve, reject) => {
if (!tbMy) {
resolve(Date.now())
return
}
tbMy.getServerTime({
success: (res) => {
resolve(res.time);
},
fail: err => {
reject(err);
}
});
});
};
/**
* 收藏商品
* @param {number} 商品id
* @returns {object} 收藏结果
*/
export function collectGoods(id: number): Promise<any> {
return new Promise((resolve, reject) => {
tbMy.tb.collectGoods({
id,
success: res => {
resolve(res);
},
fail: err => {
if (err.errorMessage === '该商品已收藏') {
// 已收藏没有给到errorCode,只能通过message判断
// 返回收藏成功,并且给到标记代表是已收藏的
resolve({ success: true, hasCollected: true, errorMessage: err.errorMessage });
} else if (err.error !== 11) {
// error code 11 为用户取消操作不认作失败场景
reject(err);
}
}
});
});
};
/**
* 查询商品收藏状态
* @param {number} 商品id
* @returns {boolean} 商品收场状态
*/
export function checkGoodsCollectedStatus(id: number): Promise<boolean> {
return new Promise((resolve) => {
tbMy.tb.checkGoodsCollectedStatus({
id,
success: res => {
resolve(res.isCollect);
}
});
});
};
/**
* 获取淘宝用户收货地址
*/
export function getUserAddress(opts = {}): Promise<any> {
let defaults = {
addAddress: 'show',
searchAddress: 'hide',
locateAddress: 'hide',
joinTag: '' // 分割收货地址符号(淘宝商家有特定发货需求)
};
//@ts-ignore
let _opts = Object.assign({}, defaults, opts);
return new Promise((resolve, reject) => {
if (!tbMy) {
resolve({})
return
}
tbMy.authorize({
scopes: 'scope.addressList',
success: () => {
const { addAddress, searchAddress, locateAddress, joinTag } = _opts;
if (!tbMy.tb.chooseAddress) {
reject({ support: false, errorMessage: '当前版本不支持选择收货地址,请升级到最新版本' });
return false;
}
tbMy.tb.chooseAddress({
addAddress,
searchAddress,
locateAddress
}, res => {
const { error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber } = res;
// 如果有error为用户取消操作不做操作
if (error) {
resolve(false);
} else {
resolve({
...res,
duibaAddress: {
name,
phone: telNumber,
address: [provinceName, cityName, countyName, streetName, detailInfo].join(joinTag)
}
});
}
}, res => {
reject(res);
})
},
});
});
};
//例子
// async function getUserAddress11(prizeId) {
// const userAddress = await getUserAddress().catch(res => {
// commonToast(res.errorMessage)
// })
// if (userAddress) {
// const { name, phone, address } = userAddress.duibaAddress
// my.confirm({
// title: '提示',
// content: '确认使用该收货地址:' + name + phone + address,
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// success: (result) => {
// const { confirm } = result
// if (confirm) {
// //发接口提交地址
// const { cloud, activityId, cloudName } = getApp()
// cloud.function.invoke(cloudName, {
// activityId,
// _id: prizeId,
// address,
// name,
// phone,
// // address: JSON.stringify(userAddress.duibaAddress)
// }, "receiveObjectPrize")
// .then(res => {
// if (res && res.success) {
// console.log("提交成功")
// } else {
// console.log("提交失败1")
// }
// })
// .catch(() => {
// console.log("云函数调用失败")
// })
// } else {
// console.log("用户取消")
// }
// },
// })
// }
// }
/**
* 点击的区域类,只用作点击
*/
// class HitArea extends FYGE.DisplayObject {
// /**
// *
// * @param width
// * @param height
// */
// constructor(width: number = 0, height: number = 0) {
// super()
// this.hitWidth = width
// this.hitHeight = height
// }
// set hitWidth(value: number) {
// this._localBoundsSelf.width = value;
// }
// set hitHeight(value: number) {
// this._localBoundsSelf.height = value;
// }
// }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment