Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
car
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
car
Commits
df9589be
Commit
df9589be
authored
May 30, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
63fcc854
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
458 additions
and
257 deletions
+458
-257
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+353
-199
UnlockPanel.ts
assets/Scripts/Panels/UnlockPanel.ts
+18
-19
GamePage.ts
assets/Scripts/Scenes/MainGame/GamePage.ts
+5
-3
MainGame.ts
assets/Scripts/Scenes/MainGame/MainGame.ts
+60
-30
gameStore.ts
assets/Scripts/store/gameStore.ts
+18
-6
store.ts
assets/Scripts/store/store.ts
+2
-0
index.do.json5
preview-template/mock/main/index.do.json5
+2
-0
No files found.
assets/Bundles/MainGame/MainGame.scene
View file @
df9589be
This diff is collapsed.
Click to expand it.
assets/Scripts/Panels/UnlockPanel.ts
View file @
df9589be
import
{
_decorator
,
Button
,
Label
,
Node
,
Sprite
,
SpriteFrame
}
from
'cc'
;
import
{
_decorator
,
Button
,
Label
,
Node
,
Sprite
,
SpriteFrame
}
from
'cc'
;
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
Panel
from
"db://assets/core/Module/Panel"
;
import
Panel
from
"db://assets/core/Module/Panel"
;
import
{
showShareGuide
}
from
"db://assets/core/Module/UIFast"
;
import
{
MainGame
}
from
"db://assets/Scripts/Scenes/MainGame/MainGame"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
store
from
"db://assets/Scripts/store/store"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
import
{
_asyncThrottle
}
from
"db://assets/Scripts/Utils/Utils"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -29,11 +30,16 @@ export class UnlockPanel extends Panel {
...
@@ -29,11 +30,16 @@ export class UnlockPanel extends Panel {
start
():
void
{
start
():
void
{
const
{
type
}
=
this
.
data
;
const
{
type
}
=
this
.
data
;
const
{
unparkQgNum
,
unparkCreditsNum
}
=
store
.
homeInfo
;
this
.
okBtn
.
getComponent
(
Sprite
).
spriteFrame
=
type
==
"share"
?
this
.
shareSf
:
this
.
exchangeSf
;
this
.
okBtn
.
getComponent
(
Sprite
).
spriteFrame
=
type
==
"share"
?
this
.
shareSf
:
this
.
exchangeSf
;
// 消耗x积分 即可解锁1个车位
if
(
type
==
"share"
)
{
// 消耗x青果 即可解锁1个车位
this
.
tip
.
string
=
"分享好友
\n
即可解锁1个车位"
;
// 分享好友 即可解锁1个车位
}
else
if
(
type
==
"green"
)
{
this
.
tip
.
string
=
`消耗
${
unparkQgNum
}
青果\n即可解锁1个车位`
;
}
else
if
(
type
==
"credits"
)
{
this
.
tip
.
string
=
`消耗
${
unparkCreditsNum
}
积分\n即可解锁1个车位`
;
}
}
}
hidePanel
()
{
hidePanel
()
{
...
@@ -46,23 +52,16 @@ export class UnlockPanel extends Panel {
...
@@ -46,23 +52,16 @@ export class UnlockPanel extends Panel {
this
.
hidePanel
();
this
.
hidePanel
();
}
}
ok
=
()
=>
{
ok
=
_asyncThrottle
(
async
()
=>
{
const
{
type
}
=
this
.
data
;
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
);
if
(
type
==
"share"
)
{
showShareGuide
();
this
.
scheduleOnce
(()
=>
{
MainGame
.
ins
.
shareUnlock
();
this
.
hidePanel
();
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
true
},
2500
);
}
else
{
}
const
{
type
,
onSuccess
}
=
this
.
data
;
const
suc
=
await
gameStore
.
unlockPark
(
type
);
if
(
!
suc
)
return
;
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
);
onSuccess
?.(
);
}
}
)
}
}
...
...
assets/Scripts/Scenes/MainGame/GamePage.ts
View file @
df9589be
...
@@ -24,6 +24,8 @@ import { showPanel, showToast } from "db://assets/core/Module/UIFast";
...
@@ -24,6 +24,8 @@ import { showPanel, showToast } from "db://assets/core/Module/UIFast";
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
UnlockPanel
}
from
"db://assets/Scripts/Panels/UnlockPanel"
;
import
{
UnlockPanel
}
from
"db://assets/Scripts/Panels/UnlockPanel"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
import
{
MainGame
}
from
"db://assets/Scripts/Scenes/MainGame/MainGame"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -88,11 +90,11 @@ export class GamePage extends Component {
...
@@ -88,11 +90,11 @@ export class GamePage extends Component {
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
false
;
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
false
;
if
(
parkIndex
===
4
)
{
if
(
parkIndex
===
4
)
{
showPanel
(
UnlockPanel
,
{
type
:
"share"
}
);
MainGame
.
ins
.
shareUnlock
(
);
}
else
if
(
parkIndex
===
5
)
{
}
else
if
(
parkIndex
===
5
)
{
showPanel
(
UnlockPanel
,
{
type
:
"exchange"
}
);
MainGame
.
ins
.
videoUnlock1
(
);
}
else
if
(
parkIndex
===
6
)
{
}
else
if
(
parkIndex
===
6
)
{
showPanel
(
UnlockPanel
,
{
type
:
"exchange"
}
);
MainGame
.
ins
.
videoUnlock2
(
);
}
}
return
;
return
;
}
}
...
...
assets/Scripts/Scenes/MainGame/MainGame.ts
View file @
df9589be
import
{
_decorator
,
assetManager
,
find
,
instantiate
,
Prefab
,
Node
,
Label
}
from
'cc'
;
import
{
_decorator
,
assetManager
,
find
,
instantiate
,
Prefab
,
Node
,
Label
}
from
'cc'
;
import
Scene
from
"db://assets/core/Module/Scene"
;
import
Scene
from
"db://assets/core/Module/Scene"
;
import
{
changeScene
,
showPanel
,
showToast
}
from
"db://assets/core/Module/UIFast"
;
import
{
changeScene
,
showPanel
,
show
ShareGuide
,
show
Toast
}
from
"db://assets/core/Module/UIFast"
;
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
HomeScene
}
from
"db://assets/Scripts/Scenes/HomeScene"
;
import
{
RoleCarColorsSysterm
}
from
"./Systerms/RoleCarColorsSysterm"
;
import
{
RoleCarColorsSysterm
}
from
"./Systerms/RoleCarColorsSysterm"
;
...
@@ -8,6 +8,7 @@ import { CarCarColorsSysterm } from "./Systerms/CarCarColorsSysterm";
...
@@ -8,6 +8,7 @@ import { CarCarColorsSysterm } from "./Systerms/CarCarColorsSysterm";
import
{
PlatformManager
}
from
"db://assets/ScriptFrame/Frame/platformManager"
;
import
{
PlatformManager
}
from
"db://assets/ScriptFrame/Frame/platformManager"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
{
UnlockPanel
}
from
"db://assets/Scripts/Panels/UnlockPanel"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -58,6 +59,20 @@ export class MainGame extends Scene {
...
@@ -58,6 +59,20 @@ export class MainGame extends Scene {
this
.
parkPoints
.
children
.
forEach
((
child
,
index
)
=>
{
this
.
parkPoints
.
children
.
forEach
((
child
,
index
)
=>
{
if
(
index
<
4
)
{
if
(
index
<
4
)
{
child
.
name
=
"empty"
;
child
.
name
=
"empty"
;
}
else
if
(
index
==
4
)
{
child
.
name
=
"lock"
;
child
.
children
[
0
].
children
[
0
].
active
=
false
;
if
(
gameStore
.
startInfo
.
shareUnlocked
)
{
child
.
children
[
0
].
children
[
1
].
active
=
false
;
if
(
child
.
children
[
0
].
children
[
2
])
{
child
.
children
[
0
].
children
[
2
].
active
=
true
;
}
}
else
{
child
.
children
[
0
].
children
[
1
].
active
=
true
;
if
(
child
.
children
[
0
].
children
[
2
])
{
child
.
children
[
0
].
children
[
2
].
active
=
false
;
}
}
}
else
{
}
else
{
child
.
name
=
"lock"
;
child
.
name
=
"lock"
;
child
.
children
[
0
].
children
[
0
].
active
=
false
;
child
.
children
[
0
].
children
[
0
].
active
=
false
;
...
@@ -65,44 +80,58 @@ export class MainGame extends Scene {
...
@@ -65,44 +80,58 @@ export class MainGame extends Scene {
}
}
child
.
children
[
1
]?.
destroy
();
child
.
children
[
1
]?.
destroy
();
child
.
children
[
1
]?.
removeFromParent
();
child
.
children
[
1
]?.
removeFromParent
();
})
});
}
unlockPoint
(
index
:
number
)
{
const
points
=
find
(
"Scene/Parkings"
).
children
;
points
[
index
].
name
=
"empty"
;
points
[
index
].
children
[
0
].
children
[
0
].
active
=
true
;
points
[
index
].
children
[
0
].
children
[
1
].
active
=
false
;
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
upgrade
);
}
}
shareUnlock
()
{
shareUnlock
()
{
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
)
if
(
gameStore
.
startInfo
.
shareUnlocked
)
{
PlatformManager
.
instance
.
shareGame
(()
=>
{
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
false
const
points
=
find
(
"Scene/Parkings"
).
children
showPanel
(
UnlockPanel
,
{
points
[
4
].
name
=
"empty"
type
:
"green"
,
points
[
4
].
children
[
0
].
children
[
0
].
active
=
true
onSuccess
:
()
=>
{
points
[
4
].
children
[
0
].
children
[
1
].
active
=
false
this
.
unlockPoint
(
4
);
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
upgrade
)
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
true
;
})
}
});
}
else
{
showShareGuide
();
this
.
scheduleOnce
(()
=>
{
if
(
gameStore
.
startInfo
.
shareUnlocked
)
return
;
gameStore
.
startInfo
.
shareUnlocked
=
true
;
gameStore
.
unlockPark
(
"share"
);
this
.
unlockPoint
(
4
);
},
2.5
);
}
}
}
videoUnlock1
()
{
videoUnlock1
()
{
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
)
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
false
;
PlatformManager
.
instance
.
showVideoAd
(()
=>
{
showPanel
(
UnlockPanel
,
{
const
points
=
find
(
"Scene/Parkings"
).
children
type
:
"credits"
,
points
[
5
].
name
=
"empty"
onSuccess
:
()
=>
{
points
[
5
].
children
[
0
].
children
[
0
].
active
=
true
this
.
unlockPoint
(
5
);
points
[
5
].
children
[
0
].
children
[
1
].
active
=
false
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
true
;
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
upgrade
)
}
},
()
=>
{
});
showToast
(
"视频播放未完成!"
)
})
}
}
videoUnlock2
()
{
videoUnlock2
()
{
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
)
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
false
;
PlatformManager
.
instance
.
showVideoAd
(()
=>
{
showPanel
(
UnlockPanel
,
{
const
points
=
find
(
"Scene/Parkings"
).
children
type
:
"credits"
,
points
[
6
].
name
=
"empty"
onSuccess
:
()
=>
{
points
[
6
].
children
[
0
].
children
[
0
].
active
=
true
this
.
unlockPoint
(
6
);
points
[
6
].
children
[
0
].
children
[
1
].
active
=
false
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
isGaming
=
true
;
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
upgrade
)
}
},
()
=>
{
});
showToast
(
"视频播放未完成!"
)
})
}
}
async
nextLevel
()
{
async
nextLevel
()
{
...
@@ -118,6 +147,7 @@ export class MainGame extends Scene {
...
@@ -118,6 +147,7 @@ export class MainGame extends Scene {
gameStore
.
startInfo
.
level
++
;
gameStore
.
startInfo
.
level
++
;
this
.
showPre
();
this
.
showPre
();
this
.
flushParkPoints
();
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
clearAll
();
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
clearAll
();
CarColorsGlobalInstance
.
instance
.
carSysterm
.
clearAll
();
CarColorsGlobalInstance
.
instance
.
carSysterm
.
clearAll
();
...
...
assets/Scripts/store/gameStore.ts
View file @
df9589be
...
@@ -10,6 +10,7 @@ const { makeAutoObservable } = mobx;
...
@@ -10,6 +10,7 @@ const { makeAutoObservable } = mobx;
export
interface
IStartInfo
{
export
interface
IStartInfo
{
level
:
number
,
level
:
number
,
startId
:
string
,
startId
:
string
,
shareUnlocked
:
boolean
,
}
}
class
GameStore
{
class
GameStore
{
...
@@ -17,6 +18,7 @@ class GameStore {
...
@@ -17,6 +18,7 @@ class GameStore {
startInfo
:
IStartInfo
=
{
startInfo
:
IStartInfo
=
{
level
:
0
,
level
:
0
,
startId
:
""
,
startId
:
""
,
shareUnlocked
:
false
,
}
}
async
start
()
{
async
start
()
{
...
@@ -37,22 +39,32 @@ class GameStore {
...
@@ -37,22 +39,32 @@ class GameStore {
this
.
startInfo
=
data
;
this
.
startInfo
=
data
;
this
.
startInfo
.
level
=
0
;
this
.
startInfo
.
level
=
0
;
this
.
startInfo
.
shareUnlocked
=
false
;
return
success
;
return
success
;
}
}
async
unlockPark
()
{
async
unlockPark
(
type
:
"share"
|
"credits"
|
"green"
)
{
const
{
startId
}
=
this
.
startInfo
;
const
{
startId
,
level
}
=
this
.
startInfo
;
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
unlockPark
,
{
const
params
:
any
=
{
startId
,
startId
,
level
:
1
,
level
,
});
type
:
type
==
"share"
?
1
:
(
type
==
"credits"
?
3
:
2
),
}
if
(
type
===
"credits"
)
{
const
{
success
,
ticket
}
=
await
creditsCost
(
"main"
,
"unlockPark"
,
"deduct_credits_desc"
,
1000
);
if
(
!
success
)
return
false
;
params
.
ticketNum
=
ticket
;
}
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
unlockPark
,
params
);
if
(
!
success
)
return
false
;
if
(
!
success
)
return
false
;
this
.
startInfo
=
data
;
return
success
;
}
}
async
middleSubmit
()
{
async
middleSubmit
()
{
...
...
assets/Scripts/store/store.ts
View file @
df9589be
...
@@ -17,6 +17,8 @@ export interface IHomeInfo {
...
@@ -17,6 +17,8 @@ export interface IHomeInfo {
freeTimes
:
number
;
freeTimes
:
number
;
creditsNum
:
number
;
creditsNum
:
number
;
gameCreditsEach
:
number
;
gameCreditsEach
:
number
;
unparkQgNum
:
number
;
unparkCreditsNum
:
number
;
boxConfigs
:
{
boxConfigs
:
{
id
:
string
;
id
:
string
;
targetLevel
:
string
;
targetLevel
:
string
;
...
...
preview-template/mock/main/index.do.json5
View file @
df9589be
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
"freeTimes": 6,
"freeTimes": 6,
"creditsNum": 100,
"creditsNum": 100,
"gameCreditsEach": 100,
"gameCreditsEach": 100,
"unparkQgNum": 66,
"unparkCreditsNum": 88,
"boxConfigs": [
"boxConfigs": [
{
{
id: 1,
id: 1,
...
...
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