Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSIWB2504
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
SSIWB2504
Commits
8e21a80f
Commit
8e21a80f
authored
Aug 04, 2025
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(游戏模式): 添加双人模式选项支持
parent
d8d7b044
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
13 deletions
+29
-13
form.component.html
src/app/form/form.component.html
+17
-0
form.component.ts
src/app/form/form.component.ts
+1
-0
interfaces.ts
src/app/play/interfaces.ts
+2
-1
play.component.ts
src/app/play/play.component.ts
+9
-12
No files found.
src/app/form/form.component.html
View file @
8e21a80f
...
@@ -98,6 +98,23 @@
...
@@ -98,6 +98,23 @@
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 游戏模式选择区 -->
<div
class=
"border-dashed"
style=
"margin: 20px;width: 1000px;"
>
<div
class=
"word-input-title"
>
<span
style=
"font-size: 20px;"
>
游戏模式:
</span>
</div>
<div
style=
"margin-top: 10px;"
>
<nz-radio-group
[(
ngModel
)]="
item
.
doubleModal
"
(
ngModelChange
)="
ngChange
()"
>
<label
nz-radio
[
nzValue
]="
false
"
>
<span
[
style
]="{
color:
!
item
.
doubleModal
?
'#
169BD5
'
:
'#
000
'}"
>
单人模式
</span>
</label>
<label
nz-radio
[
nzValue
]="
true
"
>
<span
[
style
]="{
color:item
.
doubleModal
?
'#
169BD5
'
:
'#
000
'}"
>
双人模式
</span>
</label>
</nz-radio-group>
</div>
</div>
</div>
</div>
<div
style=
"padding: 10px;background-color: #fff;display:none"
>
<div
style=
"padding: 10px;background-color: #fff;display:none"
>
<!-- 标题区 -->
<!-- 标题区 -->
...
...
src/app/form/form.component.ts
View file @
8e21a80f
...
@@ -20,6 +20,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
...
@@ -20,6 +20,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
questionType
:
"
read
"
,
questionType
:
"
read
"
,
questionTextAudio
:
""
,
questionTextAudio
:
""
,
bgAudio
:
""
,
bgAudio
:
""
,
doubleModal
:
false
,
// 游戏模式:false为单人模式,true为双人模式
questions
:
[],
questions
:
[],
};
};
...
...
src/app/play/interfaces.ts
View file @
8e21a80f
...
@@ -32,6 +32,7 @@ export interface FormData {
...
@@ -32,6 +32,7 @@ export interface FormData {
score
:
number
;
score
:
number
;
/** 标题 */
/** 标题 */
title
:
string
;
title
:
string
;
doubleModal
:
boolean
;
/** 问题文本 */
/** 问题文本 */
questionText
:
string
;
questionText
:
string
;
/** 问题类型 */
/** 问题类型 */
...
@@ -72,4 +73,4 @@ export interface Position {
...
@@ -72,4 +73,4 @@ export interface Position {
export
interface
PositionMap
{
export
interface
PositionMap
{
/** 键为问题数量,值为位置数组 */
/** 键为问题数量,值为位置数组 */
[
key
:
string
]:
Position
[];
[
key
:
string
]:
Position
[];
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
8e21a80f
...
@@ -49,6 +49,7 @@ import { FormData, Position, PositionMap } from './interfaces';
...
@@ -49,6 +49,7 @@ import { FormData, Position, PositionMap } from './interfaces';
let
defaultFormData
:
FormData
=
{
let
defaultFormData
:
FormData
=
{
"
score
"
:
0
,
"
score
"
:
0
,
"
title
"
:
""
,
"
title
"
:
""
,
"
doubleModal
"
:
false
,
"
questionText
"
:
""
,
"
questionType
"
:
"
read
"
,
"
questionTextAudio
"
:
""
,
"
questionText
"
:
""
,
"
questionType
"
:
"
read
"
,
"
questionTextAudio
"
:
""
,
"
bgAudio
"
:
""
,
"
bgAudio
"
:
""
,
"
questions
"
:
[
"
questions
"
:
[
...
@@ -397,7 +398,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -397,7 +398,6 @@ export class PlayComponent implements OnInit, OnDestroy {
console
.
log
(
'
当前选中项目:
'
,
this
.
selectList
);
console
.
log
(
'
当前选中项目:
'
,
this
.
selectList
);
}
}
initPageTitle
()
{
initPageTitle
()
{
// 创建标题背景图片元素
// 创建标题背景图片元素
const
titleBgElement
=
this
.
g_cartoon
.
createCartoonElement
(
'
page_title_bg
'
,
'
MySprite
'
);
const
titleBgElement
=
this
.
g_cartoon
.
createCartoonElement
(
'
page_title_bg
'
,
'
MySprite
'
);
...
@@ -485,11 +485,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -485,11 +485,6 @@ export class PlayComponent implements OnInit, OnDestroy {
// 渲染按钮
// 渲染按钮
this
.
render
(
checkBtnElement
.
ref
,
zIndexMap
.
card
+
2
);
this
.
render
(
checkBtnElement
.
ref
,
zIndexMap
.
card
+
2
);
}
}
/**
* 更新检查按钮状态
* 根据selectList的长度更新按钮显示
*/
updateCheckBtnState
()
{
updateCheckBtnState
()
{
if
(
this
.
checkBtnElement
)
{
if
(
this
.
checkBtnElement
)
{
if
(
this
.
selectList
.
length
>=
2
)
{
if
(
this
.
selectList
.
length
>=
2
)
{
...
@@ -501,7 +496,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -501,7 +496,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
}
}
}
}
initListItem
()
{
initListItem
()
{
// 获取questions数据
// 获取questions数据
const
questions
=
this
.
g_formData
.
questions
||
[];
const
questions
=
this
.
g_formData
.
questions
||
[];
...
@@ -681,12 +675,18 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -681,12 +675,18 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
/**
* 初始化鱼游戏
*/
initFishGame
()
{
initFishGame
()
{
}
}
/**
/**
* 初始化退出按钮
* 初始化退出按钮
* 创建退出按钮并放置在标题背景的最左侧
* 创建退出按钮并放置在标题背景的最左侧
...
@@ -715,10 +715,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -715,10 +715,6 @@ export class PlayComponent implements OnInit, OnDestroy {
});
});
}
}
/**
/**
* 订阅元素的移动事件
* 订阅元素的移动事件
* 将元素ID添加到移动元素数组中,使其能够随场景移动
* 将元素ID添加到移动元素数组中,使其能够随场景移动
...
@@ -915,6 +911,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -915,6 +911,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_formData
=
{
this
.
g_formData
=
{
score
:
0
,
score
:
0
,
title
:
''
,
title
:
''
,
doubleModal
:
false
,
questionText
:
''
,
questionText
:
''
,
questionType
:
''
,
questionType
:
''
,
questionTextAudio
:
''
,
questionTextAudio
:
''
,
...
...
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