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
f5ae3805
Commit
f5ae3805
authored
Nov 04, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
47abbef1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
7 deletions
+52
-7
HbGameSkin.exml
egret/resource/skins/HbGameSkin.exml
+1
-0
HbGame.ts
egret/src/panels/HongbaoRain/HbGame.ts
+23
-3
RainMgr.ts
egret/src/panels/HongbaoRain/RainMgr.ts
+12
-0
RainObj.ts
egret/src/panels/HongbaoRain/RainObj.ts
+16
-4
No files found.
egret/resource/skins/HbGameSkin.exml
View file @
f5ae3805
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"HbGame"
width=
"750"
height=
"1206"
xmlns:e=
"http://ns.egret.com/eui"
<e:Skin
class=
"HbGame"
width=
"750"
height=
"1206"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Group
id=
"rainGroup"
left=
"0"
right=
"0"
top=
"0"
height=
"1206"
/>
<e:Group
right=
"40"
top=
"45"
>
<e:Group
right=
"40"
top=
"45"
>
<e:Image
y=
"0"
source=
"hbGame_num_bg_png"
horizontalCenter=
"0"
/>
<e:Image
y=
"0"
source=
"hbGame_num_bg_png"
horizontalCenter=
"0"
/>
<e:BitmapLabel
id=
"numLabel"
y=
"33"
font=
"hbGameNumFont_fnt"
text=
"0"
horizontalCenter=
"0"
/>
<e:BitmapLabel
id=
"numLabel"
y=
"33"
font=
"hbGameNumFont_fnt"
text=
"0"
horizontalCenter=
"0"
/>
...
...
egret/src/panels/HongbaoRain/HbGame.ts
View file @
f5ae3805
import
Panel
from
"../../../libs/new_wx/components/Panel"
;
import
Panel
from
"../../../libs/new_wx/components/Panel"
;
import
RainMgr
from
"./RainMgr"
;
import
CutTimer
from
"../../CutTimer"
;
/**
/**
* 红包雨主游戏
* 红包雨主游戏
...
@@ -9,19 +11,22 @@ export default class HbGame extends Panel {
...
@@ -9,19 +11,22 @@ export default class HbGame extends Panel {
public
readyGroup
:
eui
.
Group
;
public
readyGroup
:
eui
.
Group
;
public
readyTips
:
eui
.
Image
;
public
readyTips
:
eui
.
Image
;
public
readyCutTime
:
eui
.
Image
;
public
readyCutTime
:
eui
.
Image
;
public
rainGroup
:
eui
.
Group
;
private
rainMgr
:
RainMgr
=
null
;
private
cutTime
:
CutTimer
=
null
;
constructor
(
data
)
{
constructor
(
data
)
{
super
();
super
();
this
.
data
=
data
;
this
.
data
=
data
;
}
}
start
()
{
onLoad
()
{
super
.
start
();
this
.
initUI
();
this
.
initUI
();
}
}
initUI
()
{
initUI
()
{
this
.
rainGroup
.
height
=
this
.
width
/
window
.
innerWidth
*
window
.
innerHeight
;
}
}
private
readyTimeEffect
()
{
private
readyTimeEffect
()
{
...
@@ -43,6 +48,7 @@ export default class HbGame extends Panel {
...
@@ -43,6 +48,7 @@ export default class HbGame extends Panel {
egret
.
Tween
.
get
(
obj
).
to
({
scaleX
:
1
,
scaleY
:
1
,
alpha
:
1
},
t1
,
_ease
).
wait
(
tw
).
call
(()
=>
{
egret
.
Tween
.
get
(
obj
).
to
({
scaleX
:
1
,
scaleY
:
1
,
alpha
:
1
},
t1
,
_ease
).
wait
(
tw
).
call
(()
=>
{
egret
.
Tween
.
get
(
obj
).
to
({
scaleX
:
_scaleMax
,
scaleY
:
_scaleMax
,
alpha
:
0.1
},
t2
).
call
(()
=>
{
egret
.
Tween
.
get
(
obj
).
to
({
scaleX
:
_scaleMax
,
scaleY
:
_scaleMax
,
alpha
:
0.1
},
t2
).
call
(()
=>
{
this
.
readyGroup
.
visible
=
false
;
this
.
readyGroup
.
visible
=
false
;
this
.
startGame
();
})
})
});
});
})
})
...
@@ -51,6 +57,19 @@ export default class HbGame extends Panel {
...
@@ -51,6 +57,19 @@ export default class HbGame extends Panel {
});
});
}
}
private
startGame
()
{
this
.
rainMgr
=
new
RainMgr
({
parent
:
this
,
rainGroup
:
this
.
rainGroup
,
});
this
.
cutTime
=
new
CutTimer
(
this
.
cutTimeLabel
,
'ss'
,
()
=>
this
.
gameOver
());
this
.
cutTime
.
start
(
59
*
1000
);
}
private
gameOver
()
{
}
private
readyTipsEffect
()
{
private
readyTipsEffect
()
{
this
.
readyTips
.
alpha
=
0
;
this
.
readyTips
.
alpha
=
0
;
egret
.
Tween
.
get
(
this
.
readyTips
).
to
({
alpha
:
1
},
300
).
call
(()
=>
this
.
readyTimeEffect
());
egret
.
Tween
.
get
(
this
.
readyTips
).
to
({
alpha
:
1
},
300
).
call
(()
=>
this
.
readyTimeEffect
());
...
@@ -59,6 +78,7 @@ export default class HbGame extends Panel {
...
@@ -59,6 +78,7 @@ export default class HbGame extends Panel {
protected
onSkinComplete
()
{
protected
onSkinComplete
()
{
this
.
readyGroup
.
visible
=
false
;
this
.
readyGroup
.
visible
=
false
;
setTimeout
(()
=>
this
.
readyTipsEffect
(),
1000
);
setTimeout
(()
=>
this
.
readyTipsEffect
(),
1000
);
this
.
onLoad
();
}
}
initEvents
()
{
initEvents
()
{
...
...
egret/src/panels/HongbaoRain/RainMgr.ts
View file @
f5ae3805
import
RainObj
from
"./RainObj"
;
import
RainData
from
"./RainData"
;
export
default
class
RainMgr
{
export
default
class
RainMgr
{
private
data
;
private
data
;
private
parent
;
private
parent
;
...
@@ -8,6 +11,15 @@ export default class RainMgr {
...
@@ -8,6 +11,15 @@ export default class RainMgr {
this
.
parent
=
this
.
data
.
parent
;
this
.
parent
=
this
.
data
.
parent
;
this
.
rainGroup
=
this
.
data
.
rainGroup
;
this
.
rainGroup
=
this
.
data
.
rainGroup
;
this
.
start
();
}
private
start
(){
let
s
=
new
RainObj
({
key
:
RainData
.
key
[
~~
(
Math
.
random
()
*
RainData
.
key
.
length
)],
scale
:
1
,
rainGroup
:
this
.
rainGroup
,
});
}
}
...
...
egret/src/panels/HongbaoRain/RainObj.ts
View file @
f5ae3805
...
@@ -2,17 +2,26 @@ export default class RainObj {
...
@@ -2,17 +2,26 @@ export default class RainObj {
private
data
=
null
;
private
data
=
null
;
private
module
:
eui
.
Image
=
null
;
private
module
:
eui
.
Image
=
null
;
private
rainGroup
=
null
;
constructor
(
data
)
{
constructor
(
data
)
{
this
.
data
=
data
;
this
.
data
=
data
;
this
.
module
.
source
=
`hbGame_
${
this
.
data
.
key
}
_png`
;
console
.
log
(
this
.
data
);
this
.
module
=
new
eui
.
Image
(
`hbGame_
${
this
.
data
.
key
}
_png`
);
this
.
module
.
scaleX
=
this
.
module
.
scaleY
=
this
.
data
.
scale
;
this
.
module
.
scaleX
=
this
.
module
.
scaleY
=
this
.
data
.
scale
;
this
.
rainGroup
=
this
.
data
.
rainGroup
;
this
.
module
.
x
=
100
;
this
.
module
.
y
=
-
100
;
this
.
rainGroup
.
addChild
(
this
.
module
);
this
.
start
();
this
.
start
();
}
}
private
start
()
{
private
start
()
{
this
.
module
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
touchTap
,
this
);
this
.
module
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
touchTap
,
this
);
egret
.
Tween
.
get
(
this
.
module
).
to
({
rotation
:
360
,
loop
:
true
},
20000
);
egret
.
Tween
.
get
(
this
.
module
,
{
loop
:
true
}).
to
({
rotation
:
~~
(
Math
.
random
()
*
2
)
?
360
:
-
360
},
18000
);
egret
.
Tween
.
get
(
this
.
module
).
to
({
y
:
this
.
rainGroup
.
height
},
10000
).
call
(()
=>
this
.
destroy
());
}
}
private
touchTap
()
{
private
touchTap
()
{
...
@@ -21,8 +30,11 @@ export default class RainObj {
...
@@ -21,8 +30,11 @@ export default class RainObj {
}
}
private
destroy
()
{
private
destroy
()
{
this
.
module
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
touchTap
,
this
);
egret
.
Tween
.
removeTweens
(
this
.
module
);
egret
.
Tween
.
removeTweens
(
this
.
module
);
this
.
module
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
touchTap
,
this
);
this
.
module
.
source
=
`hbGame_
${
this
.
data
.
key
}
_touch_png`
;
setTimeout
(()
=>
{
this
.
rainGroup
.
removeChild
(
this
.
module
);
},
1000
);
}
}
}
}
\ No newline at end of file
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