Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new_taobao
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
new_taobao
Commits
bd4dfd0d
Commit
bd4dfd0d
authored
Oct 15, 2020
by
zhangjinzhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头像昵称
parent
5040cb22
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
669 additions
and
23 deletions
+669
-23
pagegamemain.js
taobao_jn/client/pages/pagegamemain/pagegamemain.js
+64
-16
constants.js
taobao_jn/client/tbcc-sdk/lib/constants.js
+605
-7
No files found.
taobao_jn/client/pages/pagegamemain/pagegamemain.js
View file @
bd4dfd0d
...
@@ -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
modalType
,
SHARE_CONFIG
,
gnickNames
,
gavatars
}
from
'../../tbcc-sdk/lib/constants'
;
}
from
'../../tbcc-sdk/lib/constants'
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
const
{
...
@@ -112,6 +112,8 @@ Page({
...
@@ -112,6 +112,8 @@ Page({
avatar3
:
""
,
avatar3
:
""
,
avatar4
:
""
,
avatar4
:
""
,
canwin
:
false
,
canwin
:
false
,
hidetime
:
0
,
othername
:[],
},
},
onLoad
(
query
)
{
onLoad
(
query
)
{
// console.log("onLoad========>", app, props);
// console.log("onLoad========>", app, props);
...
@@ -143,13 +145,34 @@ Page({
...
@@ -143,13 +145,34 @@ Page({
canwin
=
true
;
canwin
=
true
;
}
}
let
roomnums
=
[
2
,
3
,
4
][
step
-
1
];
let
roomnums
=
[
2
,
3
,
4
][
step
-
1
];
if
(
roomnums
==
2
)
{
let
txkeys
=
Object
.
keys
(
gavatars
);
let
othername
=
[
"你"
];
}
else
if
(
roomnums
==
3
)
{
for
(
let
gu
=
0
;
gu
<
roomnums
-
1
;
gu
++
){
let
guax
=
Math
.
floor
(
Math
.
random
()
*
txkeys
.
length
);
}
else
if
(
roomnums
==
4
)
{
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
})
}
}
othername
.
push
(
gunick
);
}
// console.log("玩家名字",othername);
this
.
setData
({
othername
:
othername
});
let
roomdata
=
[];
let
roomdata
=
[];
for
(
let
i
=
0
;
i
<
roomnums
;
i
++
)
{
for
(
let
i
=
0
;
i
<
roomnums
;
i
++
)
{
let
idata
=
{
let
idata
=
{
...
@@ -341,22 +364,23 @@ Page({
...
@@ -341,22 +364,23 @@ Page({
addOneAiWarm
(
data
,
i
)
{
addOneAiWarm
(
data
,
i
)
{
let
type
=
data
[
0
];
let
type
=
data
[
0
];
let
nums
=
data
[
1
];
let
nums
=
data
[
1
];
let
othername
=
this
.
data
.
othername
;
if
(
type
==
"tool"
)
{
if
(
type
==
"tool"
)
{
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"使用道具一次获得了"
+
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
=
"玩家"
+
(
i
+
1
)
+
"完成了"
+
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"
];
inwd
+=
taskwarm
*
nums
;
inwd
+=
taskwarm
*
nums
;
this
.
updateRolewd
(
i
+
1
,
inwd
);
this
.
updateRolewd
(
i
+
1
,
inwd
);
}
else
if
(
type
==
"invite"
)
{
}
else
if
(
type
==
"invite"
)
{
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"邀请了"
+
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"
];
...
@@ -378,11 +402,12 @@ Page({
...
@@ -378,11 +402,12 @@ Page({
},
},
aiUseOneTool
()
{
aiUseOneTool
()
{
let
roomnums
=
this
.
data
.
roomnums
-
1
;
let
roomnums
=
this
.
data
.
roomnums
-
1
;
let
othername
=
this
.
data
.
othername
for
(
let
i
=
0
;
i
<
roomnums
;
i
++
)
{
for
(
let
i
=
0
;
i
<
roomnums
;
i
++
)
{
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
=
"玩家"
+
(
i
+
1
)
+
"使用道具获得了"
+
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"
];
...
@@ -419,7 +444,8 @@ Page({
...
@@ -419,7 +444,8 @@ Page({
aiuseTool
(
time
,
i
,
chatime
)
{
aiuseTool
(
time
,
i
,
chatime
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// console.log("ai" + i + "使用道具升温度");
// console.log("ai" + i + "使用道具升温度");
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"使用道具获得了"
+
toolwarm
+
"温度值"
;
let
othername
=
this
.
data
.
othername
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"
];
...
@@ -438,14 +464,16 @@ Page({
...
@@ -438,14 +464,16 @@ Page({
//机器邀请人
//机器邀请人
ainvite
(
invitenums
,
i
)
{
ainvite
(
invitenums
,
i
)
{
let
chatime
=
Math
.
floor
(
gameatime
/
invitenums
)
*
1000
;
let
chatime
=
Math
.
floor
(
gameatime
/
invitenums
)
*
1000
;
let
othername
=
this
.
data
.
othername
for
(
let
i1
=
0
;
i1
<
invitenums
;
i1
++
)
{
for
(
let
i1
=
0
;
i1
<
invitenums
;
i1
++
)
{
let
i1start
=
i1
*
chatime
;
let
i1start
=
i1
*
chatime
;
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
;
// console.log(rangetime);
// console.log(rangetime);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// console.log("ai" + i + "邀请好友升温度");
// console.log("ai" + i + "邀请好友升温度");
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"邀请了一位好友,获得了"
+
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"
];
...
@@ -458,12 +486,13 @@ Page({
...
@@ -458,12 +486,13 @@ Page({
//机器人完成任务
//机器人完成任务
aitask
(
tasknums
,
i
)
{
aitask
(
tasknums
,
i
)
{
let
chatime
=
Math
.
floor
(
gameatime
/
tasknums
)
*
1000
;
let
chatime
=
Math
.
floor
(
gameatime
/
tasknums
)
*
1000
;
let
othername
=
this
.
data
.
othername
for
(
let
i1
=
0
;
i1
<
tasknums
;
i1
++
)
{
for
(
let
i1
=
0
;
i1
<
tasknums
;
i1
++
)
{
let
i1start
=
i1
*
chatime
;
let
i1start
=
i1
*
chatime
;
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
=
"玩家"
+
(
i
+
1
)
+
"完成了一个任务,获得了"
+
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"
];
...
@@ -473,12 +502,31 @@ Page({
...
@@ -473,12 +502,31 @@ Page({
}
}
},
},
onShow
()
{
onShow
()
{
let
ntime
=
Date
.
now
();
let
hidetime
=
this
.
data
.
hidetime
;
if
(
hidetime
){
let
passtime
=
ntime
-
hidetime
;
let
gametime
=
this
.
data
.
gametime
;
gametime
-=
passtime
/
1000
;
if
(
gametime
<
0
){
gametime
=
0
;
}
this
.
setData
({
gametime
:
gametime
});
}
let
ngametime
=
this
.
data
.
gametime
;
let
ngametime
=
this
.
data
.
gametime
;
if
((
this
.
data
.
isnew
>
0
&&
this
.
data
.
isnew
<
7
)
||
this
.
data
.
show_v
!=
2
||
ngametime
<=
0
)
{
if
((
this
.
data
.
isnew
>
0
&&
this
.
data
.
isnew
<
7
)
||
this
.
data
.
show_v
!=
2
||
ngametime
<=
0
)
{
return
;
return
;
}
}
this
.
updateActInfo
();
this
.
updateActInfo
();
},
},
onHide
(){
let
ntime
=
Date
.
now
();
this
.
setData
({
hidetime
:
ntime
});
},
//更新活动信息
//更新活动信息
//30s刷新一次邀请人列表,新增温度,结束前5s再请求一次,onshow请求一次
//30s刷新一次邀请人列表,新增温度,结束前5s再请求一次,onshow请求一次
async
updateActInfo
()
{
async
updateActInfo
()
{
...
@@ -821,7 +869,7 @@ Page({
...
@@ -821,7 +869,7 @@ Page({
}
}
if
(
taskcount
>
0
&&
taskwarm
>
0
)
{
if
(
taskcount
>
0
&&
taskwarm
>
0
)
{
this
.
newAiControl
(
"task"
,
taskcount
);
this
.
newAiControl
(
"task"
,
taskcount
);
let
tasktxt
=
"完成了"
+
taskcount
+
"个任务,获得了"
+
taskwarm
+
"温度值"
;
let
tasktxt
=
"
你
完成了"
+
taskcount
+
"个任务,获得了"
+
taskwarm
+
"温度值"
;
this
.
addAttionTxt
(
tasktxt
);
this
.
addAttionTxt
(
tasktxt
);
}
}
//邀请的单独来
//邀请的单独来
...
@@ -850,7 +898,7 @@ Page({
...
@@ -850,7 +898,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
,
...
@@ -859,7 +907,7 @@ Page({
...
@@ -859,7 +907,7 @@ 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 + "温度值";
...
...
taobao_jn/client/tbcc-sdk/lib/constants.js
View file @
bd4dfd0d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment