Commit 7d3a7955 authored by Edwise's avatar Edwise 🍷

领取精力与刷新三文鱼自测第一版,修正刷新三文鱼显示不对的问题

parent 9047e0a9
......@@ -14,6 +14,8 @@
"senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"],
"energyMax":50,
"experienceMax":1000,
"senceGuide":true
"senceGuide":true,
"updateTime":1607507495319,
"lastEnergyTime":1607507395319
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -903,19 +903,19 @@ const resCanvasList = {
'69435791-11ee-4c7f-9036-c4c3e28e1750': {
name: '经验条背景',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png',
url: 'https://yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png',
uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750'
},
'6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': {
name: '经验条图片',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png',
url: 'https://yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png',
uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572'
},
'5cc07d1e-00f8-4178-8112-44fda9c15481': {
name: 'bedroomguide3final',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png',
url: 'https://yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png',
uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481'
}
};
......
......@@ -11,6 +11,7 @@ export class Ins {
/**舞台宽高 */
public static stageW: number;
public static stageH: number;
public static stage:FYGE.Stage;
/**猫咪是否出寝了 */
public static catIsOut:boolean;
......@@ -40,8 +41,8 @@ export class Ins {
"energyMax":number,
"experienceMax":number,
"senceGuide":boolean,
"lastEnergyTime":number
"lastEnergyTime":number,
"updateTime":number
}
public static senceInfo: {
......@@ -72,11 +73,17 @@ export class Ins {
public static showLoading(){
console.log("canvas请求加载loading")
GDispatcher.dispatchEvent({type:"loading"});
if(this.stage){
this.stage.mouseEnable = this.stage.mouseChildren = false;
}
}
public static hideLoading(){
console.log("canvas请求隐藏loading")
GDispatcher.dispatchEvent({type:"hideloading"});
if(this.stage){
this.stage.mouseEnable = this.stage.mouseChildren = true;
}
}
/**删除一个lottie的所有tween,停止动效 */
......@@ -141,4 +148,26 @@ export class Ins {
// (1-t)^2 P0 + 2(1-t)tP1+ t^2P2
return Math.pow(1 - t, 2) * p0 + 2 * (1 - t) * t * p1 + Math.pow(t, 2) * p2;
}
//计算两个时间之间的时间差 多少天时分秒
public static intervalTime(time) {
var date3 = time; //时间差的毫秒数
//计算出相差天数
var days = Math.floor(date3 / (24 * 3600 * 1000));
//计算出小时数
var leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数
var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
var seconds = Math.round(leave3 / 1000);
// console.log(days + "天 " + hours + "小时 ")
// return days + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒"
return minutes+"分"+seconds+"秒"
}
}
\ No newline at end of file
......@@ -82,6 +82,7 @@ export class Main {
// await RES.loadGroup("common");
Ins.stageW = this.stage.viewRect.width;
Ins.stageH = this.stage.viewRect.height;
Ins.stage = this.stage;
console.log("舞台宽高:",Ins.stageW,Ins.stageH)
await RES.loadSparkAssets(resloadingList);
console.log('resloadingList 加载完毕')
......
......@@ -80,8 +80,9 @@ export class Salmon extends Module{
id:that._id,
energy:that.salmonCnt
}
sendTbNet(TbNetName.takeEnergy,{params},(s,r)=>{
sendTbNet(TbNetName.takeEnergy,{id:that._id,energy:that.salmonCnt},(s,r)=>{
if(s){
that.mouseEnable = true;
FYGE.GDispatcher.dispatchEvent(MSG.UPDATE_ENERGY,{call:()=>{that.getSalmonAnim()}});
}else{
that.mouseEnable = true;
......
......@@ -361,8 +361,8 @@ export class MainScene extends Scene {
var that = this;
if (that.recoverEnergyHandler) clearInterval(that.recoverEnergyHandler);
console.log("上一次恢复精力的时间", new Date(Ins.userInfo.lastEnergyTime).getMinutes())
let time = new Date().getTime() - Ins.userInfo.lastEnergyTime;
console.log("相差的时间", Math.floor(time % 3600 / 60))
let time = Ins.userInfo.updateTime - Ins.userInfo.lastEnergyTime;
console.log("相差的时间", Ins.intervalTime(time))
if (time <= Ins.recoverEnergy) {
that.recoverEnergyTime = Ins.recoverEnergy - time;
} else {
......@@ -559,6 +559,7 @@ export class MainScene extends Scene {
}
that.isShow = false;
that.energyUp1();
that.updateEnergy();
}
that.setEnergy();
that.mainUi.updateUserInfo();
......@@ -594,11 +595,7 @@ export class MainScene extends Scene {
let diffCnt = Math.abs(list.length - Ins.salmonArr.length);
if (list.length >= Ins.salmonArr.length) {
// let index = 0;
for (let i = 0; i < Ins.salmonArr.length; i++) {
if (Ins.salmonArr[i] && list[Ins.salmonArr[i].index])
Ins.salmonArr[i].setCnt(list[Ins.salmonArr[i].index].energy);
// index = i;
}
//用来获取空的三文鱼索引的index标示位
let flagIndex = 0;
//可以放置的空的三文鱼索引
......@@ -622,6 +619,25 @@ export class MainScene extends Scene {
Ins.salmonArr.push(salmon);
setIndex++;
}
for(let i=1;i<this.salmonArr.length;i++){
for(let j=0;j<this.salmonArr.length-i;j++){
if(this.salmonArr[i].index>this.salmonArr[i].index){
let temp = this.salmonArr[j];
this.salmonArr[j] = this.salmonArr[j+1];
this.salmonArr[j+1] = temp;
}
}
}
setTimeout(() => {
for (let i = 0; i < Ins.salmonArr.length; i++) {
if(Ins.salmonArr)
// if (Ins.salmonArr[i] && list[Ins.salmonArr[i].index])
Ins.salmonArr[i].setCnt(list[i].energy);
// index = i;
}
},100)
}
}
......@@ -635,12 +651,8 @@ export class MainScene extends Scene {
this.salmonFlag[index] = false;
for (let i = 0; i < 5; i++) {
let salmonAnim = new SalmonAnim(x, y, i);
// salmonAnim.x = x-salmonAnim.width*0.5;
// salmonAnim.y = y-salmonAnim.height*0.7;
salmonAnim.setTween(100, 1100, i * 100);
this.salmonGroup.addChild(salmonAnim);
// let obj={t:0}
// FYGE.Tween.get(obj,{onChangeObj:obj,onChange:that.salmonMove}).wait(i*300).to({t:1},1000).call(()=>{this.salmonGroup.removeChild(salmonAnim)});
}
}
......@@ -649,8 +661,6 @@ export class MainScene extends Scene {
console.log("三文鱼运动", this, salmonAnim)
}
/**召回猫咪 */
recallCat() {
console.log("找回猫咪,刷新用户信息,刷新出勤状态")
......
......@@ -23,7 +23,7 @@ export class StartScene extends Scene {
if (s) {
if (r.data) {
Ins.userInfo = r.data;
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */
/**判断猫咪是否出寝,只在用户进入游戏时判断,使用接口判断*/
that.judgeCatIsOutAChangeMainScene();
} else {
sceneBg.visible = true;
......@@ -46,7 +46,7 @@ export class StartScene extends Scene {
console.log("选择完猫咪",r)
Ins.showLoading();
Ins.userInfo = r.data.data;
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */
/**判断猫咪是否出寝,只在用户进入游戏时判断,使用接口判断 */
this.judgeCatIsOutAChangeMainScene();
}
......
import cloud from '@tbmp/mp-cloud-sdk';
import tbcc from './tbcc-sdk';
const env = 'online' // 云函数环境 test 测试环境 online 线上环境
const env = 'test' // 云函数环境 test 测试环境 online 线上环境
cloud.init({
env: env
});
......@@ -9,7 +9,7 @@ cloud.init({
App({
env,
requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'local', // yapi,cloud: 云函数
// requestType: 'local', // yapi,cloud: 云函数
cloudName: 'tmallCat', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud,
......@@ -29,8 +29,8 @@ App({
const { activityId } = query;
// this.activityId = activityId || '5f81841def5071b132fd5e21'; //赵然
// this.activityId = activityId || '5f8022919da671f3b6d5fb14'; //小婷1
this.activityId = activityId || '5f8d47218e6a0888fc426fad'; //小婷2zhengshi
// this.activityId = activityId || '5f87e8a29897b4e0ce0ada02'; //ceshi
// this.activityId = activityId || '5f8d47218e6a0888fc426fad'; //小婷2zhengshi
this.activityId = activityId || '5f87e8a29897b4e0ce0ada02'; //ceshi
}
......
.my-prize-page {
width: 750rpx;
height: 1624rpx;
width: 100vw;
height: 100vh;
opacity: 1;
position: absolute;
top: 0;
......
......@@ -101,12 +101,12 @@ Page({
console.log('on ready')
//授权和登录先搞
await this.getAuth();
setTimeout(()=>{
my.navigateTo({
url: `/pages/myprize/myprize`
});
},1000)
// await this.getAuth();
// setTimeout(()=>{
// my.navigateTo({
// url: `/pages/pageshop/pageshop`
// });
// },1000)
// this.initCanvas();
my.__onMessage__ = (e) => {
this.onMessage(e)
......
.shop-page {
width: 750rpx;
height: 1624rpx;
width: 100vw;
height: 100vh;
opacity: 1;
position: absolute;
top: 0;
......@@ -17,7 +17,7 @@
bottom: 0;
top: 464rpx;
padding-left: 54rpx;
right:0;
right: 0;
overflow-x: auto;
}
......@@ -70,6 +70,7 @@
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.shop .shopitem .shopitem_avatar {
width: 161rpx;
height: 161rpx;
......@@ -135,12 +136,18 @@
.shop .shop_gold {
opacity: 1;
height: 54rpx;
left: 370rpx;
top: 326rpx;
top: 320rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 23.47394rpx;
color: #7b644e;
vertical-align: middle;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
}
.shop .shop_backbtn {
......
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