Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SaveTheDoge
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
SaveTheDoge
Commits
5d80f2eb
Commit
5d80f2eb
authored
Aug 31, 2023
by
Nguyễn Quang Sáng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
31/8/2023 commit
parent
15197a2b
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1498 additions
and
131 deletions
+1498
-131
14.prefab
assets/Prefabs/Levels/14.prefab
+22
-22
15.prefab
assets/Prefabs/Levels/15.prefab
+10
-10
adsense.png
assets/Resources/adsense.png
+0
-0
adsense.png.meta
assets/Resources/adsense.png.meta
+38
-0
button_double_collect.png
assets/Resources/button_double_collect.png
+0
-0
button_double_collect.png.meta
assets/Resources/button_double_collect.png.meta
+38
-0
gameplay.fire
assets/Scenes/gameplay.fire
+476
-40
levels.fire
assets/Scenes/levels.fire
+0
-22
shop.fire
assets/Scenes/shop.fire
+461
-25
GamePlay.ts
assets/Scripts/Controllers/GamePlay.ts
+64
-8
SkinsController.ts
assets/Scripts/Controllers/SkinsController.ts
+49
-2
StartScene.ts
assets/Scripts/Controllers/StartScene.ts
+3
-0
Dog.ts
assets/Scripts/Objects/Dog.ts
+0
-1
adsense-h5g-api.meta
assets/adsense-h5g-api.meta
+13
-0
ad_event.ts
assets/adsense-h5g-api/ad_event.ts
+27
-0
ad_event.ts.meta
assets/adsense-h5g-api/ad_event.ts.meta
+10
-0
h5_games_ads.ts
assets/adsense-h5g-api/h5_games_ads.ts
+194
-0
h5_games_ads.ts.meta
assets/adsense-h5g-api/h5_games_ads.ts.meta
+10
-0
interstitial_callback.ts
assets/adsense-h5g-api/interstitial_callback.ts
+12
-0
interstitial_callback.ts.meta
assets/adsense-h5g-api/interstitial_callback.ts.meta
+10
-0
interstitial_type.ts
assets/adsense-h5g-api/interstitial_type.ts
+10
-0
interstitial_type.ts.meta
assets/adsense-h5g-api/interstitial_type.ts.meta
+10
-0
preroll_callback.ts
assets/adsense-h5g-api/preroll_callback.ts
+7
-0
preroll_callback.ts.meta
assets/adsense-h5g-api/preroll_callback.ts.meta
+10
-0
rewarded_callback.ts
assets/adsense-h5g-api/rewarded_callback.ts
+13
-0
rewarded_callback.ts.meta
assets/adsense-h5g-api/rewarded_callback.ts.meta
+10
-0
style-desktop.css
build-templates/web-mobile/style-desktop.css
+1
-1
No files found.
assets/Prefabs/Levels/14.prefab
View file @
5d80f2eb
...
...
@@ -36,7 +36,7 @@
"__id__": 37
},
{
"__id__": 4
3
"__id__": 4
2
}
],
"_active": true,
...
...
@@ -110,7 +110,7 @@
}
],
"_prefab": {
"__id__": 4
2
"__id__": 4
7
},
"_opacity": 255,
"_color": {
...
...
@@ -194,7 +194,7 @@
"__id__": 37
},
{
"__id__":
37
"__id__":
42
}
],
"_id": ""
...
...
@@ -1573,17 +1573,6 @@
"fileId": "6dw+X1s/BNrJ7KUEmh6HWf",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5dIbugedtGkbbo5t9KBiGM",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "Brick copy",
...
...
@@ -1595,17 +1584,17 @@
"_active": true,
"_components": [
{
"__id__": 4
4
"__id__": 4
3
},
{
"__id__": 4
5
"__id__": 4
4
},
{
"__id__": 4
6
"__id__": 4
5
}
],
"_prefab": {
"__id__": 4
7
"__id__": 4
6
},
"_opacity": 255,
"_color": {
...
...
@@ -1659,7 +1648,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
3
"__id__": 4
2
},
"_enabled": true,
"_materials": [
...
...
@@ -1691,7 +1680,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
3
"__id__": 4
2
},
"_enabled": true,
"_type": 0,
...
...
@@ -1716,7 +1705,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
3
"__id__": 4
2
},
"_enabled": true,
"tag": 0,
...
...
@@ -1740,7 +1729,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 4
3
"__id__": 4
2
},
"asset": {
"__uuid__": "3ef9ce8f-791c-430c-b1f8-ec3703b0ae18"
...
...
@@ -1748,6 +1737,17 @@
"fileId": "123R1K5a1AdpWM7of9ETpf",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5dIbugedtGkbbo5t9KBiGM",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
...
...
assets/Prefabs/Levels/15.prefab
View file @
5d80f2eb
...
...
@@ -521,8 +521,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
80.258
,
2
8.22
,
-
96.224
,
2
7.973
,
0,
0,
0,
...
...
@@ -698,8 +698,8 @@
},
{
"__type__": "cc.Vec2",
"x":
29.3
,
"y": 4
4.9
"x":
32
,
"y": 4
7.6
},
{
"__type__": "cc.Vec2",
...
...
@@ -708,8 +708,8 @@
},
{
"__type__": "cc.Vec2",
"x": -2
7.2
,
"y": 4
2.6
"x": -2
9.4
,
"y": 4
5.7
},
{
"__type__": "cc.Vec2",
...
...
@@ -732,7 +732,7 @@
"asset": {
"__uuid__": "c3f6df06-c0ad-4e83-999f-c26983a694bc"
},
"fileId": "
87uLwgP5BPuYxg9RaYmras
",
"fileId": "
621Sp7TO1L94et3Vz7Xbp5
",
"sync": false
},
{
...
...
@@ -957,7 +957,7 @@
"__uuid__": "7c6aebf9-b0b0-4ee0-9a19-c3b7e1828a7f"
},
"dog": {
"__id__":
11
"__id__":
4
},
"_id": ""
},
...
...
@@ -1194,7 +1194,7 @@
"__uuid__": "7c6aebf9-b0b0-4ee0-9a19-c3b7e1828a7f"
},
"dog": {
"__id__":
4
"__id__":
11
},
"_id": ""
},
...
...
@@ -1966,7 +1966,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
78.574
,
-
95.388
,
-74.388,
0,
0,
...
...
assets/Resources/adsense.png
0 → 100644
View file @
5d80f2eb
6.25 KB
assets/Resources/adsense.png.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "2.3.7",
"uuid": "9773919c-689f-4327-bf0a-a2cad99806fe",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 190,
"height": 115,
"platformSettings": {},
"subMetas": {
"adsense": {
"ver": "1.0.6",
"uuid": "57b3fb4b-15db-4c36-92d9-32b4867b485f",
"importer": "sprite-frame",
"rawTextureUuid": "9773919c-689f-4327-bf0a-a2cad99806fe",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 190,
"height": 115,
"rawWidth": 190,
"rawHeight": 115,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Resources/button_double_collect.png
0 → 100644
View file @
5d80f2eb
17.6 KB
assets/Resources/button_double_collect.png.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "2.3.7",
"uuid": "c5ea459a-d4f8-44e4-9211-a95e4f22f7cc",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 334,
"height": 133,
"platformSettings": {},
"subMetas": {
"button_double_collect": {
"ver": "1.0.6",
"uuid": "8529c74e-df6d-4d3f-83fd-2885260563af",
"importer": "sprite-frame",
"rawTextureUuid": "c5ea459a-d4f8-44e4-9211-a95e4f22f7cc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 334,
"height": 133,
"rawWidth": 334,
"rawHeight": 133,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/Scenes/gameplay.fire
View file @
5d80f2eb
This diff is collapsed.
Click to expand it.
assets/Scenes/levels.fire
View file @
5d80f2eb
...
...
@@ -91,9 +91,6 @@
},
{
"__id__": 289
},
{
"__id__": 290
}
],
"_prefab": null,
...
...
@@ -12805,24 +12802,5 @@
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "23mlOldwlMM4VjKG7xyPZD"
},
{
"__type__": "221b6Awh/1PLZ7IzVb1f3El",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"soundOffSprite": {
"__uuid__": "d2abbacf-3959-4e3a-9fb7-5c1527a74dda"
},
"soundOnSprite": {
"__uuid__": "65a2b7d8-d4e8-4571-aedb-766db7693820"
},
"soundIntro": null,
"soundClick": null,
"animNode": null,
"_id": "1ck0GVZStOcohONtASUQ0f"
}
]
\ No newline at end of file
assets/Scenes/shop.fire
View file @
5d80f2eb
This diff is collapsed.
Click to expand it.
assets/Scripts/Controllers/GamePlay.ts
View file @
5d80f2eb
...
...
@@ -5,10 +5,9 @@ import PracticeLine from "../Objects/PracticeLine";
import
Utils
from
"../Tools/Utils"
;
import
{
GlobalVariables
}
from
"../Data/GlobalVariables"
;
import
StageController
from
"./StageController"
;
import
SkinController
from
"./SkinsController"
;
import
Hive
from
"../Objects/Hive"
;
import
SoundController
from
"./SoundController"
;
import
StartScene
from
"./StartScene"
;
import
{
showInterstitialAd
}
from
"../../adsense-h5g-api/h5_games_ads"
;
import
{
InterstitialType
}
from
"../../adsense-h5g-api/interstitial_type"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -27,6 +26,8 @@ export default class GamePlay extends cc.Component {
@
property
(
cc
.
Node
)
coinLabel
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
coinEarned
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
levelComp
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
adsBgr
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
notiLabel
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rewardSprite
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
shadow
:
cc
.
Node
=
null
;
@
property
(
cc
.
AudioClip
)
soundClick
:
cc
.
AudioClip
=
null
;
...
...
@@ -75,6 +76,9 @@ export default class GamePlay extends cc.Component {
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getCollisionManager
().
enabled
=
true
;
window
.
addEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
addEventListener
(
"unload"
,
this
.
handleGameReload
);
// cc.director.getPhysicsManager().debugDrawFlags = 1;
this
.
highestLevel
=
LocalStorage
.
getHighestLevel
();
this
.
currentLevel
=
LocalStorage
.
getCurrentLevel
();
...
...
@@ -99,6 +103,57 @@ export default class GamePlay extends cc.Component {
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onTouchUp
,
this
);
}
handleGameReload
()
{
LocalStorage
.
setGameStarted
(
false
);
}
onPlayerClickAds
()
{
showInterstitialAd
(
InterstitialType
.
START
,
"doubleCoin"
);
}
onDestroy
()
{
window
.
removeEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
removeEventListener
(
"unload"
,
this
.
handleGameReload
);
}
onShowNotiAds
(
status
:
string
)
{
if
(
status
==
"ok"
)
{
this
.
notiLabel
.
getComponent
(
cc
.
Label
).
string
=
"Successfully doubled coins!"
;
LocalStorage
.
setAllCoin
(
LocalStorage
.
getAllCoin
()
+
this
.
randomCoin
*
2
);
this
.
adsBgr
.
active
=
true
;
this
.
notiLabel
.
active
=
true
;
this
.
scheduleOnce
(()
=>
{
this
.
adsBgr
.
active
=
false
;
this
.
notiLabel
.
active
=
false
;
},
2
);
this
.
currentCoin
=
LocalStorage
.
getAllCoin
();
this
.
coinLabel
.
getComponent
(
cc
.
Label
).
string
=
`x
${
this
.
currentCoin
}
`
;
}
if
(
status
==
"cancel"
)
{
this
.
showFailedNotiAds
(
"Double coin failed"
);
}
if
(
status
==
"notReady"
)
{
this
.
showFailedNotiAds
(
"Advertisement is preparing"
);
}
if
(
status
==
"frequencyCapped"
)
{
this
.
showFailedNotiAds
(
"Ads frequency limit!"
);
}
}
showFailedNotiAds
(
status
:
string
)
{
this
.
notiLabel
.
getComponent
(
cc
.
Label
).
string
=
status
;
this
.
adsBgr
.
active
=
true
;
this
.
notiLabel
.
active
=
true
;
this
.
scheduleOnce
(()
=>
{
this
.
adsBgr
.
active
=
false
;
this
.
notiLabel
.
active
=
false
;
},
2
);
}
updateAllStarLabel
()
{
let
sum
=
0
;
for
(
const
item
of
LocalStorage
.
getAllStars
())
{
...
...
@@ -212,7 +267,8 @@ export default class GamePlay extends cc.Component {
if
(
cc
.
Vec2
.
distance
(
touchPos
,
this
.
lastTouchPos
)
>=
this
.
lineMinSegLength
&&
cc
.
Vec2
.
distance
(
touchPos
,
this
.
lastDrawnPos
)
<=
this
.
lineMinSegLength
*
5
cc
.
Vec2
.
distance
(
touchPos
,
this
.
lastDrawnPos
)
<=
this
.
lineMinSegLength
*
10
)
{
if
(
!
this
.
drew
)
{
let
touchNormal
=
touchPos
.
sub
(
this
.
lastTouchPos
).
normalize
();
...
...
@@ -220,19 +276,19 @@ export default class GamePlay extends cc.Component {
let
rightEdgeNormal
=
Utils
.
RotateVec2Clockwise
(
touchNormal
);
let
leftEdgeLast
=
this
.
lastTouchPos
.
add
(
cc
.
v2
(
leftEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
2
)
cc
.
v2
(
leftEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
1.5
)
);
let
rightEdgeLast
=
this
.
lastTouchPos
.
add
(
cc
.
v2
(
rightEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
2
)
cc
.
v2
(
rightEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
1.5
)
);
let
leftEdgeCurrent
=
touchPos
.
add
(
cc
.
v2
(
leftEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
2
)
cc
.
v2
(
leftEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
1.5
)
);
let
rightEdgeCurrent
=
touchPos
.
add
(
cc
.
v2
(
rightEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
2
)
cc
.
v2
(
rightEdgeNormal
).
multiplyScalar
(
this
.
lineWidth
/
1.5
)
);
let
newPolyCol
=
this
.
draw
.
addComponent
(
cc
.
PhysicsPolygonCollider
);
...
...
assets/Scripts/Controllers/SkinsController.ts
View file @
5d80f2eb
import
{
GlobalVariables
}
from
"../Data/GlobalVariables"
;
import
{
showInterstitialAd
}
from
"../../adsense-h5g-api/h5_games_ads"
;
import
{
InterstitialType
}
from
"../../adsense-h5g-api/interstitial_type"
;
import
LocalStorage
from
"../Data/LocalStorage"
;
import
StartScene
from
"./StartScene"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -10,23 +10,70 @@ export default class SkinController extends cc.Component {
@
property
(
cc
.
Node
)
playerSkins
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
enemySkins
:
cc
.
Node
=
null
;
@
property
(
cc
.
AudioClip
)
soundClick
:
cc
.
AudioClip
=
null
;
@
property
(
cc
.
Node
)
adsBgr
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
notiLabel
:
cc
.
Node
=
null
;
static
instance
:
SkinController
;
allCoin
:
number
;
allSkins
:
Array
<
{
skin
:
string
;
available
:
boolean
}
>
;
protected
onLoad
():
void
{
SkinController
.
instance
=
this
;
this
.
allCoin
=
LocalStorage
.
getAllCoin
();
this
.
allSkins
=
LocalStorage
.
getAllSkins
();
this
.
updateStatus
();
this
.
loadCurrentSkin
();
}
onPlayerClickAds
()
{
showInterstitialAd
(
InterstitialType
.
START
,
"earn15Coin"
);
}
onClickButtonBack
()
{
cc
.
director
.
loadScene
(
"start"
);
cc
.
audioEngine
.
playEffect
(
this
.
soundClick
,
false
);
cc
.
audioEngine
.
stopAllEffects
();
}
onShowNotiAds
(
status
:
string
)
{
if
(
status
==
"ok"
)
{
this
.
notiLabel
.
getComponent
(
cc
.
Label
).
string
=
"Received coins successfully!"
;
LocalStorage
.
setAllCoin
(
LocalStorage
.
getAllCoin
()
+
15
);
this
.
adsBgr
.
active
=
true
;
this
.
notiLabel
.
active
=
true
;
this
.
scheduleOnce
(()
=>
{
this
.
adsBgr
.
active
=
false
;
this
.
notiLabel
.
active
=
false
;
},
2
);
this
.
allCoin
=
LocalStorage
.
getAllCoin
();
this
.
coinLabel
.
getComponent
(
cc
.
Label
).
string
=
`x
${
this
.
allCoin
}
`
;
}
if
(
status
==
"cancel"
)
{
this
.
showFailedNotiAds
(
"Receiving coins failed!"
);
}
if
(
status
==
"notReady"
)
{
this
.
showFailedNotiAds
(
"Advertisement is preparing..!"
);
}
if
(
status
==
"frequencyCapped"
)
{
this
.
showFailedNotiAds
(
"Ads frequency limit!"
);
}
}
showFailedNotiAds
(
status
:
string
)
{
this
.
notiLabel
.
getComponent
(
cc
.
Label
).
string
=
status
;
this
.
adsBgr
.
active
=
true
;
this
.
notiLabel
.
active
=
true
;
this
.
scheduleOnce
(()
=>
{
this
.
adsBgr
.
active
=
false
;
this
.
notiLabel
.
active
=
false
;
},
2
);
}
loadCurrentSkin
()
{
const
skinPlayer
=
LocalStorage
.
getCurrentSkinPlayer
();
const
enemyPlayer
=
LocalStorage
.
getCurrentSkinEnemy
();
...
...
assets/Scripts/Controllers/StartScene.ts
View file @
5d80f2eb
...
...
@@ -30,6 +30,8 @@ export default class StartScene extends cc.Component {
this
.
updateButtonSprite
();
window
.
addEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
addEventListener
(
"unload"
,
this
.
handleGameReload
);
this
.
isStarted
=
LocalStorage
.
getGameStarted
();
if
(
this
.
isStarted
)
this
.
node
.
getChildByName
(
"Intro"
).
active
=
false
;
...
...
@@ -53,6 +55,7 @@ export default class StartScene extends cc.Component {
onDestroy
()
{
window
.
removeEventListener
(
"beforeunload"
,
this
.
handleGameReload
);
window
.
removeEventListener
(
"unload"
,
this
.
handleGameReload
);
}
onClickOpenGame
()
{
...
...
assets/Scripts/Objects/Dog.ts
View file @
5d80f2eb
import
GamePlay
from
"../Controllers/GamePlay"
;
import
SoundController
from
"../Controllers/SoundController"
;
import
{
GlobalVariables
}
from
"../Data/GlobalVariables"
;
import
LocalStorage
from
"../Data/LocalStorage"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
assets/adsense-h5g-api.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.3",
"uuid": "4e14393c-a6c4-4bfe-946c-abe1c5d19a8d",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/adsense-h5g-api/ad_event.ts
0 → 100644
View file @
5d80f2eb
/**
* Ad Events for Interstitial Callback
*/
export
enum
PrerollAdEvent
{
AD_BREAK_DONE
=
'H5GA_EVENT_PREROLL_AD_BREAK_DONE'
,
}
/**
* Ad Events for Interstitial Callback
*/
export
enum
InterstitialAdEvent
{
BEFORE_AD
=
'H5GA_EVENT_INTERSTITIAL_BEFORE_AD'
,
AFTER_AD
=
'H5GA_EVENT_INTERSTITIAL_AFTER_AD'
,
AD_BREAK_DONE
=
'H5GA_EVENT_INTERSTITIAL_AD_BREAK_DONE'
,
}
/**
* Ad Events for Rewarded Video Callback
*/
export
enum
RewardedVideoAdEvent
{
BEFORE_AD
=
'H5GA_EVENT_REWARDED_VIDEO_BEFORE_AD'
,
AFTER_AD
=
'H5GA_EVENT_REWARDED_VIDEO_AFTER_AD'
,
AD_BREAK_DONE
=
'H5GA_EVENT_REWARDED_VIDEO_AD_BREAK_DONE'
,
BEFORE_REWARD
=
'H5GA_EVENT_REWARDED_VIDEO_BEFORE_REWARD'
,
AD_DISMISSED
=
'H5GA_EVENT_REWARDED_VIDEO_AD_DISMISSED'
,
AD_VIEWED
=
'H5GA_EVENT_REWARDED_VIDEO_AD_VIEWED'
,
}
\ No newline at end of file
assets/adsense-h5g-api/ad_event.ts.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.0",
"uuid": "6cdefff5-eef4-4d14-bf7f-3797ba31418b",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/adsense-h5g-api/h5_games_ads.ts
0 → 100644
View file @
5d80f2eb
const
{
game
}
=
cc
;
import
{
InterstitialCallback
}
from
"./interstitial_callback"
;
import
{
RewardedCallback
}
from
"./rewarded_callback"
;
import
{
PrerollCallback
}
from
"./preroll_callback"
;
import
{
InterstitialAdEvent
,
PrerollAdEvent
,
RewardedVideoAdEvent
,
}
from
"./ad_event"
;
import
{
InterstitialType
}
from
"./interstitial_type"
;
import
SkinController
from
"../Scripts/Controllers/SkinsController"
;
import
GamePlay
from
"../Scripts/Controllers/GamePlay"
;
// This is needed since there're no definition for AdSense object here.
// tslint:disable-next-line:no-any
const
ADS_BY_GOOGLE
=
(
window
as
any
).
adsbygoogle
;
type
AdBreakCallback
=
|
InterstitialCallback
|
RewardedCallback
|
PrerollCallback
;
const
adBreak
=
(
o
:
AdBreakCallback
)
=>
{
ADS_BY_GOOGLE
.
push
(
o
);
};
//let showRewardedAdFn : (() => void) | null;
/**
* API to show Preroll Ad when available.
* If there are no ad available this function will request an ad.
*/
// export function showPrerollAd(){
// try {
// const game_instance = game;
// adBreak({
// type: 'preroll',
// adBreakDone: (placementInfo: any) => {
// game_instance.emit(PrerollAdEvent.AD_BREAK_DONE);
// },
// });
// console.log(ADS_BY_GOOGLE)
// } catch(e) {
// console.log(e)
// }
// }
/**
* API to show Interstitial Ad when available.
* If there are no ad available this function will request an ad.
*/
export
function
showInterstitialAd
(
type
:
InterstitialType
,
name
:
string
)
{
try
{
console
.
log
(
"try to show InterstitialAd"
);
const
gameInstance
=
game
;
adBreak
({
type
,
name
,
beforeAd
:
()
=>
{
console
.
log
(
"beforeAd"
);
gameInstance
.
emit
(
InterstitialAdEvent
.
BEFORE_AD
);
cc
.
audioEngine
.
pauseMusic
();
cc
.
audioEngine
.
pauseAllEffects
();
},
afterAd
:
()
=>
{
console
.
log
(
"afterAd"
);
gameInstance
.
emit
(
InterstitialAdEvent
.
AFTER_AD
);
},
adBreakDone
:
(
placementInfo
:
any
)
=>
{
console
.
log
(
placementInfo
);
gameInstance
.
emit
(
InterstitialAdEvent
.
AD_BREAK_DONE
);
console
.
log
(
"adBreakDone"
);
cc
.
audioEngine
.
resumeMusic
();
cc
.
audioEngine
.
resumeAllEffects
();
if
(
placementInfo
.
breakName
==
"earn15Coin"
&&
placementInfo
.
breakStatus
==
"viewed"
)
{
SkinController
.
instance
.
onShowNotiAds
(
"ok"
);
}
if
(
(
placementInfo
.
breakName
==
"earn15Coin"
&&
placementInfo
.
breakStatus
==
"ignored"
)
||
placementInfo
.
breakStatus
==
"other"
)
{
SkinController
.
instance
.
onShowNotiAds
(
"cancel"
);
}
if
(
placementInfo
.
breakName
==
"earn15Coin"
&&
placementInfo
.
breakStatus
==
"notReady"
)
{
SkinController
.
instance
.
onShowNotiAds
(
"notReady"
);
}
if
(
placementInfo
.
breakName
==
"earn15Coin"
&&
placementInfo
.
breakStatus
==
"frequencyCapped"
)
{
SkinController
.
instance
.
onShowNotiAds
(
"frequencyLimit"
);
}
if
(
placementInfo
.
breakName
==
"doubleCoin"
&&
placementInfo
.
breakStatus
==
"viewed"
)
{
GamePlay
.
instance
.
onShowNotiAds
(
"ok"
);
}
if
(
(
placementInfo
.
breakName
==
"doubleCoin"
&&
placementInfo
.
breakStatus
==
"ignored"
)
||
placementInfo
.
breakStatus
==
"other"
)
{
GamePlay
.
instance
.
onShowNotiAds
(
"cancel"
);
}
if
(
placementInfo
.
breakName
==
"doubleCoin"
&&
placementInfo
.
breakStatus
==
"notReady"
)
{
SkinController
.
instance
.
onShowNotiAds
(
"notReady"
);
}
if
(
placementInfo
.
breakName
==
"doubleCoin"
&&
placementInfo
.
breakStatus
==
"frequencyCapped"
)
{
GamePlay
.
instance
.
onShowNotiAds
(
"frequencyLimit"
);
}
},
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
/**
* API to request Rewarded Ad.
* To show the Rewarded Ad you could call showRewardedAd after
* beforeReward callback.
*/
// export function requestRewardedAd(name: string) {
// try {
// console.log("try to show InterstitialAd");
// const gameInstance = game;
// adBreak({
// type: 'reward',
// name,
// beforeAd: () => {
// console.log("beforeAd");
// gameInstance.emit(RewardedVideoAdEvent.BEFORE_AD);
// },
// afterAd: () => {
// console.log("afterAd");
// gameInstance.emit(RewardedVideoAdEvent.AFTER_AD);
// },
// adBreakDone: (placementInfo: unknown) => {
// console.log("adBreakDone");
// console.log(placementInfo)
// gameInstance.emit(RewardedVideoAdEvent.AD_BREAK_DONE);
// },
// beforeReward: (showAdFn: () => void) => {
// showRewardedAdFn = showAdFn;
// console.log("beforeReward");
// gameInstance.emit(RewardedVideoAdEvent.BEFORE_REWARD);
// },
// adDismissed: () => {
// console.log("adDismissed");
// gameInstance.emit(RewardedVideoAdEvent.AD_DISMISSED);
// },
// adViewed: () => {
// console.log("adViewed");
// gameInstance.emit(RewardedVideoAdEvent.AD_VIEWED);
// },
// });
// } catch (e) {
// console.log(e);
// }
// }
/**
* API to show Rewarded Ad when available.
*/
// export function showRewardedAd() {
// if (!showRewardedAdFn) {
// console.log('No Rewarded Ad available');
// return;
// }
// showRewardedAdFn();
// showRewardedAdFn = null;
// }
assets/adsense-h5g-api/h5_games_ads.ts.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.0",
"uuid": "b6763fe6-ff2c-4e97-a7f9-4b833b3bd756",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/adsense-h5g-api/interstitial_callback.ts
0 → 100644
View file @
5d80f2eb
import
{
InterstitialType
}
from
'./interstitial_type'
;
/**
* Interface for Interstitial AdBreak API Callback
*/
export
interface
InterstitialCallback
{
type
:
InterstitialType
;
name
:
string
;
beforeAd
:
()
=>
void
;
afterAd
:
()
=>
void
;
adBreakDone
:
(
placementInfo
:
unknown
)
=>
void
;
}
\ No newline at end of file
assets/adsense-h5g-api/interstitial_callback.ts.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.0",
"uuid": "34ce0e5e-8ebf-441d-ac42-2da72d04ed54",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/adsense-h5g-api/interstitial_type.ts
0 → 100644
View file @
5d80f2eb
/**
* Interstitial Type for AdBreak
*/
export
enum
InterstitialType
{
START
=
'start'
,
PAUSE
=
'pause'
,
NEXT
=
'next'
,
BROWSE
=
'browse'
,
REWARD
=
'reward'
,
}
\ No newline at end of file
assets/adsense-h5g-api/interstitial_type.ts.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.0",
"uuid": "41c2c096-5666-4975-9e79-905a489bf100",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/adsense-h5g-api/preroll_callback.ts
0 → 100644
View file @
5d80f2eb
/**
* Interface for Preroll AdBreak API Callback
*/
export
interface
PrerollCallback
{
type
:
string
;
adBreakDone
:
(
placementInfo
:
unknown
)
=>
void
;
}
\ No newline at end of file
assets/adsense-h5g-api/preroll_callback.ts.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.0",
"uuid": "5c029479-8a2c-42bb-a75f-7144f2b1ff01",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/adsense-h5g-api/rewarded_callback.ts
0 → 100644
View file @
5d80f2eb
/**
* Interface for Rewarded AdBreak API Callback
*/
export
interface
RewardedCallback
{
type
:
string
;
name
:
string
;
beforeAd
:
()
=>
void
;
afterAd
:
()
=>
void
;
beforeReward
:
(
showAdFn
:
()
=>
void
)
=>
void
;
adDismissed
:
()
=>
void
;
adViewed
:
()
=>
void
;
adBreakDone
:
(
placementInfo
:
unknown
)
=>
void
;
}
\ No newline at end of file
assets/adsense-h5g-api/rewarded_callback.ts.meta
0 → 100644
View file @
5d80f2eb
{
"ver": "1.1.0",
"uuid": "482f4afa-70f0-42f5-96a9-7ababa9481aa",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
build-templates/web-mobile/style-desktop.css
View file @
5d80f2eb
...
...
@@ -124,7 +124,7 @@ h1 {
}
#GameDiv
{
width
:
calc
(
100vh
*
45
/
80
)
;
width
:
100vh
;
height
:
100vh
;
margin
:
0
auto
;
background
:
black
;
...
...
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