Commit 221ae749 authored by zhangjinzhou's avatar zhangjinzhou

代码暂存

parent 91de5434
...@@ -15,33 +15,33 @@ ...@@ -15,33 +15,33 @@
<!--<image class="gamemroleimg1" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> --> <!--<image class="gamemroleimg1" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> -->
<view class="gamemplayer1" a:if="{{myidx==1}}"> <view class="gamemplayer1" a:if="{{myidx==1}}">
<image class="gamempimg1" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} /> <image class="gamempimg1" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} />
<label class="gamemptxt1">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label> <label class="gamemptxt1">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label>
</view> </view>
<label class="gamemaitor1" a:if="{{myidx!=1}}">当前温值:{{roomdata[0].wd}}℃</label> <label class="gamemaitor1" a:if="{{myidx!=1}}">当前温值:{{roomdata[0].wd}}℃</label>
</view> </view>
<view class="gamemrole2" a:if="{{roomdata.length>1}}"> <view class="gamemrole2" a:if="{{roomdata.length>1}}">
<!--<image class="gamemroleimg2" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> --> <!--<image class="gamemroleimg2" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> -->
<view class="gamemplayer2" a:if="{{myidx==2}}"> <view class="gamemplayer2" a:if="{{myidx==2}}">
<image class="gamempimg2" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} /> <image class="gamempimg2" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} />
<label class="gamemptxt2">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label> <label class="gamemptxt2">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label>
</view> </view>
<label class="gamemaitor2" a:if="{{myidx!=2}}">当前温值:{{roomdata[1].wd}}℃</label> <label class="gamemaitor2" a:if="{{myidx!=2}}">当前温值:{{roomdata[1].wd}}℃</label>
</view> </view>
<view class="gamemrole3" a:if="{{roomdata.length>2}}"> <view class="gamemrole3" a:if="{{roomdata.length>2}}">
<!--<image class="gamemroleimg3" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> --> <!--<image class="gamemroleimg3" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> -->
<view class="gamemplayer3" a:if="{{myidx==3}}"> <view class="gamemplayer3" a:if="{{myidx==3}}">
<image class="gamempimg3" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} /> <image class="gamempimg3" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} />
<label class="gamemptxt3">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label> <label class="gamemptxt3">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label>
</view> </view>
<label class="gamemaitor3" a:if="{{myidx!=3}}">当前温值:{{roomdata[2].wd}}℃</label> <label class="gamemaitor3" a:if="{{myidx!=3}}">当前温值:{{roomdata[2].wd}}℃</label>
</view> </view>
<view class="gamemrole4" a:if="{{roomdata.length>3}}"> <view class="gamemrole4" a:if="{{roomdata.length>3}}">
<!--<image class="gamemroleimg4" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> --> <!--<image class="gamemroleimg4" src={{resList['70ad9e81-ebe3-43ab-ad49-38f3c4d675bd'].url}} /> -->
<view class="gamemplayer4" a:if="{{myidx==4}}"> <view class="gamemplayer4" a:if="{{myidx==4}}">
<image class="gamempimg4" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} /> <image class="gamempimg4" src={{resList['c68097a5-eb32-422f-8583-600e3d636c93'].url}} />
<label class="gamemptxt4">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label> <label class="gamemptxt4">{{"我的队伍\n"+"当前温值:"+roomdata[myidx-1].wd+"℃"}}</label>
</view> </view>
<label class="gamemaitor4" a:if="{{myidx!=4}}">当前温值:{{roomdata[3].wd}}℃</label> <label class="gamemaitor4" a:if="{{myidx!=4}}">当前温值:{{roomdata[3].wd}}℃</label>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -19,9 +19,9 @@ const { ...@@ -19,9 +19,9 @@ const {
} = tbcc.tb; } = tbcc.tb;
let updateact = 1;//请求 let updateact = 1;//请求
let gameatime = 100;//活动倒计时,100, let gameatime = 100;//活动倒计时,100,
const toolwarm = 1;//升温道具+温度 const toolwarm = 3;//升温道具+温暖
const taskwarm = 1;//任务+温 const taskwarm = 1;//任务+温
const invitewarm = 2;//邀请+温度 const invitewarm = 20;//邀请+温暖
let gtoolcd = 5;// let gtoolcd = 5;//
const paple1 = "cloud://F03F0071205084B1A58F9C560010C076//paple3.svga"; const paple1 = "cloud://F03F0071205084B1A58F9C560010C076//paple3.svga";
...@@ -37,8 +37,8 @@ Page({ ...@@ -37,8 +37,8 @@ Page({
invitedata: [],//邀请人 invitedata: [],//邀请人
gametime: 100,//活动倒计时,s gametime: 100,//活动倒计时,s
gametimeshow: "05:00", gametimeshow: "05:00",
roomdata: [],//房间所有人温信息 roomdata: [],//房间所有人温信息
roomtdata: [],//房间预期抵达温 roomtdata: [],//房间预期抵达温
roomnums: 3,//房间人数 roomnums: 3,//房间人数
myidx: 1,//我的位置 myidx: 1,//我的位置
tooltime: 5,//升温工具倒计时 tooltime: 5,//升温工具倒计时
...@@ -235,9 +235,9 @@ Page({ ...@@ -235,9 +235,9 @@ Page({
let attiontxt1 = "游戏开始啦,共有" + this.data.roomnums + "名玩家加入游戏,快来升温队伍拿奖励吧。"; let attiontxt1 = "游戏开始啦,共有" + this.data.roomnums + "名玩家加入游戏,快来升温队伍拿奖励吧。";
this.addAttionTxt(attiontxt1); this.addAttionTxt(attiontxt1);
this.updateAct(); this.updateAct();
setTimeout(() => { // setTimeout(() => {
this.newAiControl("invite", 1); // this.newAiControl("invite", 1);
}, 4000); // }, 4000);
}, },
//新ai逻辑,tool==使用道具,task==任务,invite==邀请人 //新ai逻辑,tool==使用道具,task==任务,invite==邀请人
async newAiControl(type = "tool", ainum = 1, aiwarm = 0) { async newAiControl(type = "tool", ainum = 1, aiwarm = 0) {
...@@ -398,7 +398,7 @@ Page({ ...@@ -398,7 +398,7 @@ Page({
let aiwarm = data[2]; let aiwarm = data[2];
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"];
...@@ -412,7 +412,7 @@ Page({ ...@@ -412,7 +412,7 @@ Page({
addwarm = taskwarm * nums; addwarm = taskwarm * nums;
} }
if (addwarm > 0 && nums > 0) { if (addwarm > 0 && nums > 0) {
let itxt = othername[i] + "完成了" + nums + "个任务,获得了" + addwarm + "温值"; let itxt = othername[i] + "完成了" + nums + "个任务,获得了" + addwarm + "温值";
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"];
...@@ -422,7 +422,7 @@ Page({ ...@@ -422,7 +422,7 @@ Page({
} else if (type == "invite") { } else if (type == "invite") {
if (nums > 0) { if (nums > 0) {
let itxt = othername[i] + "邀请了" + nums + "位好友,获得了" + invitewarm * nums + "温值"; let itxt = othername[i] + "邀请了" + nums + "位好友,获得了" + invitewarm * 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"];
...@@ -450,7 +450,7 @@ Page({ ...@@ -450,7 +450,7 @@ Page({
let chatime = Math.ceil(Math.random() * 5) + 2; let chatime = Math.ceil(Math.random() * 5) + 2;
let itime1 = Number((Math.random() * chatime).toFixed(2)) * 1000; let itime1 = Number((Math.random() * chatime).toFixed(2)) * 1000;
setTimeout(() => { setTimeout(() => {
let itxt = othername[i] + "使用道具获得了" + toolwarm + "温值"; let itxt = othername[i] + "使用道具获得了" + toolwarm + "温值";
this.addAttionTxt(itxt); this.addAttionTxt(itxt);
let inroomidx = i + 1; let inroomidx = i + 1;
let inwd = this.data.roomdata[inroomidx]["wd"]; let inwd = this.data.roomdata[inroomidx]["wd"];
...@@ -475,7 +475,7 @@ Page({ ...@@ -475,7 +475,7 @@ Page({
//ai邀请 //ai邀请
let inviterange = [0, 5]; let inviterange = [0, 5];
let invitenums = Math.round(Math.random() * inviterange[1]) + inviterange[0]; let invitenums = Math.round(Math.random() * inviterange[1]) + inviterange[0];
// console.log("邀请的温值", invitenums); // console.log("邀请的温值", invitenums);
this.ainvite(invitenums, i); this.ainvite(invitenums, i);
//ai任务 //ai任务
let taskrange = [1, 5]; let taskrange = [1, 5];
...@@ -486,9 +486,9 @@ Page({ ...@@ -486,9 +486,9 @@ Page({
//机器使用道具 //机器使用道具
aiuseTool(time, i, chatime) { aiuseTool(time, i, chatime) {
setTimeout(() => { setTimeout(() => {
// console.log("ai" + i + "使用道具升温"); // console.log("ai" + i + "使用道具升温");
let othername = this.data.othername let othername = this.data.othername
let itxt = othername[i] + "使用道具获得了" + toolwarm + "温值"; let itxt = othername[i] + "使用道具获得了" + toolwarm + "温值";
this.addAttionTxt(itxt); this.addAttionTxt(itxt);
let inroomidx = i + 1; let inroomidx = i + 1;
let inwd = this.data.roomdata[inroomidx]["wd"]; let inwd = this.data.roomdata[inroomidx]["wd"];
...@@ -515,8 +515,8 @@ Page({ ...@@ -515,8 +515,8 @@ Page({
// console.log(rangetime); // console.log(rangetime);
setTimeout(() => { setTimeout(() => {
// console.log("ai" + i + "邀请好友升温"); // console.log("ai" + i + "邀请好友升温");
let itxt = othername[i] + "邀请了一位好友,获得了" + invitewarm + "温值"; let itxt = othername[i] + "邀请了一位好友,获得了" + invitewarm + "温值";
this.addAttionTxt(itxt); this.addAttionTxt(itxt);
let inroomidx = i + 1; let inroomidx = i + 1;
let inwd = this.data.roomdata[inroomidx]["wd"]; let inwd = this.data.roomdata[inroomidx]["wd"];
...@@ -535,7 +535,7 @@ Page({ ...@@ -535,7 +535,7 @@ Page({
let i1end = (i1 + 1) * chatime - 5000; let i1end = (i1 + 1) * chatime - 5000;
let rangetime = Math.floor(Math.random() * (i1end - i1start)) + i1start; let rangetime = Math.floor(Math.random() * (i1end - i1start)) + i1start;
setTimeout(() => { setTimeout(() => {
let itxt = othername[i] + "完成了一个任务,获得了" + taskwarm + "温值"; let itxt = othername[i] + "完成了一个任务,获得了" + taskwarm + "温值";
this.addAttionTxt(itxt); this.addAttionTxt(itxt);
let inroomidx = i + 1; let inroomidx = i + 1;
let inwd = this.data.roomdata[inroomidx]["wd"]; let inwd = this.data.roomdata[inroomidx]["wd"];
...@@ -616,7 +616,7 @@ Page({ ...@@ -616,7 +616,7 @@ Page({
}); });
}, },
//更新活动信息 //更新活动信息
//30s刷新一次邀请人列表,新增温,结束前5s再请求一次,onshow请求一次 //30s刷新一次邀请人列表,新增温,结束前5s再请求一次,onshow请求一次
async updateActInfo(gamestat = "now") { async updateActInfo(gamestat = "now") {
// console.log("updateActInfo=======>"); // console.log("updateActInfo=======>");
clearTimeout(updateact); clearTimeout(updateact);
...@@ -865,7 +865,7 @@ Page({ ...@@ -865,7 +865,7 @@ Page({
}, },
//更新attionlist,玩家相关 //更新attionlist,玩家相关
async updateAttionList(gamestat = "now") { async updateAttionList(gamestat = "now") {
// console.log("更新玩家++温值"); // console.log("更新玩家++温值");
let startime = this.data.startime; let startime = this.data.startime;
let endtime = this.data.endtime; let endtime = this.data.endtime;
let step = this.data.step; let step = this.data.step;
...@@ -963,7 +963,7 @@ Page({ ...@@ -963,7 +963,7 @@ Page({
} }
if (taskcount > 0 && taskwarm > 0) { if (taskcount > 0 && taskwarm > 0) {
this.newAiControl("task", taskcount, taskwarm); this.newAiControl("task", taskcount, taskwarm);
let tasktxt = "你完成了" + taskcount + "个任务,获得了" + taskwarm + "温值"; let tasktxt = "你完成了" + taskcount + "个任务,获得了" + taskwarm + "温值";
this.addAttionTxt(tasktxt); this.addAttionTxt(tasktxt);
} }
//邀请的单独来 //邀请的单独来
...@@ -992,7 +992,7 @@ Page({ ...@@ -992,7 +992,7 @@ Page({
let chawarm = ndata.warms - ldata.warms; let chawarm = ndata.warms - ldata.warms;
let iattiontxt = ""; let iattiontxt = "";
if (type == "invite") { if (type == "invite") {
iattiontxt = "你邀请" + chacount + "人" + "获得了" + chawarm + "温值"; iattiontxt = "你邀请" + chacount + "人" + "获得了" + chawarm + "温值";
this.setData({ this.setData({
inviteshowdata: { inviteshowdata: {
chacount: chacount, chacount: chacount,
...@@ -1001,19 +1001,19 @@ Page({ ...@@ -1001,19 +1001,19 @@ Page({
}); });
this.openInvite(); this.openInvite();
} else if (type == "tool") { } else if (type == "tool") {
iattiontxt = "你使用道具" + chacount + "次" + "获得了" + chawarm + "温值"; iattiontxt = "你使用道具" + chacount + "次" + "获得了" + chawarm + "温值";
} else if (type == "follow") { } else if (type == "follow") {
return [chacount, chawarm]; return [chacount, chawarm];
// iattiontxt = "完成任务follow" + chacount + "次" + "获得了" + chawarm + "温值"; // iattiontxt = "完成任务follow" + chacount + "次" + "获得了" + chawarm + "温值";
} else if (type == "sign") { } else if (type == "sign") {
return [chacount, chawarm]; return [chacount, chawarm];
// iattiontxt = "完成任务sign" + chacount + "次" + "获得了" + chawarm + "温值"; // iattiontxt = "完成任务sign" + chacount + "次" + "获得了" + chawarm + "温值";
} else if (type == "collect") { } else if (type == "collect") {
return [chacount, chawarm]; return [chacount, chawarm];
// iattiontxt = "完成任务collect" + chacount + "次" + "获得了" + chawarm + "温值"; // iattiontxt = "完成任务collect" + chacount + "次" + "获得了" + chawarm + "温值";
} else if (type == "browseGoods") { } else if (type == "browseGoods") {
return [chacount, chawarm]; return [chacount, chawarm];
// iattiontxt = "完成任务browseGoods" + chacount + "次" + "获得了" + chawarm + "温值"; // iattiontxt = "完成任务browseGoods" + chacount + "次" + "获得了" + chawarm + "温值";
} }
if (iattiontxt.length > 0) { if (iattiontxt.length > 0) {
return iattiontxt; return iattiontxt;
...@@ -1437,7 +1437,7 @@ Page({ ...@@ -1437,7 +1437,7 @@ Page({
} }
} else {//机器胜利 } else {//机器胜利
let doup = false; let doup = false;
let towarm = towarm = Math.round(Math.random() * 3) * invitewarm; let towarm = Math.round(Math.random() * 3) * 1;
if (iwd > mywd) {//可不处理 if (iwd > mywd) {//可不处理
havechao = true; havechao = true;
doup = Math.random() < 0.2; doup = Math.random() < 0.2;
......
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