Commit 33113c01 authored by zhangjinzhou's avatar zhangjinzhou

头像延迟显示

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