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
3 years ago
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 功能实现
parent
6610f190
master
v44
v43
v42
v41
v40
v39
v38
v37
v36
v35
v34
v33
v32
v31
v30
v29
v28
v27
v26
v25
v24
v23
v22
v21
v20
v19
v18
v17
v16
v15
v14
v13
v12
v11
v10
v9
v8
v7
v6
v5
v4
v3
v2
v1
No related merge requests found
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 @@
"_active": true,
"_components": [
{
"__id__": 41
7
"__id__": 41
8
},
{
"__id__": 41
8
"__id__": 41
9
}
],
"_prefab": null,
...
...
@@ -244,14 +244,14 @@
],
"_active": true,
"_components": [
{
"__id__": 414
},
{
"__id__": 415
},
{
"__id__": 416
},
{
"__id__": 417
}
],
"_prefab": null,
...
...
@@ -323,7 +323,7 @@
"_active": true,
"_components": [
{
"__id__": 41
3
"__id__": 41
4
}
],
"_prefab": null,
...
...
@@ -17313,6 +17313,9 @@
},
{
"__id__": 412
},
{
"__id__": 413
}
],
"_prefab": null,
...
...
@@ -17437,6 +17440,76 @@
"customAttributeStrArr": [],
"_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",
"_name": "",
...
...
This diff is collapsed.
Click to expand it.
assets/oxford_front/scene/oxford_front.ts
View file @
bb13d393
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
Attributes
from
"
../script/Attributes
"
;
import
{
callNetworkApiGet
}
from
"
../script/util
"
;
import
{
callNetworkApiGet
,
callNetworkApiPost
,
jumpToCourseWare
,
buttonOnClick
,
jumpToBundle
}
from
"
../script/util
"
;
// @ts-ignore
import
{
assign
,
createMachine
,
interpret
,
actions
,
forwardTo
,
matchesState
}
from
"
../script/xstate
"
;
const
{
pure
,
send
,
raise
,
sendParent
}
=
actions
;
...
...
@@ -36,15 +36,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
UnitPageViewBgNode
:
cc
.
Node
=
null
;
rootAttrTree
:
Attributes
=
null
;
kidInfo
:
any
;
onLoad
(){
async
onLoadEnd
()
{
this
.
tws
=
[];
this
.
LoadingCount
=
0
;
this
.
initSize
();
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
()
{
if
(
this
.
gameMachineService
)
{
if
(
this
.
gameMachineService
)
{
this
.
gameMachineService
.
start
();
}
}
...
...
@@ -70,20 +90,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_mapScaleMin
=
Math
.
min
(
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
()
{
const
pages
=
this
.
UnitViewPager
.
getPages
();
let
pIndex
=
pages
.
length
-
1
;
...
...
@@ -97,12 +103,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
lessonButtons
.
forEach
((
n
)
=>
{
n
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
);
n
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
function
(
e
)
{
const
na
:
Attributes
=
e
.
currentTarget
.
getComponent
(
'
Attributes
'
);
const
dataIndex
=
na
.
attrMap
[
'
index
'
];
console
.
log
(
'
-----------------
'
);
console
.
log
(
e
.
currentTarget
);
console
.
log
(
'
-----------------
'
);
// TODO 打开课件
const
b
=
e
.
currentTarget
;
const
lock
=
cc
.
find
(
'
icon_key
'
,
b
);
const
syllabusId
=
b
.
data_id
;
const
forderId
=
b
.
data_pid
;
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
)
});
}
...
...
@@ -110,8 +132,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
moveUnitViewBackground
()
{
//获取滚动视图相对于左上角原点的当前滚动偏移
let
scrollOffset
:
cc
.
Vec2
=
this
.
UnitViewPager
.
getScrollOffset
();
this
.
UnitsListNode
.
y
=
(
scrollOffset
.
y
*
8
/
9
)
+
600
;
this
.
UnitPageViewBgNode
.
y
=
(
scrollOffset
.
y
*
.
81
)
+
600
;
this
.
UnitsListNode
.
y
=
(
scrollOffset
.
y
*
8
/
9
)
+
600
;
this
.
UnitPageViewBgNode
.
y
=
(
scrollOffset
.
y
*
.
81
)
+
600
;
}
initBg
()
{
this
.
rootAttrTree
.
querySelectorAll
(
'
.page-holder
'
).
forEach
(
p
=>
{
...
...
@@ -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
)
{
cc
.
audioEngine
.
stopMusic
();
cc
.
audioEngine
.
playMusic
(
audio
,
true
);
}
createFiniteStateMachines
()
{
let
pid
=
21228
;
// 本地测试用
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
pid
=
middleLayer
.
getComponent
(
'
middleLayer
'
).
getData
(
'
NJ_MonkyTree
'
);
}
const
operationState
=
{
id
:
'
operation
'
,
initial
:
'
UnitView
'
,
...
...
@@ -153,11 +190,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
width=4></outline>`
;
});
callNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
pid
:
21228
},
(
resp
:
any
)
=>
{
callNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
pid
},
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
;
const
list
=
rows
.
reduce
((
result
,
next
)
=>
{
const
list
=
rows
.
reduce
((
result
,
next
)
=>
{
const
{
children
}
=
next
;
// has_courseware true 是文件夹
let
childrenList
=
children
.
filter
(
r
=>
r
.
has_courseware
)
...
...
@@ -172,25 +210,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
lessonsBtn
.
forEach
(
b
=>
{
const
attr
:
Attributes
=
b
.
getComponent
(
'
Attributes
'
);
const
index
=
attr
.
attrMap
[
'
index
'
];
const
lesson
=
list
[
index
];
const
lock
=
cc
.
find
(
'
icon_key
'
,
b
);
if
(
index
===
0
)
{
lock
.
active
=
false
;
}
else
{
lock
.
active
=
true
;
}
const
titleNode
=
attr
.
querySelector
(
'
.title
'
);
// titleNode.getComponent(cc.RichText).string = `<outline align=top
// width=4></outline>`;
if
(
!
lesson
)
{
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
;
b
.
attr
({
'
data_id
'
:
lesson
.
id
});
const
{
parent
}
=
b
;
const
{
parent
}
=
b
;
const
pa
=
parent
.
getComponent
(
'
Attributes
'
);
const
{
outline
}
=
pa
.
attrMap
;
const
{
outline
}
=
pa
.
attrMap
;
titleNode
.
getComponent
(
cc
.
RichText
).
string
=
`<outline align=top color=
${
outline
}
width=4>
${
lesson
.
name
}
</outline>`
;
}
});
ctx
.
UnitViewData
=
list
;
...
...
This diff is collapsed.
Click to expand it.
assets/oxford_front/script/MyCocosSceneComponent.ts
View file @
bb13d393
...
...
@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
preload
()
{
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
"
])
{
// window["air"].onCourseInScreen = (next) => {
...
...
@@ -95,7 +95,7 @@ export class MyCocosSceneComponent extends cc.Component {
// this.onLoadEnd();
// next();
// };
this
.
onLoadEnd
();
await
this
.
onLoadEnd
();
window
[
"
air
"
].
hideAirClassLoading
();
}
else
{
this
.
onLoadEnd
();
...
...
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
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