Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DropAndMergeTheNumber
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
Nguyễn Quang Sáng
DropAndMergeTheNumber
Commits
1b412c27
Commit
1b412c27
authored
Oct 11, 2023
by
Nguyễn Quang Sáng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11/10/23 commit
parent
ac24b9d1
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
4815 additions
and
163 deletions
+4815
-163
priceBar.png
assets/Resources/Sprites/UI/Buttons/priceBar.png
+0
-0
priceBar.png.meta
assets/Resources/Sprites/UI/Buttons/priceBar.png.meta
+38
-0
restartBtn.png
assets/Resources/Sprites/UI/Buttons/restartBtn.png
+0
-0
restartBtn.png.meta
assets/Resources/Sprites/UI/Buttons/restartBtn.png.meta
+38
-0
reviveBar1.png
assets/Resources/Sprites/UI/Buttons/reviveBar1.png
+0
-0
reviveBar1.png.meta
assets/Resources/Sprites/UI/Buttons/reviveBar1.png.meta
+38
-0
reviveBar2.png
assets/Resources/Sprites/UI/Buttons/reviveBar2.png
+0
-0
reviveBar2.png.meta
assets/Resources/Sprites/UI/Buttons/reviveBar2.png.meta
+38
-0
ads.png
assets/Resources/Sprites/UI/Icons/ads.png
+0
-0
ads.png.meta
assets/Resources/Sprites/UI/Icons/ads.png.meta
+7
-7
gameover.png
assets/Resources/Sprites/UI/Icons/gameover.png
+0
-0
gameover.png.meta
assets/Resources/Sprites/UI/Icons/gameover.png.meta
+38
-0
gameplay.fire
assets/Scenes/gameplay.fire
+4499
-150
ButtonsController.ts
assets/Scripts/Controllers/ButtonsController.ts
+15
-3
GameController.ts
assets/Scripts/Controllers/GameController.ts
+5
-2
GameOverScreen.ts
assets/Scripts/Controllers/GameOverScreen.ts
+84
-0
GameOverScreen.ts.meta
assets/Scripts/Controllers/GameOverScreen.ts.meta
+10
-0
Score.ts
assets/Scripts/Data/Score.ts
+5
-1
No files found.
assets/Resources/Sprites/UI/Buttons/priceBar.png
0 → 100644
View file @
1b412c27
2.41 KB
assets/Resources/Sprites/UI/Buttons/priceBar.png.meta
0 → 100644
View file @
1b412c27
{
"ver": "2.3.7",
"uuid": "034c243f-8d75-4d38-b22d-9d91a95ec31f",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 160,
"height": 54,
"platformSettings": {},
"subMetas": {
"priceBar": {
"ver": "1.0.6",
"uuid": "de754ef0-d9c2-48ea-8a58-c800bb21b925",
"importer": "sprite-frame",
"rawTextureUuid": "034c243f-8d75-4d38-b22d-9d91a95ec31f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 160,
"height": 54,
"rawWidth": 160,
"rawHeight": 54,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 18,
"borderRight": 15,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Resources/Sprites/UI/Buttons/restartBtn.png
0 → 100644
View file @
1b412c27
4.74 KB
assets/Resources/Sprites/UI/Buttons/restartBtn.png.meta
0 → 100644
View file @
1b412c27
{
"ver": "2.3.7",
"uuid": "756f8b45-1006-4286-a493-b9234ba94918",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 249,
"height": 97,
"platformSettings": {},
"subMetas": {
"restartBtn": {
"ver": "1.0.6",
"uuid": "1a9d0455-9c5d-4689-a0bc-eb4a92c378bb",
"importer": "sprite-frame",
"rawTextureUuid": "756f8b45-1006-4286-a493-b9234ba94918",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 249,
"height": 97,
"rawWidth": 249,
"rawHeight": 97,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 81,
"borderRight": 91,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Resources/Sprites/UI/Buttons/reviveBar1.png
0 → 100644
View file @
1b412c27
7.62 KB
assets/Resources/Sprites/UI/Buttons/reviveBar1.png.meta
0 → 100644
View file @
1b412c27
{
"ver": "2.3.7",
"uuid": "3d1860a3-a55d-4230-9498-5477b03e8b55",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 409,
"height": 131,
"platformSettings": {},
"subMetas": {
"reviveBar1": {
"ver": "1.0.6",
"uuid": "aadb8c66-2ab2-4d45-ae77-72dcacb578c7",
"importer": "sprite-frame",
"rawTextureUuid": "3d1860a3-a55d-4230-9498-5477b03e8b55",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 409,
"height": 131,
"rawWidth": 409,
"rawHeight": 131,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 43,
"borderRight": 40,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Resources/Sprites/UI/Buttons/reviveBar2.png
0 → 100644
View file @
1b412c27
2.32 KB
assets/Resources/Sprites/UI/Buttons/reviveBar2.png.meta
0 → 100644
View file @
1b412c27
{
"ver": "2.3.7",
"uuid": "e2a3ef02-46b8-44a7-8f80-1037be7c54b5",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 166,
"height": 76,
"platformSettings": {},
"subMetas": {
"reviveBar2": {
"ver": "1.0.6",
"uuid": "fcc1f587-eb5e-4fd0-aea0-196792afaf27",
"importer": "sprite-frame",
"rawTextureUuid": "e2a3ef02-46b8-44a7-8f80-1037be7c54b5",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 166,
"height": 76,
"rawWidth": 166,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 28,
"borderRight": 26,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Resources/Sprites/UI/Icons/ads.png
View replaced file @
ac24b9d1
View file @
1b412c27
2.36 KB
|
W:
|
H:
2.19 KB
|
W:
|
H:
2-up
Swipe
Onion skin
assets/Resources/Sprites/UI/Icons/ads.png.meta
View file @
1b412c27
{
"ver": "2.3.7",
"uuid": "
593f2aea-6f48-4534-a2a5-6f5cfaec84eb
",
"uuid": "
96b4d338-5f57-4516-918e-9b3de55b3ea5
",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
...
...
@@ -14,9 +14,9 @@
"subMetas": {
"ads": {
"ver": "1.0.6",
"uuid": "
5b2c4cea-6c15-4f45-9296-76285a5e9ba7
",
"uuid": "
f88a8d60-654d-4a21-bfbc-790aee7f39a5
",
"importer": "sprite-frame",
"rawTextureUuid": "
593f2aea-6f48-4534-a2a5-6f5cfaec84eb
",
"rawTextureUuid": "
96b4d338-5f57-4516-918e-9b3de55b3ea5
",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
...
...
@@ -24,10 +24,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width":
6
1,
"height":
54
,
"rawWidth":
6
1,
"rawHeight":
54
,
"width":
7
1,
"height":
81
,
"rawWidth":
7
1,
"rawHeight":
81
,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
...
...
assets/Resources/Sprites/UI/Icons/gameover.png
0 → 100644
View file @
1b412c27
35.1 KB
assets/Resources/Sprites/UI/Icons/gameover.png.meta
0 → 100644
View file @
1b412c27
{
"ver": "2.3.7",
"uuid": "59af5a30-ac4e-4321-a8d1-08243202a656",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 411,
"height": 206,
"platformSettings": {},
"subMetas": {
"gameover": {
"ver": "1.0.6",
"uuid": "712fba40-fad1-4809-afa6-0bcb2691866f",
"importer": "sprite-frame",
"rawTextureUuid": "59af5a30-ac4e-4321-a8d1-08243202a656",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 411,
"height": 206,
"rawWidth": 411,
"rawHeight": 206,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Scenes/gameplay.fire
View file @
1b412c27
This diff is collapsed.
Click to expand it.
assets/Scripts/Controllers/ButtonsController.ts
View file @
1b412c27
import
BlockData
from
"../Data/BlockData"
;
import
LocalStorage
from
"../Data/LocalStorage"
;
import
GameController
from
"./GameController"
;
import
GameOverScreen
from
"./GameOverScreen"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -36,6 +37,7 @@ export default class ButtonsController extends cc.Component {
}
onClickPause
()
{
if
(
GameOverScreen
.
instance
.
gameOver
)
return
;
if
(
!
GameController
.
instance
.
isGameStart
)
return
;
if
(
GameController
.
instance
.
isGamePaused
)
{
GameController
.
instance
.
isGamePaused
=
false
;
...
...
@@ -122,11 +124,11 @@ export default class ButtonsController extends cc.Component {
if
(
!
hasNonZeroValue
)
return
;
GameController
.
instance
.
isGamePaused
=
true
;
this
.
regEvent
s
();
this
.
regEvent
();
this
.
destroyBlockPopUp
.
getComponent
(
cc
.
Animation
).
play
(
"PopDown"
);
}
regEvent
s
()
{
regEvent
()
{
let
childrens
=
GameController
.
instance
.
board
.
children
;
childrens
.
forEach
((
child
)
=>
{
if
(
child
.
children
.
length
>
0
)
{
...
...
@@ -135,6 +137,15 @@ export default class ButtonsController extends cc.Component {
});
}
removeEvent
()
{
let
childrens
=
GameController
.
instance
.
board
.
children
;
childrens
.
forEach
((
child
)
=>
{
if
(
child
.
children
.
length
>
0
)
{
child
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchDown
,
this
);
}
});
}
onTouchDown
(
event
:
cc
.
Event
.
EventTouch
)
{
const
data
=
BlockData
.
instance
.
blockData
;
const
childrens
=
GameController
.
instance
.
board
.
children
;
...
...
@@ -156,7 +167,8 @@ export default class ButtonsController extends cc.Component {
}
GameController
.
instance
.
checkEmptyCell
();
this
.
destroyBlockPopUp
.
getComponent
(
cc
.
Animation
).
play
(
"PullUp"
);
GameController
.
instance
.
isGamePaused
=
false
;
this
.
removeEvent
();
this
.
destroyBlockPopUp
.
getComponent
(
cc
.
Animation
).
play
(
"PullUp"
);
}
}
assets/Scripts/Controllers/GameController.ts
View file @
1b412c27
...
...
@@ -3,6 +3,7 @@ import LocalStorage from "../Data/LocalStorage";
import
Score
from
"../Data/Score"
;
import
Block
from
"../Objects/Block"
;
import
Utils
from
"../Tools/Utils"
;
import
GameOverScreen
from
"./GameOverScreen"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -15,6 +16,8 @@ export default class GameController extends cc.Component {
@
property
(
Score
)
scoreLbl
:
Score
=
null
;
@
property
(
cc
.
Label
)
coinLbl
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
nextBlockSpf
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
shadow
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
gameOverScreen
:
cc
.
Node
=
null
;
static
instance
:
GameController
;
...
...
@@ -75,7 +78,8 @@ export default class GameController extends cc.Component {
spawnBlock
(
index
:
number
)
{
if
(
this
.
blocksData
.
blockData
.
length
>
0
)
{
const
isFull
=
this
.
blocksData
.
blockData
[
0
].
some
((
e
)
=>
e
!==
0
);
if
(
isFull
)
return
;
if
(
isFull
)
return
this
.
gameOverScreen
.
getComponent
(
GameOverScreen
).
isGameOver
();
}
if
(
this
.
isPreviewNextBlock
)
{
...
...
@@ -242,7 +246,6 @@ export default class GameController extends cc.Component {
this
.
currentBlock
.
getComponent
(
Block
).
isPlace
=
true
;
this
.
touched
=
false
;
this
.
currentBlock
=
null
;
if
(
this
.
isPreviewNextBlock
)
{
this
.
spawnBlock
(
this
.
nextBlock
);
...
...
assets/Scripts/Controllers/GameOverScreen.ts
0 → 100644
View file @
1b412c27
import
LocalStorage
from
"../Data/LocalStorage"
;
import
Score
from
"../Data/Score"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
GameOverScreen
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
shadow
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
coin
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
highScore
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
currentScore
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
ignoreBtn
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
matchResultSrceen
:
cc
.
Node
=
null
;
static
instance
:
GameOverScreen
;
gameOver
:
boolean
=
false
;
protected
onLoad
():
void
{
GameOverScreen
.
instance
=
this
;
}
isGameOver
()
{
this
.
gameOver
=
true
;
this
.
shadow
.
active
=
true
;
this
.
node
.
active
=
true
;
this
.
coin
.
getComponent
(
cc
.
Label
).
string
=
LocalStorage
.
getAllCoin
().
toString
();
this
.
highScore
.
getComponent
(
cc
.
Label
).
string
=
LocalStorage
.
getHighestScore
().
toString
();
this
.
currentScore
.
getComponent
(
cc
.
Label
).
string
=
Score
.
instance
.
currentScore
.
toString
();
}
onClickIgnoreBtn
()
{
this
.
node
.
active
=
false
;
this
.
matchResultSrceen
.
active
=
true
;
this
.
matchResultSrceen
.
getChildByName
(
"CoinBar"
)
.
getChildByName
(
"Coin"
)
.
getComponent
(
cc
.
Label
).
string
=
LocalStorage
.
getAllCoin
().
toString
();
this
.
matchResultSrceen
.
getChildByName
(
"ScoreBox"
)
.
getChildByName
(
"HighScoreBar"
)
.
getChildByName
(
"Label"
)
.
getComponent
(
cc
.
Label
).
string
=
LocalStorage
.
getHighestScore
().
toString
();
this
.
matchResultSrceen
.
getChildByName
(
"ScoreBox"
)
.
getChildByName
(
"CurrentScoreBar"
)
.
getChildByName
(
"Label"
)
.
getComponent
(
cc
.
Label
).
string
=
Score
.
instance
.
currentScore
.
toString
();
const
score
=
Score
.
instance
.
currentScore
;
const
rewardValues
=
[
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
100
];
if
(
score
<
3000
)
return
this
.
updateReward
(
0
);
for
(
let
i
=
0
;
i
<
rewardValues
.
length
;
i
++
)
{
if
(
score
<=
(
i
+
1
)
*
10000
)
{
this
.
updateReward
(
rewardValues
[
i
]);
break
;
}
}
}
updateReward
(
amount
:
number
)
{
const
reward
=
this
.
matchResultSrceen
.
getChildByName
(
"RewardBar"
)
.
getChildByName
(
"Label"
);
reward
.
getComponent
(
cc
.
Label
).
string
=
"+"
+
amount
;
LocalStorage
.
setAllCoin
(
LocalStorage
.
getAllCoin
()
+
amount
);
this
.
matchResultSrceen
.
getChildByName
(
"CoinBar"
)
.
getChildByName
(
"Coin"
)
.
getComponent
(
cc
.
Label
).
string
=
LocalStorage
.
getAllCoin
().
toString
();
}
}
assets/Scripts/Controllers/GameOverScreen.ts.meta
0 → 100644
View file @
1b412c27
{
"ver": "1.1.0",
"uuid": "e6b5fcd0-45c6-44a6-8175-f163cd4875d2",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/Scripts/Data/Score.ts
View file @
1b412c27
...
...
@@ -6,10 +6,14 @@ const { ccclass, property } = cc._decorator;
export
default
class
Score
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
highScoreLbl
:
cc
.
Node
=
null
;
static
instance
:
Score
;
currentScore
:
number
=
0
;
highestScore
:
number
=
LocalStorage
.
getHighestScore
();
protected
onLoad
():
void
{
Score
.
instance
=
this
;
this
.
highScoreLbl
.
getComponent
(
cc
.
Label
).
string
=
this
.
highestScore
.
toString
();
}
...
...
@@ -17,7 +21,7 @@ export default class Score extends cc.Component {
setScore
(
score
:
number
)
{
this
.
currentScore
+=
score
;
this
.
node
.
getComponent
(
cc
.
Label
).
string
=
this
.
currentScore
.
toString
();
if
(
this
.
currentScore
>
this
.
highestScore
)
{
LocalStorage
.
setHighestScore
(
this
.
currentScore
);
this
.
highScoreLbl
.
getComponent
(
cc
.
Label
).
string
=
...
...
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