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
fee0effd
Commit
fee0effd
authored
Oct 15, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3f8c001b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
19 deletions
+17
-19
index.html
egret/index.html
+2
-2
MainBase.ts
egret/libs/tl/MainBase.ts
+2
-3
Box.ts
egret/src/startScene/Box.ts
+5
-3
Monkey.ts
egret/src/startScene/Monkey.ts
+0
-2
Net.ts
egret/src/startScene/Net.ts
+1
-1
StartScene.ts
egret/src/startScene/StartScene.ts
+7
-8
No files found.
egret/index.html
View file @
fee0effd
...
@@ -41,11 +41,11 @@
...
@@ -41,11 +41,11 @@
<!-- <script src="default.thm.js"></script> -->
<!-- <script src="default.thm.js"></script> -->
<script
src=
"output.js"
></script>
<script
src=
"output.js"
></script>
<script>
<script>
localStorage
.
clear
();
//
localStorage.clear();
var
__t0__
=
Date
.
now
();
var
__t0__
=
Date
.
now
();
var
__debug__
=
1
;
var
__debug__
=
1
;
var
__monkeyHandSize__
=
30
;
var
__monkeyHandSize__
=
30
;
var
__boxMoveSpeed__
=
1
;
var
__boxMoveSpeed__
=
3
;
var
__BOX_CREATE_INTERVAL__
=
60
*
4
;
var
__BOX_CREATE_INTERVAL__
=
60
*
4
;
var
__boxOpenState__
=
'resource/assets/startScene/openstate.json'
;
var
__boxOpenState__
=
'resource/assets/startScene/openstate.json'
;
var
__boxmap__
=
{
var
__boxmap__
=
{
...
...
egret/libs/tl/MainBase.ts
View file @
fee0effd
...
@@ -37,9 +37,8 @@ export default class MainBase extends eui.UILayer {
...
@@ -37,9 +37,8 @@ export default class MainBase extends eui.UILayer {
//生效情况
//生效情况
//RES.getResByUrl jpg or png类型
//RES.getResByUrl jpg or png类型
//RES.getResAsync('monkey_png')
//RES.getResAsync('monkey_png')
if
(
filename
.
indexOf
(
'png'
)
!=-
1
||
filename
.
indexOf
(
'jpg'
)
!=-
1
)
if
(
filename
.
indexOf
(
'png'
)
!=
-
1
||
filename
.
indexOf
(
'jpg'
)
!=
-
1
)
console
.
log
(
'已经处理:'
,
filename
)
result
=
JSON
.
parse
(
JSON
.
stringify
(
result
));
result
=
JSON
.
parse
(
JSON
.
stringify
(
result
));
// result.url = result.url.replace('.png', '.png?x-oss-process=image/format,webp');
// result.url = result.url.replace('.png', '.png?x-oss-process=image/format,webp');
result
.
url
=
result
.
url
.
replace
(
'.jpg'
,
'.jpg?x-oss-process=image/format,webp'
);
result
.
url
=
result
.
url
.
replace
(
'.jpg'
,
'.jpg?x-oss-process=image/format,webp'
);
}
}
...
...
egret/src/startScene/Box.ts
View file @
fee0effd
...
@@ -82,7 +82,7 @@ export default class Box extends egret.Sprite {
...
@@ -82,7 +82,7 @@ export default class Box extends egret.Sprite {
});
});
}
}
private
_vyStart
=
12
;
private
_vyStart
=
25
;
private
_vy
:
number
;
private
_vy
:
number
;
private
_gy
:
number
;
private
_gy
:
number
;
private
_throwStartVY
:
number
;
private
_throwStartVY
:
number
;
...
@@ -93,14 +93,16 @@ export default class Box extends egret.Sprite {
...
@@ -93,14 +93,16 @@ export default class Box extends egret.Sprite {
const
scale
=
(
this
.
_vyStart
*
this
.
_scaleMax
-
Math
.
abs
(
this
.
_vy
))
/
this
.
_vyStart
;
const
scale
=
(
this
.
_vyStart
*
this
.
_scaleMax
-
Math
.
abs
(
this
.
_vy
))
/
this
.
_vyStart
;
this
.
scaleX
=
this
.
scaleY
=
scale
;
this
.
scaleX
=
this
.
scaleY
=
scale
;
}
}
doThrow
():
any
{
doThrow
():
any
{
this
.
_pic
.
stopAtIdleFrame
();
this
.
_pic
.
stopAtIdleFrame
();
this
.
_throwStartVY
=
this
.
_vy
;
this
.
_throwStartVY
=
this
.
_vy
;
this
.
_vy
=
-
this
.
_vyStart
;
this
.
_vy
=
-
this
.
_vyStart
;
this
.
_gy
=
.
2
;
this
.
_gy
=
.
55
;
this
.
y
=
Box
.
MIDDLE_Y
;
}
}
get
vy
()
{
return
this
.
_vy
}
get
vy
()
{
return
this
.
_vy
}
get
type
()
{
return
this
.
_type
}
get
type
()
{
return
this
.
_type
}
get
boxData
()
{
return
__boxmap__
[
this
.
_type
]
}
get
boxData
()
{
return
__boxmap__
[
this
.
_type
]
}
...
...
egret/src/startScene/Monkey.ts
View file @
fee0effd
import
{
getResPath
}
from
"../utils"
;
export
default
class
Monkey
extends
egret
.
Sprite
{
export
default
class
Monkey
extends
egret
.
Sprite
{
private
h
=
525
;
private
h
=
525
;
private
w
=
265
;
private
w
=
265
;
...
...
egret/src/startScene/Net.ts
View file @
fee0effd
...
@@ -26,7 +26,7 @@ export default class Net extends egret.Sprite {
...
@@ -26,7 +26,7 @@ export default class Net extends egret.Sprite {
let
url
=
getResPath
()
+
`resource/assets/startScene/net.json`
;
let
url
=
getResPath
()
+
`resource/assets/startScene/net.json`
;
RES
.
getResByUrl
(
url
,
(
sheet
:
egret
.
SpriteSheet
)
=>
{
RES
.
getResByUrl
(
url
,
(
sheet
:
egret
.
SpriteSheet
)
=>
{
this
.
_pic
.
sheet
=
sheet
;
this
.
_pic
.
sheet
=
sheet
;
this
.
_pic
.
fps
=
1
0
;
this
.
_pic
.
fps
=
2
0
;
this
.
alpha
=
0
;
this
.
alpha
=
0
;
egret
.
Tween
.
get
(
this
).
to
({
alpha
:
1
},
500
);
egret
.
Tween
.
get
(
this
).
to
({
alpha
:
1
},
500
);
// setInterval(() => {
// setInterval(() => {
...
...
egret/src/startScene/StartScene.ts
View file @
fee0effd
...
@@ -53,11 +53,8 @@ export default class StartScene extends Scene {
...
@@ -53,11 +53,8 @@ export default class StartScene extends Scene {
this
.
_debug
=
new
debug
(
this
.
getLayer
(
LayerTypes
.
top
));
this
.
_debug
=
new
debug
(
this
.
getLayer
(
LayerTypes
.
top
));
}
}
const
model
=
new
GamePlayModel
();
const
model
=
new
GamePlayModel
();
model
.
update
();
model
.
update
();
// box.touchEnabled = true;
// box.touchEnabled = true;
// box.addEventListener(egret.TouchEvent.TOUCH_BEGIN, () => {
// box.addEventListener(egret.TouchEvent.TOUCH_BEGIN, () => {
// NetManager.ins.getInfo(() => {
// NetManager.ins.getInfo(() => {
...
@@ -81,7 +78,7 @@ export default class StartScene extends Scene {
...
@@ -81,7 +78,7 @@ export default class StartScene extends Scene {
private
_catchedBox
:
Box
;
private
_catchedBox
:
Box
;
private
_cathchedBoxOpenState
:
BoxOpenState
;
private
_cathchedBoxOpenState
:
BoxOpenState
;
onTouch
()
{
async
onTouch
()
{
this
.
_net
.
doAction
();
this
.
_net
.
doAction
();
const
catchedBoxs
=
this
.
_boxListCtrl
.
boxs
.
filter
(
const
catchedBoxs
=
this
.
_boxListCtrl
.
boxs
.
filter
(
box
=>
Math
.
abs
(
box
.
y
-
Box
.
MIDDLE_Y
)
<
StartScene
.
NET_RANGE
);
box
=>
Math
.
abs
(
box
.
y
-
Box
.
MIDDLE_Y
)
<
StartScene
.
NET_RANGE
);
...
@@ -113,8 +110,7 @@ export default class StartScene extends Scene {
...
@@ -113,8 +110,7 @@ export default class StartScene extends Scene {
const
dis
=
100
+
__monkeyHandSize__
;
const
dis
=
100
+
__monkeyHandSize__
;
if
(
disX
<
dis
&&
disY
<
dis
)
{
if
(
disX
<
dis
&&
disY
<
dis
)
{
this
.
onCatchedByMonkey
();
this
.
onCatchedByMonkey
();
}
}
else
if
(
this
.
_catchedBox
.
vy
>
0
)
{
else
if
(
this
.
_catchedBox
.
vy
>
0
)
{
this
.
onNotCatchedByMonkey
();
this
.
onNotCatchedByMonkey
();
}
}
}
}
...
@@ -130,6 +126,7 @@ export default class StartScene extends Scene {
...
@@ -130,6 +126,7 @@ export default class StartScene extends Scene {
.
to
({
alpha
:
0
},
500
).
call
(()
=>
{
.
to
({
alpha
:
0
},
500
).
call
(()
=>
{
this
.
_catchedBoxByMoneky
.
destroy
();
this
.
_catchedBoxByMoneky
.
destroy
();
this
.
_catchedBoxByMoneky
=
null
;
this
.
_catchedBoxByMoneky
=
null
;
this
.
boxListCtrl
.
resume
();
},
this
);
},
this
);
}
}
...
@@ -142,12 +139,14 @@ export default class StartScene extends Scene {
...
@@ -142,12 +139,14 @@ export default class StartScene extends Scene {
this
.
_cathchedBoxOpenState
.
onReady
=
()
=>
{
this
.
_cathchedBoxOpenState
.
onReady
=
()
=>
{
egret
.
Tween
.
get
(
this
.
_catchedBox
).
to
({
alpha
:
0
},
500
);
egret
.
Tween
.
get
(
this
.
_catchedBox
).
to
({
alpha
:
0
},
500
);
this
.
_catchedBox
=
null
;
this
.
_catchedBox
=
null
;
}
}
this
.
_cathchedBoxOpenState
.
start
();
this
.
_cathchedBoxOpenState
.
start
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
_cathchedBoxOpenState
.
destroy
();
this
.
_cathchedBoxOpenState
.
destroy
();
this
.
_cathchedBoxOpenState
=
null
;
this
.
_cathchedBoxOpenState
=
null
;
},
1000
);
this
.
boxListCtrl
.
resume
();
},
1000
);
}
}
private
_handX
:
number
;
private
_handX
:
number
;
...
...
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