Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new-kickball
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
new-kickball
Commits
01867d9b
Commit
01867d9b
authored
Jun 03, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
332535bf
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
158 additions
and
77 deletions
+158
-77
.scilla
.scilla
+1
-1
main.scene
assets/scenes/main.scene
+29
-0
BallItem.ts
assets/scripts/scenes/BallItem.ts
+1
-1
ScenePlay.ts
assets/scripts/scenes/ScenePlay.ts
+40
-30
CarBulletAni.ts
assets/scripts/scenes/scenePlay/CarBulletAni.ts
+7
-7
ngameSubmit.ts
assets/scripts/scenes/scenePlay/ngameSubmit.ts
+38
-0
ngameSubmit.ts.meta
assets/scripts/scenes/scenePlay/ngameSubmit.ts.meta
+1
-0
MustCompile.ts
src/generated/MustCompile.ts
+41
-38
No files found.
.scilla
View file @
01867d9b
{"currentScene":"assets/prefabs/BallItem.pfb"}
\ No newline at end of file
{"currentScene":"assets/scenes/main.scene"}
\ No newline at end of file
assets/scenes/main.scene
View file @
01867d9b
...
...
@@ -396,6 +396,35 @@
"bottomline": "entity|791444c1-84e8-4455-9fb1-c1b2691c6cc0",
"topline": "entity|9f9bfbf2-4f77-4a1b-b1b5-42b6784e0c8c"
}
},
{
"script": "./scripts/scenes/scenePlay/ngameSubmit",
"properties": {
"doJoin": "dynamic|API|doJoin",
"getNgameStartStatus": "dynamic|API|ngameSubmit"
}
},
{
"script": "./scripts/api/SampleApi",
"properties": {
"method": "POST",
"uri": "/hdtool/recon/ngame/ngameSubmit",
"name": "ngameSubmit",
"onError": [
{
"entity": "entity|1265b761-1b67-4d76-9526-78c457a8d113",
"component": 3,
"method": "onError_ngameSubmit"
}
],
"onResponse": [
{
"entity": "entity|1265b761-1b67-4d76-9526-78c457a8d113",
"component": 3,
"method": "onResponse_ngameSubmit"
}
]
}
}
],
"uuid": "1265b761-1b67-4d76-9526-78c457a8d113",
...
...
assets/scripts/scenes/BallItem.ts
View file @
01867d9b
...
...
@@ -9,7 +9,7 @@ export default class BallItem extends Body {
constructor
()
{
super
();
this
.
gravity
=
0.225
;
this
.
rotationSpeed
=
0.5
;
s
this
.
rotationSpeed
=
0.5
;
}
onAwake
()
{
...
...
assets/scripts/scenes/ScenePlay.ts
View file @
01867d9b
...
...
@@ -11,10 +11,10 @@ import Body from "./Body";
import
CarBulletAni
from
"./scenePlay/CarBulletAni"
;
import
CarShootAni
from
"./scenePlay/CarShootAni"
;
import
{
removeFromList
}
from
"./_"
;
import
ngameSubmit
from
"./scenePlay/ngameSubmit"
;
export
default
class
ScenePlay
extends
InteractComponent
implements
INavigatorViewBase
{
BallItemPrefab
:
resource
;
// BulletItemPrefab: resource;
RedFirePrefab
:
resource
;
BlueRocketPrefab
:
resource
;
YellowRocketPrefab
:
resource
;
...
...
@@ -25,18 +25,18 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
topline
:
Entity
;
bottomline
:
Entity
;
doJoinData
:
dynamic
;
getNgameStartStatus
:
dynamic
;
score
=
0
;
bodys
:
Body
[];
ballList
:
B
ody
[];
ballList
:
B
allItem
[];
drops
:
Body
[];
_carShootAni
:
CarShootAni
;
_carBulletAni
:
CarBulletAni
;
private
_ngameSubmitApi
:
ngameSubmit
;
onGlobalTouchBegin
(
e
):
any
{
this
.
_lastTouchMoveX
=
-
1
;
this
.
_lastTouchMoveX
=
-
1
;
return
super
.
onGlobalTouchBegin
(
e
);
}
...
...
@@ -58,6 +58,36 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
onUpdate
()
{
this
.
checkBallCollideGroud
();
this
.
checkBulletCollideBall
();
}
checkBulletCollideBall
()
{
for
(
let
i
=
0
;
i
<
this
.
_carBulletAni
.
bullets
.
length
;
i
++
)
{
const
bullet
=
this
.
_carBulletAni
.
bullets
[
i
];
const
{
width
:
bulletWidth
,
height
:
bulletHeight
}
=
bullet
.
entity
.
getComponent
(
Transform
);
for
(
let
j
=
0
;
j
<
this
.
ballList
.
length
;
j
++
)
{
const
ball
=
this
.
ballList
[
j
];
const
x0
=
Math
.
abs
(
getX
(
ball
.
entity
)
-
getX
(
bullet
.
entity
));
const
y0
=
Math
.
abs
(
getY
(
ball
.
entity
)
-
getY
(
bullet
.
entity
));
const
{
scale
:
ballScale
}
=
ball
.
getComponent
(
Transform
);
const
{
height
:
ballH
}
=
ball
.
entity
.
getChildrenByName
(
'blue'
)[
0
].
getComponent
(
Transform
);
const
x1
=
bulletWidth
/
2
+
ballH
/
2
*
ballScale
.
x
;
const
y1
=
bulletHeight
/
2
+
ballH
/
2
*
ballScale
.
x
;
if
(
x0
<
x1
&&
y0
<
y1
)
{
//子弹和球碰撞了,不再便利其他球
this
.
_carBulletAni
.
removeBullet
(
bullet
);
i
--
;
if
(
ball
.
reduceScore
()
==
0
)
{
//破裂
this
.
onBallSplit
(
ball
);
}
break
;
}
}
}
}
onBallSplit
(
ball
:
BallItem
)
{
removeFromList
(
ball
,
this
.
ballList
);
this
.
entity
.
removeChild
(
ball
.
entity
);
}
checkBallCollideGroud
()
{
...
...
@@ -119,7 +149,7 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
async
createBigBall
()
{
let
dir
=
Math
.
random
()
>
0.5
?
-
1
:
1
;
const
ball
=
this
.
getBallItem
(
20
);
setXY
(
ball
.
entity
,
-
375
,
getY
(
this
.
topline
)
+
400
);
setXY
(
ball
.
entity
,
-
375
,
getY
(
this
.
topline
));
const
body
=
ball
.
getComponent
(
Body
);
body
.
enabled
=
false
;
await
getTween
(
this
,
ball
.
getComponent
(
Transform
),
{
x
:
-
375
+
200
},
700
);
...
...
@@ -130,7 +160,7 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
getBallItem
(
score
:
number
)
{
const
ball
=
instantiate
(
this
.
BallItemPrefab
);
ball
.
getComponent
(
BallItem
).
score
=
score
;
const
body
=
ball
.
getComponent
(
B
ody
);
const
body
=
ball
.
getComponent
(
B
allItem
);
this
.
bodys
.
push
(
body
);
this
.
ballList
.
push
(
body
);
this
.
entity
.
addChild
(
ball
);
...
...
@@ -144,6 +174,7 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
this
.
drops
=
[];
this
.
_carShootAni
=
this
.
car
.
getComponent
(
CarShootAni
);
this
.
_carBulletAni
=
this
.
car
.
getComponent
(
CarBulletAni
);
this
.
_ngameSubmitApi
=
this
.
getComponent
(
ngameSubmit
);
}
onDidEnter
(
last
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
void
{
...
...
@@ -155,32 +186,11 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
setInterval
(()
=>
{
this
.
createBigBall
();
},
2
000
);
},
10
*
1
000
);
}
onGameOver
()
{
this
.
ngameSubmit
();
}
ngameSubmit
()
{
console
.
log
(
'createSgin'
,
this
.
doJoinData
,
this
.
score
,
'[]'
,
this
.
getNgameStartStatus
.
submitToken
);
const
sign
=
createSgin
(
this
.
doJoinData
,
this
.
score
,
'[]'
,
this
.
getNgameStartStatus
.
submitToken
);
const
param
:
any
=
{
orderId
:
this
.
doJoinData
,
score
:
this
.
score
,
gameData
:
'[]'
,
sgin
:
sign
,
dynamicData
:
'[]'
};
this
.
broadcast
(
'callApi'
,
1
,
'ngameSubmit'
,
param
);
}
onResponse_ngameSubmit
()
{
this
.
bubbling
(
'showDialog'
,
'GameOver'
);
}
onError_ngameSubmit
()
{
this
.
_ngameSubmitApi
.
ngameSubmit
(
this
.
score
);
}
onDidLeave
(
next
:
string
,
action
:
alien
.
NavigatorAction
,
parameters
:
any
):
void
{
...
...
assets/scripts/scenes/scenePlay/CarBulletAni.ts
View file @
01867d9b
...
...
@@ -23,7 +23,7 @@ export default class CarBulletAni extends ScillaComponent {
private
_interval
=
3
;
//等级1 2 3 4
private
_lines
=
7
;
private
_lines
=
1
;
private
_offsetList
:
number
[][]
=
[];
bullets
:
Body
[]
=
[];
private
_freeBullets
:
Body
[];
...
...
@@ -57,12 +57,12 @@ export default class CarBulletAni extends ScillaComponent {
this
.
checkRemoveBullets
();
}
removeBullet
(
b
ody
:
Body
)
{
b
ody
.
entity
.
enabled
=
false
;
this
.
_playScene
.
removeChild
(
b
ody
.
entity
);
removeFromList
(
b
ody
,
this
.
bullets
);
this
.
_freeBullets
.
push
(
b
ody
);
this
.
bubbling
(
'bulletRemoved'
,
b
ody
);
removeBullet
(
b
ullet
:
Body
)
{
b
ullet
.
entity
.
enabled
=
false
;
this
.
_playScene
.
removeChild
(
b
ullet
.
entity
);
removeFromList
(
b
ullet
,
this
.
bullets
);
this
.
_freeBullets
.
push
(
b
ullet
);
this
.
bubbling
(
'bulletRemoved'
,
b
ullet
);
// console.log(this._freeBullets.length, this._bullets.length);
}
...
...
assets/scripts/scenes/scenePlay/ngameSubmit.ts
0 → 100644
View file @
01867d9b
import
ScillaComponent
from
'components/base/ScillaComponent'
;
import
{
createSgin
}
from
'assets/scripts/net/webService'
;
import
{
dynamic
}
from
'scilla/src'
;
export
default
class
ngameSubmit
extends
ScillaComponent
{
onAwake
()
{
super
.
onAwake
();
}
onUpdate
(
t
)
{
super
.
onUpdate
(
t
);
}
doJoin
:
dynamic
;
getNgameStartStatus
:
dynamic
;
ngameSubmit
(
score
:
number
)
{
console
.
log
(
'createSgin'
,
this
.
doJoin
,
score
,
'[]'
,
this
.
getNgameStartStatus
.
submitToken
);
const
sign
=
createSgin
(
this
.
doJoin
,
score
,
'[]'
,
this
.
getNgameStartStatus
.
submitToken
);
const
param
:
any
=
{
orderId
:
this
.
doJoin
,
score
:
score
,
gameData
:
'[]'
,
sgin
:
sign
,
dynamicData
:
'[]'
};
this
.
broadcast
(
'callApi'
,
1
,
'ngameSubmit'
,
param
);
}
onResponse_ngameSubmit
()
{
this
.
bubbling
(
'showDialog'
,
'GameOver'
);
}
onError_ngameSubmit
()
{
}
}
assets/scripts/scenes/scenePlay/ngameSubmit.ts.meta
0 → 100644
View file @
01867d9b
{"ver":"1.0.1","uuid":"c7ed7528-bfa7-40c2-a502-e01500fd21dd","subMetas":{},"type":"script"}
src/generated/MustCompile.ts
View file @
01867d9b
...
...
@@ -5,8 +5,8 @@
import
{
registerDef
}
from
'scilla'
import
component0
from
'components/
renderer/RectRenderer
'
;
registerDef
(
'components/
renderer/RectRenderer
'
,
component0
);
import
component0
from
'components/
other/RelativeLayout
'
;
registerDef
(
'components/
other/RelativeLayout
'
,
component0
);
import
component1
from
'components/base/Transform'
;
registerDef
(
'components/base/Transform'
,
component1
);
...
...
@@ -23,11 +23,11 @@ registerDef('components/other/FullStageSize', component4);
import
component5
from
'components/base/TouchInterrupt'
;
registerDef
(
'components/base/TouchInterrupt'
,
component5
);
import
component6
from
'components/
other/CameraControll
er'
;
registerDef
(
'components/
other/CameraControll
er'
,
component6
);
import
component6
from
'components/
renderer/RectRender
er'
;
registerDef
(
'components/
renderer/RectRender
er'
,
component6
);
import
component7
from
'components/other/
RelativeLayout
'
;
registerDef
(
'components/other/
RelativeLayout
'
,
component7
);
import
component7
from
'components/other/
CameraController
'
;
registerDef
(
'components/other/
CameraController
'
,
component7
);
import
component8
from
'components/renderer/TextureRenderer'
;
registerDef
(
'components/renderer/TextureRenderer'
,
component8
);
...
...
@@ -41,56 +41,59 @@ registerDef('components/animation/TouchZoom', component10);
import
component11
from
'components/ui/Button'
;
registerDef
(
'components/ui/Button'
,
component11
);
import
component12
from
'../../assets/scripts/dialogs/
Rule
DialogContent'
;
registerDef
(
'./scripts/dialogs/
Rule
DialogContent'
,
component12
);
import
component12
from
'../../assets/scripts/dialogs/
Alert
DialogContent'
;
registerDef
(
'./scripts/dialogs/
Alert
DialogContent'
,
component12
);
import
component13
from
'../../assets/scripts/api/SamplePollingApi'
;
registerDef
(
'./scripts/api/SamplePollingApi'
,
component13
);
import
component14
from
'../../assets/scripts/scenes/
SceneStar
t'
;
registerDef
(
'./scripts/scenes/
SceneStar
t'
,
component14
);
import
component14
from
'../../assets/scripts/scenes/
scenePlay/ngameSubmi
t'
;
registerDef
(
'./scripts/scenes/
scenePlay/ngameSubmi
t'
,
component14
);
import
component15
from
'../../assets/scripts/scenes/Scene
Controller
'
;
registerDef
(
'./scripts/scenes/Scene
Controller
'
,
component15
);
import
component15
from
'../../assets/scripts/scenes/Scene
Start
'
;
registerDef
(
'./scripts/scenes/Scene
Start
'
,
component15
);
import
component16
from
'../../assets/scripts/scenes/
scenePlay/CarBulletAni
'
;
registerDef
(
'./scripts/scenes/
scenePlay/CarBulletAni
'
,
component16
);
import
component16
from
'../../assets/scripts/scenes/
SceneController
'
;
registerDef
(
'./scripts/scenes/
SceneController
'
,
component16
);
import
component17
from
'../../assets/scripts/scenes/scenePlay/Car
Shoo
tAni'
;
registerDef
(
'./scripts/scenes/scenePlay/Car
Shoo
tAni'
,
component17
);
import
component17
from
'../../assets/scripts/scenes/scenePlay/Car
Bulle
tAni'
;
registerDef
(
'./scripts/scenes/scenePlay/Car
Bulle
tAni'
,
component17
);
import
component18
from
'../../assets/scripts/
popup/Popup
'
;
registerDef
(
'./scripts/
popup/Popup
'
,
component18
);
import
component18
from
'../../assets/scripts/
scenes/scenePlay/CarShootAni
'
;
registerDef
(
'./scripts/
scenes/scenePlay/CarShootAni
'
,
component18
);
import
component19
from
'../../assets/scripts/
navigator/SingleSceneNavigator
'
;
registerDef
(
'./scripts/
navigator/SingleSceneNavigator
'
,
component19
);
import
component19
from
'../../assets/scripts/
popup/Popup
'
;
registerDef
(
'./scripts/
popup/Popup
'
,
component19
);
import
component20
from
'../../assets/scripts/
dialogs/AlertDialogContent
'
;
registerDef
(
'./scripts/
dialogs/AlertDialogContent
'
,
component20
);
import
component20
from
'../../assets/scripts/
navigator/SingleSceneNavigator
'
;
registerDef
(
'./scripts/
navigator/SingleSceneNavigator
'
,
component20
);
import
component21
from
'../../assets/scripts/scenes/ScenePlay'
;
registerDef
(
'./scripts/scenes/ScenePlay'
,
component21
);
import
component22
from
'../../assets/scripts/
api/SampleApi
'
;
registerDef
(
'./scripts/
api/SampleApi
'
,
component22
);
import
component22
from
'../../assets/scripts/
dialogs/RuleDialogContent
'
;
registerDef
(
'./scripts/
dialogs/RuleDialogContent
'
,
component22
);
import
component23
from
'../../assets/scripts/
game/CustomTextRenderer
'
;
registerDef
(
'./scripts/
game/CustomTextRenderer
'
,
component23
);
import
component23
from
'../../assets/scripts/
api/SampleApi
'
;
registerDef
(
'./scripts/
api/SampleApi
'
,
component23
);
import
component24
from
'../../assets/scripts/
MainControll
er'
;
registerDef
(
'./scripts/
MainControll
er'
,
component24
);
import
component24
from
'../../assets/scripts/
game/CustomTextRender
er'
;
registerDef
(
'./scripts/
game/CustomTextRender
er'
,
component24
);
import
component25
from
'../../assets/scripts/
dialogs/GameOverPanel
'
;
registerDef
(
'./scripts/
dialogs/GameOverPanel
'
,
component25
);
import
component25
from
'../../assets/scripts/
MainController
'
;
registerDef
(
'./scripts/
MainController
'
,
component25
);
import
component26
from
'../../assets/scripts/
common/Toast
'
;
registerDef
(
'./scripts/
common/Toast
'
,
component26
);
import
component26
from
'../../assets/scripts/
dialogs/GameOverPanel
'
;
registerDef
(
'./scripts/
dialogs/GameOverPanel
'
,
component26
);
import
component27
from
'../../assets/scripts/
scenes/BallItem
'
;
registerDef
(
'./scripts/
scenes/BallItem
'
,
component27
);
import
component27
from
'../../assets/scripts/
common/Toast
'
;
registerDef
(
'./scripts/
common/Toast
'
,
component27
);
import
component28
from
'../../assets/scripts/scenes/
Rocket
Item'
;
registerDef
(
'./scripts/scenes/
Rocket
Item'
,
component28
);
import
component28
from
'../../assets/scripts/scenes/
Ball
Item'
;
registerDef
(
'./scripts/scenes/
Ball
Item'
,
component28
);
import
component29
from
'../../assets/scripts/scenes/BulletItem'
;
registerDef
(
'./scripts/scenes/BulletItem'
,
component29
);
import
component29
from
'../../assets/scripts/scenes/RocketItem'
;
registerDef
(
'./scripts/scenes/RocketItem'
,
component29
);
import
component30
from
'../../assets/scripts/scenes/BulletItem'
;
registerDef
(
'./scripts/scenes/BulletItem'
,
component30
);
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