Commit 33113c01 authored by zhangjinzhou's avatar zhangjinzhou

头像延迟显示

parent 30360ae7
......@@ -5,7 +5,7 @@ import API from '../../api';
import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser";
import {
modalType, SHARE_CONFIG,gnickNames,gavatars
modalType, SHARE_CONFIG, gnickNames, gavatars
} from '../../tbcc-sdk/lib/constants';
const app = getApp();
const {
......@@ -112,8 +112,8 @@ Page({
avatar3: "",
avatar4: "",
canwin: false,
hidetime:0,
othername:[],
hidetime: 0,
othername: [],
},
onLoad(query) {
// console.log("onLoad========>", app, props);
......@@ -147,31 +147,42 @@ Page({
let roomnums = [2, 3, 4][step - 1];
let txkeys = Object.keys(gavatars);
let othername = ["你"];
for(let gu=0;gu<roomnums-1;gu++){
let guax = Math.floor(Math.random()*txkeys.length);
let guuid = txkeys.splice(guax,1)[0];
for (let gu = 0; gu < roomnums - 1; gu++) {
let guax = Math.floor(Math.random() * txkeys.length);
let guuid = txkeys.splice(guax, 1)[0];
let guimg = gavatars[guuid].url;
let gunx = Math.floor(Math.random()*gnickNames.length);
let gunick = gnickNames.splice(gunx,1)[0];
if(gu==0){
this.setData({
avatar2:guimg,
})
}else if(gu==1){
this.setData({
avatar3:guimg
})
}else if(gu==2){
this.setData({
avatar4:guimg
})
let gunx = Math.floor(Math.random() * gnickNames.length);
let gunick = gnickNames.splice(gunx, 1)[0];
if (gu == 0) {
let time1 = Math.floor(Math.random() * 1000) + 500
setTimeout(() => {
this.setData({
avatar2: guimg,
})
}, time1);
} else if (gu == 1) {
let time2 = Math.floor(Math.random() * 800) + 1000;
setTimeout(() => {
this.setData({
avatar3: guimg
})
}, time2);
} else if (gu == 2) {
let time3 = Math.floor(Math.random() * 500) + 2000;
setTimeout(() => {
this.setData({
avatar4: guimg
})
}, time3);
}
othername.push(gunick);
}
// console.log("玩家名字",othername);
this.setData({
othername:othername
othername: othername
});
let roomdata = [];
for (let i = 0; i < roomnums; i++) {
......@@ -366,14 +377,14 @@ Page({
let nums = data[1];
let othername = this.data.othername;
if (type == "tool") {
let itxt = othername[i]+"使用道具一次获得了" + toolwarm + "温度值";
let itxt = othername[i] + "使用道具一次获得了" + toolwarm + "温度值";
this.addAttionTxt(itxt);
let inroomidx = i;
let inwd = this.data.roomdata[inroomidx]["wd"];
inwd += toolwarm;
this.updateRolewd(i + 1, inwd);
} else if (type == "task") {
let itxt = othername[i]+ "完成了" + nums + "个任务,获得了" + taskwarm * nums + "温度值";
let itxt = othername[i] + "完成了" + nums + "个任务,获得了" + taskwarm * nums + "温度值";
this.addAttionTxt(itxt);
let inroomidx = i;
let inwd = this.data.roomdata[inroomidx]["wd"];
......@@ -471,7 +482,7 @@ Page({
let rangetime = Math.floor(Math.random() * (i1end - i1start)) + i1start;
// console.log(rangetime);
setTimeout(() => {
// console.log("ai" + i + "邀请好友升温度");
let itxt = othername[i] + "邀请了一位好友,获得了" + invitewarm + "温度值";
this.addAttionTxt(itxt);
......@@ -504,15 +515,15 @@ Page({
onShow() {
let ntime = Date.now();
let hidetime = this.data.hidetime;
if(hidetime){
let passtime = ntime-hidetime;
if (hidetime) {
let passtime = ntime - hidetime;
let gametime = this.data.gametime;
gametime -= passtime/1000;
if(gametime<0){
gametime -= passtime / 1000;
if (gametime < 0) {
gametime = 0;
}
this.setData({
gametime:gametime
gametime: gametime
});
}
let ngametime = this.data.gametime;
......@@ -521,10 +532,10 @@ Page({
}
this.updateActInfo();
},
onHide(){
onHide() {
let ntime = Date.now();
this.setData({
hidetime:ntime
hidetime: ntime
});
},
//更新活动信息
......@@ -660,7 +671,7 @@ Page({
show_v: 2
})
this.startGame();
}, 1000);
}, 3000);
},
//新手下一步
tonextguide() {
......
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