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
91de5434
Commit
91de5434
authored
Oct 17, 2020
by
zhangjinzhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
982b741e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
738 additions
and
467 deletions
+738
-467
project-ide.json
taobao_jn/client/.kaitian/project-ide.json
+3
-0
pagegamemain.js
taobao_jn/client/pages/pagegamemain/pagegamemain.js
+232
-6
pagepageindex.js
taobao_jn/client/pages/pagepageindex/pagepageindex.js
+503
-461
No files found.
taobao_jn/client/.kaitian/project-ide.json
0 → 100644
View file @
91de5434
{
"enableLegacyRemoteDebug"
:
true
}
\ No newline at end of file
taobao_jn/client/pages/pagegamemain/pagegamemain.js
View file @
91de5434
...
@@ -14,7 +14,8 @@ const {
...
@@ -14,7 +14,8 @@ const {
const
{
const
{
commonToast
,
commonToast
,
navigateToOutside
,
navigateToOutside
,
getSystemInfo
getSystemInfo
,
getServerTime
}
=
tbcc
.
tb
;
}
=
tbcc
.
tb
;
let
updateact
=
1
;
//请求
let
updateact
=
1
;
//请求
let
gameatime
=
100
;
//活动倒计时,100,
let
gameatime
=
100
;
//活动倒计时,100,
...
@@ -106,7 +107,6 @@ Page({
...
@@ -106,7 +107,6 @@ Page({
inviteshowdata
:
{
inviteshowdata
:
{
},
},
avatar1
:
""
,
avatar1
:
""
,
avatar2
:
""
,
avatar2
:
""
,
avatar3
:
""
,
avatar3
:
""
,
...
@@ -114,9 +114,18 @@ Page({
...
@@ -114,9 +114,18 @@ Page({
canwin
:
false
,
canwin
:
false
,
hidetime
:
0
,
hidetime
:
0
,
othername
:
[],
othername
:
[],
overequest
:
false
,
},
},
onLoad
(
query
)
{
onLoad
(
query
)
{
// console.log("onLoad========>", app, props);
// console.log("onLoad========>", app, props);
if
(
query
&&
query
.
laststat
)
{
let
laststat
=
query
.
laststat
;
console
.
log
(
"laststat=====>"
,
laststat
);
this
.
getLastGame
();
return
;
}
else
{
console
.
log
(
"普通进入"
);
}
let
isnewdata
=
my
.
getStorageSync
({
let
isnewdata
=
my
.
getStorageSync
({
key
:
'jn_'
+
app
.
openId
+
'_new'
key
:
'jn_'
+
app
.
openId
+
'_new'
});
});
...
@@ -138,6 +147,7 @@ Page({
...
@@ -138,6 +147,7 @@ Page({
// step = 3;
// step = 3;
gameatime
=
Math
.
floor
((
Number
(
end
)
-
Number
(
start
))
/
1000
);
gameatime
=
Math
.
floor
((
Number
(
end
)
-
Number
(
start
))
/
1000
);
gtoolcd
=
Number
(
toolcd
);
gtoolcd
=
Number
(
toolcd
);
console
.
error
(
"道具cd"
,
toolcd
,
gtoolcd
);
let
sucgl
=
Number
(
gl
);
let
sucgl
=
Number
(
gl
);
let
nranksuc
=
Math
.
random
();
let
nranksuc
=
Math
.
random
();
let
canwin
=
false
;
let
canwin
=
false
;
...
@@ -563,17 +573,54 @@ Page({
...
@@ -563,17 +573,54 @@ Page({
this
.
updateActInfo
();
this
.
updateActInfo
();
},
},
onHide
()
{
onHide
()
{
//房间数据
let
roomdata
=
this
.
data
.
roomdata
;
let
roomnums
=
this
.
data
.
roomnums
;
let
tooltime
=
this
.
data
.
tooltime
;
let
canwin
=
this
.
data
.
canwin
;
let
step
=
this
.
data
.
step
;
let
startime
=
this
.
data
.
startime
;
let
endtime
=
this
.
data
.
endtime
;
let
avatar2
=
this
.
data
.
avatar2
;
let
avatar3
=
this
.
data
.
avatar3
;
let
avatar4
=
this
.
data
.
avatar4
;
let
othername
=
this
.
data
.
othername
;
let
overequest
=
this
.
data
.
overequest
;
let
ntime
=
Date
.
now
();
let
ntime
=
Date
.
now
();
my
.
setStorage
({
key
:
'jn_'
+
app
.
openId
+
'_gamedata'
,
data
:
{
roomdata
:
roomdata
,
roomnums
:
roomnums
,
tooltime
:
tooltime
,
canwin
:
canwin
,
step
:
step
,
startime
:
startime
,
endtime
:
endtime
,
avatar2
,
avatar3
,
avatar4
,
othername
:
othername
,
overequest
:
overequest
,
hidetime
:
ntime
,
}
})
this
.
setData
({
this
.
setData
({
hidetime
:
ntime
hidetime
:
ntime
});
});
},
},
//更新活动信息
//更新活动信息
//30s刷新一次邀请人列表,新增温度,结束前5s再请求一次,onshow请求一次
//30s刷新一次邀请人列表,新增温度,结束前5s再请求一次,onshow请求一次
async
updateActInfo
()
{
async
updateActInfo
(
gamestat
=
"now"
)
{
// console.log("updateActInfo=======>");
// console.log("updateActInfo=======>");
clearTimeout
(
updateact
);
clearTimeout
(
updateact
);
await
this
.
updateAttionList
();
await
this
.
updateAttionList
(
gamestat
);
await
this
.
getInviteListByCurGame
();
await
this
.
getInviteListByCurGame
();
let
lesstime
=
this
.
data
.
gametime
*
1000
;
let
lesstime
=
this
.
data
.
gametime
*
1000
;
let
chatime
=
30000
;
let
chatime
=
30000
;
...
@@ -658,6 +705,9 @@ Page({
...
@@ -658,6 +705,9 @@ Page({
}).
catch
(
res
=>
{
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
commonToast
(
res
&&
res
.
message
);
})
})
this
.
setData
({
overequest
:
true
});
const
{
success
,
data
}
=
overdata
;
const
{
success
,
data
}
=
overdata
;
if
(
success
)
{
if
(
success
)
{
const
{
warms
,
isWin
,
prize
,
unLockStep
}
=
data
;
const
{
warms
,
isWin
,
prize
,
unLockStep
}
=
data
;
...
@@ -814,7 +864,7 @@ Page({
...
@@ -814,7 +864,7 @@ Page({
return
showm
+
":"
+
shows
;
return
showm
+
":"
+
shows
;
},
},
//更新attionlist,玩家相关
//更新attionlist,玩家相关
async
updateAttionList
()
{
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
;
...
@@ -834,6 +884,9 @@ Page({
...
@@ -834,6 +884,9 @@ Page({
if
(
total
>
nwd
)
{
if
(
total
>
nwd
)
{
this
.
updateRolewd
(
ridx
,
total
);
this
.
updateRolewd
(
ridx
,
total
);
}
}
if
(
gamestat
==
"last"
)
{
return
;
}
//使用道具的单独来
//使用道具的单独来
if
(
tool
)
{
if
(
tool
)
{
let
txt2
=
this
.
solveAttionTxt
(
tool
,
this
.
data
.
ltool
,
"tool"
);
let
txt2
=
this
.
solveAttionTxt
(
tool
,
this
.
data
.
ltool
,
"tool"
);
...
@@ -1147,7 +1200,7 @@ Page({
...
@@ -1147,7 +1200,7 @@ Page({
let
addy
=
50
;
let
addy
=
50
;
let
step
=
this
.
data
.
step
;
let
step
=
this
.
data
.
step
;
var
con
=
stage
.
addChild
(
new
FYGE
.
Container
())
var
con
=
stage
.
addChild
(
new
FYGE
.
Container
())
con
.
y
=
stage
.
viewRect
.
y
;
con
.
y
=
stage
.
viewRect
.
y
;
stage
.
addEventListener
(
FYGE
.
Event
.
INIT_STAGE
,
()
=>
{
stage
.
addEventListener
(
FYGE
.
Event
.
INIT_STAGE
,
()
=>
{
SvgaParser
.
loadSvga
(
SvgaParser
.
loadSvga
(
paple1
,
paple1
,
...
@@ -1235,6 +1288,179 @@ Page({
...
@@ -1235,6 +1288,179 @@ Page({
stage
.
flush
();
stage
.
flush
();
FYGE
.
getRequestAnimationFrame
()(
loop
);
FYGE
.
getRequestAnimationFrame
()(
loop
);
}
}
},
//用上局游戏继续
async
getLastGame
()
{
let
key
=
'jn_'
+
app
.
openId
+
'_gamedata'
;
let
lgamedata
=
await
new
Promise
((
res
,
rej
)
=>
{
my
.
getStorage
({
key
:
key
,
success
:
(
result
)
=>
{
console
.
log
(
"checkLastGameStat======>suc"
,
result
);
res
(
result
.
data
);
},
fail
:
()
=>
{
rej
(
false
);
},
complete
:
()
=>
{
}
});
})
if
(
lgamedata
)
{
let
{
roomdata
,
roomnums
,
tooltime
,
canwin
,
step
,
startime
,
endtime
,
avatar2
,
avatar3
,
avatar4
,
othername
,
overequest
}
=
lgamedata
;
commonToast
(
"正在连接到上一局"
);
if
(
!
overequest
)
{
let
nowTime
=
await
getServerTime
().
catch
(()
=>
{
});
if
(
!
nowTime
)
{
nowTime
=
Date
.
now
();
}
console
.
log
(
"nowtime===>"
,
nowTime
,
endtime
,
nowTime
-
endtime
);
if
(
endtime
>
nowTime
)
{
//继续
this
.
lastgamereset
(
lgamedata
,
nowTime
);
}
else
{
//结算
this
.
lastgameover
(
lgamedata
,
nowTime
);
}
}
else
{
console
.
error
(
"哪里处理问题====》"
,
lgamedata
);
}
my
.
removeStorage
({
key
:
key
});
}
},
//直接结束
async
lastgameover
(
lgamedata
,
nowTime
)
{
console
.
log
(
"直接结束========》"
);
let
{
roomdata
,
roomnums
,
tooltime
,
canwin
,
step
,
startime
,
endtime
,
avatar2
,
avatar3
,
avatar4
,
othername
,
overequest
,
hidetime
}
=
lgamedata
;
let
passtime
=
Math
.
floor
((
nowTime
-
hidetime
)
/
1000
);
if
(
passtime
>
0
)
{
tooltime
-=
passtime
;
}
if
(
tooltime
<
0
)
{
tooltime
=
0
;
}
this
.
setData
({
avatar1
:
app
.
avatar
,
avatar2
:
avatar2
,
avatar3
:
avatar3
,
avatar4
:
avatar4
,
step
:
step
,
roomnums
:
roomnums
,
roomdata
:
roomdata
,
canwin
:
canwin
,
gametime
:
0
,
gametimeshow
:
this
.
changeshowtime
(
0
),
tooltime
:
tooltime
,
showtooltime
:
this
.
changeshowtime
(
tooltime
),
startime
:
Number
(
startime
),
endtime
:
Number
(
endtime
),
});
this
.
updateActInfo
(
"last"
);
this
.
updateAiInfo
();
console
.
log
(
"更新ai"
);
this
.
changePageShow1
();
console
.
log
(
"aiwdshow"
,
this
.
data
.
roomdata
);
this
.
gameover
();
},
//恢复上局游戏
async
lastgamereset
(
lgamedata
,
nowTime
)
{
let
{
roomdata
,
roomnums
,
tooltime
,
canwin
,
step
,
startime
,
endtime
,
avatar2
,
avatar3
,
avatar4
,
othername
,
overequest
,
hidetime
}
=
lgamedata
;
let
passtime
=
Math
.
floor
((
nowTime
-
hidetime
)
/
1000
);
if
(
passtime
>
0
)
{
tooltime
-=
passtime
;
}
if
(
tooltime
<
0
)
{
tooltime
=
0
;
}
let
gameatime
=
Math
.
floor
((
Number
(
endtime
)
-
Number
(
nowTime
))
/
1000
);
this
.
setData
({
avatar1
:
app
.
avatar
,
avatar2
:
avatar2
,
avatar3
:
avatar3
,
avatar4
:
avatar4
,
step
:
step
,
roomnums
:
roomnums
,
roomdata
:
roomdata
,
canwin
:
canwin
,
gametime
:
gameatime
,
gametimeshow
:
this
.
changeshowtime
(
gameatime
),
tooltime
:
tooltime
,
showtooltime
:
this
.
changeshowtime
(
tooltime
),
startime
:
Number
(
startime
),
endtime
:
Number
(
endtime
),
})
this
.
updateActInfo
(
"last"
);
this
.
updateAiInfo
();
this
.
changePageShow1
();
this
.
updateAct
();
},
},
async
changePageShow1
()
{
await
new
Promise
((
res
)
=>
{
this
.
setData
({
show_v
:
1
});
setTimeout
(()
=>
{
this
.
setData
({
show_v
:
2
});
res
();
},
1000
);
})
},
//上局游戏直接设置新的
updateAiInfo
()
{
let
canwin
=
this
.
data
.
canwin
;
let
roomnums
=
this
.
data
.
roomnums
-
1
;
let
roomdata
=
this
.
data
.
roomdata
;
let
myidx
=
this
.
data
.
myidx
-
1
;
let
mywd
=
roomdata
[
myidx
].
wd
;
if
(
mywd
==
0
)
{
canwin
=
false
;
}
let
havechao
=
false
;
for
(
let
i
=
0
;
i
<
roomdata
.
length
;
i
++
)
{
if
(
i
!=
myidx
)
{
let
idata
=
this
.
data
.
roomdata
[
i
];
let
iwd
=
idata
.
wd
;
let
twd
=
iwd
;
if
(
canwin
)
{
//玩家胜利
if
(
iwd
<
mywd
)
{
twd
=
Math
.
floor
(
Math
.
random
()
*
(
mywd
-
iwd
))
+
iwd
;
}
}
else
{
//机器胜利
let
doup
=
false
;
let
towarm
=
towarm
=
Math
.
round
(
Math
.
random
()
*
3
)
*
invitewarm
;
if
(
iwd
>
mywd
)
{
//可不处理
havechao
=
true
;
doup
=
Math
.
random
()
<
0.2
;
}
else
{
if
(
havechao
)
{
//可不处理
doup
=
Math
.
random
()
<
0.5
;
}
else
{
doup
=
true
towarm
=
Math
.
ceil
(
mywd
-
iwd
+
towarm
);
havechao
=
true
;
}
}
if
(
doup
&&
towarm
>
0
)
{
twd
=
iwd
+
towarm
;
}
}
this
.
updateRolewd
(
i
,
twd
);
}
}
}
});
});
\ No newline at end of file
taobao_jn/client/pages/pagepageindex/pagepageindex.js
View file @
91de5434
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