Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dg10_ty
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
dg10_ty
Commits
5b9a217b
Commit
5b9a217b
authored
Oct 01, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏完成
parent
dd7329ff
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2194 additions
and
642 deletions
+2194
-642
dg08_hx.fire
assets/dg08_hx/scene/dg08_hx.fire
+2029
-334
dg08_hx.ts
assets/dg08_hx/scene/dg08_hx.ts
+92
-241
Game.ts
assets/dg08_hx/scene/tool/Game.ts
+47
-41
pg.ts
assets/dg08_hx/scene/tool/pg.ts
+6
-0
defaultData.ts
assets/dg08_hx/script/defaultData.ts
+1
-25
form.component.html
form/src/app/form/form.component.html
+18
-1
form.component.ts
form/src/app/form/form.component.ts
+1
-0
No files found.
assets/dg08_hx/scene/dg08_hx.fire
View file @
5b9a217b
This diff is collapsed.
Click to expand it.
assets/dg08_hx/scene/dg08_hx.ts
View file @
5b9a217b
This diff is collapsed.
Click to expand it.
assets/dg08_hx/scene/tool/Game.ts
View file @
5b9a217b
...
...
@@ -16,17 +16,31 @@ export class Fish {
}
export
class
Option
{
// public type;
public
type
:
string
;
public
image
:
string
;
public
audio
:
string
;
public
text
:
string
;
public
right
:
boolean
;
constructor
(
data
)
{
this
.
type
=
data
.
type
;
this
.
image
=
data
.
image
;
this
.
audio
=
data
.
audio
;
this
.
text
=
data
.
text
;
this
.
right
=
data
.
isRight
==
1
;
}
}
export
class
Question
{
public
txt
;
// public picUrl;
public
audioUrl
;
// public right: boolean;
public
data
;
public
id
:
number
;
public
count
:
number
;
public
time
:
number
;
public
touchRight
:
boolean
;
public
parent
;
public
options
:
Array
<
Option
>
;
public
rights
:
Array
<
Option
>
;
constructor
(
data
,
id
)
{
this
.
id
=
id
;
// this.type = data.type;
...
...
@@ -37,6 +51,15 @@ export class Option {
this
.
audioUrl
=
data
.
audio
;
// this.right = data.right;
this
.
touchRight
=
false
;
this
.
rights
=
[];
this
.
options
=
data
.
options
.
map
(
op
=>
new
Option
(
op
))
}
addRight
(
option
)
{
this
.
rights
.
push
(
option
)
}
checkRight
()
{
let
rights
=
this
.
options
.
filter
(
op
=>
op
.
right
);
return
this
.
rights
.
length
>=
rights
.
length
}
}
export
class
Item
{
...
...
@@ -124,7 +147,7 @@ export default class Game {
return
Game
.
ins
;
}
private
data
:
any
;
private
lists
:
Array
<
Op
tion
>
private
lists
:
Array
<
Ques
tion
>
public
player
:
Player
;
public
robot
:
Robot
;
public
state
:
GAME_STATE
;
...
...
@@ -156,61 +179,44 @@ export default class Game {
this
.
data
=
data
.
questions
;
}
public
start
:
boolean
;
public
page
:
number
;
public
idx
:
number
;
reset
()
{
this
.
player
.
reset
();
this
.
robot
.
reset
();
this
.
page
=
1
;
this
.
idx
=
0
;
this
.
start
=
true
;
this
.
lists
=
[];
for
(
let
i
=
0
;
i
<
this
.
data
.
length
;
i
++
)
{
let
data
=
this
.
data
[
i
];
this
.
lists
.
push
(
new
Op
tion
(
data
,
i
+
1
));
this
.
lists
.
push
(
new
Ques
tion
(
data
,
i
+
1
));
}
this
.
state
=
GAME_STATE
.
WAIT
;
this
.
total
=
this
.
lists
.
length
;
}
public
getCardInfo
()
{
let
option
:
Option
=
this
.
lists
.
splice
(
0
,
1
)[
0
];
// if (this.lists.length > 0) {
// let random = Math.floor(Math.random() * this.lists.length);
// option = this.lists.splice(random, 1)[0];
// } else {
// option = null;
// }
console
.
log
(
"
this.cardInfo=======
"
,
option
)
return
option
;
}
// checkSuccess(arr: Option[]) {
// let data = this.getCurrentPage();
// let options = data.optionList.concat();
// options.sort((A, B) => A.id - B.id)
// for (let i = 0; i < options.length; i++) {
// if (arr[i] && arr[i].id != options[i].id) {
// return false;
// }
// }
// return true;
// }
// getDataByPage(page): Item {
// return this.lists.filter(li => li.page == page)[0]
// }
// getCurrentPage(): Item {
// let page = this.page;
// return this.lists.filter(li => li.page == page)[0]
// public getCardInfo() {
// let option: Question = this.lists.splice(0, 1)[0];
// // if (this.lists.length > 0) {
// // let random = Math.floor(Math.random() * this.lists.length);
// // option = this.lists.splice(random, 1)[0];
// // } else {
// // option = null;
// // }
// console.log(" this.cardInfo=======", option)
// return option;
// }
getCurrentPage
():
Question
{
return
this
.
lists
[
this
.
idx
];
}
getTotalPageNum
()
{
return
this
.
lists
.
length
;
}
getCurrentPageNum
()
{
return
this
.
page
;
return
this
.
idx
;
}
addPage
()
{
this
.
page
+=
1
;
this
.
idx
+=
1
;
}
get
getTot
la
()
{
get
getTot
al
()
{
return
this
.
lists
.
length
;
// this.total = 0;
// this.lists.forEach((item) => {
...
...
@@ -219,6 +225,6 @@ export default class Game {
// return this.total;
}
get
isOver
()
{
return
this
.
page
>
this
.
lists
.
length
;
return
this
.
idx
>
this
.
lists
.
length
;
}
}
\ No newline at end of file
assets/dg08_hx/scene/tool/pg.ts
View file @
5b9a217b
...
...
@@ -187,6 +187,12 @@ let pg = {
if
(
!
child
)
return
pg
.
logger
.
w
(
"
findChildByPath error->
"
+
"
找不到此节点,请检查层级路径:
"
+
childPath
);
return
child
;
},
//--------------------坐标转换--------------------------------------
coverPosition
(
sourceNode
,
targetNode
)
{
let
startWorldPos
=
sourceNode
.
convertToWorldSpaceAR
(
cc
.
v2
(
0
,
0
));
let
startPos
=
targetNode
.
convertToNodeSpaceAR
(
startWorldPos
);
return
startPos
;
},
//--------------------触控事件--------------------------------
//添加监听
touchOn
(
item
,
callback
,
target
)
{
...
...
assets/dg08_hx/script/defaultData.ts
View file @
5b9a217b
export
const
defaultData
=
{
"
title
"
:
"
听音选择
"
,
"
questions
"
:
[
{
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3
"
,
"
time
"
:
null
,
"
duration
"
:
""
,
"
audioName
"
:
"
进入下一题.mp3
"
,
"
options
"
:
[
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
apple
"
},
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
banner
"
},
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
pie
"
},
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
test
"
}]
},
{
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3
"
,
"
time
"
:
null
,
"
duration
"
:
""
,
"
audioName
"
:
"
进入下一题.mp3
"
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/07c89b4a6a1a18b0c0a3029720fdfdbc.png
"
,
"
word
"
:
""
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/d20b34eac11f5687d3386389aea170a2.png
"
,
"
word
"
:
""
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/639ada88f3e52966103caca156f720d6.png
"
,
"
word
"
:
""
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/38408b9ce048508830086c5e5cd2f384.png
"
,
"
word
"
:
""
}]
}]
}
\ No newline at end of file
export
const
defaultData
=
{
"
title
"
:
"
听音选择
"
,
"
questions
"
:
[{
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3
"
,
"
time
"
:
null
,
"
duration
"
:
""
,
"
audioName
"
:
"
进入下一题.mp3
"
,
"
options
"
:
[{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
apple
"
,
"
isRight
"
:
"
1
"
},
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
banner
"
,
"
isRight
"
:
"
0
"
},
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
pie
"
,
"
isRight
"
:
"
0
"
},
{
"
type
"
:
"
text
"
,
"
audio
"
:
""
,
"
image
"
:
""
,
"
word
"
:
""
,
"
text
"
:
"
test
"
,
"
isRight
"
:
"
1
"
}]
},
{
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3
"
,
"
time
"
:
null
,
"
duration
"
:
""
,
"
audioName
"
:
"
进入下一题.mp3
"
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/07c89b4a6a1a18b0c0a3029720fdfdbc.png
"
,
"
word
"
:
""
,
"
isRight
"
:
"
0
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/d20b34eac11f5687d3386389aea170a2.png
"
,
"
word
"
:
""
,
"
isRight
"
:
"
0
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/639ada88f3e52966103caca156f720d6.png
"
,
"
word
"
:
""
,
"
isRight
"
:
"
1
"
},
{
"
type
"
:
"
img
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/38408b9ce048508830086c5e5cd2f384.png
"
,
"
word
"
:
""
,
"
isRight
"
:
"
1
"
}]
},
{
"
audio
"
:
""
,
"
time
"
:
null
,
"
duration
"
:
""
,
"
audioName
"
:
""
,
"
options
"
:
[{
"
type
"
:
"
img_text
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/3f36264d6aaa65e578a6d7e261ea8a2e.png
"
,
"
isRight
"
:
"
1
"
,
"
text
"
:
"
fish
"
},
{
"
type
"
:
"
img_text
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/713e3312f1ed1876baf169026654d0c2.png
"
,
"
isRight
"
:
"
0
"
,
"
text
"
:
"
gray
"
},
{
"
type
"
:
"
img_text
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/23290ec65a6700c931105c52aaf4e24c.jpg
"
,
"
isRight
"
:
"
0
"
,
"
text
"
:
"
international
"
},
{
"
type
"
:
"
img_text
"
,
"
audio
"
:
""
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/912b16d5a85e46fa5b0e2b75fb9d6bdf.png
"
,
"
isRight
"
:
"
0
"
,
"
text
"
:
"
break
"
}]
}]
}
\ No newline at end of file
form/src/app/form/form.component.html
View file @
5b9a217b
...
...
@@ -114,7 +114,7 @@
选项类型:
</div>
<div
style=
"margin-top: 5px;"
>
<nz-radio-group
[(
ngModel
)]="
option
.
type
"
>
<nz-radio-group
[(
ngModel
)]="
option
.
type
"
(
ngModelChange
)="
save
()"
>
<label
nz-radio
nzValue=
"img"
>
<span
[
style
]="{
color:option
.
type=
='img'
?
'#
169BD5
'
:
'#
000
'}"
>
图片
</span>
</label>
...
...
@@ -128,6 +128,23 @@
</div>
</div>
<div
style=
"margin-top: 20px;"
>
<div
class=
"word-type-option-title"
>
是否正确:
</div>
<div
style=
"margin-top: 5px;"
>
<nz-radio-group
[(
ngModel
)]="
option
.
isRight
"
(
ngModelChange
)="
save
()"
>
<label
nz-radio
nzValue=
"1"
>
<span
[
style
]="{
color:option
.
isRight=
='1'
?
'#
169BD5
'
:
'#
000
'}"
>
正确
</span>
</label>
<label
nz-radio
nzValue=
"0"
>
<span
[
style
]="{
color:option
.
isRight=
='0'
?
'#
169BD5
'
:
'#
000
'}"
>
错误
</span>
</label>
</nz-radio-group>
</div>
</div>
<div
style=
"margin-top: 25px;"
>
<div
class=
"option-img"
>
<div
*
ngIf=
"option.type=='img' || option.type =='img_text'"
style=
"width: 200px;"
>
...
...
form/src/app/form/form.component.ts
View file @
5b9a217b
...
...
@@ -69,6 +69,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
type
:
'
img
'
,
audio
:
''
,
image
:
''
,
isRight
:
"
0
"
,
});
this
.
save
();
}
...
...
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