Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wfc13
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
wfc13
Commits
fd873286
Commit
fd873286
authored
Aug 13, 2021
by
shunx 马
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
3a570370
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
44 deletions
+53
-44
BoxGroup.ts
project/src/scenes/BoxGroup.ts
+47
-44
IndexScene.ts
project/src/scenes/IndexScene.ts
+6
-0
No files found.
project/src/scenes/BoxGroup.ts
View file @
fd873286
...
...
@@ -13,67 +13,70 @@ let boxGroupUpRight = [];
export
class
BoxGroup
extends
FYGE
.
Sprite
{
constructor
()
{
super
();
this
.
initBox
();
super
();
this
.
initBox
();
}
initBox
()
{
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
let
box
=
new
Box
();
box
.
position
.
set
(
40
,
0
+
i
*
238
);
box
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
handleClick
,
this
);
box
.
position
.
set
(
40
,
0
+
i
*
238
);
box
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
handleClick
,
this
);
this
.
addChild
(
box
);
boxGroupUpLeft
.
push
(
box
);
}
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
let
box
=
new
Box
();
box
.
position
.
set
(
230
,
0
+
i
*
238
);
box
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
handleClick
,
this
);
this
.
addChild
(
box
);
boxGroupDown
.
push
(
box
);
let
box
=
new
Box
();
box
.
position
.
set
(
230
,
0
+
i
*
238
);
box
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
handleClick
,
this
);
this
.
addChild
(
box
);
boxGroupDown
.
push
(
box
);
}
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
let
box
=
new
Box
();
box
.
position
.
set
(
427
,
0
+
i
*
238
);
box
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
handleClick
,
this
);
this
.
addChild
(
box
);
boxGroupUpRight
.
push
(
box
);
}
let
box
=
new
Box
();
box
.
position
.
set
(
427
,
0
+
i
*
238
);
box
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
handleClick
,
this
);
this
.
addChild
(
box
);
boxGroupUpRight
.
push
(
box
);
}
}
move
()
{
const
speed
=
2
;
boxGroupUpLeft
.
forEach
(
i
=>
{
i
.
y
-=
speed
;
})
if
(
boxGroupUpLeft
[
0
].
y
<
-
238
)
{
boxGroupUpLeft
[
0
].
y
=
238
*
3
;
const
popBox
=
boxGroupUpLeft
.
shift
();
boxGroupUpLeft
.
push
(
popBox
);
const
speed
=
2
;
boxGroupUpLeft
.
forEach
(
i
=>
{
i
.
y
-=
speed
;
})
if
(
boxGroupUpLeft
[
0
].
y
<
-
238
)
{
boxGroupUpLeft
[
0
].
y
=
238
*
3
;
const
popBox
=
boxGroupUpLeft
.
shift
();
boxGroupUpLeft
.
push
(
popBox
);
}
boxGroupDown
.
forEach
(
i
=>
{
i
.
y
+=
speed
;
if
(
i
.
y
>=
623
)
{
i
.
y
-=
boxGroupDown
.
length
*
238
;
}
boxGroupDown
.
forEach
(
i
=>
{
i
.
y
+=
speed
;
if
(
i
.
y
>=
623
)
{
i
.
y
-=
boxGroupDown
.
length
*
238
;
}
})
boxGroupUpRight
.
forEach
(
i
=>
{
i
.
y
-=
speed
;
})
if
(
boxGroupUpRight
[
0
].
y
<
-
238
)
{
boxGroupUpRight
[
0
].
y
=
238
*
3
;
const
popBox
=
boxGroupUpRight
.
shift
();
boxGroupUpRight
.
push
(
popBox
);
boxGroupUpRight
.
forEach
(
i
=>
{
i
.
y
-=
speed
;
})
if
(
boxGroupUpRight
[
0
].
y
<
-
238
)
{
boxGroupUpRight
[
0
].
y
=
238
*
3
;
const
popBox
=
boxGroupUpRight
.
shift
();
boxGroupUpRight
.
push
(
popBox
);
}
}
handleClick
()
{
// const indexsvga = new FYGE.MovieClip(RES.getRes('盲盒开启-打开-输出.svga'));
// indexsvga.mouseChildren = indexsvga.mouseEnable = false;
// // indexsvga.position.set(100,100)
// this.addChild(indexsvga);
showPanel
(
CostPanel
);
}
handleClick
(
e
)
{
const
indexsvga
=
new
FYGE
.
MovieClip
(
RES
.
getRes
(
'盲盒选中-输出.svga'
));
this
.
dispatchEvent
(
"stopIndexEnterFrame"
,
{
isMove
:
false
});
indexsvga
.
mouseChildren
=
indexsvga
.
mouseEnable
=
false
;
indexsvga
.
position
.
set
(
e
.
target
.
x
-
200
,
e
.
target
.
y
-
190
)
this
.
addChild
(
indexsvga
);
indexsvga
.
startAniRange
(
1
,
indexsvga
.
totalFrames
,
1
,
()
=>
{
showPanel
(
CostPanel
);
});
}
}
project/src/scenes/IndexScene.ts
View file @
fd873286
...
...
@@ -70,12 +70,18 @@ export class IndexScene extends Scene {
onEnterFrame
()
{
boxGroup
&&
boxGroup
.
move
();
boxGroup
.
addEventListener
(
"stopIndexEnterFrame"
,
this
.
removeEvent
,
this
);
}
toRule
()
{
showPanel
(
RulePanel
);
}
removeEvent
()
{
this
.
removeEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
}
getIndex
=
async
()
=>
{
const
result
=
await
sendWebNet
(
WebNetName
.
projectIndex
);
if
(
!
result
.
success
)
return
;
...
...
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