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
64c0275d
Commit
64c0275d
authored
Nov 07, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
38469926
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
9 deletions
+70
-9
index.html
egret/index.html
+1
-1
HbGameSkin.exml
egret/resource/skins/HbGameSkin.exml
+3
-3
HbGame.ts
egret/src/panels/HongbaoRain/HbGame.ts
+61
-1
RainObj.ts
egret/src/panels/HongbaoRain/RainObj.ts
+5
-4
No files found.
egret/index.html
View file @
64c0275d
...
...
@@ -60,7 +60,7 @@
<script
src=
"libs/fileSave.js"
></script>
<img
id=
"pic"
style=
"width:100%;position: absolute;z-index: 999;display: none;"
/>
<script>
window
[
'hbRainTime'
]
=
3
0
;
window
[
'hbRainTime'
]
=
1
0
;
window
[
'plugs'
]
=
[
1
,
2
,
3
]
// localStorage.clear();
window
[
'isInvitePage'
]
=
0
;
...
...
egret/resource/skins/HbGameSkin.exml
View file @
64c0275d
...
...
@@ -6,10 +6,10 @@
<e:Image
y=
"0"
source=
"hbGame_num_bg_png"
horizontalCenter=
"0"
/>
<e:BitmapLabel
id=
"scoreLabel"
y=
"33"
text=
"0"
horizontalCenter=
"0"
font=
"hbGameScoreFont_fnt"
/>
</e:Group>
<e:Group
y=
"45"
horizontalCenter=
"0"
height=
"154"
>
<e:Group
id=
"cutTimerGroup"
y=
"45"
horizontalCenter=
"0"
height=
"154"
>
<e:Image
id=
"timeBtn"
y=
"0"
horizontalCenter=
"0"
x=
"10"
source=
"hbGame_CutTime_btn_png"
/>
<e:Image
y=
"25"
horizontalCenter=
"0"
source=
"hbGame_CutTime_bg_png"
/>
<e:Image
y=
"32"
source=
"hbGame_CutTime_progress_png"
horizontalCenter=
"-0.5"
/>
<e:Image
id=
"cutCircle"
y=
"32"
source=
"hbGame_CutTime_progress_png"
horizontalCenter=
"-0.5"
/>
<e:BitmapLabel
id=
"cutTimeLabel"
y=
"67"
text=
"60"
font=
"hbGameCutTimeFont_fnt"
horizontalCenter=
"0.5"
/>
</e:Group>
<e:Group
id=
"readyGroup"
y=
"310.5"
horizontalCenter=
"0"
width=
"560"
height=
"710"
anchorOffsetY=
"0"
>
...
...
@@ -17,6 +17,6 @@
<e:Label
text=
"点击所有动物均可累积双份红包"
y=
"520"
fontFamily=
"FZY3JW"
horizontalCenter=
"0"
/>
<e:Image
y=
"566"
source=
"hbGame_lion_touch_png"
horizontalCenter=
"-37.5"
/>
<e:Image
y=
"597"
source=
"hbGame_+2_png"
horizontalCenter=
"82"
/>
<e:Image
id=
"readyCutTime"
y=
"
95
"
horizontalCenter=
"0"
x=
"10"
source=
"hbGame_1_png"
/>
<e:Image
id=
"readyCutTime"
y=
"
121
"
horizontalCenter=
"0"
x=
"10"
source=
"hbGame_1_png"
/>
</e:Group>
</e:Skin>
\ No newline at end of file
egret/src/panels/HongbaoRain/HbGame.ts
View file @
64c0275d
...
...
@@ -8,6 +8,8 @@ import { NetName } from "../../../libs/tw/enum/NetName";
import
PanelCtrl
from
"../../../libs/new_wx/ctrls/panelCtrl"
;
import
SceneCtrl
from
"../../../libs/new_wx/ctrls/sceneCtrl"
;
import
Utils
from
"../../Utils"
;
import
Shape
=
egret
.
Shape
;
import
nrABIVersion
=
egret_native
.
nrABIVersion
;
/**
* 红包雨主游戏
...
...
@@ -16,7 +18,9 @@ export default class HbGame extends Panel {
public
rainGroup
:
eui
.
Group
;
public
scoreGroup
:
eui
.
Group
;
public
scoreLabel
:
eui
.
BitmapLabel
;
public
cutTimerGroup
:
eui
.
Group
;
public
timeBtn
:
eui
.
Image
;
public
cutCircle
:
eui
.
Image
;
public
cutTimeLabel
:
eui
.
BitmapLabel
;
public
readyGroup
:
eui
.
Group
;
public
tipLabel
:
eui
.
Label
;
...
...
@@ -26,10 +30,13 @@ export default class HbGame extends Panel {
private
cutTime
:
egret
.
Timer
=
null
;
private
time
:
number
=
window
[
'hbRainTime'
];
private
totalTime
:
number
=
window
[
'hbRainTime'
];
private
score
=
0
;
private
scoreLabelStr
=
0
;
private
cutShape
:
egret
.
Shape
;
constructor
(
data
)
{
super
();
this
.
data
=
data
;
...
...
@@ -45,7 +52,14 @@ export default class HbGame extends Panel {
this
.
rainGroup
.
height
=
this
.
width
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
tipLabel
.
textFlow
=
(
new
HtmlTextParser
).
parser
(
`抢到<b>
${
this
.
data
.
needScore
}
</b>个红包才有奖励哦~`
);
this
.
cutTimeLabel
.
text
=
`
${
this
.
time
}
`
this
.
cutTimeLabel
.
text
=
`
${
this
.
time
}
`
;
this
.
cutShape
=
new
egret
.
Shape
();
this
.
cutShape
.
graphics
.
beginFill
(
0xff0000
);
this
.
cutShape
.
graphics
.
drawArc
(
63
,
90
,
60
,
-
Math
.
PI
/
180
*
90
,
Math
.
PI
/
180
*
270
,
true
);
this
.
cutShape
.
graphics
.
endFill
();
this
.
cutTimerGroup
.
addChild
(
this
.
cutShape
);
this
.
cutCircle
.
mask
=
this
.
cutShape
;
}
// 加分
...
...
@@ -134,6 +148,46 @@ export default class HbGame extends Panel {
this
.
cutTime
=
new
egret
.
Timer
(
1000
,
0
);
this
.
cutTime
.
addEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
timeCallFun
,
this
);
this
.
cutTime
.
start
();
this
.
getSectorProgress
();
}
private
getSectorProgress
():
egret
.
Shape
{
let
shape
=
this
.
cutShape
;
let
angle
:
number
=
360
;
let
cTime
:
number
=
0
;
let
totalTime
:
number
=
this
.
totalTime
;
let
lastT
=
new
Date
().
getTime
();
let
dt
=
0
;
egret
.
startTick
(
function
(
timeStamp
:
number
):
boolean
{
dt
=
(
new
Date
().
getTime
()
-
lastT
)
/
1000
;
cTime
+=
dt
;
if
(
cTime
>
totalTime
){
cTime
=
0
;
}
angle
=
360
*
cTime
/
totalTime
;
changeGraphics
(
angle
);
angle
=
angle
%
360
;
lastT
=
new
Date
().
getTime
();
return
true
;
},
this
);
return
shape
;
function
changeGraphics
(
angle
)
{
angle
-=
90
;
shape
.
graphics
.
clear
();
shape
.
graphics
.
beginFill
(
0xff0000
);
shape
.
graphics
.
moveTo
(
63
,
90
);
shape
.
graphics
.
lineTo
(
100
,
50
);
shape
.
graphics
.
drawArc
(
63
,
90
,
60
,
-
Math
.
PI
/
180
*
90
,
angle
*
Math
.
PI
/
180
,
true
);
shape
.
graphics
.
lineTo
(
63
,
90
);
shape
.
graphics
.
endFill
();
}
}
private
timeCallFun
()
{
...
...
@@ -141,6 +195,12 @@ export default class HbGame extends Panel {
if
(
this
.
time
<=
0
)
{
this
.
gameOver
();
}
if
(
this
.
time
==
3
)
{
let
_y
=
this
.
cutTimerGroup
.
y
;
egret
.
Tween
.
get
(
this
.
cutTimerGroup
,
{
loop
:
true
}).
to
({
y
:
_y
+
10
},
100
).
call
(()
=>
{
egret
.
Tween
.
get
(
this
.
cutTimerGroup
).
to
({
y
:
_y
},
100
);
})
}
}
private
readyTimeEffect
()
{
...
...
egret/src/panels/HongbaoRain/RainObj.ts
View file @
64c0275d
...
...
@@ -2,7 +2,6 @@ import { GDispatcher } from "../../../libs/tc/util/GDispatcher";
import
RainData
from
"./RainData"
;
import
{
loadSvga
}
from
"../../loadSvga"
;
import
getResPath
from
"../../../libs/new_tc/getResPath"
;
import
PanelCtrl
from
"../../../libs/new_wx/ctrls/panelCtrl"
;
export
default
class
RainObj
{
private
data
=
null
;
...
...
@@ -50,14 +49,15 @@ export default class RainObj {
let
_scaleY
=
this
.
module
.
scaleY
;
egret
.
Tween
.
get
(
this
.
module
).
to
({
scaleX
:
_scaleX
+
0.2
,
scaleY
:
_scaleY
+
0.2
},
100
).
call
(()
=>
{
this
.
module
.
source
=
`hbGame_
${
this
.
data
.
key
}
_touch_png`
;
egret
.
Tween
.
get
(
this
.
module
).
to
({
scaleX
:
_scaleX
,
scaleY
:
_scaleY
},
100
).
call
(()
=>
{
if
(
this
.
data
.
key
==
'hongbao'
){
egret
.
Tween
.
get
(
this
.
module
).
to
({
scaleX
:
_scaleX
,
scaleY
:
_scaleY
},
100
).
call
(()
=>
{
if
(
this
.
data
.
key
==
'hongbao'
)
{
loadSvga
(
getResPath
()
+
'resource/assets/svgas/hbRainHb.svga'
,
this
.
rainGroup
).
then
(
async
(
mv
:
any
)
=>
{
mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
()
=>
{
this
.
rainGroup
.
removeChild
(
mv
);
},
this
);
mv
.
x
=
this
.
module
.
x
-
180
*
this
.
module
.
scaleX
;
mv
.
y
=
this
.
module
.
y
-
250
*
this
.
module
.
scaleY
;
mv
.
touchEnable
=
false
;
mv
.
scaleX
=
this
.
module
.
scaleX
;
mv
.
scaleY
=
this
.
module
.
scaleY
;
this
.
rainGroup
.
addChild
(
mv
);
...
...
@@ -70,6 +70,7 @@ export default class RainObj {
// 添加分数特效
private
addScoreEffect
()
{
let
timeout
=
(
this
.
data
.
key
==
'hongbao'
)
?
500
:
300
;
setTimeout
(()
=>
{
let
score
=
new
eui
.
Image
(
`hbGame_+
${
RainData
.
data
[
this
.
data
.
key
].
score
}
_png`
);
let
_x
=
score
.
x
=
this
.
module
.
x
-
20
;
...
...
@@ -82,7 +83,7 @@ export default class RainObj {
score
.
visible
=
false
});
});
},
500
);
},
timeout
);
}
private
destroy
()
{
...
...
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