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
369d8f09
Commit
369d8f09
authored
May 30, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
23b36405
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
20 deletions
+27
-20
ReviewPanel.ts
assets/Scripts/Panels/ReviewPanel.ts
+8
-6
MainGame.ts
assets/Scripts/Scenes/MainGame/MainGame.ts
+11
-9
gameStore.ts
assets/Scripts/store/gameStore.ts
+8
-5
No files found.
assets/Scripts/Panels/ReviewPanel.ts
View file @
369d8f09
...
@@ -5,6 +5,8 @@ import Panel from "db://assets/core/Module/Panel";
...
@@ -5,6 +5,8 @@ import Panel from "db://assets/core/Module/Panel";
import
{
showPanel
,
showShareGuide
}
from
"db://assets/core/Module/UIFast"
;
import
{
showPanel
,
showShareGuide
}
from
"db://assets/core/Module/UIFast"
;
import
{
MainGame
}
from
"db://assets/Scripts/Scenes/MainGame/MainGame"
;
import
{
MainGame
}
from
"db://assets/Scripts/Scenes/MainGame/MainGame"
;
import
{
FailPage
}
from
"db://assets/Scripts/Panels/FailPage"
;
import
{
FailPage
}
from
"db://assets/Scripts/Panels/FailPage"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
import
{
_asyncThrottle
}
from
"db://assets/Scripts/Utils/Utils"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -42,14 +44,15 @@ export class ReviewPanel extends Panel {
...
@@ -42,14 +44,15 @@ export class ReviewPanel extends Panel {
super
.
hidePanel
();
super
.
hidePanel
();
}
}
cancel
=
()
=>
{
cancel
=
_asyncThrottle
(
()
=>
{
this
.
hidePanel
();
this
.
hidePanel
();
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
);
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
);
showPanel
(
FailPag
e
);
gameStore
.
submit
(
fals
e
);
}
}
)
ok
=
()
=>
{
ok
=
_asyncThrottle
(
()
=>
{
const
{
type
}
=
this
.
data
;
const
{
type
}
=
this
.
data
;
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
);
if
(
type
==
"share"
)
{
if
(
type
==
"share"
)
{
showShareGuide
();
showShareGuide
();
...
@@ -62,8 +65,7 @@ export class ReviewPanel extends Panel {
...
@@ -62,8 +65,7 @@ export class ReviewPanel extends Panel {
}
}
AudioMgr
.
ins
.
playOneShot
(
AudioClipName
.
button_ok
);
})
}
}
}
...
...
assets/Scripts/Scenes/MainGame/MainGame.ts
View file @
369d8f09
...
@@ -8,6 +8,7 @@ import { RoleCarColorsSysterm } from "db://assets/CarColorsGame/Scrips/Systerms/
...
@@ -8,6 +8,7 @@ import { RoleCarColorsSysterm } from "db://assets/CarColorsGame/Scrips/Systerms/
import
{
CarCarColorsSysterm
}
from
"db://assets/CarColorsGame/Scrips/Systerms/CarCarColorsSysterm"
;
import
{
CarCarColorsSysterm
}
from
"db://assets/CarColorsGame/Scrips/Systerms/CarCarColorsSysterm"
;
import
{
SuccessPage
}
from
"db://assets/Scripts/Panels/SuccessPage"
;
import
{
SuccessPage
}
from
"db://assets/Scripts/Panels/SuccessPage"
;
import
{
PlatformManager
}
from
"db://assets/ScriptFrame/Frame/platformManager"
;
import
{
PlatformManager
}
from
"db://assets/ScriptFrame/Frame/platformManager"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -19,8 +20,6 @@ export class MainGame extends Scene {
...
@@ -19,8 +20,6 @@ export class MainGame extends Scene {
static
skin
:
string
=
"MainGame"
;
static
skin
:
string
=
"MainGame"
;
static
bundle
:
string
=
"MainGame"
;
static
bundle
:
string
=
"MainGame"
;
level
:
number
=
0
;
@
property
(
Node
)
gamePre
:
Node
=
null
;
@
property
(
Node
)
gamePre
:
Node
=
null
;
@
property
(
Node
)
parkPoints
:
Node
=
null
;
@
property
(
Node
)
parkPoints
:
Node
=
null
;
...
@@ -47,10 +46,10 @@ export class MainGame extends Scene {
...
@@ -47,10 +46,10 @@ export class MainGame extends Scene {
showPre
()
{
showPre
()
{
this
.
gamePre
.
active
=
true
;
this
.
gamePre
.
active
=
true
;
const
isLevel1
=
this
.
level
===
1
;
const
isLevel1
=
gameStore
.
startInfo
.
level
===
1
;
this
.
gamePre
.
getChildByName
(
"第二关"
).
active
=
!
isLevel1
;
this
.
gamePre
.
getChildByName
(
"第二关"
).
active
=
!
isLevel1
;
this
.
gamePre
.
getChildByName
(
"第一关"
).
active
=
isLevel1
;
this
.
gamePre
.
getChildByName
(
"第一关"
).
active
=
isLevel1
;
this
.
gamePre
.
getChildByName
(
"txt"
).
getComponent
(
Label
).
string
=
`第
${
this
.
level
}
关`
;
this
.
gamePre
.
getChildByName
(
"txt"
).
getComponent
(
Label
).
string
=
`第
${
gameStore
.
startInfo
.
level
}
关`
;
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
gamePre
.
active
=
false
;
this
.
gamePre
.
active
=
false
;
},
2
);
},
2
);
...
@@ -108,22 +107,25 @@ export class MainGame extends Scene {
...
@@ -108,22 +107,25 @@ export class MainGame extends Scene {
}
}
async
nextLevel
()
{
async
nextLevel
()
{
if
(
this
.
level
>=
5
)
{
if
(
gameStore
.
startInfo
.
level
>=
5
)
{
showPanel
(
SuccessPag
e
);
gameStore
.
submit
(
tru
e
);
return
;
return
;
}
}
this
.
level
++
;
if
(
gameStore
.
startInfo
.
level
!=
0
)
{
gameStore
.
middleSubmit
();
}
gameStore
.
startInfo
.
level
++
;
this
.
showPre
();
this
.
showPre
();
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
clearAll
();
CarColorsGlobalInstance
.
instance
.
roleSysterm
.
clearAll
();
CarColorsGlobalInstance
.
instance
.
carSysterm
.
clearAll
();
CarColorsGlobalInstance
.
instance
.
carSysterm
.
clearAll
();
const
level
=
await
new
Promise
<
Prefab
>
((
resolve
)
=>
{
const
level
=
await
new
Promise
<
Prefab
>
((
resolve
)
=>
{
assetManager
.
getBundle
(
"MainGame"
)
assetManager
.
getBundle
(
"MainGame"
)
.
load
(
`Levels/level
${
this
.
level
}
`
,
Prefab
,
(
err
,
prefab
:
Prefab
)
=>
{
.
load
(
`Levels/level
${
gameStore
.
startInfo
.
level
}
`
,
Prefab
,
(
err
,
prefab
:
Prefab
)
=>
{
if
(
err
)
{
if
(
err
)
{
resolve
(
null
);
resolve
(
null
);
return
;
return
;
...
...
assets/Scripts/store/gameStore.ts
View file @
369d8f09
...
@@ -5,12 +5,14 @@ import { creditsCost, sendWebNet, WebNetName } from "db://assets/Scripts/Utils/W
...
@@ -5,12 +5,14 @@ import { creditsCost, sendWebNet, WebNetName } from "db://assets/Scripts/Utils/W
const
{
makeAutoObservable
}
=
mobx
;
const
{
makeAutoObservable
}
=
mobx
;
export
interface
IStartInfo
{
export
interface
IStartInfo
{
level
:
number
,
startId
:
string
,
startId
:
string
,
}
}
class
GameStore
{
class
GameStore
{
startInfo
:
IStartInfo
=
{
startInfo
:
IStartInfo
=
{
level
:
0
,
startId
:
""
,
startId
:
""
,
}
}
...
@@ -31,6 +33,7 @@ class GameStore {
...
@@ -31,6 +33,7 @@ class GameStore {
if
(
!
success
)
return
false
;
if
(
!
success
)
return
false
;
this
.
startInfo
=
data
;
this
.
startInfo
=
data
;
this
.
startInfo
.
level
=
0
;
return
success
;
return
success
;
}
}
...
@@ -51,11 +54,11 @@ class GameStore {
...
@@ -51,11 +54,11 @@ class GameStore {
async
middleSubmit
()
{
async
middleSubmit
()
{
const
{
startId
}
=
this
.
startInfo
;
const
{
startId
,
level
}
=
this
.
startInfo
;
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
middleSubmit
,
{
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
middleSubmit
,
{
startId
,
startId
,
level
:
1
,
level
,
});
});
if
(
!
success
)
return
false
;
if
(
!
success
)
return
false
;
...
@@ -63,13 +66,13 @@ class GameStore {
...
@@ -63,13 +66,13 @@ class GameStore {
this
.
startInfo
=
data
;
this
.
startInfo
=
data
;
}
}
async
submit
()
{
async
submit
(
suc
:
boolean
)
{
const
{
startId
}
=
this
.
startInfo
;
const
{
startId
,
level
}
=
this
.
startInfo
;
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
middleSubmit
,
{
const
{
success
,
data
}
=
await
sendWebNet
(
WebNetName
.
middleSubmit
,
{
startId
,
startId
,
level
:
1
,
level
:
suc
?
level
:
level
-
1
,
});
});
if
(
!
success
)
return
false
;
if
(
!
success
)
return
false
;
...
...
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