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
a522ea2d
Commit
a522ea2d
authored
Oct 15, 2020
by
zhangjinzhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zancun
parent
99886dbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
37 deletions
+102
-37
pagegamemain.js
taobao_jn/client/pages/pagegamemain/pagegamemain.js
+102
-37
No files found.
taobao_jn/client/pages/pagegamemain/pagegamemain.js
View file @
a522ea2d
...
...
@@ -81,7 +81,7 @@ Page({
toolshow_v
:
false
,
taskshow_v
:
false
,
invite_v
:
false
,
unLockPkData
:{
unLockPkData
:
{
},
pk1data
:
{
...
...
@@ -107,15 +107,15 @@ Page({
avatar2
:
""
,
avatar3
:
""
,
avatar4
:
""
,
canwin
:
false
canwin
:
false
},
onLoad
(
props
)
{
console
.
log
(
"onLoad========>"
,
app
,
props
);
let
step
=
1
;
let
sucgl
=
70
;
let
nranksuc
=
Math
.
random
()
*
100
;
let
nranksuc
=
Math
.
random
()
*
100
;
let
canwin
=
false
;
if
(
nranksuc
<
sucgl
)
{
//能赢
if
(
nranksuc
<
sucgl
)
{
//能赢
canwin
=
true
;
}
let
roomnums
=
[
2
,
3
,
4
][
step
-
1
];
...
...
@@ -141,7 +141,8 @@ Page({
roomdata
:
roomdata
,
attionlist
:
[],
showattionlist
:
[],
canwin
:
canwin
,
canwin
:
canwin
,
isfirst
:
true
,
});
let
attiontxt1
=
"游戏开始啦,共有"
+
roomnums
+
"名玩家加入游戏,快来升温队伍拿奖励吧。"
;
this
.
addAttionTxt
(
attiontxt1
);
...
...
@@ -152,13 +153,63 @@ Page({
this
.
newAiControl
();
},
//新ai逻辑
newAiControl
(){
newAiControl
()
{
let
canwin
=
this
.
data
.
canwin
;
let
roomnums
=
this
.
data
.
roomnums
-
1
;
if
(
canwin
){
// 机器不用操作
let
roomnums
=
this
.
data
.
roomnums
-
1
;
let
doact
=
false
;
if
(
canwin
)
{
// 机器不用操作
doact
=
false
;
}
else
{
//机器使用道具
doact
=
true
;
}
else
{
//机器使用道具
}
let
i
=
1
;
if
(
doact
)
{
let
isfirst
=
this
.
data
.
isfirst
;
if
(
isfirst
)
{
this
.
setData
({
isfirst
:
false
});
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"使用道具获得了"
+
toolwarm
+
"温度值"
;
this
.
addAttionTxt
(
itxt
);
let
inroomidx
=
i
+
1
;
let
inwd
=
this
.
data
.
roomdata
[
inroomidx
][
"wd"
];
inwd
+=
toolwarm
;
this
.
updateRolewd
(
i
+
2
,
inwd
);
}
else
{
//任务,或是邀请人
let
randfrom
=
Math
.
random
();
if
(
randfrom
<
0.3
)
{
//任务
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"完成了一个任务,获得了"
+
taskwarm
+
"温度值"
;
this
.
addAttionTxt
(
itxt
);
let
inroomidx
=
i
+
1
;
let
inwd
=
this
.
data
.
roomdata
[
inroomidx
][
"wd"
];
inwd
+=
taskwarm
;
this
.
updateRolewd
(
i
+
2
,
inwd
);
}
else
{
//邀请人
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"邀请了一位好友,获得了"
+
invitewarm
+
"温度值"
;
this
.
addAttionTxt
(
itxt
);
let
inroomidx
=
i
+
1
;
let
inwd
=
this
.
data
.
roomdata
[
inroomidx
][
"wd"
];
inwd
+=
invitewarm
;
this
.
updateRolewd
(
i
+
2
,
inwd
);
}
}
}
},
aiUseOneTool
()
{
let
roomnums
=
this
.
data
.
roomnums
-
1
;
for
(
let
i
=
0
;
i
<
roomnums
;
i
++
)
{
let
chatime
=
Math
.
ceil
(
Math
.
random
()
*
5
)
+
2
;
let
itime1
=
Number
((
Math
.
random
()
*
chatime
).
toFixed
(
2
))
*
1000
;
setTimeout
(()
=>
{
let
itxt
=
"玩家"
+
(
i
+
1
)
+
"使用道具获得了"
+
toolwarm
+
"温度值"
;
this
.
addAttionTxt
(
itxt
);
let
inroomidx
=
i
+
1
;
let
inwd
=
this
.
data
.
roomdata
[
inroomidx
][
"wd"
];
inwd
+=
toolwarm
;
this
.
updateRolewd
(
i
+
2
,
inwd
);
},
itime1
);
}
},
//其余机器人升温逻辑
...
...
@@ -312,7 +363,21 @@ Page({
async
gameover
()
{
this
.
closetool
();
// console.log("游戏结束");
let
iswin
=
this
.
data
.
iswin
;
let
roomnums
=
this
.
data
.
roomnums
;
let
mywd
=
this
.
data
.
roomdata
[
this
.
data
.
myidx
-
1
].
wd
;
let
iswin
=
true
;
for
(
let
i
=
1
;
i
<
roomnums
;
i
++
)
{
let
idata
=
this
.
data
.
roomdata
[
i
];
let
iwd
=
idata
.
wd
;
if
(
iwd
>=
mywd
)
{
iswin
=
false
;
break
;
}
}
this
.
setData
({
iswin
:
iswin
});
let
step
=
this
.
data
.
step
;
const
overdata
=
await
API
.
gameOver
({
isWin
:
iswin
,
...
...
@@ -323,7 +388,7 @@ Page({
const
{
success
,
data
}
=
overdata
;
if
(
success
)
{
const
{
warms
,
isWin
,
prize
,
unLockStep
}
=
data
;
console
.
log
(
"over"
,
data
)
console
.
log
(
"over"
,
data
)
if
(
isWin
)
{
if
(
prize
&&
prize
.
image
&&
prize
.
image
.
length
>
0
)
{
this
.
setData
({
...
...
@@ -331,23 +396,23 @@ Page({
})
this
.
openprize1
();
}
else
{
this
.
setData
({
pk1data
:
data
})
this
.
setData
({
pk1data
:
data
})
this
.
openprize4
();
}
}
else
{
}
else
{
if
(
prize
&&
prize
.
image
&&
prize
.
image
.
length
>
0
)
{
this
.
setData
({
pk1data
:
data
})
this
.
openprize1
();
}
else
{
this
.
setData
({
pk1data
:
data
})
this
.
openprize3
();
}
this
.
setData
({
pk1data
:
data
})
this
.
openprize1
();
}
else
{
this
.
setData
({
pk1data
:
data
})
this
.
openprize3
();
}
}
// console.log("结束数据", overdata);
}
...
...
@@ -623,7 +688,7 @@ Page({
this
.
closeLockStep
();
this
.
closeTask
();
// my.navigateBack();
my
.
redirectTo
({
url
:
'/pages/pagepageindex/pagepageindex'
})
my
.
redirectTo
({
url
:
'/pages/pagepageindex/pagepageindex'
})
},
//打开道具页面
...
...
@@ -693,15 +758,15 @@ Page({
})
},
openLockStep
(
data
){
this
.
closeprize1
();
this
.
closeprize2
();
this
.
closeprize3
();
this
.
closeprize4
();
this
.
setData
({
unLockPkData
:
data
,
lockstepshow_v
:
true
})
openLockStep
(
data
)
{
this
.
closeprize1
();
this
.
closeprize2
();
this
.
closeprize3
();
this
.
closeprize4
();
this
.
setData
({
unLockPkData
:
data
,
lockstepshow_v
:
true
})
},
closeLockStep
()
{
this
.
setData
({
...
...
@@ -780,7 +845,7 @@ Page({
console
.
log
(
err
);
}
)
SvgaParser
.
loadSvga
(
SvgaParser
.
loadSvga
(
paple3
,
(
v
)
=>
{
console
.
log
(
"svga"
+
v
);
...
...
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