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
98fc3690
Commit
98fc3690
authored
Nov 11, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6a6cdeb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
16 deletions
+39
-16
CutTimer.ts
egret/src/CutTimer.ts
+8
-7
HbRainIcon.ts
egret/src/mapScene/icon/HbRainIcon.ts
+28
-6
hbRainBaseInfo.json
mock/happyclear/hbRainBaseInfo.json
+3
-3
No files found.
egret/src/CutTimer.ts
View file @
98fc3690
...
...
@@ -31,12 +31,10 @@ export default class CutTimer {
* @param labelText 该字符串将作为倒计时显示的文字,hh、mm、ss将被分别替换成时,分,秒,例:将在hh:mm:ss后消失 -> 将在18:07:21后消失
* @param callFun 如果希望他在结束时去做一些什么则传入一个回调函数
*/
constructor
(
label
:
IDisplayText
,
labelText
:
string
,
callFun
?:
Function
)
{
this
.
_label
=
label
;
this
.
_labelText
=
labelText
;
if
(
callFun
)
{
this
.
_callFun
=
callFun
;
}
constructor
(
label
?:
IDisplayText
,
labelText
?:
string
,
callFun
?:
Function
)
{
this
.
_label
=
label
||
null
;
this
.
_labelText
=
labelText
||
"hh:mm:ss"
;
this
.
_callFun
=
callFun
||
null
;
}
/**
...
...
@@ -108,11 +106,14 @@ export default class CutTimer {
&&
timer
.
sec
===
"00"
)
{
this
.
stopAndCallFun
();
}
if
(
!
this
.
_label
){
return
;
}
let
str
=
this
.
_labelText
;
str
=
str
.
replace
(
/hh/g
,
timer
.
hour
);
str
=
str
.
replace
(
/mm/g
,
timer
.
min
);
str
=
str
.
replace
(
/ss/g
,
timer
.
sec
);
if
(
this
.
_label
instanceof
eui
.
Label
){
if
(
this
.
_label
instanceof
eui
.
Label
)
{
this
.
_label
.
textFlow
=
(
new
HtmlTextParser
).
parser
(
str
);
}
else
{
this
.
_label
.
text
=
str
;
...
...
egret/src/mapScene/icon/HbRainIcon.ts
View file @
98fc3690
...
...
@@ -3,17 +3,23 @@ import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import
{
GDispatcher
}
from
"../../../libs/tc/util/GDispatcher"
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
{
getlogItem
}
from
"../../Main"
;
import
CutTimer
from
"../../CutTimer"
;
export
default
class
HbRainIcon
extends
IconBase
{
private
cutTimer
:
CutTimer
=
null
;
constructor
(
name
:
string
,
group
:
eui
.
Group
,
btn
:
eui
.
Button
,
tipsBg
?:
eui
.
Image
,
tipsLabel
?:
eui
.
Label
)
{
super
(
name
,
group
,
btn
,
tipsBg
,
tipsLabel
);
this
.
cutTimer
=
new
CutTimer
();
this
.
cutTimer
.
callFun
=
()
=>
{
this
.
updateIcon
();
};
this
.
updateIcon
();
}
protected
start
()
{
super
.
start
();
this
.
updateIcon
();
}
public
showLog
()
{
...
...
@@ -27,19 +33,35 @@ export default class HbRainIcon extends IconBase {
if
(
res
.
code
==
"600054"
||
res
.
code
==
"600055"
)
{
this
.
visible
=
false
;
}
GDispatcher
.
dispatchEvent
(
'updateActIcon'
);
return
;
}
const
data
=
res
.
data
;
if
(
!
data
.
currentSession
&&
!
data
.
nextSession
)
{
let
time
:
number
;
const
sysTime
=
res
.
timestamp
;
// 当前系统时间
if
(
data
.
currentSession
)
{
this
.
visible
=
true
;
time
=
data
.
currentSession
.
endTime
-
sysTime
+
3000
;
if
(
!
this
.
cutTimer
.
start
(
time
))
{
this
.
cutTimer
.
stop
();
this
.
cutTimer
.
start
(
time
);
}
}
else
if
(
data
.
nextSession
)
{
this
.
visible
=
true
;
time
=
data
.
nextSession
.
startTime
-
sysTime
+
3000
;
if
(
!
this
.
cutTimer
.
start
(
time
))
{
this
.
cutTimer
.
stop
();
this
.
cutTimer
.
start
(
time
);
}
}
else
{
this
.
visible
=
false
;
return
;
}
this
.
visible
=
true
;
GDispatcher
.
dispatchEvent
(
'updateActIcon'
)
;
});
}
/**
* 点击icon
* @param e 点击事件
...
...
mock/happyclear/hbRainBaseInfo.json
View file @
98fc3690
...
...
@@ -2,13 +2,13 @@
"success"
:
true
,
"code"
:
"0000000000"
,
"desc"
:
"OK"
,
"timestamp"
:
1573
440905952
,
"timestamp"
:
1573
210800000
,
"data"
:
{
"currentRemainTimes"
:
0
,
"currentRem
1
ainTimes"
:
0
,
"currentSession"
:
{
"sessionIndex"
:
10
,
"startTime"
:
1573210800000
,
"endTime"
:
1573
440915952
,
"endTime"
:
1573
210803000
,
"limitScore"
:
10
},
"nextSession"
:
{
...
...
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