Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dg18_tianci
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
dg18_tianci
Commits
50ca08f1
Commit
50ca08f1
authored
Jan 26, 2026
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加聚合组概念
parent
f34552a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
7 deletions
+33
-7
dg18_tianci.ts
assets/dg18_tianci/scene/dg18_tianci.ts
+17
-7
Unit.ts
form/src/app/common/custom-hot-zone/Unit.ts
+1
-0
custom-hot-zone.component.html
...app/common/custom-hot-zone/custom-hot-zone.component.html
+12
-0
custom-hot-zone.component.ts
...c/app/common/custom-hot-zone/custom-hot-zone.component.ts
+3
-0
No files found.
assets/dg18_tianci/scene/dg18_tianci.ts
View file @
50ca08f1
...
...
@@ -295,13 +295,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
!
isIn
)
{
this
.
onMeetFail
(
node
);
}
else
{
// 未碰撞到
// 判定碰撞坐标和区域
let
{
targetData
,
targetItem
}
=
this
.
checkSuccess
(
node
)
let
{
targetData
,
targetItem
}
=
this
.
checkSuccess
(
node
)
;
if
(
!
targetData
)
{
this
.
onMeetFail
(
node
);
}
else
{
if
(
node
.
data
.
text
!=
targetData
.
text
)
{
let
targetGroup
=
(
targetData
.
aggregationGroup
!=
null
&&
targetData
.
aggregationGroup
>
0
)
?
targetData
.
aggregationGroup
:
0
;
let
nodeGroup
=
(
node
.
data
.
aggregationGroup
!=
null
&&
node
.
data
.
aggregationGroup
>
0
)
?
node
.
data
.
aggregationGroup
:
0
;
let
isMatch
=
false
;
if
(
targetGroup
===
0
)
{
// 无聚合组:必须文本与槽位完全对应
isMatch
=
(
node
.
data
.
text
===
targetData
.
text
);
}
else
{
// 有聚合组:只要拖放的单词属于该组,且槽位属于同一组即可(同组内位置可互换)
isMatch
=
(
nodeGroup
===
targetGroup
);
}
if
(
!
isMatch
)
{
this
.
onMeetFail
(
node
);
}
else
{
targetItem
.
active
=
false
;
...
...
@@ -311,23 +320,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
// 检测碰撞
成功需要重新编写
// 检测碰撞
:找到距离最近的、尚未被占用的目标槽位
checkSuccess
(
node
)
{
// 左上角坐标
let
targetData
=
null
;
let
targetItem
=
null
;
let
minDis
=
999999
;
let
items
=
this
.
layout_target
.
children
;
items
.
forEach
((
item
,
i
)
=>
{
if
(
!
item
.
active
)
return
;
// 已占用的槽位不再参与匹配
let
data
=
item
.
data
;
if
(
!
data
)
return
;
let
dis
=
this
.
getDistances
(
item
,
node
);
if
(
dis
<
100
&&
dis
<
minDis
)
{
minDis
=
dis
;
targetData
=
data
;
targetItem
=
item
;
}
})
return
{
targetData
,
targetItem
}
})
;
return
{
targetData
,
targetItem
}
;
}
private
changepoints
(
data
,
bgImg
)
{
...
...
form/src/app/common/custom-hot-zone/Unit.ts
View file @
50ca08f1
...
...
@@ -1956,6 +1956,7 @@ export class HotZoneItem extends MySprite {
audio_url
;
pic_url
;
text
;
aggregationGroup
:
number
=
0
;
private
_itemType
;
private
shapeRect
:
ShapeRect
;
...
...
form/src/app/common/custom-hot-zone/custom-hot-zone.component.html
View file @
50ca08f1
...
...
@@ -41,6 +41,18 @@
</nz-radio-group>
</div>
<div
style=
"margin-top: 5px; margin-bottom: 5px"
>
<span>
聚合组:
</span>
<nz-select
style=
"width: 100%;"
[(
ngModel
)]="
it
.
aggregationGroup
"
nzPlaceHolder=
"选择聚合组"
>
<nz-option
[
nzValue
]="
0
"
nzLabel=
"不聚合"
></nz-option>
<nz-option
[
nzValue
]="
1
"
nzLabel=
"聚合组1"
></nz-option>
<nz-option
[
nzValue
]="
2
"
nzLabel=
"聚合组2"
></nz-option>
<nz-option
[
nzValue
]="
3
"
nzLabel=
"聚合组3"
></nz-option>
<nz-option
[
nzValue
]="
4
"
nzLabel=
"聚合组4"
></nz-option>
<nz-option
[
nzValue
]="
5
"
nzLabel=
"聚合组5"
></nz-option>
</nz-select>
</div>
<div
*
ngIf=
"it.itemType == 'pic'"
>
<app-upload-image-with-preview
[
picUrl
]="
it
?.
pic_url
"
...
...
form/src/app/common/custom-hot-zone/custom-hot-zone.component.ts
View file @
50ca08f1
...
...
@@ -249,6 +249,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
item
.
y
=
this
.
canvasHeight
/
2
;
item
.
itemType
=
this
.
defaultItemType
;
item
.
aggregationGroup
=
saveData
&&
saveData
.
aggregationGroup
!=
null
?
saveData
.
aggregationGroup
:
0
;
if
(
saveData
)
{
...
...
@@ -449,6 +450,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
item
.
pic_url
=
data
.
pic_url
;
item
.
text
=
data
.
text
;
item
.
itemType
=
data
.
itemType
;
item
.
aggregationGroup
=
data
.
aggregationGroup
!=
null
?
data
.
aggregationGroup
:
0
;
this
.
refreshItem
(
item
);
console
.
log
(
'
item:
'
,
item
);
...
...
@@ -875,6 +877,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
text
:
hotZoneArr
[
i
].
text
,
audio_url
:
hotZoneArr
[
i
].
audio_url
,
itemType
:
hotZoneArr
[
i
].
itemType
,
aggregationGroup
:
hotZoneArr
[
i
].
aggregationGroup
!=
null
?
hotZoneArr
[
i
].
aggregationGroup
:
0
,
fontSize
:
this
.
hotZoneFontObj
.
size
,
fontName
:
this
.
hotZoneFontObj
.
name
,
fontColor
:
this
.
hotZoneFontObj
.
color
,
...
...
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