Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
xiaoxiaole
Commits
968badc5
Commit
968badc5
authored
Sep 23, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
cf3426ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
21 deletions
+33
-21
MainBase.ts
egret/libs/new_wx/MainBase.ts
+22
-14
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+5
-3
MapScene.ts
egret/src/mapScene/MapScene.ts
+2
-2
StartPanel.ts
egret/src/panels/StartPanel.ts
+3
-1
home.json
mock/happyclear/home.json
+1
-1
No files found.
egret/libs/new_wx/MainBase.ts
View file @
968badc5
...
...
@@ -277,6 +277,7 @@ export default class MainBase extends eui.UILayer {
const
result
=
DataManager
.
ins
.
getData
(
'getShareInfo'
);
window
[
'registerWX'
](
result
);
});
updateMainTimer
();
}
}
...
...
@@ -302,7 +303,7 @@ export default class MainBase extends eui.UILayer {
playGameBg
();
}
if
(
timerInit
)
{
//
if(timerInit) {
NetManager
.
ins
.
hc_home
(()
=>
{
updateMainTimer
();
//更新bloodpanel和mapscene
...
...
@@ -313,7 +314,7 @@ export default class MainBase extends eui.UILayer {
if
(
current
&&
current
[
'updateTimerView'
])
current
[
'updateTimerView'
]();
},
window
[
'collectRuleId'
]);
}
//
}
}
...
...
@@ -325,17 +326,16 @@ export default class MainBase extends eui.UILayer {
}
}
let
timerInit
=
false
;
export
const
initTimer
=
()
=>
{
if
(
timerInit
)
return
;
timerInit
=
true
;
const
data
=
getHomeData
();
if
(
data
.
refectionCountdown
==
0
)
data
.
refectionCountdown
=
2
;
data
.
refectionCountdown
+=
Math
.
floor
(
new
Date
().
getTime
()
/
1000
);
updateMainTimer
();
}
const
timer
=
new
egret
.
Timer
(
1000
);
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER_COMPLETE
,
()
=>
{
// let timerInit=false;
// export const initTimer = ()=>{
// if(timerInit) return;
// timerInit=true;
// const data = getHomeData();
// if(data.refectionCountdown==0) data.refectionCountdown = 2;
// data.refectionCountdown += Math.floor(new Date().getTime()/1000);
// updateMainTimer();
// }
const
updateTimerAndView
=
()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
updateMainTimer
();
//更新bloodpanel和mapscene
...
...
@@ -346,6 +346,11 @@ timer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, () => {
if
(
current
&&
current
[
'updateTimerView'
])
current
[
'updateTimerView'
]();
},
window
[
'collectRuleId'
]);
}
const
timer
=
new
egret
.
Timer
(
1000
);
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER_COMPLETE
,
()
=>
{
updateTimerAndView
();
},
this
)
export
const
mainTimer
=
timer
;
export
const
updateMainTimer
=
()
=>
{
...
...
@@ -356,8 +361,11 @@ export const updateMainTimer = () => {
mainTimer
.
reset
();
const
left
=
data
.
refectionCountdown
-
Math
.
floor
(
new
Date
().
getTime
()
/
1000
);
mainTimer
.
repeatCount
=
left
;
if
(
left
>
=
0
)
if
(
left
>
0
)
mainTimer
.
start
();
else
if
(
left
==
0
)
{
updateTimerAndView
();
}
else
console
.
error
(
'data error'
)
}
...
...
egret/libs/tw/manager/NetManager.ts
View file @
968badc5
...
...
@@ -1780,9 +1780,11 @@ export class NetManager extends ABNetManager {
* @param result 结果
*/
protected
onResponse
(
net
:
INetData
,
result
:
any
):
void
{
// if(net.name == 'hc_home') {
// result.data.refectionCountdown += Math.floor(new Date().getTime()/1000);
// }
if
(
net
.
name
==
'hc_home'
)
{
if
(
result
.
data
.
refectionCountdown
==
0
)
result
.
data
.
refectionCountdown
=
5
;
result
.
data
.
refectionCountdown
+=
Math
.
floor
(
new
Date
().
getTime
()
/
1000
);
}
//数据处理
const
data
:
Data
=
DataManager
.
ins
.
updateData
(
net
.
name
,
result
,
net
.
param
);
//接口成功
...
...
egret/src/mapScene/MapScene.ts
View file @
968badc5
...
...
@@ -18,7 +18,7 @@ import setGray from "../setGray";
import
{
loadSvga
}
from
"../loadSvga"
;
import
getResPath
from
"../../libs/new_tc/getResPath"
;
import
CountDown
from
"./CountDown"
;
import
{
initTimer
}
from
"../../libs/new_wx/MainBase"
;
export
default
class
MapScene
extends
Scene
{
scrollGroup
:
eui
.
Group
;
...
...
@@ -32,7 +32,7 @@ export default class MapScene extends Scene {
async
start
(
data
?)
{
super
.
start
();
initTimer
();
if
(
getBgOn
()
&&
MapScene
[
'firstPlayBgTag'
]
==
true
)
{
playBg
();
}
...
...
egret/src/panels/StartPanel.ts
View file @
968badc5
...
...
@@ -103,7 +103,9 @@ export default class StartPanel extends Panel {
// Loading.instace.hide();
this
.
touchChildren
=
true
;
this
.
touchEnabled
=
true
;
updateMainTimerAfterGetData
();
wait
(
2000
).
then
(()
=>
{
updateMainTimerAfterGetData
();
});
if
(
success
)
{
// Loading.instace.show();
try
{
...
...
mock/happyclear/home.json
View file @
968badc5
...
...
@@ -5,7 +5,7 @@
"timestamp"
:
1566885811001
,
"data"
:
{
"refectionCountdown"
:
0
,
"remainEnargy"
:
5
,
"remainEnargy"
:
4
,
"isGetAllTreasureBox"
:
0
,
"wealth"
:
7960
,
"totalStars"
:
145
,
...
...
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