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
db2d8dc5
Commit
db2d8dc5
authored
Jun 05, 2025
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
af43633d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
78 deletions
+88
-78
Car10.prefab
assets/Bundles/MainGame/prefab/Car10.prefab
+5
-5
Car4.prefab
assets/Bundles/MainGame/prefab/Car4.prefab
+4
-4
Car6.prefab
assets/Bundles/MainGame/prefab/Car6.prefab
+4
-4
Car8.prefab
assets/Bundles/MainGame/prefab/Car8.prefab
+5
-5
CarCarColorsComponent.ts
...ripts/Scenes/MainGame/Components/CarCarColorsComponent.ts
+19
-8
CarCarColorsSysterm.ts
...s/Scripts/Scenes/MainGame/Systerms/CarCarColorsSysterm.ts
+49
-44
RoleCarColorsSysterm.ts
.../Scripts/Scenes/MainGame/Systerms/RoleCarColorsSysterm.ts
+2
-8
No files found.
assets/Bundles/MainGame/prefab/Car10.prefab
View file @
db2d8dc5
...
@@ -2751,13 +2751,13 @@
...
@@ -2751,13 +2751,13 @@
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": 0,
"y": 0,
"z":
-0.05
"z":
0
},
},
"_size": {
"_size": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 1.
2
,
"x": 1.
176
,
"y": 1,
"y": 1,
"z": 4
"z": 4
.171
},
},
"_id": ""
"_id": ""
},
},
...
@@ -2843,7 +2843,7 @@
...
@@ -2843,7 +2843,7 @@
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
},
},
{
{
"__uuid__": "
4d88ad28-d740-4f52-8b92-8b84bb1a8087@e114f
",
"__uuid__": "
20730933-a375-49d7-9d0d-5ff3804cd768
",
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
}
}
],
],
...
@@ -2978,7 +2978,7 @@
...
@@ -2978,7 +2978,7 @@
},
},
"_materials": [
"_materials": [
{
{
"__uuid__": "
4d88ad28-d740-4f52-8b92-8b84bb1a8087@e114f
",
"__uuid__": "
20730933-a375-49d7-9d0d-5ff3804cd768
",
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
}
}
],
],
...
...
assets/Bundles/MainGame/prefab/Car4.prefab
View file @
db2d8dc5
...
@@ -1638,13 +1638,13 @@
...
@@ -1638,13 +1638,13 @@
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": 0,
"y": 0,
"z": 0
.06
"z": 0
},
},
"_size": {
"_size": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 1.2,
"x": 1.2
4
,
"y": 1,
"y": 1,
"z":
2.8
"z":
3.289
},
},
"_id": ""
"_id": ""
},
},
...
@@ -1724,7 +1724,7 @@
...
@@ -1724,7 +1724,7 @@
},
},
"_materials": [
"_materials": [
{
{
"__uuid__": "
a6c4d563-2f30-4a18-9d91-80eff8639cac@ca88e
",
"__uuid__": "
0d2472bd-75d4-4674-8107-8db3d902af00
",
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
}
}
],
],
...
...
assets/Bundles/MainGame/prefab/Car6.prefab
View file @
db2d8dc5
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": 0,
"y": 0,
"z": 0.2
87
"z": 0.2
15
}
}
},
},
{
{
...
@@ -1886,13 +1886,13 @@
...
@@ -1886,13 +1886,13 @@
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": 0,
"y": 0,
"z": 0
.06
"z": 0
},
},
"_size": {
"_size": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 1.
2
,
"x": 1.
156
,
"y": 1,
"y": 1,
"z": 2.
8
"z": 2.
622
},
},
"_id": ""
"_id": ""
},
},
...
...
assets/Bundles/MainGame/prefab/Car8.prefab
View file @
db2d8dc5
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": 0,
"y": 0,
"z": 0.
61
"z": 0.
585
}
}
},
},
{
{
...
@@ -2162,9 +2162,9 @@
...
@@ -2162,9 +2162,9 @@
},
},
"_size": {
"_size": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 1.
2
,
"x": 1.
134
,
"y": 1,
"y": 1,
"z": 3.2
"z": 3.2
22
},
},
"_id": ""
"_id": ""
},
},
...
@@ -2250,7 +2250,7 @@
...
@@ -2250,7 +2250,7 @@
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
},
},
{
{
"__uuid__": "
8e9c0e2b-bb1f-424d-bbe2-b63e83bea2db@e114f
",
"__uuid__": "
bf332ea3-76ec-4a94-81d6-bb2928080508
",
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
}
}
],
],
...
@@ -2385,7 +2385,7 @@
...
@@ -2385,7 +2385,7 @@
},
},
"_materials": [
"_materials": [
{
{
"__uuid__": "
8e9c0e2b-bb1f-424d-bbe2-b63e83bea2db@e114f
",
"__uuid__": "
bf332ea3-76ec-4a94-81d6-bb2928080508
",
"__expectedType__": "cc.Material"
"__expectedType__": "cc.Material"
}
}
],
],
...
...
assets/Scripts/Scenes/MainGame/Components/CarCarColorsComponent.ts
View file @
db2d8dc5
import
{
_decorator
,
color
,
Color
,
Component
,
Enum
,
find
,
Material
,
MeshRenderer
,
Node
,
tween
,
Vec3
}
from
'cc'
;
import
{
_decorator
,
BoxCollider
,
color
,
Color
,
Component
,
Enum
,
find
,
Material
,
MeshRenderer
,
Node
,
tween
,
Vec3
}
from
'cc'
;
import
{
CarColors
,
CarTypes
}
from
'../CarColorsGlobalTypes'
;
import
{
CarColors
,
CarTypes
}
from
'../CarColorsGlobalTypes'
;
import
{
RoleCarColorsComponent
}
from
'./RoleCarColorsComponent'
;
import
{
RoleCarColorsComponent
}
from
'./RoleCarColorsComponent'
;
import
{
CarColorsGlobalInstance
}
from
'../CarColorsGlobalInstance'
;
import
{
CarColorsGlobalInstance
}
from
'../CarColorsGlobalInstance'
;
...
@@ -33,6 +46,9 @@ export class CarCarColorsComponent extends Component {
...
@@ -33,6 +46,9 @@ export class CarCarColorsComponent extends Component {
@
property
(
MeshRenderer
)
bodyMesh
:
MeshRenderer
=
null
@
property
(
MeshRenderer
)
bodyMesh
:
MeshRenderer
=
null
@
property
(
MeshRenderer
)
top
:
MeshRenderer
=
null
@
property
(
MeshRenderer
)
top
:
MeshRenderer
=
null
get
sitNum
()
{
return
this
.
node
.
getChildByName
(
"Seets"
).
children
.
length
;
}
halfLen
:
number
=
2
halfLen
:
number
=
2
...
@@ -43,12 +59,7 @@ export class CarCarColorsComponent extends Component {
...
@@ -43,12 +59,7 @@ export class CarCarColorsComponent extends Component {
onLoad
()
{
onLoad
()
{
this
.
changeColor
()
this
.
changeColor
()
if
(
this
.
carType
===
CarTypes
.
CAR8
)
{
this
.
halfLen
=
this
.
getComponent
(
BoxCollider
).
size
.
z
/
2
;
this
.
halfLen
=
1.6
}
else
if
(
this
.
carType
===
CarTypes
.
CAR6
)
{
this
.
halfLen
=
1.4
}
this
.
roleNum
=
0
this
.
roleNum
=
0
this
.
isFull
=
false
this
.
isFull
=
false
}
}
...
@@ -95,7 +106,7 @@ export class CarCarColorsComponent extends Component {
...
@@ -95,7 +106,7 @@ export class CarCarColorsComponent extends Component {
this
.
tweenCount
+=
1
this
.
tweenCount
+=
1
this
.
roleNum
+=
1
this
.
roleNum
+=
1
this
.
isFull
=
this
.
roleNum
>=
this
.
node
.
getChildByName
(
"Seets"
).
children
.
length
;
this
.
isFull
=
this
.
roleNum
>=
this
.
sitNum
;
return
this
.
isFull
return
this
.
isFull
}
}
...
...
assets/Scripts/Scenes/MainGame/Systerms/CarCarColorsSysterm.ts
View file @
db2d8dc5
...
@@ -18,28 +18,20 @@ export class CarCarColorsSysterm extends Component {
...
@@ -18,28 +18,20 @@ export class CarCarColorsSysterm extends Component {
checkBoxInter
:
number
=
10
// 每10帧检测一次
checkBoxInter
:
number
=
10
// 每10帧检测一次
addCar
(
node
:
Node
)
{
addCar
(
node
:
Node
)
{
const
carBoxCom
=
node
.
getComponent
(
CarBoxComponent
)
const
carBoxCom
=
node
.
getComponent
(
CarBoxComponent
)
;
if
(
carBoxCom
)
{
if
(
carBoxCom
)
{
this
.
checkBoxInter
=
10
this
.
checkBoxInter
=
10
;
this
.
carBoxMap
.
push
(
carBoxCom
)
this
.
carBoxMap
.
push
(
carBoxCom
)
;
node
.
getChildByName
(
"cars"
).
children
.
forEach
((
car
)
=>
{
node
.
getChildByName
(
"cars"
).
children
.
forEach
((
car
)
=>
{
car
.
active
=
false
car
.
active
=
false
;
this
.
addCar
(
car
)
this
.
addCar
(
car
)
;
})
})
;
return
return
;
}
}
this
.
activeCar
.
set
(
node
.
uuid
,
node
)
this
.
activeCar
.
set
(
node
.
uuid
,
node
);
const
color
=
node
.
getComponent
(
CarCarColorsComponent
).
carColor
let
{
carColor
,
sitNum
}
=
node
.
getComponent
(
CarCarColorsComponent
);
const
carType
=
node
.
getComponent
(
CarCarColorsComponent
).
carType
for
(;
sitNum
--
;)
{
let
len
=
10
this
.
carSeats
.
push
(
carColor
);
if
(
carType
===
CarTypes
.
CAR8
)
{
len
=
8
}
else
if
(
carType
===
CarTypes
.
CAR6
)
{
len
=
6
}
for
(;
len
--
;)
{
this
.
carSeats
.
push
(
color
)
}
}
}
}
...
@@ -58,52 +50,65 @@ export class CarCarColorsSysterm extends Component {
...
@@ -58,52 +50,65 @@ export class CarCarColorsSysterm extends Component {
}
}
refreshCar
()
{
refreshCar
()
{
const
cars
=
find
(
"Scene/Levels"
).
children
[
0
].
children
const
cars
=
find
(
"Scene/Levels"
).
children
[
0
].
children
;
const
car4s
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
cars
:
[],
colors
:
[],
};
const
miniCars
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
const
miniCars
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
cars
:
[],
cars
:
[],
colors
:
[]
colors
:
[]
,
}
}
;
const
middleCars
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
const
middleCars
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
cars
:
[],
cars
:
[],
colors
:
[]
colors
:
[]
,
}
}
;
const
bigCars
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
const
bigCars
:
{
cars
:
Array
<
Node
>
,
colors
:
Array
<
CarColors
>
}
=
{
cars
:
[],
cars
:
[],
colors
:
[]
colors
:
[]
,
}
}
;
cars
.
forEach
(
car
=>
{
cars
.
forEach
(
car
=>
{
const
carCom
=
car
.
getComponent
(
CarCarColorsComponent
)
const
carCom
=
car
.
getComponent
(
CarCarColorsComponent
);
if
(
!
carCom
)
return
if
(
!
carCom
)
return
;
if
(
carCom
.
carType
===
CarTypes
.
CAR4
)
{
car4s
.
cars
.
push
(
car
);
car4s
.
colors
.
push
(
carCom
.
carColor
);
return
;
}
if
(
carCom
.
carType
===
CarTypes
.
CAR6
)
{
if
(
carCom
.
carType
===
CarTypes
.
CAR6
)
{
miniCars
.
cars
.
push
(
car
)
miniCars
.
cars
.
push
(
car
)
;
miniCars
.
colors
.
push
(
carCom
.
carColor
)
miniCars
.
colors
.
push
(
carCom
.
carColor
)
;
return
return
;
}
}
if
(
carCom
.
carType
===
CarTypes
.
CAR8
)
{
if
(
carCom
.
carType
===
CarTypes
.
CAR8
)
{
middleCars
.
cars
.
push
(
car
)
middleCars
.
cars
.
push
(
car
)
;
middleCars
.
colors
.
push
(
carCom
.
carColor
)
middleCars
.
colors
.
push
(
carCom
.
carColor
)
;
return
return
;
}
}
if
(
carCom
.
carType
===
CarTypes
.
CAR10
)
{
if
(
carCom
.
carType
===
CarTypes
.
CAR10
)
{
bigCars
.
cars
.
push
(
car
)
bigCars
.
cars
.
push
(
car
)
;
bigCars
.
colors
.
push
(
carCom
.
carColor
)
bigCars
.
colors
.
push
(
carCom
.
carColor
)
;
return
return
;
}
}
})
})
;
car4s
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
miniCars
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
miniCars
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
middleCars
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
middleCars
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
bigCars
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
bigCars
.
colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
car4s
.
cars
.
forEach
((
car
,
index
)
=>
{
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
car4s
.
colors
[
index
];
});
miniCars
.
cars
.
forEach
((
car
,
index
)
=>
{
miniCars
.
cars
.
forEach
((
car
,
index
)
=>
{
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
miniCars
.
colors
[
index
]
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
miniCars
.
colors
[
index
]
;
})
})
;
middleCars
.
cars
.
forEach
((
car
,
index
)
=>
{
middleCars
.
cars
.
forEach
((
car
,
index
)
=>
{
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
middleCars
.
colors
[
index
]
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
middleCars
.
colors
[
index
]
;
})
})
;
bigCars
.
cars
.
forEach
((
car
,
index
)
=>
{
bigCars
.
cars
.
forEach
((
car
,
index
)
=>
{
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
bigCars
.
colors
[
index
]
car
.
getComponent
(
CarCarColorsComponent
).
carColor
=
bigCars
.
colors
[
index
]
;
})
})
;
}
}
checkCarBox
()
{
checkCarBox
()
{
...
...
assets/Scripts/Scenes/MainGame/Systerms/RoleCarColorsSysterm.ts
View file @
db2d8dc5
...
@@ -17,7 +17,7 @@ import { CarCarColorsComponent } from '../Components/CarCarColorsComponent';
...
@@ -17,7 +17,7 @@ import { CarCarColorsComponent } from '../Components/CarCarColorsComponent';
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
AudioClipName
,
AudioMgr
}
from
"db://assets/core/base/AudioMgr"
;
import
{
showPanel
}
from
"db://assets/core/Module/UIFast"
;
import
{
showPanel
}
from
"db://assets/core/Module/UIFast"
;
import
{
ReviewPanel
}
from
"db://assets/Scripts/Panels/ReviewPanel"
;
import
{
ReviewPanel
}
from
"db://assets/Scripts/Panels/ReviewPanel"
;
import
{
CarColors
,
CarTypes
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalTypes"
;
import
{
CarColors
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalTypes"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
{
CarColorsGlobalInstance
}
from
"db://assets/Scripts/Scenes/MainGame/CarColorsGlobalInstance"
;
import
{
MainGame
}
from
"db://assets/Scripts/Scenes/MainGame/MainGame"
;
import
{
MainGame
}
from
"db://assets/Scripts/Scenes/MainGame/MainGame"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
import
gameStore
from
"db://assets/Scripts/store/gameStore"
;
...
@@ -90,14 +90,8 @@ export class RoleCarColorsSysterm extends Component {
...
@@ -90,14 +90,8 @@ export class RoleCarColorsSysterm extends Component {
for
(
let
i
=
cars
.
length
;
i
--
;){
for
(
let
i
=
cars
.
length
;
i
--
;){
const
car
=
cars
[
i
]
const
car
=
cars
[
i
]
const
carComp
=
car
.
getComponent
(
CarCarColorsComponent
)
const
carComp
=
car
.
getComponent
(
CarCarColorsComponent
)
let
num
=
10
let
num
=
carComp
.
sitNum
;
if
(
carComp
.
carType
===
CarTypes
.
CAR8
){
num
=
8
}
else
if
(
carComp
.
carType
===
CarTypes
.
CAR6
){
num
=
6
}
num
-=
carComp
.
roleNum
num
-=
carComp
.
roleNum
console
.
log
(
num
)
for
(;
num
--
;){
for
(;
num
--
;){
// console.log(num)
// console.log(num)
colors
.
push
(
carComp
.
carColor
)
colors
.
push
(
carComp
.
carColor
)
...
...
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