Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_MonkyTree
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
NJ_MonkyTree
Commits
bb13d393
Commit
bb13d393
authored
Jun 14, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 功能实现
parent
6610f190
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
72 deletions
+201
-72
NJ_MonkyTree.fire
assets/NJ_MonkyTree/scene/NJ_MonkyTree.fire
+79
-6
oxford_front.ts
assets/oxford_front/scene/oxford_front.ts
+105
-64
MyCocosSceneComponent.ts
assets/oxford_front/script/MyCocosSceneComponent.ts
+2
-2
defaultData.js
assets/oxford_front/script/defaultData.js
+6
-0
defaultData.js.meta
assets/oxford_front/script/defaultData.js.meta
+9
-0
No files found.
assets/NJ_MonkyTree/scene/NJ_MonkyTree.fire
View file @
bb13d393
...
@@ -78,10 +78,10 @@
...
@@ -78,10 +78,10 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 41
7
"__id__": 41
8
},
},
{
{
"__id__": 41
8
"__id__": 41
9
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -244,14 +244,14 @@
...
@@ -244,14 +244,14 @@
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
"__id__": 414
},
{
{
"__id__": 415
"__id__": 415
},
},
{
{
"__id__": 416
"__id__": 416
},
{
"__id__": 417
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -323,7 +323,7 @@
...
@@ -323,7 +323,7 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 41
3
"__id__": 41
4
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -17313,6 +17313,9 @@
...
@@ -17313,6 +17313,9 @@
},
},
{
{
"__id__": 412
"__id__": 412
},
{
"__id__": 413
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -17437,6 +17440,76 @@
...
@@ -17437,6 +17440,76 @@
"customAttributeStrArr": [],
"customAttributeStrArr": [],
"_id": "92na9emSxEq4sJX4n2jZ6/"
"_id": "92na9emSxEq4sJX4n2jZ6/"
},
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 409
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 409
},
"_id": "e3wAmPzt9BlYvBCfveIBBT"
},
{
{
"__type__": "8d79deWXmhBy7QSSjlRnsfL",
"__type__": "8d79deWXmhBy7QSSjlRnsfL",
"_name": "",
"_name": "",
...
...
assets/oxford_front/scene/oxford_front.ts
View file @
bb13d393
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
Attributes
from
"
../script/Attributes
"
;
import
Attributes
from
"
../script/Attributes
"
;
import
{
callNetworkApiGet
}
from
"
../script/util
"
;
import
{
callNetworkApiGet
,
callNetworkApiPost
,
jumpToCourseWare
,
buttonOnClick
,
jumpToBundle
}
from
"
../script/util
"
;
// @ts-ignore
// @ts-ignore
import
{
assign
,
createMachine
,
interpret
,
actions
,
forwardTo
,
matchesState
}
from
"
../script/xstate
"
;
import
{
assign
,
createMachine
,
interpret
,
actions
,
forwardTo
,
matchesState
}
from
"
../script/xstate
"
;
const
{
pure
,
send
,
raise
,
sendParent
}
=
actions
;
const
{
pure
,
send
,
raise
,
sendParent
}
=
actions
;
...
@@ -36,15 +36,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -36,15 +36,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
UnitPageViewBgNode
:
cc
.
Node
=
null
;
UnitPageViewBgNode
:
cc
.
Node
=
null
;
rootAttrTree
:
Attributes
=
null
;
rootAttrTree
:
Attributes
=
null
;
kidInfo
:
any
;
onLoad
(){
async
onLoadEnd
()
{
this
.
tws
=
[];
this
.
tws
=
[];
this
.
LoadingCount
=
0
;
this
.
LoadingCount
=
0
;
this
.
initSize
();
this
.
initSize
();
cc
.
debug
.
setDisplayStats
(
false
);
cc
.
debug
.
setDisplayStats
(
false
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
this
.
kidInfo
=
await
middleLayer
.
getComponent
(
'
middleLayer
'
).
getUserInfo
();
}
this
.
rootAttrTree
=
this
.
getComponent
(
'
Attributes
'
);
this
.
initBg
();
this
.
initUnitViewPager
();
this
.
createFiniteStateMachines
();
const
BackViewButtons
=
this
.
rootAttrTree
.
querySelectorAll
(
'
.back-view
'
);
BackViewButtons
.
forEach
(
b
=>
{
buttonOnClick
(
b
,
()
=>
{
jumpToBundle
(
"
NJ_MoTianLun
"
);
});
});
this
.
initialized
();
}
}
initialized
()
{
initialized
()
{
if
(
this
.
gameMachineService
)
{
if
(
this
.
gameMachineService
)
{
this
.
gameMachineService
.
start
();
this
.
gameMachineService
.
start
();
}
}
}
}
...
@@ -70,20 +90,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -70,20 +90,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_mapScaleMin
=
Math
.
min
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMin
=
Math
.
min
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMax
=
Math
.
max
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMax
=
Math
.
max
(
sx
,
sy
)
*
this
.
_cocosScale
;
}
}
start
()
{
this
.
rootAttrTree
=
this
.
getComponent
(
'
Attributes
'
);
this
.
initBg
();
this
.
initUnitViewPager
();
this
.
createFiniteStateMachines
();
const
BackViewButtons
=
this
.
rootAttrTree
.
querySelectorAll
(
'
.back-view
'
);
BackViewButtons
.
forEach
(
b
=>
{
b
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
// TODO 返回上一层
},
this
,
true
);
});
this
.
initialized
();
}
initUnitViewPager
()
{
initUnitViewPager
()
{
const
pages
=
this
.
UnitViewPager
.
getPages
();
const
pages
=
this
.
UnitViewPager
.
getPages
();
let
pIndex
=
pages
.
length
-
1
;
let
pIndex
=
pages
.
length
-
1
;
...
@@ -97,12 +103,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -97,12 +103,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
lessonButtons
.
forEach
((
n
)
=>
{
lessonButtons
.
forEach
((
n
)
=>
{
n
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
);
n
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
);
n
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
function
(
e
)
{
n
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
function
(
e
)
{
const
na
:
Attributes
=
e
.
currentTarget
.
getComponent
(
'
Attributes
'
);
const
b
=
e
.
currentTarget
;
const
dataIndex
=
na
.
attrMap
[
'
index
'
];
const
lock
=
cc
.
find
(
'
icon_key
'
,
b
);
console
.
log
(
'
-----------------
'
);
const
syllabusId
=
b
.
data_id
;
console
.
log
(
e
.
currentTarget
);
const
forderId
=
b
.
data_pid
;
console
.
log
(
'
-----------------
'
);
// TODO 打开课件
if
(
!
syllabusId
)
{
this
.
showTips
(
"
未解锁 [101]
"
);
return
;
}
if
(
lock
.
active
)
{
this
.
showTips
(
"
未解锁
"
);
return
;
}
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
middleLayer
.
getComponent
(
'
middleLayer
'
).
setData
(
'
NJ_MonkyTree_Son
'
,
{
forderId
,
syllabusId
,
});
}
jumpToCourseWare
(
syllabusId
);
},
this
,
true
)
},
this
,
true
)
});
});
}
}
...
@@ -110,8 +132,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -110,8 +132,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
moveUnitViewBackground
()
{
moveUnitViewBackground
()
{
//获取滚动视图相对于左上角原点的当前滚动偏移
//获取滚动视图相对于左上角原点的当前滚动偏移
let
scrollOffset
:
cc
.
Vec2
=
this
.
UnitViewPager
.
getScrollOffset
();
let
scrollOffset
:
cc
.
Vec2
=
this
.
UnitViewPager
.
getScrollOffset
();
this
.
UnitsListNode
.
y
=
(
scrollOffset
.
y
*
8
/
9
)
+
600
;
this
.
UnitsListNode
.
y
=
(
scrollOffset
.
y
*
8
/
9
)
+
600
;
this
.
UnitPageViewBgNode
.
y
=
(
scrollOffset
.
y
*
.
81
)
+
600
;
this
.
UnitPageViewBgNode
.
y
=
(
scrollOffset
.
y
*
.
81
)
+
600
;
}
}
initBg
()
{
initBg
()
{
this
.
rootAttrTree
.
querySelectorAll
(
'
.page-holder
'
).
forEach
(
p
=>
{
this
.
rootAttrTree
.
querySelectorAll
(
'
.page-holder
'
).
forEach
(
p
=>
{
...
@@ -123,12 +145,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -123,12 +145,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
});
}
}
showTips
(
tips
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
middleLayer
)
{
console
.
log
(
tips
);
return
;
}
middleLayer
.
getComponent
(
'
middleLayer
'
).
showTips
(
tips
);
}
playBgMusic
(
audio
)
{
playBgMusic
(
audio
)
{
cc
.
audioEngine
.
stopMusic
();
cc
.
audioEngine
.
stopMusic
();
cc
.
audioEngine
.
playMusic
(
audio
,
true
);
cc
.
audioEngine
.
playMusic
(
audio
,
true
);
}
}
createFiniteStateMachines
()
{
createFiniteStateMachines
()
{
let
pid
=
21228
;
// 本地测试用
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
pid
=
middleLayer
.
getComponent
(
'
middleLayer
'
).
getData
(
'
NJ_MonkyTree
'
);
}
const
operationState
=
{
const
operationState
=
{
id
:
'
operation
'
,
id
:
'
operation
'
,
initial
:
'
UnitView
'
,
initial
:
'
UnitView
'
,
...
@@ -153,11 +190,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -153,11 +190,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
width=4></outline>`
;
width=4></outline>`
;
});
});
callNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
pid
:
21228
},
(
resp
:
any
)
=>
{
callNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
pid
},
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
;
let
{
rows
}
=
resp
;
const
list
=
rows
.
reduce
((
result
,
next
)
=>
{
const
list
=
rows
.
reduce
((
result
,
next
)
=>
{
const
{
children
}
=
next
;
const
{
children
}
=
next
;
// has_courseware true 是文件夹
// has_courseware true 是文件夹
let
childrenList
=
children
.
filter
(
r
=>
r
.
has_courseware
)
let
childrenList
=
children
.
filter
(
r
=>
r
.
has_courseware
)
...
@@ -172,25 +210,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -172,25 +210,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
lessonsBtn
.
forEach
(
b
=>
{
lessonsBtn
.
forEach
(
b
=>
{
const
attr
:
Attributes
=
b
.
getComponent
(
'
Attributes
'
);
const
attr
:
Attributes
=
b
.
getComponent
(
'
Attributes
'
);
const
index
=
attr
.
attrMap
[
'
index
'
];
const
index
=
attr
.
attrMap
[
'
index
'
];
const
lesson
=
list
[
index
];
const
lesson
=
list
[
index
];
const
lock
=
cc
.
find
(
'
icon_key
'
,
b
);
const
lock
=
cc
.
find
(
'
icon_key
'
,
b
);
if
(
index
===
0
)
{
lock
.
active
=
false
;
}
else
{
lock
.
active
=
true
;
lock
.
active
=
true
;
}
const
titleNode
=
attr
.
querySelector
(
'
.title
'
);
const
titleNode
=
attr
.
querySelector
(
'
.title
'
);
// titleNode.getComponent(cc.RichText).string = `<outline align=top
// width=4></outline>`;
if
(
!
lesson
)
{
if
(
!
lesson
)
{
return
;
return
;
}
}
// TODO 解锁逻辑
b
.
attr
({
'
data_id
'
:
lesson
.
id
});
b
.
attr
({
'
data_pid
'
:
lesson
.
pid
});
if
(
this
.
kidInfo
&&
this
.
kidInfo
.
unlock_syllabuses
?.
includes
(
lesson
.
id
))
{
lock
.
active
=
false
;
lock
.
active
=
false
;
b
.
attr
({
'
data_id
'
:
lesson
.
id
});
const
{
parent
}
=
b
;
const
{
parent
}
=
b
;
const
pa
=
parent
.
getComponent
(
'
Attributes
'
);
const
pa
=
parent
.
getComponent
(
'
Attributes
'
);
const
{
outline
}
=
pa
.
attrMap
;
const
{
outline
}
=
pa
.
attrMap
;
titleNode
.
getComponent
(
cc
.
RichText
).
string
=
`<outline align=top color=
${
outline
}
titleNode
.
getComponent
(
cc
.
RichText
).
string
=
`<outline align=top color=
${
outline
}
width=4>
${
lesson
.
name
}
</outline>`
;
width=4>
${
lesson
.
name
}
</outline>`
;
}
});
});
ctx
.
UnitViewData
=
list
;
ctx
.
UnitViewData
=
list
;
...
...
assets/oxford_front/script/MyCocosSceneComponent.ts
View file @
bb13d393
...
@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
...
@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
preload
()
{
preload
()
{
const
preloadArr
=
this
.
_imageResList
.
concat
(
this
.
_audioResList
).
concat
(
this
.
_animaResList
);
const
preloadArr
=
this
.
_imageResList
.
concat
(
this
.
_audioResList
).
concat
(
this
.
_animaResList
);
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
(
err
,
data
)
=>
{
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
async
(
err
,
data
)
=>
{
if
(
window
&&
window
[
"
air
"
])
{
if
(
window
&&
window
[
"
air
"
])
{
// window["air"].onCourseInScreen = (next) => {
// window["air"].onCourseInScreen = (next) => {
...
@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component {
...
@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component {
// this.onLoadEnd();
// this.onLoadEnd();
// next();
// next();
// };
// };
this
.
onLoadEnd
();
await
this
.
onLoadEnd
();
window
[
"
air
"
].
hideAirClassLoading
();
window
[
"
air
"
].
hideAirClassLoading
();
}
else
{
}
else
{
this
.
onLoadEnd
();
this
.
onLoadEnd
();
...
...
assets/oxford_front/script/defaultData.js
0 → 100644
View file @
bb13d393
export
const
defaultData
=
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png
"
,
"
pic_url_2
"
:
"
http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png
"
,
"
text
"
:
"
This is a test label.
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3
"
}
\ No newline at end of file
assets/oxford_front/script/defaultData.js.meta
0 → 100644
View file @
bb13d393
{
"ver": "1.0.8",
"uuid": "8b6718a7-4616-4fef-aa42-bd17ddde91fc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
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