Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
38c5f54d
Commit
38c5f54d
authored
Feb 19, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
771d7e29
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
20 deletions
+85
-20
.DS_Store
egret/.DS_Store
+0
-0
Effect.ts
egret/src/Effect.ts
+62
-11
PlayScene.ts
egret/src/playScene/PlayScene.ts
+3
-1
createCircle.ts
egret/src/playScene/factory/createCircle.ts
+2
-1
createRegTriangle.ts
egret/src/playScene/factory/createRegTriangle.ts
+5
-4
createSquare.ts
egret/src/playScene/factory/createSquare.ts
+4
-3
StartScene.ts
egret/src/startScene/StartScene.ts
+9
-0
No files found.
egret/.DS_Store
View file @
38c5f54d
No preview for this file type
egret/src/Effect.ts
View file @
38c5f54d
import
Body
from
"./playScene/physics/Body"
;
export
default
class
Effect
extends
egret
.
Sprite
{
import
{
sqrt3
}
from
"./playScene/physics/Const"
;
export
default
class
Effect
{
NUMS_MAX
=
11
;
NUMS_MAX
=
11
;
start
(
type
)
{
_parent
:
egret
.
DisplayObjectContainer
;
constructor
(
block
:
Body
,
parent
:
egret
.
DisplayObjectContainer
)
{
const
resName
=
block
.
view
[
'bg'
][
'__resName__'
]
for
(
let
i
=
0
;
i
<
this
.
NUMS_MAX
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
NUMS_MAX
;
i
++
)
{
const
data
=
this
.
createItem
(
1
);
const
data
=
this
.
createItem
(
resName
);
this
.
addChild
(
data
.
shape
);
parent
.
addChild
(
data
.
shape
);
egret
.
Tween
.
get
(
data
).
to
({},
360
);
data
.
shape
.
x
=
block
.
x
;
data
.
shape
.
y
=
block
.
y
;
egret
.
Tween
.
get
(
data
.
shape
).
to
({
x
:
data
.
targetX
+
block
.
x
,
y
:
block
.
y
+
data
.
targetY
,
scaleY
:
0
,
scaleX
:
0
},
360
).
call
(()
=>
{
data
.
shape
.
parent
&&
data
.
shape
.
parent
.
removeChild
(
data
.
shape
);
});
}
}
}
}
createItem
(
type
)
{
createItem
(
resName
:
string
)
{
const
moveDisMax
=
100
;
const
moveDisMax
=
100
;
const
squareSize
=
100
;
const
squareSize
=
100
;
const
shape
=
new
egret
.
Shape
();
const
shape
=
new
egret
.
Shape
();
shape
.
graphics
.
beginFill
(
0xff0000
);
const
shapeType
=
this
.
getShapeType
(
resName
);
shape
.
graphics
.
drawRect
(
-
squareSize
/
2
,
-
squareSize
/
2
,
squareSize
,
squareSize
);
if
(
shapeType
==
'circle'
)
{
shape
.
graphics
.
endFill
();
shape
.
graphics
.
beginFill
(
this
.
getShapeColor
(
resName
));
shape
.
graphics
.
drawCircle
(
0
,
0
,
squareSize
/
2
);
shape
.
graphics
.
endFill
();
}
else
if
(
shapeType
==
'tri'
)
{
shape
.
graphics
.
beginFill
(
this
.
getShapeColor
(
resName
));
shape
.
graphics
.
moveTo
(
0
,
-
squareSize
*
sqrt3
/
3
);
shape
.
graphics
.
lineTo
(
squareSize
/
2
,
squareSize
*
sqrt3
/
6
);
shape
.
graphics
.
lineTo
(
-
squareSize
/
2
,
squareSize
*
sqrt3
/
6
);
shape
.
graphics
.
endFill
();
}
else
if
(
shapeType
==
'sq'
)
{
shape
.
graphics
.
beginFill
(
this
.
getShapeColor
(
resName
));
shape
.
graphics
.
drawRect
(
-
squareSize
/
2
,
-
squareSize
/
2
,
squareSize
,
squareSize
);
shape
.
graphics
.
endFill
();
}
const
scale
=
Math
.
random
()
*
0.7
+
0.3
;
const
scale
=
Math
.
random
()
*
0.7
+
0.3
;
const
rotation
=
Math
.
random
()
*
360
;
const
rotation
=
Math
.
random
()
*
360
;
const
angle
=
Math
.
random
()
*
Math
.
PI
*
2
;
const
angle
=
Math
.
random
()
*
Math
.
PI
*
2
;
...
@@ -23,6 +44,36 @@ export default class Effect extends egret.Sprite {
...
@@ -23,6 +44,36 @@ export default class Effect extends egret.Sprite {
const
targetX
=
Math
.
sin
(
angle
)
*
dis
;
const
targetX
=
Math
.
sin
(
angle
)
*
dis
;
const
targetY
=
Math
.
cos
(
angle
)
*
dis
;
const
targetY
=
Math
.
cos
(
angle
)
*
dis
;
shape
.
scaleX
=
shape
.
scaleY
=
scale
;
shape
.
scaleX
=
shape
.
scaleY
=
scale
;
return
{
shape
:
shape
};
shape
.
rotation
=
rotation
;
return
{
shape
:
shape
,
targetX
:
targetX
,
targetY
:
targetY
};
}
getShapeType
(
resName
:
string
)
{
if
(
resName
==
'circle1_png'
)
return
'circle'
;
if
(
resName
.
indexOf
(
'tri'
)
>
-
1
)
return
'tri'
;
if
(
resName
.
indexOf
(
'sq'
)
>
-
1
)
return
'sq'
;
return
'circle'
}
getShapeColor
(
resName
:
string
)
{
if
(
resName
==
'circle1_png'
)
return
0xffca55
;
if
(
resName
==
'sq1_png'
)
return
0xfa7782
;
if
(
resName
==
'sq2_png'
)
return
0xf677ce
;
if
(
resName
==
'sq3_png'
)
return
0xffac84
;
if
(
resName
==
'sq4_png'
)
return
0xffca55
;
if
(
resName
==
'tri1_png'
)
return
0x2db0ee
;
if
(
resName
==
'tri2_png'
)
return
0x86e45f
;
return
0xffca55
}
}
}
}
\ No newline at end of file
egret/src/playScene/PlayScene.ts
View file @
38c5f54d
...
@@ -22,6 +22,7 @@ import { isSpecialBody, getLadderPosition, getLadderHPosition, getBounce, isSpec
...
@@ -22,6 +22,7 @@ import { isSpecialBody, getLadderPosition, getLadderHPosition, getBounce, isSpec
import
{
getBlocks
,
resetCounter
,
getCounter
}
from
"./blockGen"
;
import
{
getBlocks
,
resetCounter
,
getCounter
}
from
"./blockGen"
;
import
createSpeialCircle
from
"./factory/createSpeialCircle"
;
import
createSpeialCircle
from
"./factory/createSpeialCircle"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
Effect
from
"../Effect"
;
export
default
class
PlayScene
extends
Scene
{
export
default
class
PlayScene
extends
Scene
{
initEvents
()
{
initEvents
()
{
...
@@ -271,6 +272,7 @@ export default class PlayScene extends Scene {
...
@@ -271,6 +272,7 @@ export default class PlayScene extends Scene {
this
.
data
.
score
++
;
this
.
data
.
score
++
;
block
.
num
=
block
.
num
-
1
;
block
.
num
=
block
.
num
-
1
;
if
(
block
.
num
<=
0
)
{
if
(
block
.
num
<=
0
)
{
new
Effect
(
block
,
this
);
//回收加动效
//回收加动效
this
.
removeEle
(
block
,
this
.
blocks
);
this
.
removeEle
(
block
,
this
.
blocks
);
this
.
removeChild
(
block
.
view
);
this
.
removeChild
(
block
.
view
);
...
@@ -403,7 +405,7 @@ export default class PlayScene extends Scene {
...
@@ -403,7 +405,7 @@ export default class PlayScene extends Scene {
blocks
.
forEach
(
block
=>
{
blocks
.
forEach
(
block
=>
{
console
.
log
(
'ladderNums'
,
block
.
ladderNums
)
console
.
log
(
'ladderNums'
,
block
.
ladderNums
)
// if (block.ladderNums >= 1) {
// if (block.ladderNums >= 1) {
if
(
block
.
ladderNums
>=
9
)
{
if
(
block
.
ladderNums
>=
9
)
{
failed
=
true
;
failed
=
true
;
}
}
});
});
...
...
egret/src/playScene/factory/createCircle.ts
View file @
38c5f54d
...
@@ -9,6 +9,7 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -9,6 +9,7 @@ export default (that: PlayScene, x, y, num) => {
sprite
.
touchEnabled
=
sprite
.
touchChildren
=
false
;
sprite
.
touchEnabled
=
sprite
.
touchChildren
=
false
;
//背景
//背景
const
shape
=
new
egret
.
Bitmap
(
RES
.
getRes
(
'circle1_png'
));
const
shape
=
new
egret
.
Bitmap
(
RES
.
getRes
(
'circle1_png'
));
shape
[
'__resName__'
]
=
'circle1_png'
;
const
radius
=
shape
.
width
/
2
;
const
radius
=
shape
.
width
/
2
;
const
length
=
radius
*
2
;
const
length
=
radius
*
2
;
shape
.
anchorOffsetX
=
shape
.
width
/
2
;
shape
.
anchorOffsetX
=
shape
.
width
/
2
;
...
@@ -35,5 +36,5 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -35,5 +36,5 @@ export default (that: PlayScene, x, y, num) => {
block
.
y
=
y
;
block
.
y
=
y
;
block
.
num
=
num
;
block
.
num
=
num
;
that
.
blocks
.
push
(
block
);
that
.
blocks
.
push
(
block
);
block
.
ladderNums
=
1
;
block
.
ladderNums
=
1
;
}
}
\ No newline at end of file
egret/src/playScene/factory/createRegTriangle.ts
View file @
38c5f54d
...
@@ -6,7 +6,7 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -6,7 +6,7 @@ export default (that: PlayScene, x, y, num) => {
const
picType
=
Math
.
ceil
(
Math
.
random
()
*
2
);
const
picType
=
Math
.
ceil
(
Math
.
random
()
*
2
);
const
pic
=
new
egret
.
Bitmap
(
RES
.
getRes
(
`tri
${
picType
}
_png`
));
const
pic
=
new
egret
.
Bitmap
(
RES
.
getRes
(
`tri
${
picType
}
_png`
));
pic
.
anchorOffsetX
=
pic
.
width
/
2
;
pic
.
anchorOffsetX
=
pic
.
width
/
2
;
pic
.
anchorOffsetY
=
pic
.
height
*
.
65
;
pic
.
anchorOffsetY
=
pic
.
height
*
.
65
;
if
(
!
block
)
{
if
(
!
block
)
{
const
sprite
=
new
egret
.
Sprite
();
const
sprite
=
new
egret
.
Sprite
();
sprite
.
touchEnabled
=
sprite
.
touchChildren
=
false
;
sprite
.
touchEnabled
=
sprite
.
touchChildren
=
false
;
...
@@ -19,7 +19,7 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -19,7 +19,7 @@ export default (that: PlayScene, x, y, num) => {
txt
.
width
=
length
;
txt
.
width
=
length
;
txt
.
height
=
length
;
txt
.
height
=
length
;
txt
.
anchorOffsetX
=
length
/
2
;
txt
.
anchorOffsetX
=
length
/
2
;
txt
.
anchorOffsetY
=
length
/
2
;
txt
.
anchorOffsetY
=
length
/
2
;
txt
.
size
=
26
;
txt
.
size
=
26
;
txt
.
textColor
=
0xffffff
;
txt
.
textColor
=
0xffffff
;
txt
.
textAlign
=
egret
.
HorizontalAlign
.
CENTER
;
txt
.
textAlign
=
egret
.
HorizontalAlign
.
CENTER
;
...
@@ -35,11 +35,12 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -35,11 +35,12 @@ export default (that: PlayScene, x, y, num) => {
block
.
view
.
addChild
(
block
.
view
[
'txt'
]);
block
.
view
.
addChild
(
block
.
view
[
'txt'
]);
}
}
}
}
block
.
view
[
"bg"
][
'__resName__'
]
=
`tri
${
picType
}
_png`
;
that
.
addChild
(
block
.
view
)
that
.
addChild
(
block
.
view
)
block
.
x
=
x
;
block
.
x
=
x
;
block
.
y
=
y
;
block
.
y
=
y
;
block
.
rotation
=
Math
.
random
()
*
360
;
block
.
rotation
=
Math
.
random
()
*
360
;
block
.
num
=
num
;
block
.
num
=
num
;
that
.
blocks
.
push
(
block
);
that
.
blocks
.
push
(
block
);
block
.
ladderNums
=
1
;
block
.
ladderNums
=
1
;
}
}
\ No newline at end of file
egret/src/playScene/factory/createSquare.ts
View file @
38c5f54d
...
@@ -6,7 +6,7 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -6,7 +6,7 @@ export default (that: PlayScene, x, y, num) => {
const
pic
=
new
egret
.
Bitmap
(
RES
.
getRes
(
`sq
${
picType
}
_png`
));
const
pic
=
new
egret
.
Bitmap
(
RES
.
getRes
(
`sq
${
picType
}
_png`
));
pic
.
anchorOffsetX
=
pic
.
width
/
2
;
pic
.
anchorOffsetX
=
pic
.
width
/
2
;
pic
.
anchorOffsetY
=
pic
.
height
/
2
;
pic
.
anchorOffsetY
=
pic
.
height
/
2
;
let
block
:
Square
=
that
.
pool
.
takeOut
(
"square"
);
let
block
:
Square
=
that
.
pool
.
takeOut
(
"square"
);
if
(
!
block
)
{
if
(
!
block
)
{
const
sprite
=
new
egret
.
Sprite
();
const
sprite
=
new
egret
.
Sprite
();
sprite
.
touchEnabled
=
sprite
.
touchChildren
=
false
;
sprite
.
touchEnabled
=
sprite
.
touchChildren
=
false
;
...
@@ -38,12 +38,13 @@ export default (that: PlayScene, x, y, num) => {
...
@@ -38,12 +38,13 @@ export default (that: PlayScene, x, y, num) => {
block
.
view
.
addChild
(
block
.
view
[
'txt'
]);
block
.
view
.
addChild
(
block
.
view
[
'txt'
]);
}
}
}
}
block
.
view
[
"bg"
][
'__resName__'
]
=
`sq
${
picType
}
_png`
;
that
.
addChild
(
block
.
view
)
that
.
addChild
(
block
.
view
)
block
.
x
=
x
;
block
.
x
=
x
;
block
.
y
=
y
;
block
.
y
=
y
;
block
.
num
=
num
;
block
.
num
=
num
;
block
.
rotation
=
Math
.
random
()
*
360
;
block
.
rotation
=
Math
.
random
()
*
360
;
// block.rotation = Math.random()>0.5 ? 0 : 45;
// block.rotation = Math.random()>0.5 ? 0 : 45;
that
.
blocks
.
push
(
block
);
that
.
blocks
.
push
(
block
);
block
.
ladderNums
=
1
;
block
.
ladderNums
=
1
;
}
}
\ No newline at end of file
egret/src/startScene/StartScene.ts
View file @
38c5f54d
...
@@ -9,6 +9,7 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
...
@@ -9,6 +9,7 @@ import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import
{
ModuleTypes
}
from
"../../libs/new_wx/types/sceneTypes"
;
import
{
ModuleTypes
}
from
"../../libs/new_wx/types/sceneTypes"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
Effect
from
"../Effect"
;
export
default
class
StartScene
extends
Scene
{
export
default
class
StartScene
extends
Scene
{
ruleBtn
:
eui
.
Button
;
ruleBtn
:
eui
.
Button
;
...
@@ -34,6 +35,14 @@ export default class StartScene extends Scene {
...
@@ -34,6 +35,14 @@ export default class StartScene extends Scene {
});
});
NetManager
.
ins
.
getPrizeInfo
(()
=>
{
},
window
[
'revivePlugId'
]);
NetManager
.
ins
.
getPrizeInfo
(()
=>
{
},
window
[
'revivePlugId'
]);
// setTimeout(() => {
// const e = new Effect('circle1_png');
// this.addChild(e);
// e.x = 375;
// e.y = 500;
// }, 1000);
}
}
private
updateGetInfoView
()
{
private
updateGetInfoView
()
{
...
...
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