Commit efbe8198 authored by wildfirecode13's avatar wildfirecode13

Merge branch 'tianmaoxiaoyuan'

parents 238b9b29 199cae6d
No preview for this file type
...@@ -11,6 +11,11 @@ http://gitlab2.dui88.com/wanghongyuan/hello_canvas ...@@ -11,6 +11,11 @@ http://gitlab2.dui88.com/wanghongyuan/hello_canvas
sendTbNet(TbNetName.showModal, {name:'ruleModal'}, (s, res) => { }) sendTbNet(TbNetName.showModal, {name:'ruleModal'}, (s, res) => { })
``` ```
# 给弹窗传参
```js
sendTbNet(TbNetName.showModal, {name:'messageModal',data:{catName:'喵喵'}}, (s, res) => { })
```
# 切换场景 # 切换场景
```js ```js
sendTbNet(TbNetName.navigateToPage, {name:'pageshop'}, (s, res) => { }) sendTbNet(TbNetName.navigateToPage, {name:'pageshop'}, (s, res) => { })
......
{ {
"success": false, "success": true,
"message":"请稍后重试", "data": {
"data": "aaaa", "tips": "梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛梳毛",
"code": "000" "isUpgrade": true,
"channel": "aliqua",
"strategyCode": "dolore",
"code": "et nostrud adipisicing",
"image": "occaecat aliquip",
"name": "officia et deserunt ut",
"type": 65894870.29773912
},
"code": "culpa eu Ut"
} }
\ No newline at end of file
...@@ -2,14 +2,15 @@ ...@@ -2,14 +2,15 @@
"success": true, "success": true,
"message":"", "message":"",
"data": { "data": {
"catType": 1, "catType": 2,
"userNick": "Edwise", "userNick": "Edwise",
"energy": "100", "energy": 100,
"happyCoin": "1000", "happyCoin":1000,
"experience": "50", "experience": 50,
"level": "1", "level": "1",
"avatar": "https://yun.duiba.com.cn/spark/assets/b1992c528b36c2d26942e9c83941242e59481475.png", "avatar": "https://yun.duiba.com.cn/spark/assets/a3ae99684afa9a1f8d94f4c95ee6f1ed81de9996.png",
"sence": 1, "sence": 3,
"catName": "喵喵喵" "catName": "喵喵喵",
"senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"]
} }
} }
\ No newline at end of file
...@@ -91,7 +91,7 @@ class Waiting extends FYGE.Container { ...@@ -91,7 +91,7 @@ class Waiting extends FYGE.Container {
} }
show(msg: string = "加载中") { show(msg: string = "加载中") {
this.msg.text = msg; // this.msg.text = msg;
} }
destroy() { destroy() {
......
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.
...@@ -632,14 +632,32 @@ const resCanvasList = { ...@@ -632,14 +632,32 @@ const resCanvasList = {
'0cc64b0c-3ccc-4d88-b697-bb402319cef7': { '0cc64b0c-3ccc-4d88-b697-bb402319cef7': {
name: 'ToastBg', name: 'ToastBg',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png', url: 'https://yun.duiba.com.cn/spark/assets/ToastBg.81e208c0050ce46ac576ba881d02db07a02bffe2.png',
uuid: '0cc64b0c-3ccc-4d88-b697-bb402319cef7' uuid: '0cc64b0c-3ccc-4d88-b697-bb402319cef7'
}, },
'69009eb9-4593-4a43-a9d7-a6356ebd6d04': { '69009eb9-4593-4a43-a9d7-a6356ebd6d04': {
name: '精力条对话框', name: '精力条对话框',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/精力条对话框.da8e059d18cf967026989e3c376b7364210c3d4e.png', url: 'https://yun.duiba.com.cn/spark/assets/精力条对话框.da8e059d18cf967026989e3c376b7364210c3d4e.png',
uuid: '69009eb9-4593-4a43-a9d7-a6356ebd6d04' uuid: '69009eb9-4593-4a43-a9d7-a6356ebd6d04'
},
'72345190-f95b-4152-bccf-393b8a5aa8d0': {
name: '召回猫咪icon',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/召回猫咪icon.41d0b6bb23a7eccf0facb8918cfb679239b7f82f.png',
uuid: '72345190-f95b-4152-bccf-393b8a5aa8d0'
},
'3b12798d-d932-4f5b-a442-6e4877ba5c16': {
name: 'LetterTexture',
ext: '.png',
url: 'https://yun.duiba.com.cn/spark/assets/LetterTexture.78192e79fa3b21a85b245038f23561eeb5141d4d.png',
uuid: '3b12798d-d932-4f5b-a442-6e4877ba5c16'
},
'624e8c63-963f-4b20-9802-b0fb006fbf93': {
name: 'catTalkDialog',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/catTalkDialog.6fa85b0929d7d8e0d42d0d30587cdbdc33059a8f.png',
uuid: '624e8c63-963f-4b20-9802-b0fb006fbf93'
} }
}; };
export default resCanvasList; export default resCanvasList;
...@@ -3,6 +3,7 @@ const BlueCatTexture = require("./src/lottieSrc/lottieTextureJson/BlueCatTexture ...@@ -3,6 +3,7 @@ const BlueCatTexture = require("./src/lottieSrc/lottieTextureJson/BlueCatTexture
const OrengeCatTexture = require("./src/lottieSrc/lottieTextureJson/OrengeCatTexture.json") const OrengeCatTexture = require("./src/lottieSrc/lottieTextureJson/OrengeCatTexture.json")
const SanhuaCatTexture = require("./src/lottieSrc/lottieTextureJson/SanhuaCatTexture.json") const SanhuaCatTexture = require("./src/lottieSrc/lottieTextureJson/SanhuaCatTexture.json")
const XianluoCatTexture = require("./src/lottieSrc/lottieTextureJson/XianluoCatTexture.json") const XianluoCatTexture = require("./src/lottieSrc/lottieTextureJson/XianluoCatTexture.json")
const LetterTexture = require("./src/lottieSrc/lottieTextureJson/LetterTexture.json")
const resLottieList = { const resLottieList = {
"blueCat":{ "blueCat":{
imgUrl:resCanvasList["a7dc39fa-5f6d-4e94-8979-81c4a4aa183f"].url, imgUrl:resCanvasList["a7dc39fa-5f6d-4e94-8979-81c4a4aa183f"].url,
...@@ -19,6 +20,10 @@ const resLottieList = { ...@@ -19,6 +20,10 @@ const resLottieList = {
"xianluoCat":{ "xianluoCat":{
imgUrl:resCanvasList["de2d1dca-ed1c-4fe0-93ef-684f4b96c87e"].url, imgUrl:resCanvasList["de2d1dca-ed1c-4fe0-93ef-684f4b96c87e"].url,
json:XianluoCatTexture json:XianluoCatTexture
},
"letter":{
imgUrl:resCanvasList["3b12798d-d932-4f5b-a442-6e4877ba5c16"].url,
json:LetterTexture
} }
} }
export default resLottieList; export default resLottieList;
\ No newline at end of file
/**当前场景对应的类型 */ /**当前场景对应的类型 */
export enum SCENETYPE{ export enum SCENETYPE{
/**教室 */ /**教室 */
CLASSROOM, CLASSROOM=1,
/**操场 */ /**操场 */
PLAYGROUND, PLAYGROUND,
/**寝室 */ /**寝室 */
......
import { RES } from "../module/RES"; import { RES } from "../module/RES";
import resCanvasList from "../resCanvasList" import resCanvasList from "../resCanvasList"
import { SCENETYPE } from "./Enum";
/**记录全局信息与全局方法 */ /**记录全局信息与全局方法 */
export class Ins { export class Ins {
/**舞台宽高 */ /**舞台宽高 */
public static stageW: number; public static stageW: number;
public static stageH: number; public static stageH: number;
/**猫咪是否出寝了 */
public static catIsOut:boolean;
/**当前用户所在场景 */
public static curScene:SCENETYPE;
public static userInfo: { public static userInfo: {
"catName": string, //猫咪姓名 "catName": string, //猫咪姓名
"catType": string, //猫咪类型 "catType": string, //猫咪类型
"userNick": string, //用户昵称 "userNick": string, //用户昵称
"energy": string, //精力值 "energy": number, //精力值
"happyCoin": string, //欢乐币 "happyCoin": number, //欢乐币
"experience": string, //经验值 "experience": number, //经验值
"level": string, //等级 "level": string, //等级
"avatar": string, //头像 "avatar": string, //头像
"sence": number, //场景 "sence": number, //场景
"senceTips":string[] //场景互动文案(猫咪说话)
}
public static showToast(msg?:any){
FYGE.GDispatcher.dispatchEvent("toast",msg);
}
public static showLoading(){
FYGE.GDispatcher.dispatchEvent("loading");
}
public static hideLoading(){
FYGE.GDispatcher.dispatchEvent("hideloading");
} }
/**删除一个lottie的所有tween,停止动效 */ /**删除一个lottie的所有tween,停止动效 */
......
...@@ -108,18 +108,18 @@ export class Main { ...@@ -108,18 +108,18 @@ export class Main {
// }) // })
//获取数据,,必成功 //获取数据,,必成功
// showWaiting(); // showWaiting();
sendTbNet(TbNetName.getAppData, {}, (s, res) => { // sendTbNet(TbNetName.getAppData, {}, (s, res) => {
console.log('getAppData success,res',s,res) // console.log('getAppData success,res',s,res)
}) // })
sendTbNet(TbNetName.getActivityBaseInfoById, {}, (s, res) => { // sendTbNet(TbNetName.getActivityBaseInfoById, {}, (s, res) => {
console.log('getActivityBaseInfoById success,res',s,res) // console.log('getActivityBaseInfoById success,res',s,res)
}) // })
console.log('准备打开弹窗') // console.log('准备打开弹窗')
setTimeout(() => { // setTimeout(() => {
sendTbNet(TbNetName.showModal, {name:'ruleModal'}, (s, res) => { // sendTbNet(TbNetName.showModal, {name:'messageModal',data:{catName:'喵喵'}}, (s, res) => {
console.log('showModal ruleModal, success,res',s,res) // console.log('showModal messageModal, success,res',s,res)
}) // })
}, 3000); // }, 3000);
// console.log('准备切换到兑换页面') // console.log('准备切换到兑换页面')
// setTimeout(() => { // setTimeout(() => {
// sendTbNet(TbNetName.navigateToPage, {name:'pageshop'}, (s, res) => { // sendTbNet(TbNetName.navigateToPage, {name:'pageshop'}, (s, res) => {
......
...@@ -10,5 +10,5 @@ export const ResJson = { ...@@ -10,5 +10,5 @@ export const ResJson = {
"name": "startScene" "name": "startScene"
} }
], ],
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1600743469/resource/" "path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1600763276/resource/"
} }
\ No newline at end of file
import { showToast, wait, clearWait } from "../module/ctrls"; import { showToast, wait, clearWait } from "../module/ctrls";
import { Ins } from "./Ins";
import { GDispatcher } from "./Main"; import { GDispatcher } from "./Main";
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分 //接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
...@@ -168,7 +169,7 @@ export function sendTbNet( ...@@ -168,7 +169,7 @@ export function sendTbNet(
netName: TbNetName, netName: TbNetName,
parameter?: any, parameter?: any,
callback?: (success: boolean, res?: dataOut) => void, callback?: (success: boolean, res?: dataOut) => void,
hideMsg: boolean = false hideMsg: boolean = true
): Promise<dataOut> { ): Promise<dataOut> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
//网络超时 //网络超时
...@@ -215,7 +216,7 @@ export function sendTbNet( ...@@ -215,7 +216,7 @@ export function sendTbNet(
//记录数据 //记录数据
dataRecord[netName] = d; dataRecord[netName] = d;
//统一错误信息提示,d.data为了区分网络超时 //统一错误信息提示,d.data为了区分网络超时
if (!hideMsg && !d.success) showToast(d.message || "网络超时") if (!hideMsg && !d.success) Ins.showToast(d.message || "网络超时")
//执行回调 //执行回调
callback && callback(d.success, d); callback && callback(d.success, d);
resolve(d) resolve(d)
......
...@@ -44,12 +44,19 @@ export class Cat extends Module { ...@@ -44,12 +44,19 @@ export class Cat extends Module {
catAnimArr: FYGE.Lottie[] = []; //猫咪lottie实例组 catAnimArr: FYGE.Lottie[] = []; //猫咪lottie实例组
catLottieArr: any //猫咪lottie数据组 catLottieArr: any //猫咪lottie数据组
actRunning: boolean = false; //动效是否进行中,如果动效进行中,无法进行其他动效 actRunning: boolean = false; //动效是否进行中,如果动效进行中,无法进行其他动效
dialog:FYGE.Sprite; //猫咪对话框气泡
dialogText:FYGE.TextField; //猫咪对话框气泡文字内容
dialogPos:any[]=[{x:1,y:1}]; //猫咪对话框气泡位置
initUi() { initUi() {
this.initCatLottieArr(); this.initCatLottieArr();
console.log(this.catLottieArr); console.log(this.catLottieArr);
this.initCat(); this.initCat();
this.setCatAnimShow(0); this.initDialog();
var tipsArr = Ins.userInfo.senceTips;
var index = Math.floor(Math.random()*tipsArr.length)
this.showDialog(1,tipsArr[index]);
this.setCatAnimShow(1,()=>{this.stopCatAct()});
this.initEvents(); this.initEvents();
} }
...@@ -66,7 +73,7 @@ export class Cat extends Module { ...@@ -66,7 +73,7 @@ export class Cat extends Module {
}, },
"orenge": { "orenge": {
sleep: jumao01, sleep: jumao01,
talk: jumaoshumao, talk: jumaoshuohua,
clear: jumaoshumao, clear: jumaoshumao,
rua: jumaolumao04, rua: jumaolumao04,
play: jumaowanshua, play: jumaowanshua,
...@@ -119,7 +126,43 @@ export class Cat extends Module { ...@@ -119,7 +126,43 @@ export class Cat extends Module {
that.catAnimArr.push(that.cat_touch); that.catAnimArr.push(that.cat_touch);
} }
curAnim: number = 0; /**初始化对话框 */
initDialog(){
var that = this;
that.dialogPos = [{},{x:280,y:516},{x:320,y:400},{x:280,y:556},{x:280,y:536},{x:370,y:536}]
that.dialog = Ins.initSprite("624e8c63-963f-4b20-9802-b0fb006fbf93");
that.dialog.position.set(280,526)
that.addChild(that.dialog);
that.dialogText = Ins.initLabel({size:24,x:30,y:20});
that.dialogText.textWidth = 280;
that.dialog.addChild(that.dialogText);
that.dialogText.textHeight = 138;
that.dialogText.verticalAlign = FYGE.VERTICAL_ALIGN.MIDDLE
// that.dialogText.text = "哈哈哈哈哈哈哈,哈哈哈\n哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈";
console.log("最大长度为"+that.dialogText.text.length)
console.log("当前文本高度为"+that.dialogText.textHeight);
// that.dialog.visible = false;
that.dialog.alpha = 0;
}
/**显示对话框 */
showDialog(type,msg:string){
var that = this;
msg = msg.length>=11?msg.substring(0,11)+'\n'+msg.substring(11):msg
that.dialog.position.set(that.dialogPos[type].x,that.dialogPos[type].y)
that.dialogText.text = msg;
FYGE.Tween.removeTweens(that.dialog);
that.dialog.alpha = 0;
FYGE.Tween.get(that.dialog).to({alpha:1},400);
// this.dialog.visible = true;
}
/**隐藏对话框 */
hideDialog(){
this.dialog.alpha = 0;
FYGE.Tween.removeTweens(this.dialog);
}
/**根据index显示猫咪动画 /**根据index显示猫咪动画
* 0:睡觉,1:说话,2:梳毛,3:撸猫,4:玩球,5:摸头 * 0:睡觉,1:说话,2:梳毛,3:撸猫,4:玩球,5:摸头
*/ */
...@@ -142,29 +185,49 @@ export class Cat extends Module { ...@@ -142,29 +185,49 @@ export class Cat extends Module {
} }
} }
/**猫咪停止互动 */
stopCatAct(){
var that = this;
that.hideDialog();
that.setCatAnimShow(0,null);
}
/**猫咪互动 */ /**猫咪互动 */
catAct(e) { catAct(e) {
if (this.actRunning) return; if (this.actRunning) return;
var that = this; var that = this;
let actType = e.data; let actType = e.data;
var type;
switch(actType){
case 2: type=2;
break;
case 3: type=1;
break;
case 4: type=4;
break;
case 5: type=3;
break;
}
console.log(actType); console.log(actType);
sendTbNet(TbNetName.interaction, {}, (s, r) => { sendTbNet(TbNetName.interaction, {type:type,scene:Ins.curScene}, (s, r) => {
if (s) { if (s) {
FYGE.GDispatcher.dispatchEvent(MSG.UPDATE_USERINFO);
that.actRunning = true; that.actRunning = true;
switch (actType) { switch (actType) {
case CAT_ACTTYPEP.SLEEP: case CAT_ACTTYPEP.SLEEP:
break; break;
default: default:
that.setCatAnimShow(actType, () => { that.setCatAnimShow(0, null) }); that.showDialog(actType,r.data.tips);
that.setCatAnimShow(actType, () => {
that.stopCatAct();
});
break; break;
} }
}else }else
{ {
FYGE.GDispatcher.dispatchEvent("23",r.message) Ins.showToast(r.message)
} }
}) })
} }
initEvents() { initEvents() {
......
{
"1085e1ca-a5a5-4e1c-9917-fb27efa359f7.png": {
"x": 2,
"y": 2,
"w": 299,
"h": 175,
"ox": 0,
"oy": 0,
"sw": 299,
"sh": 175,
"ro": false
},
"eafa36c0-16e3-4112-b56e-a492a4899a5f.png": {
"x": 2,
"y": 179,
"w": 298,
"h": 243,
"ox": 0,
"oy": 0,
"sw": 298,
"sh": 243,
"ro": true
},
"6612ca2f-948b-49a3-982f-250e4cd9c635.png": {
"x": 247,
"y": 179,
"w": 249,
"h": 215,
"ox": 0,
"oy": 0,
"sw": 249,
"sh": 215,
"ro": false
},
"798dbdf0-d769-4d22-baaf-b811eb29db30.png": {
"x": 2,
"y": 479,
"w": 187,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 187,
"sh": 24,
"ro": false
}
}
\ No newline at end of file
export const letter = {
"v": "5.6.10",
"fr": 30,
"ip": 0,
"op": 17,
"w": 750,
"h": 1624,
"nm": "底",
"layers": [
{
"ind": 1,
"ty": 2,
"nm": "点击信封打开看看",
"refId": "798dbdf0-d769-4d22-baaf-b811eb29db30",
"ks": {
"o": {
"a": 1,
"k": [
{
"t": 0,
"s": [
100
]
},
{
"t": 7,
"s": [
100
]
},
{
"t": 8,
"s": [
0
]
},
{
"t": 15,
"s": [
0
]
},
{
"t": 16,
"s": [
100
]
}
]
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
383.5,
1003,
0
]
},
"a": {
"a": 0,
"k": [
93.5,
12,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 600
},
{
"ind": 3,
"ty": 2,
"nm": "上",
"refId": "1085e1ca-a5a5-4e1c-9917-fb27efa359f7",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
388.5,
887.5,
0
]
},
"a": {
"a": 0,
"k": [
149.5,
87.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 600
},
{
"ind": 4,
"ty": 2,
"nm": "字条",
"refId": "6612ca2f-948b-49a3-982f-250e4cd9c635",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 1,
"k": [
{
"t": 0,
"s": [
388.5,
866.5,
0
]
},
{
"t": 8,
"s": [
388.5,
859.5,
0
]
},
{
"t": 16,
"s": [
388.5,
866.5,
0
]
}
]
},
"a": {
"a": 0,
"k": [
124.5,
107.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 600
},
{
"ind": 5,
"ty": 2,
"nm": "下",
"refId": "eafa36c0-16e3-4112-b56e-a492a4899a5f",
"ks": {
"o": {
"a": 0,
"k": 100
},
"r": {
"a": 0,
"k": 0
},
"p": {
"a": 0,
"k": [
390,
835.5,
0
]
},
"a": {
"a": 0,
"k": [
149,
121.5,
0
]
},
"s": {
"a": 0,
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 600
}
],
"markers": []
}
\ No newline at end of file
...@@ -13,6 +13,8 @@ export class RulePanel extends Panel{ ...@@ -13,6 +13,8 @@ export class RulePanel extends Panel{
this.y = (Ins.stageH - bg.height)>>1; this.y = (Ins.stageH - bg.height)>>1;
var ruleLabel = Ins.initLabel({size:24,text:"规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则"}) var ruleLabel = Ins.initLabel({size:24,text:"规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则"})
var ruleView = new FYGE.ScrollPage(574,279,ruleLabel.textHeight) var ruleView = new FYGE.ScrollPage(574,279,ruleLabel.textHeight)
ruleLabel.textWidth = 570;
// ruleLabel.
ruleView.isSpringBack = false; ruleView.isSpringBack = false;
ruleView.x = 76; ruleView.x = 76;
ruleView.y = 167; ruleView.y = 167;
......
...@@ -19,7 +19,7 @@ export class SelectCatPanel extends Panel { ...@@ -19,7 +19,7 @@ export class SelectCatPanel extends Panel {
var bg = Ins.initSprite("db53267d-4141-4d3e-afda-9b523c89be3e"); var bg = Ins.initSprite("db53267d-4141-4d3e-afda-9b523c89be3e");
that.addChild(bg); that.addChild(bg);
that.x = (Ins.stageW - bg.width) >> 1; that.x = (Ins.stageW - bg.width) >> 1;
that.y = Ins.stageH < 1624 ? (Ins.stageH - bg.height + 300) >> 1 : (Ins.stageH - bg.height) >> 1; that.y = (Ins.stageH - bg.height) >> 1;
that.selectSureBtn = Ins.initSprite("628fc38b-7dc0-4c69-aac1-279d60c8f1ed", 185, 804); that.selectSureBtn = Ins.initSprite("628fc38b-7dc0-4c69-aac1-279d60c8f1ed", 185, 804);
that.addChild(that.selectSureBtn); that.addChild(that.selectSureBtn);
......
...@@ -7,65 +7,80 @@ import { MSG, SCENETYPE } from "../Enum"; ...@@ -7,65 +7,80 @@ import { MSG, SCENETYPE } from "../Enum";
import { showToast } from "../../module/ctrls"; import { showToast } from "../../module/ctrls";
import { GDispatcher } from "../Main"; import { GDispatcher } from "../Main";
import { Cat } from "../cat/Cat"; import { Cat } from "../cat/Cat";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { letter } from "../lottieSrc/lottieTs/letter";
export class MainScene extends Scene{ export class MainScene extends Scene {
/**场景背景 */ /**场景背景 */
private sceneBg:FYGE.Sprite; private sceneBg: FYGE.Sprite;
/**场景背景纹理 */ /**场景背景纹理 */
private bgTexture:FYGE.Texture; private bgTexture: FYGE.Texture;
/**场景背景uuid组 */ /**场景背景uuid组 */
private bgUUID:string[]=[]; private bgUUID: string[] = [];
/**主页面UI */ /**主页面UI */
private mainUi:MainSceneBtnUi; private mainUi: MainSceneBtnUi;
/**台历按钮,进入教室 */ /**台历按钮,进入教室 */
private tlBtn:FYGE.Sprite; private tlBtn: FYGE.Sprite;
/**毛线球按钮,进入操场 */ /**毛线球按钮,进入操场 */
private mxqBtn:FYGE.Sprite; private mxqBtn: FYGE.Sprite;
/**猫猫 */ /**猫猫 */
private cat:Cat; private cat: Cat;
/**信封 */ /**信封 */
private letter:FYGE.Lottie; private letter: FYGE.Lottie;
/**精力条组 */ /**精力条组 */
private energyGroup:FYGE.Sprite; //精力条组/背景 private energyGroup: FYGE.Sprite; //精力条组/背景
private energyImg:FYGE.Sprite; //精力条图片 private energyImg: FYGE.Sprite; //精力条图片
private energyDeco:FYGE.Sprite; //精力条装饰品,就是那个可爱的猫爪子 private energyDeco: FYGE.Sprite; //精力条装饰品,就是那个可爱的猫爪子
private energyLabel:FYGE.TextField; //精力条文本,精力条下方的文本x/xxx private energyLabel: FYGE.TextField; //精力条文本,精力条下方的文本x/xxx
private energyDialog:FYGE.Sprite; //精力条上方的气泡 private energyDialog: FYGE.Sprite; //精力条上方的气泡
private energyDialogLabel:FYGE.TextField; //精力条上方气泡中的文字 private energyDialogLabel: FYGE.TextField; //精力条上方气泡中的文字
private energy:number; //当前精力值 private energy: number; //当前精力值
private energyImgW:number; //精力条宽度 private energyImgW: number; //精力条宽度
private maxEnergy: number = 1500; //最大精力值
initUi(){
/**猫咪等级 */
private level: number = 0;
initUi() {
var that = this; var that = this;
that.initSceneEle(); that.initSceneEle();
} }
/**初始化场景元素 */ /**初始化场景元素 */
initSceneEle(){ initSceneEle() {
var that = this; var that = this;
that.x = (Ins.stageW - 750)>>1; that.x = (Ins.stageW - 750) >> 1;
that.y = (Ins.stageH - 1624)>>1; that.y = (Ins.stageH - 1624) >> 1;
console.log(that.y); console.log(that.y);
that.mouseChildren = true; that.mouseChildren = true;
Ins.curScene = Ins.userInfo.sence;
//0:教室,1:操场,2:寝室 //0:教室,1:操场,2:寝室
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea","efaf990e-5392-49ad-94d8-25c04f651ede","b3c8c187-e5c9-4968-9a00-a118d18ab2fc"]; that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
//生成默认场景,后面要改成根据接口值判断 //生成默认场景,后面要改成根据接口值判断
that.sceneBg = Ins.initSprite("b3c8c187-e5c9-4968-9a00-a118d18ab2fc"); that.sceneBg = Ins.initSprite(that.bgUUID[Ins.curScene-1]);
that.addChild(that.sceneBg); that.addChild(that.sceneBg);
that.tlBtn = Ins.initSprite("1f8b040d-2fbc-4ff8-92f9-159773364fae",0,640); that.tlBtn = Ins.initSprite("1f8b040d-2fbc-4ff8-92f9-159773364fae", 0, 640);
that.tlBtn.alpha = 0.1; that.tlBtn.alpha = 0.1;
that.tlBtn.mouseEnable = true; that.tlBtn.mouseEnable = true;
that.addChild(that.tlBtn); that.addChild(that.tlBtn);
that.mxqBtn = Ins.initSprite("1f8b040d-2fbc-4ff8-92f9-159773364fae",50,940); that.mxqBtn = Ins.initSprite("1f8b040d-2fbc-4ff8-92f9-159773364fae", 50, 940);
that.mxqBtn.width = 80; that.mxqBtn.width = 80;
that.mxqBtn.height = 80; that.mxqBtn.height = 80;
that.mxqBtn.alpha = 0.1; that.mxqBtn.alpha = 0.1;
that.mxqBtn.mouseEnable = true; that.mxqBtn.mouseEnable = true;
that.addChild(that.mxqBtn); that.addChild(that.mxqBtn);
that.mainUi = new MainSceneBtnUi({uiType:SCENETYPE.BEADROOM}); if(Ins.curScene==SCENETYPE.BEADROOM){
that.tlBtn.visible = true;
that.mxqBtn.visible = true;
}else{
that.tlBtn.visible = false;
that.mxqBtn.visible = false;
}
that.mainUi = new MainSceneBtnUi({ uiType: Ins.curScene });
that.addChild(that.mainUi); that.addChild(that.mainUi);
that.initCat(); that.initCat();
...@@ -73,31 +88,58 @@ export class MainScene extends Scene{ ...@@ -73,31 +88,58 @@ export class MainScene extends Scene{
} }
/**初始化猫咪 */ /**初始化猫咪 */
initCat(){ initCat() {
var that = this; var that = this;
that.cat = new Cat({type:"xianluo"}); that.cat = new Cat({ type: "orenge" });
that.addChild(that.cat); that.addChild(that.cat);
if (Ins.catIsOut) {
that.cat.visible = false;
//当猫出走的时候,隐藏猫咪,创建信封
that.letter = new FYGE.Lottie(letter);
that.addChild(that.letter);
that.letter.play();
}
}
/**打开信封 */
openLetter() {
console.log("打开信封弹窗")
if (this.letter && this.letter.visible) {
sendTbNet(TbNetName.showModal, { name: 'messageModal', data: { catName: Ins.userInfo.catName } }, (s, res) => {
console.log('showModal ruleModal, success,res', s, res)
})
}
}
/**删除信封 */
removeLetter() {
var that = this;
Ins.stopLottieAnim(that.letter);
} }
/**初始化精力组 */ /**初始化精力组 */
initEnergy(){ initEnergy() {
var that = this; var that = this;
that.energyGroup = Ins.initSprite("fa59e617-f1d9-4065-85e1-6f6ebefb230f",60,1119); that.energyGroup = Ins.initSprite("fa59e617-f1d9-4065-85e1-6f6ebefb230f", 60, 1119);
that.energyGroup.mouseEnable = false;
that.energyGroup.mouseChildren = false;
that.addChild(that.energyGroup); that.addChild(that.energyGroup);
that.energyImg = Ins.initSprite("e00aee6d-2a90-4e92-b365-f031320d582c",9,9); that.energyImg = Ins.initSprite("e00aee6d-2a90-4e92-b365-f031320d582c", 9, 9);
that.energyImgW = that.energyImg.width; that.energyImgW = that.energyImg.width;
that.energyGroup.addChild(that.energyImg); that.energyGroup.addChild(that.energyImg);
that.energyDeco = Ins.initSprite("0eb9c19f-248e-4bf1-bffb-ea694a94b16f",541,-9); that.energyDeco = Ins.initSprite("0eb9c19f-248e-4bf1-bffb-ea694a94b16f", 541, -9);
that.energyGroup.addChild(that.energyDeco); that.energyGroup.addChild(that.energyDeco);
that.energyDialog = Ins.initSprite("69009eb9-4593-4a43-a9d7-a6356ebd6d04",174,-60); that.energyDialog = Ins.initSprite("69009eb9-4593-4a43-a9d7-a6356ebd6d04", 174, -60);
that.energyGroup.addChild(that.energyDialog); that.energyGroup.addChild(that.energyDialog);
that.energyDialogLabel = Ins.initLabel({size:26,text:"每5分钟恢复10点精力"}); that.energyDialogLabel = Ins.initLabel({ size: 26, text: "每5分钟恢复10点精力" });
that.energyDialog.addChild(that.energyDialogLabel); that.energyDialog.addChild(that.energyDialogLabel);
that.energyDialogLabel.x = (that.energyDialog.width - that.energyDialogLabel.textWidth)*0.5; that.energyDialogLabel.x = (that.energyDialog.width - that.energyDialogLabel.textWidth) * 0.5;
that.energyDialogLabel.y = (that.energyDialog.height - that.energyDialogLabel.textHeight)*0.5-2; that.energyDialogLabel.y = (that.energyDialog.height - that.energyDialogLabel.textHeight) * 0.5 - 2;
that.energyLabel = Ins.initLabel({ size: 26, y: 85 });
that.energyGroup.addChild(that.energyLabel);
var mask = new FYGE.Shape(); var mask = new FYGE.Shape();
mask.beginFill(6,1); mask.beginFill(6, 1);
mask.drawRoundedRect(0,0,that.energyImg.width,that.energyImg.height,38,38,38,38); mask.drawRoundedRect(0, 0, that.energyImg.width, that.energyImg.height, 38, 38, 38, 38);
mask.endFill(); mask.endFill();
mask.x = 9; mask.x = 9;
mask.y = 9; mask.y = 9;
...@@ -106,53 +148,93 @@ export class MainScene extends Scene{ ...@@ -106,53 +148,93 @@ export class MainScene extends Scene{
that.setEnergy(); that.setEnergy();
} }
/**设置精力 */ /**设置精力组数据 */
setEnergy(){ setEnergy() {
var that = this; var that = this;
that.energyImg.scaleX = 0.5; that.energy = Ins.userInfo.energy;
that.energyDeco.x = that.energyImgW*that.energyImg.scaleX-that.energyDeco.width*0.5; that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2
}
/**按照时间恢复精力 */
energyUp() {
} }
/**切换场景 */ /**切换场景 */
changeMainScene(type:SCENETYPE){ changeMainScene(type: SCENETYPE) {
console.log("切换到"+type) console.log("切换到" + type)
var that = this; var that = this;
that.sceneBg.texture = RES.getRes(resCanvasList[that.bgUUID[type]].url) Ins.curScene = type;
that.sceneBg.texture = RES.getRes(resCanvasList[that.bgUUID[type-1]].url)
//切换场景时判断猫在不在,后面要改成与接口值判断 //切换场景时判断猫在不在,后面要改成与接口值判断
if(type==2){ if (Ins.catIsOut) {
that.cat.visible = true;
}else{
that.cat.visible = false; that.cat.visible = false;
that.cat.setCatAnimShow(0); } else {
if ((type) == Ins.userInfo.sence) {
that.cat.visible = true;
} else {
that.cat.visible = false;
that.cat.stopCatAct();
}
} }
switch(type){ switch (type) {
case SCENETYPE.BEADROOM: case SCENETYPE.BEADROOM: //切换到寝室
that.mxqBtn.visible = that.tlBtn.visible = true; that.mxqBtn.visible = that.tlBtn.visible = true;
if (that.letter && Ins.catIsOut) {
that.letter.visible = true;
}
break; break;
case SCENETYPE.CLASSROOM: case SCENETYPE.CLASSROOM: //切换到教室
that.mxqBtn.visible = that.tlBtn.visible = false; that.mxqBtn.visible = that.tlBtn.visible = false;
if (that.letter) {
that.letter.visible = false;
}
break; break;
case SCENETYPE.PLAYGROUND: case SCENETYPE.PLAYGROUND: //切换到操场
that.mxqBtn.visible = that.tlBtn.visible = false; that.mxqBtn.visible = that.tlBtn.visible = false;
if (that.letter) {
that.letter.visible = false;
}
break; break;
} }
that.mainUi.changeBtnByUiType(type); that.mainUi.changeBtnByUiType(type);
} }
/**更新用户相关信息 */
updateUserInfo() {
var that = this;
sendTbNet(TbNetName.getUserInfo, {}, (s, r) => {
if (s) {
Ins.userInfo = r.data;
that.setEnergy();
that.mainUi.updateUserInfo();
} else {
showToast(r.message)
}
})
}
initEvents(){ initEvents() {
var that = this; var that = this;
console.log("主场景添加事件") console.log("主场景添加事件")
that.tlBtn.addEventListener(FYGE.MouseEvent.CLICK,()=>{that.changeMainScene(SCENETYPE.CLASSROOM)},that); that.tlBtn.addEventListener(FYGE.MouseEvent.CLICK, () => { that.changeMainScene(SCENETYPE.CLASSROOM) }, that);
that.mxqBtn.addEventListener(FYGE.MouseEvent.CLICK,()=>{that.changeMainScene(SCENETYPE.PLAYGROUND)},that); that.mxqBtn.addEventListener(FYGE.MouseEvent.CLICK, () => { that.changeMainScene(SCENETYPE.PLAYGROUND) }, that);
FYGE.GDispatcher.addEventListener(MSG.CHANGE_SCENE,()=>{that.changeMainScene(SCENETYPE.BEADROOM)},that); that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.addEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that);
FYGE.GDispatcher.addEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that);
} }
removeEvents(){ removeEvents() {
var that = this; var that = this;
console.log("主场景移除事件") console.log("主场景移除事件")
that.tlBtn.removeEventListener(FYGE.MouseEvent.CLICK,()=>{that.changeMainScene(SCENETYPE.CLASSROOM)},that); that.tlBtn.removeEventListener(FYGE.MouseEvent.CLICK, () => { that.changeMainScene(SCENETYPE.CLASSROOM) }, that);
that.mxqBtn.removeEventListener(FYGE.MouseEvent.CLICK,()=>{that.changeMainScene(SCENETYPE.PLAYGROUND)},that); that.mxqBtn.removeEventListener(FYGE.MouseEvent.CLICK, () => { that.changeMainScene(SCENETYPE.PLAYGROUND) }, that);
FYGE.GDispatcher.removeEventListener(MSG.CHANGE_SCENE,()=>{that.changeMainScene(SCENETYPE.BEADROOM)},that); that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.removeEventListener(MSG.CHANGE_SCENE, () => { that.changeMainScene(SCENETYPE.BEADROOM) }, that);
FYGE.GDispatcher.removeEventListener(MSG.UPDATE_USERINFO, that.updateUserInfo, that);
} }
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ import Root from "./Root"; ...@@ -5,7 +5,7 @@ import Root from "./Root";
import resCanvasList from "../../../game/resCanvasList" import resCanvasList from "../../../game/resCanvasList"
import { MainScene } from "./MainScene"; import { MainScene } from "./MainScene";
import { Ins } from "../Ins"; import { Ins } from "../Ins";
import { showPanel, showToast } from "../../module/ctrls"; import { changeScene, showPanel, showToast } from "../../module/ctrls";
import { SelectCatPanel } from "../panels/selectcatpanel/SelectCatPanel"; import { SelectCatPanel } from "../panels/selectcatpanel/SelectCatPanel";
import { sendTbNet, TbNetName } from "../TaoBaoNet"; import { sendTbNet, TbNetName } from "../TaoBaoNet";
export class StartScene extends Scene { export class StartScene extends Scene {
...@@ -20,14 +20,20 @@ export class StartScene extends Scene { ...@@ -20,14 +20,20 @@ export class StartScene extends Scene {
if(s){ if(s){
if(r.data){ if(r.data){
Ins.userInfo = r.data; Ins.userInfo = r.data;
this.addChild(new MainScene()); /**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */
if(r.data.sence==4){
Ins.catIsOut = true;
}else{
Ins.catIsOut = false;
}
changeScene(MainScene)
}else }else
{ {
showPanel(SelectCatPanel); showPanel(SelectCatPanel);
} }
}else }else
{ {
showToast(r.message) Ins.showToast(r.message)
} }
}) })
......
...@@ -36,15 +36,22 @@ export class MainSceneBtnUi extends Module { ...@@ -36,15 +36,22 @@ export class MainSceneBtnUi extends Module {
private playBtn: FYGE.Sprite; private playBtn: FYGE.Sprite;
/**补充精力按钮 */ /**补充精力按钮 */
private energyBtn: FYGE.Sprite; private energyBtn: FYGE.Sprite;
/**召回猫咪按钮 */
private catRecall: FYGE.Sprite;
/**猫猫信息组 */ /**猫猫信息组 */
private catInfoGroup: FYGE.Sprite; private catInfoGroup: FYGE.Sprite;
private catAvatar: FYGE.Sprite; //猫猫头像 private catAvatar: FYGE.Sprite; //猫猫头像
private catNameLabel: FYGE.TextField; //猫猫名称文本 private catNameLabel: FYGE.TextField; //猫猫名称文本
private catLevelLabel: FYGE.TextField; //猫猫等级文本 private catLevelLabel: FYGE.TextField; //猫猫等级文本
private catExperience:FYGE.TextField; //经验值文本
/**鱼鱼积分组 */ /**鱼鱼积分组 */
private fishPointGroup: FYGE.Sprite; private fishPointGroup: FYGE.Sprite;
private fishPointLabel: FYGE.TextField; //鱼鱼积分文本 private fishPointLabel: FYGE.TextField; //鱼鱼积分文本
/**按钮组,一个上方按钮组,一个下方按钮组,如果用于适配就改变这两个按钮组 */
private topBtnGroup:FYGE.Sprite;
private bottomBtnGroup:FYGE.Sprite;
/**互动进行中,当互动进行中时,无法点击互动按钮进行互动 */ /**互动进行中,当互动进行中时,无法点击互动按钮进行互动 */
private actRunning: boolean = false; private actRunning: boolean = false;
initUi() { initUi() {
...@@ -58,43 +65,62 @@ export class MainSceneBtnUi extends Module { ...@@ -58,43 +65,62 @@ export class MainSceneBtnUi extends Module {
that.mouseEnable = false; that.mouseEnable = false;
that.mouseChildren = true; that.mouseChildren = true;
that.strategyBtn = Ins.initSprite("e636bd22-361f-442a-8684-ccfe1141485a", 579, 332); that.topBtnGroup = new FYGE.Sprite();
that.addChild(that.strategyBtn); that.topBtnGroup.y = 220;
that.topBtnGroup.mouseEnable = that.topBtnGroup.mouseChildren = true;
that.addChild(that.topBtnGroup);
that.bottomBtnGroup = new FYGE.Sprite();
that.bottomBtnGroup.y = 1240;
that.bottomBtnGroup.mouseEnable = that.bottomBtnGroup.mouseChildren = true;
that.addChild(that.bottomBtnGroup);
that.prizeBtn = Ins.initSprite("e8b083c7-307a-4446-9bc9-99f75c3573e5", 579, 457); that.strategyBtn = Ins.initSprite("e636bd22-361f-442a-8684-ccfe1141485a", 579, 112);
that.addChild(that.prizeBtn); that.topBtnGroup.addChild(that.strategyBtn);
that.energyBtn = Ins.initSprite("cdb8e186-9872-442e-b71e-bba0a9ce5846", 539, 1233); that.prizeBtn = Ins.initSprite("e8b083c7-307a-4446-9bc9-99f75c3573e5", 579, 237);
that.addChild(that.energyBtn); that.topBtnGroup.addChild(that.prizeBtn);
that.energyBtn = Ins.initSprite("cdb8e186-9872-442e-b71e-bba0a9ce5846", 539, -7);
that.bottomBtnGroup.addChild(that.energyBtn);
that.initCatInfoGroup(); that.initCatInfoGroup();
that.initFishPointGroup(); that.initFishPointGroup();
that.initActBtn(); that.initActBtn();
that.updateUserInfo();
that.start(); that.start();
} }
/**初始化猫猫信息 */ /**初始化猫猫信息 */
initCatInfoGroup() { initCatInfoGroup() {
var that = this; var that = this;
that.catInfoGroup = Ins.initSprite("af4b699e-5152-4571-8c54-1c06eabf19e9", 69, 220), that.catInfoGroup = Ins.initSprite("af4b699e-5152-4571-8c54-1c06eabf19e9", 69),
that.addChild(that.catInfoGroup); that.topBtnGroup.addChild(that.catInfoGroup);
that.catAvatar = new FYGE.Sprite(); that.catAvatar = new FYGE.Sprite();
that.catInfoGroup.addChild(that.catAvatar); that.catInfoGroup.addChild(that.catAvatar);
var mask = new FYGE.Shape();
mask.beginFill(6, 1);
mask.drawCircle(0, 0, 24)
mask.endFill();
mask.position.set(33,33)
that.catInfoGroup.addChild(mask);
that.catAvatar.mask = mask;
that.catNameLabel = Ins.initLabel({ color: "black", size: 24, text: "喵喵喵", x: (95 - 19), y: (167 - 145) }) that.catNameLabel = Ins.initLabel({ color: "black", size: 24, text: "喵喵喵", x: (95 - 19), y: (167 - 145) })
that.catInfoGroup.addChild(that.catNameLabel); that.catInfoGroup.addChild(that.catNameLabel);
that.catLevelLabel = Ins.initLabel({ color: "black", size: 24, text: "Lv.1", x: (192 - 19), y: (167 - 145) }) that.catLevelLabel = Ins.initLabel({ color: "black", size: 24, text: "Lv.1", x: (192 - 19), y: (167 - 145) })
that.catInfoGroup.addChild(that.catLevelLabel); that.catInfoGroup.addChild(that.catLevelLabel);
// that.catLevelLabel
} }
/**初始化鱼鱼积分组 */ /**初始化鱼鱼积分组 */
initFishPointGroup() { initFishPointGroup() {
var that = this; var that = this;
that.fishPointGroup = Ins.initSprite("f0810375-c8f1-4939-9b11-1cbde6840e2a", 465, 220); that.fishPointGroup = Ins.initSprite("f0810375-c8f1-4939-9b11-1cbde6840e2a", 465);
that.addChild(that.fishPointGroup); that.topBtnGroup.addChild(that.fishPointGroup);
that.fishPointLabel = Ins.initLabel({ color: "black", size: 24, text: "111111", x: 99, y: 24 }) that.fishPointLabel = Ins.initLabel({ color: "black", size: 24, text: "111111", x: 99, y: 24 })
that.fishPointGroup.addChild(that.fishPointLabel); that.fishPointGroup.addChild(that.fishPointLabel);
...@@ -103,46 +129,70 @@ export class MainSceneBtnUi extends Module { ...@@ -103,46 +129,70 @@ export class MainSceneBtnUi extends Module {
/**初始化互动按钮 */ /**初始化互动按钮 */
initActBtn() { initActBtn() {
var that = this; var that = this;
that.combingBtn = Ins.initSprite("aa17cfa9-f1db-47eb-9eeb-f5947b7f47a8", 62, 1240); that.combingBtn = Ins.initSprite("aa17cfa9-f1db-47eb-9eeb-f5947b7f47a8", 62);
that.addChild(that.combingBtn); that.bottomBtnGroup.addChild(that.combingBtn);
that.catBtn = Ins.initSprite("0b44efa9-1e8a-4c43-a2a5-93852d88918c", 210, 1240); that.catBtn = Ins.initSprite("0b44efa9-1e8a-4c43-a2a5-93852d88918c", 210);
that.addChild(that.catBtn); that.bottomBtnGroup.addChild(that.catBtn);
that.returnBtn = Ins.initSprite("55f703cd-f0d2-4ec1-9430-6193c1cbc1cb", 62, 1240); that.returnBtn = Ins.initSprite("55f703cd-f0d2-4ec1-9430-6193c1cbc1cb", 62);
that.addChild(that.returnBtn); that.bottomBtnGroup.addChild(that.returnBtn);
that.touchHeadBtn = Ins.initSprite("b7ec0f16-ea48-4e41-8def-7cc660fa93d7", 210, 1240); that.touchHeadBtn = Ins.initSprite("b7ec0f16-ea48-4e41-8def-7cc660fa93d7", 210);
that.addChild(that.touchHeadBtn); that.bottomBtnGroup.addChild(that.touchHeadBtn);
that.playBtn = Ins.initSprite("922deced-62d2-4995-9dd6-82bc7913f362", 210, 1240); that.playBtn = Ins.initSprite("922deced-62d2-4995-9dd6-82bc7913f362", 210);
that.addChild(that.playBtn); that.bottomBtnGroup.addChild(that.playBtn);
that.catRecall = Ins.initSprite("72345190-f95b-4152-bccf-393b8a5aa8d0", 62)
that.bottomBtnGroup.addChild(that.catRecall);
that.hideAllActBtn();
that.changeBtnByUiType(that.uiType)
}
/**更新用户数据,在初始化时调用一次,后续通过消息调用,调用用户信息接口的时候调用 */
updateUserInfo() {
var that = this;
const { catName, happyCoin, level, avatar } = Ins.userInfo;
that.catAvatar.texture = RES.getRes(avatar);
that.catAvatar.width = 52;
that.catAvatar.height = 52;
that.catAvatar.x = that.catAvatar.y = 5
that.catNameLabel.text = catName;
that.catLevelLabel.text = "Lv." + level;
that.fishPointLabel.text = "" + happyCoin;
}
/**隐藏所有互动按钮 */
hideAllActBtn() {
var that = this;
that.combingBtn.visible = false; that.combingBtn.visible = false;
that.catBtn.visible = false; that.catBtn.visible = false;
that.returnBtn.visible = false; that.returnBtn.visible = false;
that.touchHeadBtn.visible = false; that.touchHeadBtn.visible = false;
that.playBtn.visible = false; that.playBtn.visible = false;
that.changeBtnByUiType(that.uiType) that.catRecall.visible = false;
} }
/**改变按钮显示,根据uiType */ /**改变按钮显示,根据uiType */
changeBtnByUiType(type: any) { changeBtnByUiType(type: any) {
var that = this; var that = this;
that.combingBtn.visible = false; that.hideAllActBtn();
that.catBtn.visible = false;
that.returnBtn.visible = false;
that.touchHeadBtn.visible = false;
that.playBtn.visible = false;
switch (type) { switch (type) {
case SCENETYPE.BEADROOM: case SCENETYPE.BEADROOM:
that.combingBtn.visible = true; if (Ins.catIsOut) {
that.catBtn.visible = true; that.catRecall.visible = true;
} else if(Ins.userInfo.sence==type){
that.combingBtn.visible = true;
that.catBtn.visible = true;
}
break; break;
case SCENETYPE.CLASSROOM: case SCENETYPE.CLASSROOM:
that.returnBtn.visible = true; that.returnBtn.visible = true;
if (!Ins.catIsOut&&Ins.userInfo.sence==type) {
that.touchHeadBtn.visible = true; that.touchHeadBtn.visible = true;
}
break; break;
case SCENETYPE.PLAYGROUND: case SCENETYPE.PLAYGROUND:
that.returnBtn.visible = true; that.returnBtn.visible = true;
if (!Ins.catIsOut&&Ins.userInfo.sence==type) {
that.playBtn.visible = true; that.playBtn.visible = true;
}
break; break;
default: console.log("改变场景ui时设置uiType错误"); default: console.log("改变场景ui时设置uiType错误");
break; break;
...@@ -153,10 +203,10 @@ export class MainSceneBtnUi extends Module { ...@@ -153,10 +203,10 @@ export class MainSceneBtnUi extends Module {
touchHandler(e: FYGE.MouseEvent) { touchHandler(e: FYGE.MouseEvent) {
console.log(e.target); console.log(e.target);
var that = this; var that = this;
that.btnDelay(e.target);
if (e.target == that.returnBtn) { if (e.target == that.returnBtn) {
that.returnBedRoom(); that.returnBedRoom();
} else { } else {
that.btnDelay(e.target);
switch (e.target) { switch (e.target) {
case that.energyBtn: case that.energyBtn:
that.getEnergy(); that.getEnergy();
...@@ -179,11 +229,22 @@ export class MainSceneBtnUi extends Module { ...@@ -179,11 +229,22 @@ export class MainSceneBtnUi extends Module {
case that.prizeBtn: case that.prizeBtn:
that.openPrizePage(); that.openPrizePage();
break; break;
case that.catRecall:
that.catRecallHandler();
break;
default:console.log("主页面按钮点击事件错误,请检查")
break;
} }
} }
} }
/**召回猫咪事件 */
catRecallHandler(){
console.log("召回猫咪");
}
/**补充精力 */ /**补充精力 */
getEnergy() { getEnergy() {
console.log("补充精力"); console.log("补充精力");
...@@ -243,6 +304,7 @@ export class MainSceneBtnUi extends Module { ...@@ -243,6 +304,7 @@ export class MainSceneBtnUi extends Module {
that.addEvent(that.catBtn, FYGE.MouseEvent.CLICK, that.touchHandler); that.addEvent(that.catBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.addEvent(that.combingBtn, FYGE.MouseEvent.CLICK, that.touchHandler); that.addEvent(that.combingBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.addEvent(that.touchHeadBtn, FYGE.MouseEvent.CLICK, that.touchHandler); that.addEvent(that.touchHeadBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.addEvent(that.catRecall, FYGE.MouseEvent.CLICK, that.touchHandler);
} }
/**添加事件,为了防止obj没有被创建封装 */ /**添加事件,为了防止obj没有被创建封装 */
...@@ -265,7 +327,13 @@ export class MainSceneBtnUi extends Module { ...@@ -265,7 +327,13 @@ export class MainSceneBtnUi extends Module {
that.removeEvent(that.energyBtn, FYGE.MouseEvent.CLICK, that.touchHandler); that.removeEvent(that.energyBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.returnBtn, FYGE.MouseEvent.CLICK, that.touchHandler); that.removeEvent(that.returnBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.strategyBtn, FYGE.MouseEvent.CLICK, that.touchHandler); that.removeEvent(that.strategyBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.prizeBtn, FYGE.MouseEvent.CLICK, that.touchHandler) that.removeEvent(that.prizeBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.playBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.catBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.combingBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.touchHeadBtn, FYGE.MouseEvent.CLICK, that.touchHandler);
that.removeEvent(that.catRecall, FYGE.MouseEvent.CLICK, that.touchHandler);
} }
start() { start() {
......
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
import './comcatname.less';
class Comcatname extends Component {
constructor(props) {
super(props);
this.state = this.state || { resList: resList };
}
render() {
return (
<div className="catname">
<img className="catnamecatimg" src={this.state.resList['02aacfd1-3347-40a7-8a3a-9f20c1b5706b'].url} />
<div className="catnamedialog">
<img className="catnamedialogbg" src={this.state.resList['50779aee-069e-4dd9-b2ff-88beda9f43d1'].url} />
<span className="catnamedialoglabel">铲屎官~帮我取个名字吧!喵~</span>
</div>
<img className="catnamesure" src={this.state.resList['c7916d41-ea9d-4f8e-b5aa-e2060d6ae265'].url} />
<div className="catnameinput">
<img className="catnameinputbg" src={this.state.resList['947d970f-52bf-4319-82f0-a3e65620ed75'].url} />
<span className="catnameinputlabel">输入名字</span>
<span className="catnameinputrandom">随机名字</span>
</div>
</div>
);
}
}
export default Comcatname;
\ No newline at end of file
.shop { .catname {
width: 750px; width: 500px;
height: 1624px; height: 842px;
opacity: 1; opacity: 1;
left: 126px;
top: 378px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
.shopbg { .catnamecatimg {
width: 750px; width: 421px;
height: 1624px; height: 301px;
opacity: 1; opacity: 1;
left: 38px;
top: 202px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
} }
.shopitem { .catnamedialog {
width: 309px; width: 466px;
height: 324px; height: 177px;
opacity: 1; opacity: 1;
left: 54px; left: 5px;
top: 254px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
.shopitem_bg2 { .catnamedialogbg {
width: 309px; width: 466px;
height: 324px; height: 177px;
opacity: 1; opacity: 1;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
} }
.shopitem_bg1 { .catnamedialoglabel {
width: 224px; width: 359px;
height: 161px; height: 72px;
opacity: 1; opacity: 1;
left: 45px; left: 59px;
top: 29px; top: 46px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
font-size: 28px;
color: rgba(87, 75, 69, 1);
} }
.shopitem_disabledbtn { }
width: 209px; .catnamesure {
height: 60px; width: 282px;
opacity: 1; height: 106px;
left: 49px; opacity: 1;
top: 241px; left: 111px;
position: absolute; top: 736px;
transform-origin: 0px 0px 0px; position: absolute;
} transform-origin: 0px 0px 0px;
.shopitem_buybtn { }
width: 217px; .catnameinput {
height: 68px; width: 500px;
height: 147px;
opacity: 1;
top: 538px;
position: absolute;
transform-origin: 0px 0px 0px;
.catnameinputbg {
width: 500px;
height: 102px;
opacity: 1; opacity: 1;
left: 45px;
top: 237px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
} }
.shopitem_txt { .catnameinputlabel {
width: 88px; width: 104px;
height: 20px; height: 27px;
opacity: 1; opacity: 1;
left: 136px; left: 199px;
top: 261px; top: 37px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
font-size: 21.79723px; font-size: 28px;
color: rgba(71, 69, 67, 1); color: rgba(104, 91, 78, 1);
} }
.shopitem_name { .catnameinputrandom {
width: 209px; width: 91px;
height: 23px; height: 26px;
opacity: 1; opacity: 1;
left: 51px; left: 205px;
top: 203px; top: 121px;
position: absolute; position: absolute;
transform-origin: 0px 0px 0px; transform-origin: 0px 0px 0px;
font-size: 20.12052px; font-size: 24px;
color: rgba(71, 69, 67, 1); color: rgba(248, 241, 235, 1);
} }
} }
.shop_gold {
width: 98px;
height: 21px;
opacity: 1;
left: 348px;
top: 151px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 23.47394px;
color: rgba(123, 100, 78, 1);
}
.shop_backbtn {
width: 67px;
height: 67px;
opacity: 1;
left: 48px;
top: 41px;
position: absolute;
transform-origin: 0px 0px 0px;
}
} }
\ No newline at end of file
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
import './comlevelup.less';
class Comlevelup extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
render() {
return (
<div className="levelup ">
<img className="levelup_light " src={this.state.resList['a158cbff-9dcd-49df-bb91-16213d58036e'].url} />
<img className="levelup_bg " src={this.state.resList['b027d194-0fad-45ea-8b1c-3502f7869d2d'].url} />
<img className="levelup_closebtn " src={this.state.resList['d33bbf87-ed39-4959-8673-02a4c31dca77'].url} />
<img className="levelup_bg2 " src={this.state.resList['f88dfc75-c9f1-4e9d-8826-8a1d0e513259'].url} />
<span className="levelup_txt ">精力上限1200 → 精力上限1500</span>
<img className="levelup_title " src={this.state.resList['69bff61a-b5a6-4979-ba8d-9e008aed737a'].url} />
<img className="levelup_imgbg " src={this.state.resList['f56872e2-5e79-4906-99a2-576231f153af'].url} />
<img className="levelup_btn " src={this.state.resList['95520b55-9655-4988-a833-3907978dbffb'].url} />
</div>
);
}
}
export default Comlevelup;
.levelup {
width: 750px;
height: 1093px;
opacity: 1;
top: 221px;
position: absolute;
transform-origin: 0px 0px 0px;
.levelup_light {
width: 750px;
height: 1093px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
}
.levelup_bg {
width: 584px;
height: 715px;
opacity: 1;
left: 85px;
top: 200px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.levelup_closebtn {
width: 45px;
height: 45px;
opacity: 1;
left: 584px;
top: 236px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.levelup_bg2 {
width: 651px;
height: 784px;
opacity: 1;
left: 52px;
top: 182px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.levelup_txt {
width: 371px;
height: 26px;
opacity: 1;
left: 191px;
top: 711px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 26px;
color: rgba(87, 71, 56, 1);
}
.levelup_title {
width: 206px;
height: 35px;
opacity: 1;
left: 274px;
top: 314px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.levelup_imgbg {
width: 360px;
height: 299px;
opacity: 1;
left: 197px;
top: 377px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.levelup_btn {
width: 351px;
height: 105px;
opacity: 1;
left: 201px;
top: 773px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
...@@ -2,22 +2,22 @@ ...@@ -2,22 +2,22 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
//import API from '../../api';
import './pagegamescene.less'; import './commessage.less';
class Pagegamescene extends Component { class Commessage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { resList: resList }; this.state = { resList: resList };
} }
render() { render() {
return ( return (
<div className="gamescene "> <div className="message ">
<div> <img className="message_bg " src={this.state.resList['0c446868-16d2-47f1-a0d6-27dadff681f2'].url} />
<canvas id="canvas" style={{ width: '100%', height: '100%' }}></canvas> <span className="message_txt ">猫咪名字 留</span>
</div> <img className="message_btn " src={this.state.resList['3ad6a924-dda8-49f4-b8fc-0e796347e802'].url} />
<img className="message_closebtn " src={this.state.resList['5488b126-f520-496f-ace6-010a89eb108f'].url} />
</div> </div>
); );
} }
} }
export default Pagegamescene; export default Commessage;
.message {
width: 676px;
height: 650px;
opacity: 1;
left: 40px;
top: 418px;
position: absolute;
transform-origin: 0px 0px 0px;
.message_bg {
width: 676px;
height: 650px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
}
.message_txt {
width: 142px;
height: 25px;
opacity: 1;
left: 268px;
top: 355px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 26px;
color: rgba(104, 91, 78, 1);
}
.message_btn {
width: 45px;
height: 45px;
opacity: 1;
left: 577px;
top: 24px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.message_closebtn {
width: 352px;
height: 106px;
opacity: 1;
left: 161px;
top: 510px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
import './comselectcat.less';
class Comselectcat extends Component {
constructor(props) {
super(props);
this.state = this.state || { resList: resList };
}
render() {
return (
<div className="selectcat">
<img className="selectcatbg" src={this.state.resList['db53267d-4141-4d3e-afda-9b523c89be3e'].url} />
<div className="selectcatblue">
<img className="bluebg" src={this.state.resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url} />
<img className="blueimg" src={this.state.resList['95a6b0a9-3e7a-4a0b-82b6-6742e2a8bddf'].url} />
<span className="bluename">田园橘猫</span>
<img className="bluesure" src={this.state.resList['f956cda2-5eef-4942-8737-742d171527bd'].url} />
</div>
<div className="selectcatsh">
<img className="shbg" src={this.state.resList['8b464624-24b0-46ae-ab4a-65928d4784c7'].url} />
<img className="shimg" src={this.state.resList['fe52ffae-fadd-40f3-97b5-d3d56fd04781'].url} />
<span className="shname">田园橘猫</span>
<img className="shsure" src={this.state.resList['f956cda2-5eef-4942-8737-742d171527bd'].url} />
</div>
<div className="selectcatxl">
<img className="xlbg" src={this.state.resList['6a1a5aa9-affa-42e2-9703-ec36c33f0635'].url} />
<img className="xlimg" src={this.state.resList['193f6955-d754-4b9f-80ca-b9b9a72e8a8b'].url} />
<span className="xlname">田园橘猫</span>
<img className="xlsure" src={this.state.resList['f956cda2-5eef-4942-8737-742d171527bd'].url} />
</div>
<div className="selectcatorge">
<img className="orgebg" src={this.state.resList['8850353b-0a98-4335-9d46-a36678f44be0'].url} />
<img className="orgeimg" src={this.state.resList['e28e5250-c740-4e4f-a855-c415c557e77e'].url} />
<span className="orgename">田园橘猫</span>
<img className="orgesure" src={this.state.resList['f956cda2-5eef-4942-8737-742d171527bd'].url} />
</div>
<img className="selectcattrue" src={this.state.resList['628fc38b-7dc0-4c69-aac1-279d60c8f1ed'].url} />
</div>
);
}
}
export default Comselectcat;
\ No newline at end of file
.selectcat {
width: 721px;
height: 943px;
opacity: 1;
left: 15px;
top: 300px;
position: absolute;
transform-origin: 0px 0px 0px;
.selectcatbg {
width: 721px;
height: 943px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
left: 0px;
top: 0px;
}
.selectcatblue {
width: 303px;
height: 272px;
opacity: 1;
left: 377px;
top: 501px;
position: absolute;
transform-origin: 0px 0px 0px;
.bluebg {
width: 303px;
height: 272px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
}
.blueimg {
width: 161px;
height: 145px;
opacity: 1;
left: 68px;
top: 32px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.bluename {
width: 244px;
height: 26px;
opacity: 1;
left: 26px;
top: 198px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 28px;
color: rgba(104, 91, 78, 1);
text-align: center;
}
.bluesure {
width: 68px;
height: 53px;
opacity: 1;
left: 224px;
top: 172px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
.selectcatsh {
width: 302px;
height: 272px;
opacity: 1;
left: 43px;
top: 501px;
position: absolute;
transform-origin: 0px 0px 0px;
.shbg {
width: 302px;
height: 272px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
}
.shimg {
width: 173px;
height: 138px;
opacity: 1;
left: 59px;
top: 43px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.shname {
width: 244px;
height: 26px;
opacity: 1;
left: 26px;
top: 198px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 28px;
color: rgba(104, 91, 78, 1);
text-align: center;
}
.shsure {
width: 68px;
height: 53px;
opacity: 1;
left: 224px;
top: 172px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
.selectcatxl {
width: 303px;
height: 271px;
opacity: 1;
left: 377px;
top: 197px;
position: absolute;
transform-origin: 0px 0px 0px;
.xlbg {
width: 303px;
height: 271px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
}
.xlimg {
width: 157px;
height: 153px;
opacity: 1;
left: 72px;
top: 29px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.xlname {
width: 244px;
height: 26px;
opacity: 1;
left: 26px;
top: 198px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 28px;
color: rgba(104, 91, 78, 1);
text-align: center;
}
.xlsure {
width: 68px;
height: 53px;
opacity: 1;
left: 224px;
top: 172px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
.selectcatorge {
width: 302px;
height: 271px;
opacity: 1;
left: 43px;
top: 197px;
position: absolute;
transform-origin: 0px 0px 0px;
.orgebg {
width: 302px;
height: 271px;
opacity: 1;
position: absolute;
transform-origin: 0px 0px 0px;
}
.orgeimg {
width: 164px;
height: 141px;
opacity: 1;
left: 67px;
top: 36px;
position: absolute;
transform-origin: 0px 0px 0px;
}
.orgename {
width: 244px;
height: 26px;
opacity: 1;
left: 26px;
top: 198px;
position: absolute;
transform-origin: 0px 0px 0px;
font-size: 28px;
color: rgba(104, 91, 78, 1);
text-align: center;
}
.orgesure {
width: 68px;
height: 53px;
opacity: 1;
left: 224px;
top: 172px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
.selectcattrue {
width: 352px;
height: 106px;
opacity: 1;
left: 185px;
top: 804px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
\ No newline at end of file
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import './pagefrontpage.less';
class Pagefrontpage extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
render() {
return (
<div className="frontpage ">
<div className="div " />
<img className="image " src={this.state.resList['eb602b5e-fd36-4968-bed0-ec786cd8e1c0'].url} />
</div>
);
}
}
export default Pagefrontpage;
.frontpage {
width: 750px;
height: 1624px;
display: block;
position: absolute;
transform-origin: 0px 0px 0px;
left: 228px;
top: 146px;
.div {
width: 300px;
height: 300px;
opacity: 1;
display: block;
position: absolute;
background-color: #ff6600;
transform-origin: 0px 0px 0px;
top: 278px;
left: -142px;
}
.image {
width: 276px;
height: 275px;
opacity: 1;
display: block;
position: absolute;
transform-origin: 0px 0px 0px;
left: -184px;
top: -134px;
}
}
.gamescene {
top: 0px;
left: 0px;
width: 750px;
height: 1624px;
display: block;
position: absolute;
.gamecanvas {
width: 300px;
height: 300px;
opacity: 1;
display: block;
left: 0px;
top: 0px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import './pageshop.less';
class Pageshop extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
render() {
return (
<div className="shop">
<img className="shopbg" src={this.state.resList['da6bc001-768a-4b1c-95af-a9a8853ef6f9'].url} />
<div className="shopitem">
<img className="shopitem_bg2" src={this.state.resList['a5230993-3870-4a91-bdd1-ffc4782770d0'].url} />
<img className="shopitem_bg1" src={this.state.resList['dd4ee407-16e4-4cb7-9eba-365b33f466a3'].url} />
<img className="shopitem_disabledbtn" src={this.state.resList['8d08152f-311a-446a-a15a-ff02ebed0139'].url} />
<img className="shopitem_buybtn" src={this.state.resList['dd8ea96e-e33f-4f5d-b31f-29f332c3c867'].url} />
<span className="shopitem_txt">101010</span>
<span className="shopitem_name">商品名商品名商品名</span>
</div>
<span className="shop_gold">101010</span>
<img className="shop_backbtn" src={this.state.resList['bdab9777-8a4d-4659-ba23-66aaddb7fa5b'].url} />
</div>
);
}
}
export default Pageshop;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -32,6 +32,11 @@ const apiList = { ...@@ -32,6 +32,11 @@ const apiList = {
method:'get', method:'get',
isShowLoading: false isShowLoading: false
}, },
getUserInfo: {
handle: 'getUserInfo',
method:'get',
isShowLoading: false
},
login: { login: {
handle: 'login', handle: 'login',
method:'get', method:'get',
......
page {
background: #f7f7f7;
font-family: 'Helvetica Neue', Helvetica, Hiragino Sans GB, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
}
* {
box-sizing: border-box;
}
.d-flex {
display: flex
}
.d-flex__item {
flex: 1;
}
.d-flex--aligncenter {
align-items: center;
}
.popcontainer {
position: fixed;
width: 750rpx;
height: 1624rpx;
top: 50%;
left: 50%;
margin-left:-375rpx;
margin-top:-812rpx;
background: rgba(0, 0, 0, 0.7);
}
.modal-animate-fade-in {
opacity: 0;
animation: modalAnimateFadeIn .3s forwards;
}
.modal-animate-zoom-in {
transform: scale(0);
animation: modalAnimateZoomIn .4s forwards;
}
.modal-animate-fly-in {
transform: translateY(100%);
animation: modalAnimateFlyIn .3s forwards;
}
.btn-animate-pulse {
animation: btnAnimatePulse .8s infinite;
}
@keyframes modalAnimateFadeIn {
to {
opacity: 1;
}
}
@keyframes modalAnimateZoomIn {
to {
transform: scale(1);
}
}
@keyframes modalAnimateFlyIn {
to {
transform: translateY(0);
}
}
@keyframes btnAnimatePulse {
from {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
to {
transform: scale(1);
}
}
\ No newline at end of file
...@@ -8,7 +8,8 @@ cloud.init({ ...@@ -8,7 +8,8 @@ cloud.init({
App({ App({
requestType: 'cloud', // yapi,cloud: 云函数 requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'yapi', // yapi,cloud: 云函数 requestType: 'yapi', // yapi,cloud: 云函数
cloudName: 'floor', // 主云函数项目名 base clientTemplate2C cloudName: 'tmallCat', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud, cloud,
tbcc, tbcc,
onLaunch(options) { onLaunch(options) {
......
{ {
"pages": [ "pages": [
"pages/index/index",
"pages/pagecanvas/pagecanvas", "pages/pagecanvas/pagecanvas",
"pages/index/index",
"pages/pageshop/pageshop", "pages/pageshop/pageshop",
"pages/myprize/myprize" "pages/myprize/myprize"
], ],
......
.catname {
width: 500rpx;
height: 842rpx;
opacity: 1;
left: 126rpx;
top: 378rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamecatimg {
width: 421rpx;
height: 301rpx;
opacity: 1;
left: 38rpx;
top: 202rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamedialog {
width: 466rpx;
height: 177rpx;
opacity: 1;
left: 5rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamedialog .catnamedialogbg {
width: 466rpx;
height: 177rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnamedialog .catnamedialoglabel {
width: 359rpx;
height: 72rpx;
opacity: 1;
left: 59rpx;
top: 46rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #574b45;
}
.catname .catnamesure {
width: 282rpx;
height: 106rpx;
opacity: 1;
left: 111rpx;
top: 736rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnameinput {
width: 500rpx;
height: 147rpx;
opacity: 1;
top: 538rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnameinput .catnameinputbg {
width: 500rpx;
height: 102rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.catname .catnameinput .catnameinputlabel {
width: 104rpx;
height: 27rpx;
opacity: 1;
left: 199rpx;
top: 37rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
}
.catname .catnameinput .catnameinputrandom {
width: 91rpx;
height: 26rpx;
opacity: 1;
left: 205rpx;
top: 121rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 24rpx;
color: #f8f1eb;
}
<view class="catname">
<image class="catnamecatimg" src={{resList['02aacfd1-3347-40a7-8a3a-9f20c1b5706b'].url}} />
<view class="catnamedialog">
<image class="catnamedialogbg" src={{resList['50779aee-069e-4dd9-b2ff-88beda9f43d1'].url}} />
<label class="catnamedialoglabel">铲屎官~帮我取个名字吧!喵~</label>
</view>
<image class="catnamesure" src={{resList['c7916d41-ea9d-4f8e-b5aa-e2060d6ae265'].url}} />
<view class="catnameinput">
<image class="catnameinputbg" src={{resList['947d970f-52bf-4319-82f0-a3e65620ed75'].url}} />
<label class="catnameinputlabel">输入名字</label>
<label class="catnameinputrandom">随机名字</label>
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {},
data: {
resList: resList
},
methods: {},
onInit(props) {
this.setData(this.data || {
resList: resList
});
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.levelup-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.levelup__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.levelup {
position: absolute;
width: 750rpx;
height: 1093rpx;
opacity: 1;
transform-origin: 0rpx 0rpx 0rpx;
top:50%;
margin-top: -546rpx;
}
.levelup .levelup_light {
width: 750rpx;
height: 1093rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_bg {
width: 584rpx;
height: 715rpx;
opacity: 1;
left: 85rpx;
top: 200rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_closebtn {
width: 45rpx;
height: 45rpx;
opacity: 1;
left: 584rpx;
top: 236rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_bg2 {
width: 651rpx;
height: 784rpx;
opacity: 1;
left: 52rpx;
top: 182rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_txt {
width: 371rpx;
height: 26rpx;
opacity: 1;
left: 191rpx;
top: 711rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx;
color: #574738;
}
.levelup .levelup_title {
width: 206rpx;
height: 35rpx;
opacity: 1;
left: 274rpx;
top: 314rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_imgbg {
width: 360rpx;
height: 299rpx;
opacity: 1;
left: 197rpx;
top: 377rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.levelup .levelup_btn {
width: 351rpx;
height: 105rpx;
opacity: 1;
left: 201rpx;
top: 773rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
\ No newline at end of file
<view class="levelup-modal">
<view class="levelup__shade modal-animate-fade-in" />
<view class="levelup modal-animate-zoom-in">
<image class="levelup_light " src={{resList['a158cbff-9dcd-49df-bb91-16213d58036e'].url}} />
<image class="levelup_bg " src={{resList['b027d194-0fad-45ea-8b1c-3502f7869d2d'].url}} />
<image class="levelup_bg2 " src={{resList['f88dfc75-c9f1-4e9d-8826-8a1d0e513259'].url}} />
<label class="levelup_txt ">精力上限1200 → 精力上限1500</label>
<image class="levelup_title " src={{resList['69bff61a-b5a6-4979-ba8d-9e008aed737a'].url}} />
<image class="levelup_imgbg " src={{resList['f56872e2-5e79-4906-99a2-576231f153af'].url}} />
<image class="levelup_btn " onTap="onBtnClick" src={{resList['95520b55-9655-4988-a833-3907978dbffb'].url}} />
<image class="levelup_closebtn " onTap="onModalClose" src={{resList['d33bbf87-ed39-4959-8673-02a4c31dca77'].url}} />
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {},
data: {
resList: resList
},
methods: {
onBtnClick() {
console.log('onBtnClick');
this.onModalClose();
},
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.message-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.message__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.message {
width: 676rpx;
height: 650rpx;
opacity: 1;
left: 40rpx;
top:50%;
margin-top: -325rpx;
/* top: 418rpx; */
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.message .message_bg {
width: 676rpx;
height: 650rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.message .message_txt {
width: 142rpx;
height: 25rpx;
opacity: 1;
left: 268rpx;
top: 355rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 26rpx;
color: #685b4e;
}
.message .message_btn {
width: 45rpx;
height: 45rpx;
opacity: 1;
left: 577rpx;
top: 24rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.message .message_closebtn {
width: 352rpx;
height: 106rpx;
opacity: 1;
left: 161rpx;
top: 510rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="message-modal">
<view class="message__shade modal-animate-fade-in" />
<view class="message ">
<image class="message_bg " src={{resList['0c446868-16d2-47f1-a0d6-27dadff681f2'].url}} />
<label class="message_txt ">{{mydata.catName}}</label>
<image class="message_btn " onTap="onModalClose" src={{resList['3ad6a924-dda8-49f4-b8fc-0e796347e802'].url}} />
<image class="message_closebtn " onTap="onModalClose" src={{resList['5488b126-f520-496f-ace6-010a89eb108f'].url}} />
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {
mydata:null
},
data: {
resList: resList
},
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
}
},
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.selectcat {
width: 721rpx;
height: 943rpx;
opacity: 1;
left: 15rpx;
top: 320rpx;
/* margin-top: -472.5rpx; */
position: absolute;
transform-origin: 50% 50% 0rpx;
}
.selectcat .selectcatbg {
width: 721rpx;
height: 943rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
left: 0rpx;
top: 0rpx;
}
.selectcat .selectcatblue {
width: 303rpx;
height: 272rpx;
opacity: 1;
left: 377rpx;
top: 501rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatblue .bluebg {
width: 303rpx;
height: 272rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatblue .blueimg {
width: 161rpx;
height: 145rpx;
opacity: 1;
left: 68rpx;
top: 32rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatblue .bluename {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatblue .bluesure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh {
width: 302rpx;
height: 272rpx;
opacity: 1;
left: 43rpx;
top: 501rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh .shbg {
width: 302rpx;
height: 272rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh .shimg {
width: 173rpx;
height: 138rpx;
opacity: 1;
left: 59rpx;
top: 43rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatsh .shname {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatsh .shsure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl {
width: 303rpx;
height: 271rpx;
opacity: 1;
left: 377rpx;
top: 197rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl .xlbg {
width: 303rpx;
height: 271rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl .xlimg {
width: 157rpx;
height: 153rpx;
opacity: 1;
left: 72rpx;
top: 29rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatxl .xlname {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatxl .xlsure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge {
width: 302rpx;
height: 271rpx;
opacity: 1;
left: 43rpx;
top: 197rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge .orgebg {
width: 302rpx;
height: 271rpx;
opacity: 1;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge .orgeimg {
width: 164rpx;
height: 141rpx;
opacity: 1;
left: 67rpx;
top: 36rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcatorge .orgename {
width: 244rpx;
height: 26rpx;
opacity: 1;
left: 26rpx;
top: 198rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 28rpx;
color: #685b4e;
text-align: center;
}
.selectcat .selectcatorge .orgesure {
width: 68rpx;
height: 53rpx;
opacity: 1;
left: 224rpx;
top: 172rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.selectcat .selectcattrue {
width: 352rpx;
height: 106rpx;
opacity: 1;
left: 185rpx;
top: 804rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
<view class="selectcat modal-animate-zoom-in">
<image class="selectcatbg" src={{resList['db53267d-4141-4d3e-afda-9b523c89be3e'].url}} />
<view class="selectcatblue" id="cat_1" onTap="changeSelectCat">
<image class="bluebg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="blueimg" src={{resList['95a6b0a9-3e7a-4a0b-82b6-6742e2a8bddf'].url}} />
<label class="bluename">1</label>
<image class="bluesure" a:if="{{curSelect==1}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<view class="selectcatsh" id="cat_2" onTap="changeSelectCat">
<image class="shbg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="shimg" src={{resList['fe52ffae-fadd-40f3-97b5-d3d56fd04781'].url}} />
<label class="shname">2</label>
<image class="shsure" a:if="{{curSelect==2}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<view class="selectcatxl" id="cat_3" onTap="changeSelectCat">
<image class="xlbg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="xlimg" src={{resList['193f6955-d754-4b9f-80ca-b9b9a72e8a8b'].url}} />
<label class="xlname">3</label>
<image class="xlsure" a:if="{{curSelect==3}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<view class="selectcatorge" id="cat_4" onTap="changeSelectCat">
<image class="orgebg" src={{resList['02183198-f4da-4ac2-8bf3-d6b7a07d3279'].url}} />
<image class="orgeimg" src={{resList['e28e5250-c740-4e4f-a855-c415c557e77e'].url}} />
<label class="orgename">4</label>
<image class="orgesure" a:if="{{curSelect==4}}" src={{resList['f956cda2-5eef-4942-8737-742d171527bd'].url}} />
</view>
<image class="selectcattrue" onTap="selectSure" src={{resList['628fc38b-7dc0-4c69-aac1-279d60c8f1ed'].url}} />
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
Component({
props: {
},
data: {
resList: resList,
curSelect:1 //1:蓝猫,2:三花,3:暹罗,4:橘猫
},
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
console.log('onModalClose')
},
changeSelectCat(e){
// console.log(e.currentTarget.id);
let type = parseInt(e.currentTarget.id.split("_")[1]);
this.setData({
curSelect:type
})
console.log(type);
},
selectSure(){
console.log(this.props);
const {closeModal,onModalClose} = this.props;
onModalClose && onModalClose();
console.log(closeModal)
closeModal&&closeModal();
}
},
didMount() {
console.log(this.data.curSelect)
this.setData({
curSelect:2
})
},
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
const mock = {
getUserInfo:require('../../project/src/canvas/game/mock/miniTb/tmallCat.getUserInfo.json')
}
export default mock;
{
"success": true,
"message":"",
"data": {
"catType": 2,
"userNick": "Edwise",
"energy": 100,
"happyCoin":1000,
"experience": 50,
"level": "1",
"avatar": "https://yun.duiba.com.cn/spark/assets/a3ae99684afa9a1f8d94f4c95ee6f1ed81de9996.png",
"sence": 3,
"catName": "喵喵喵"
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,4 +4,9 @@ ...@@ -4,4 +4,9 @@
</canvas> </canvas>
</view> </view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal"><text>{{rule}}</text></rule-modal> <rule-modal a:if="{{ruleModalVisible}}" onModalClose="closeRuleModal"><text>{{rule}}</text></rule-modal>
\ No newline at end of file <levelup-modal a:if="{{levelupModalVisible}}" onModalClose="closeLevelupModal"></levelup-modal>
<message-modal a:if="{{messageModalVisible}}" mydata="{{messageModalData}}" onModalClose="closeMessageModal"></message-modal>
<view class="popcontainer" a:if="{{selectcatModalVisible}}"><selectcat-modal onModalClose="closeSelectcatModal" closeModal=closeModal></selectcat-modal></view>
<view class="popcontainer" a:if="{{catnameModalVisible}}" ><catname-modal onModalClose="closeCatnameModal"/></view>
\ No newline at end of file
...@@ -4,6 +4,7 @@ import { ...@@ -4,6 +4,7 @@ import {
Main Main
} from './output'; } from './output';
import API from '../../api'; import API from '../../api';
import mock from '../../mock';
const app = getApp(); const app = getApp();
const { const {
tbcc tbcc
...@@ -25,7 +26,14 @@ const checkSystem = async () => { ...@@ -25,7 +26,14 @@ const checkSystem = async () => {
Page({ Page({
data: { data: {
ruleModalVisible: false catType: 1,
catName: '',
messageModalVisible: false,
messageModalData: {},
ruleModalVisible: false,
levelupModalVisible: false,
selectcatModalVisible: false,
catnameModalVisible: false,
}, },
onLoad(props) { onLoad(props) {
...@@ -44,13 +52,30 @@ Page({ ...@@ -44,13 +52,30 @@ Page({
onReady() { onReady() {
console.log('on ready') console.log('on ready')
var that = this;
setTimeout(() => {
var parameter = {
name: "selectcatModal"
}
var data = {
netName: "mine.showModal",
parameter
}
that.onMessage({
data: data
})
}, 2000)
//授权和登录先搞 //授权和登录先搞
// this.getAuth(); // this.getAuth();
my.__onMessage__ = (e) => {
this.onMessage(e)
}
}, },
init() { init() {
console.log('do init'); console.log('do init');
this.spark_startEngine(); this.spark_startEngine();
}, },
spark_startEngine() { spark_startEngine() {
...@@ -71,7 +96,9 @@ Page({ ...@@ -71,7 +96,9 @@ Page({
app.canvasMain = this.main; app.canvasMain = this.main;
this.main.addGlobalEvent("onMessage", self.onMessage, self); this.main.addGlobalEvent("onMessage", self.onMessage, self);
this.main.addGlobalEvent("showToast", self.showToast, self); this.main.addGlobalEvent("toast", self.showToast, self);
this.main.addGlobalEvent("loading", self.showLoadingHandler,self);
this.main.addGlobalEvent("hideloading",self.hideLoadingHandler,self);
} }
} }
}); });
...@@ -87,15 +114,21 @@ Page({ ...@@ -87,15 +114,21 @@ Page({
}); });
}, },
showToast(e) { showToastHandler(e) {
my.showToast({ my.showToast({
content: e.data || "网络异常,请稍后重试~", content: e.data || "网络异常,请稍后重试~",
duration: 2000 duration: 2000
}); });
}, },
showLoadingHandler(){
my.showLoading();
},
hideLoadingHandler(){
my.hideLoading();
},
postMessage(netName, data) { postMessage(netName, data) {
this.main.dispatchGlobalEvent({ this.main && this.main.dispatchGlobalEvent({
type: netName type: netName
}, data); //以防复用事件event串了,就用这种方式 }, data); //以防复用事件event串了,就用这种方式
}, },
...@@ -141,8 +174,10 @@ Page({ ...@@ -141,8 +174,10 @@ Page({
data: {} data: {}
}; };
const key = `${parameter.name}Visible`; const key = `${parameter.name}Visible`;
const datakey = `${parameter.name}Data`;
const toSetData = {}; const toSetData = {};
toSetData[key] = true; toSetData[key] = true;
toSetData[datakey] = parameter.data;
this.setData(toSetData); this.setData(toSetData);
break; break;
case 'test': case 'test':
...@@ -157,6 +192,12 @@ Page({ ...@@ -157,6 +192,12 @@ Page({
} = app.cloud; } = app.cloud;
const [myCloudName, handler] = netName.split("."); //待写, const [myCloudName, handler] = netName.split("."); //待写,
if (app.requestType == 'yapi') {
console.log('mock[handler]', mock[handler])
this.postMessage(netName, mock[handler]);
return;
}
parameter.activityId = app.activityId; parameter.activityId = app.activityId;
fc.invoke(myCloudName, parameter, handler).then(res => { fc.invoke(myCloudName, parameter, handler).then(res => {
this.postMessage(netName, res); this.postMessage(netName, res);
...@@ -200,7 +241,8 @@ Page({ ...@@ -200,7 +241,8 @@ Page({
} = userInfo; } = userInfo;
app.nickName = nickName; app.nickName = nickName;
app.avatar = avatar; app.avatar = avatar;
this.login(); this.init();
// this.login();
} }
}, },
/** /**
...@@ -224,10 +266,34 @@ Page({ ...@@ -224,10 +266,34 @@ Page({
this.init(); this.init();
} }
}, },
/**选择猫咪,打开取名弹窗 */
closeModal() {
// this.catType = type;
// console.log("选择了", type)
},
closeLevelupModal() {
this.setData({
levelupModalVisible: false
});
},
closeRuleModal() { closeRuleModal() {
this.setData({ this.setData({
ruleModalVisible: false ruleModalVisible: false
}); });
} },
closeMessageModal() {
this.setData({
messageModalVisible: false
});
},
closeCatnameModal() {
this.setData({
catnameModalVisible: false
})
},
closeSelectcatModal() {
this.setData({
selectcatModalVisible: false
})
},
}); });
\ No newline at end of file
{ {
"usingComponents": { "usingComponents": {
"rule-modal": "/components/ruleModal/ruleModal" "rule-modal": "/components/ruleModal/ruleModal",
"levelup-modal": "/components/comlevelup/comlevelup",
"message-modal": "/components/commessage/commessage",
"selectcat-modal":"/components/comselectcat/comselectcat",
"catname-modal":"/components/comcatname/comcatname"
} }
} }
\ No newline at end of file
.shop {
}
.shop-page { .shop-page {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
...@@ -10,6 +8,26 @@ ...@@ -10,6 +8,26 @@
overflow: hidden; overflow: hidden;
/* background: url('') no-repeat center top/cover; */ /* background: url('') no-repeat center top/cover; */
} }
.shop-wrap {
width: 100%;
position: absolute;
bottom: 0;
top: 254rpx;
padding-left: 54rpx;
right:0;
overflow-x: auto;
}
.shop-list {
width: 100%;
height: auto;
/* background-color: black; */
display: flex;
flex-flow: row wrap;
align-content: flex-start;
}
.shop .shopbg { .shop .shopbg {
width: 750rpx; width: 750rpx;
height: 1624rpx; height: 1624rpx;
...@@ -17,15 +35,21 @@ ...@@ -17,15 +35,21 @@
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem { .shop .shopitem {
position: relative;
/* display: flex;
justify-content: center;
align-items: center; */
box-sizing: border-box;
width: 309rpx; width: 309rpx;
height: 324rpx; height: 324rpx;
opacity: 1; opacity: 1;
left: 54rpx; margin: 0 30rpx 30rpx 0;
top: 254rpx; /* left: 54rpx;
position: absolute; top: 254rpx; */
transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem .shopitem_bg2 { .shop .shopitem .shopitem_bg2 {
width: 309rpx; width: 309rpx;
height: 324rpx; height: 324rpx;
...@@ -33,6 +57,7 @@ ...@@ -33,6 +57,7 @@
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem .shopitem_bg1 { .shop .shopitem .shopitem_bg1 {
width: 224rpx; width: 224rpx;
height: 161rpx; height: 161rpx;
...@@ -42,6 +67,7 @@ ...@@ -42,6 +67,7 @@
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem .shopitem_disabledbtn { .shop .shopitem .shopitem_disabledbtn {
width: 209rpx; width: 209rpx;
height: 60rpx; height: 60rpx;
...@@ -51,6 +77,7 @@ ...@@ -51,6 +77,7 @@
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem .shopitem_buybtn { .shop .shopitem .shopitem_buybtn {
width: 217rpx; width: 217rpx;
height: 68rpx; height: 68rpx;
...@@ -60,6 +87,7 @@ ...@@ -60,6 +87,7 @@
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem .shopitem_txt { .shop .shopitem .shopitem_txt {
width: 88rpx; width: 88rpx;
height: 20rpx; height: 20rpx;
...@@ -71,6 +99,7 @@ ...@@ -71,6 +99,7 @@
font-size: 21.79723rpx; font-size: 21.79723rpx;
color: #474543; color: #474543;
} }
.shop .shopitem .shopitem_name { .shop .shopitem .shopitem_name {
width: 209rpx; width: 209rpx;
height: 23rpx; height: 23rpx;
...@@ -81,7 +110,11 @@ ...@@ -81,7 +110,11 @@
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
font-size: 20.12052rpx; font-size: 20.12052rpx;
color: #474543; color: #474543;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.shop .shop_gold { .shop .shop_gold {
width: 98rpx; width: 98rpx;
height: 21rpx; height: 21rpx;
...@@ -93,6 +126,7 @@ ...@@ -93,6 +126,7 @@
font-size: 23.47394rpx; font-size: 23.47394rpx;
color: #7b644e; color: #7b644e;
} }
.shop .shop_backbtn { .shop .shop_backbtn {
width: 67rpx; width: 67rpx;
height: 67rpx; height: 67rpx;
...@@ -101,4 +135,4 @@ ...@@ -101,4 +135,4 @@
top: 41rpx; top: 41rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
\ No newline at end of file
<view class="shop"> <view class="shop">
<view class="shop-page" style="{{{'background':`url(${resList['da6bc001-768a-4b1c-95af-a9a8853ef6f9'].url}) no-repeat center top/cover`}}}"> <view class="shop-page" style="{{{'background':`url(${resList['da6bc001-768a-4b1c-95af-a9a8853ef6f9'].url}) no-repeat center top/cover`}}}">
<!-- <image class="shopbg" src={{resList['da6bc001-768a-4b1c-95af-a9a8853ef6f9'].url}} /> -->
<view class="shopitem">
<image class="shopitem_bg2" src={{resList['a5230993-3870-4a91-bdd1-ffc4782770d0'].url}} />
<image class="shopitem_bg1" src={{resList['dd4ee407-16e4-4cb7-9eba-365b33f466a3'].url}} />
<image class="shopitem_disabledbtn" src={{resList['8d08152f-311a-446a-a15a-ff02ebed0139'].url}} />
<image class="shopitem_buybtn" src={{resList['dd8ea96e-e33f-4f5d-b31f-29f332c3c867'].url}} />
<label class="shopitem_txt">101010</label>
<label class="shopitem_name">商品名商品名商品名</label>
</view>
<label class="shop_gold">101010</label> <label class="shop_gold">101010</label>
<image a:if={{false}} class="shop_backbtn" src={{resList['bdab9777-8a4d-4659-ba23-66aaddb7fa5b'].url}} /> <image a:if={{false}} class="shop_backbtn" src={{resList['bdab9777-8a4d-4659-ba23-66aaddb7fa5b'].url}} />
<view class="shop-wrap">
<view class="shop-list">
<!--<image class="shopbg" src={{resList['da6bc001-768a-4b1c-95af-a9a8853ef6f9'].url}} /> -->
<view class="shopitem" a:for="{{list}}">
<image class="shopitem_bg2" src={{resList['a5230993-3870-4a91-bdd1-ffc4782770d0'].url}} />
<image class="shopitem_bg1" src={{resList['dd4ee407-16e4-4cb7-9eba-365b33f466a3'].url}} />
<image class="shopitem_disabledbtn" src={{resList['8d08152f-311a-446a-a15a-ff02ebed0139'].url}} />
<image class="shopitem_buybtn" src={{resList['dd8ea96e-e33f-4f5d-b31f-29f332c3c867'].url}} />
<label class="shopitem_txt">101010</label>
<label class="shopitem_name">start{{item}}eeeeeeend</label>
</view>
</view>
</view>
</view> </view>
</view> </view>
\ No newline at end of file
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
import resList from '../../resconfig/resList'; //import API from '../../api'; import resList from '../../resconfig/resList'; //import API from '../../api';
Page({ Page({
data: {}, data: {
list:[1,2,3,4,5]
},
onLoad(props) { onLoad(props) {
this.setData( { this.setData( {
......
const resList = { const resList = {
'0c446868-16d2-47f1-a0d6-27dadff681f2': {
name: 'message_bg',
ext: '.png',
uuid: '0c446868-16d2-47f1-a0d6-27dadff681f2',
url: '//yun.duiba.com.cn/spark/assets/3b954e2265924a7fd5250a5b2b48627360a0b905.png'
},
'3ad6a924-dda8-49f4-b8fc-0e796347e802': {
name: 'message_btn',
ext: '.png',
uuid: '3ad6a924-dda8-49f4-b8fc-0e796347e802',
url: '//yun.duiba.com.cn/spark/assets/2b22fec0227db9f7df6ee42e5161939aa4f9a06f.png'
},
'5488b126-f520-496f-ace6-010a89eb108f': {
name: 'message_closebtn',
ext: '.png',
uuid: '5488b126-f520-496f-ace6-010a89eb108f',
url: '//yun.duiba.com.cn/spark/assets/23ede9d65dea3267e4f46ca010c593e5a825f3e9.png'
},
'a158cbff-9dcd-49df-bb91-16213d58036e': {
name: 'levelup_light',
ext: '.png',
uuid: 'a158cbff-9dcd-49df-bb91-16213d58036e',
url: '//yun.duiba.com.cn/spark/assets/87bdbe797ad68e59540e0f5ab3984b6b7e79894d.png'
},
'b027d194-0fad-45ea-8b1c-3502f7869d2d': {
name: 'levelup_bg',
ext: '.png',
uuid: 'b027d194-0fad-45ea-8b1c-3502f7869d2d',
url: '//yun.duiba.com.cn/spark/assets/2b70fadb540ea098ab1305551d4fdc4d96b050ed.png'
},
'd33bbf87-ed39-4959-8673-02a4c31dca77': {
name: 'levelup_closebtn',
ext: '.png',
uuid: 'd33bbf87-ed39-4959-8673-02a4c31dca77',
url: '//yun.duiba.com.cn/spark/assets/2b22fec0227db9f7df6ee42e5161939aa4f9a06f.png'
},
'f88dfc75-c9f1-4e9d-8826-8a1d0e513259': {
name: 'levelup_bg2',
ext: '.png',
uuid: 'f88dfc75-c9f1-4e9d-8826-8a1d0e513259',
url: '//yun.duiba.com.cn/spark/assets/3626273026f000df09d73b2b37a92aca68ed7feb.png'
},
'69bff61a-b5a6-4979-ba8d-9e008aed737a': {
name: 'levelup_title',
ext: '.png',
uuid: '69bff61a-b5a6-4979-ba8d-9e008aed737a',
url: '//yun.duiba.com.cn/spark/assets/f88ebf9dad3fb309575d72f91ab0a8704291574f.png'
},
'f56872e2-5e79-4906-99a2-576231f153af': {
name: 'levelup_imgbg',
ext: '.png',
uuid: 'f56872e2-5e79-4906-99a2-576231f153af',
url: '//yun.duiba.com.cn/spark/assets/adbbe665822e7e67c405ee5a62b56859521ab715.png'
},
'95520b55-9655-4988-a833-3907978dbffb': {
name: 'levelup_btn',
ext: '.png',
uuid: '95520b55-9655-4988-a833-3907978dbffb',
url: '//yun.duiba.com.cn/spark/assets/5193855f40ff72dea9f48022083a6a35240b6dc6.png'
},
'137b39ef-0c25-4991-a57e-0308daaec2dd': {
name: 'levelup_light',
ext: '.png',
uuid: '137b39ef-0c25-4991-a57e-0308daaec2dd',
url: '//yun.duiba.com.cn/spark/assets/0928fc8aa144851335f0588f4418df0a12f4e232.png'
},
'bca418af-89d1-4fe0-90a8-ae8581ad328c': {
name: 'levelup_bg',
ext: '.png',
uuid: 'bca418af-89d1-4fe0-90a8-ae8581ad328c',
url: '//yun.duiba.com.cn/spark/assets/2b70fadb540ea098ab1305551d4fdc4d96b050ed.png'
},
'c2adf081-7720-4814-ad9e-e28d13522ee0': {
name: 'levelup_closebtn',
ext: '.png',
uuid: 'c2adf081-7720-4814-ad9e-e28d13522ee0',
url: '//yun.duiba.com.cn/spark/assets/2b22fec0227db9f7df6ee42e5161939aa4f9a06f.png'
},
'9de58772-9830-4e72-aba8-b07802266b5d': {
name: 'levelup_bg2',
ext: '.png',
uuid: '9de58772-9830-4e72-aba8-b07802266b5d',
url: '//yun.duiba.com.cn/spark/assets/3626273026f000df09d73b2b37a92aca68ed7feb.png'
},
'be93e436-d2eb-4c29-922c-577810ed6571': {
name: 'levelup_title',
ext: '.png',
uuid: 'be93e436-d2eb-4c29-922c-577810ed6571',
url: '//yun.duiba.com.cn/spark/assets/f88ebf9dad3fb309575d72f91ab0a8704291574f.png'
},
'b1c40894-4d50-45e6-8fc8-118ef6d9d598': {
name: 'levelup_imgbg',
ext: '.png',
uuid: 'b1c40894-4d50-45e6-8fc8-118ef6d9d598',
url: '//yun.duiba.com.cn/spark/assets/adbbe665822e7e67c405ee5a62b56859521ab715.png'
},
'8da5fe13-41a3-4b5b-b079-938e0c7eef5a': {
name: 'levelup_btn',
ext: '.png',
uuid: '8da5fe13-41a3-4b5b-b079-938e0c7eef5a',
url: '//yun.duiba.com.cn/spark/assets/5193855f40ff72dea9f48022083a6a35240b6dc6.png'
},
'da6bc001-768a-4b1c-95af-a9a8853ef6f9': { 'da6bc001-768a-4b1c-95af-a9a8853ef6f9': {
name: 'shopbg', name: 'shopbg',
ext: '.png', ext: '.png',
...@@ -34,6 +147,97 @@ const resList = { ...@@ -34,6 +147,97 @@ const resList = {
ext: '.png', ext: '.png',
uuid: 'bdab9777-8a4d-4659-ba23-66aaddb7fa5b', uuid: 'bdab9777-8a4d-4659-ba23-66aaddb7fa5b',
url: '//yun.duiba.com.cn/spark/assets/368892ca025f9fc6100cc5e7da22675a814db39f.png' url: '//yun.duiba.com.cn/spark/assets/368892ca025f9fc6100cc5e7da22675a814db39f.png'
} },
'02183198-f4da-4ac2-8bf3-d6b7a07d3279': {
name: '底18',
ext: '.png',
uuid: '02183198-f4da-4ac2-8bf3-d6b7a07d3279',
url: '//yun.duiba.com.cn/spark/assets/38c8d93cf305d0b4c9ec17aaa7aaca754ac7c33b.png'
},
'95a6b0a9-3e7a-4a0b-82b6-6742e2a8bddf': {
name: '脸17',
ext: '.png',
uuid: '95a6b0a9-3e7a-4a0b-82b6-6742e2a8bddf',
url: '//yun.duiba.com.cn/spark/assets/ef2d52a9b45b94e4166b27df2bb381648453d9aa.png'
},
'fe52ffae-fadd-40f3-97b5-d3d56fd04781': {
name: '脸13',
ext: '.png',
uuid: 'fe52ffae-fadd-40f3-97b5-d3d56fd04781',
url: '//yun.duiba.com.cn/spark/assets/643a3ebab02f202846efc2488ffd5c99252a210f.png'
},
'193f6955-d754-4b9f-80ca-b9b9a72e8a8b': {
name: '脸9',
ext: '.png',
uuid: '193f6955-d754-4b9f-80ca-b9b9a72e8a8b',
url: '//yun.duiba.com.cn/spark/assets/b1992c528b36c2d26942e9c83941242e59481475.png'
},
'e28e5250-c740-4e4f-a855-c415c557e77e': {
name: '脸5',
ext: '.png',
uuid: 'e28e5250-c740-4e4f-a855-c415c557e77e',
url: '//yun.duiba.com.cn/spark/assets/5e5e85d3745031ccb7004e04a188a3f7a42fbaa0.png'
},
'f956cda2-5eef-4942-8737-742d171527bd': {
name: '勾',
ext: '.png',
uuid: 'f956cda2-5eef-4942-8737-742d171527bd',
url: '//yun.duiba.com.cn/spark/assets/b8a22520aeb4c118f3ca52e37ea38961631bbb05.png'
},
'628fc38b-7dc0-4c69-aac1-279d60c8f1ed': {
name: '按钮2',
ext: '.png',
uuid: '628fc38b-7dc0-4c69-aac1-279d60c8f1ed',
url: '//yun.duiba.com.cn/spark/assets/248191d2099fd413fcb4ced176942523b65dee87.png'
},
'db53267d-4141-4d3e-afda-9b523c89be3e': {
name: '选择猫咪背景',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/选择猫咪背景.380e7b102d2288cfd03900177d662d8f5f38f400.png',
uuid: 'db53267d-4141-4d3e-afda-9b523c89be3e'
},
'02aacfd1-3347-40a7-8a3a-9f20c1b5706b': {
name: '说话猫30',
ext: '.png',
uuid: '02aacfd1-3347-40a7-8a3a-9f20c1b5706b',
url: '//yun.duiba.com.cn/spark/assets/d668bfa5e8f20d360058f1ce301622f028320e8e.png'
},
'24b7d459-41d6-408c-9829-4768fe38abf5': {
name: '底29',
ext: '.png',
uuid: '24b7d459-41d6-408c-9829-4768fe38abf5',
url: '//yun.duiba.com.cn/spark/assets/44e5ec770784008cbde2036987d786ad10179074.png'
},
'97484cf2-5146-4287-b104-ed1f43c71ee0': {
name: '按钮27',
ext: '.png',
uuid: '97484cf2-5146-4287-b104-ed1f43c71ee0',
url: '//yun.duiba.com.cn/spark/assets/ccc2315a56a4886cdffd32311d57583c870963d0.png'
},
'50779aee-069e-4dd9-b2ff-88beda9f43d1': {
name: '底25',
ext: '.png',
uuid: '50779aee-069e-4dd9-b2ff-88beda9f43d1',
url: '//yun.duiba.com.cn/spark/assets/5f8647eb5032613a6116f3cefc00d4448e24becc.png'
},
'c7916d41-ea9d-4f8e-b5aa-e2060d6ae265': {
name: '按钮23',
ext: '.png',
uuid: 'c7916d41-ea9d-4f8e-b5aa-e2060d6ae265',
url: '//yun.duiba.com.cn/spark/assets/5411d96c77b95fddfd2a42d08d1522d992bff210.png'
},
'947d970f-52bf-4319-82f0-a3e65620ed75': {
name: '底22',
ext: '.png',
uuid: '947d970f-52bf-4319-82f0-a3e65620ed75',
url: '//yun.duiba.com.cn/spark/assets/b29d45b60af4e4daecce521a84896cb4d276e2a5.png'
},
}; };
export default resList; export default resList;
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