Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
debug_shell
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
debug_shell
Commits
0c3f1ae8
Commit
0c3f1ae8
authored
Dec 05, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
af9dfdb5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
210 additions
and
214 deletions
+210
-214
debug_shell.js
play/assets/debug_shell/scene/debug_shell.js
+4
-9
oxford_front.ts
play/assets/oxford_front/scene/oxford_front.ts
+206
-205
No files found.
play/assets/debug_shell/scene/debug_shell.js
View file @
0c3f1ae8
...
@@ -47,15 +47,10 @@ cc.Class({
...
@@ -47,15 +47,10 @@ cc.Class({
if
(
err
)
{
if
(
err
)
{
return
this
.
asyncDelayLog
(
err
);
return
this
.
asyncDelayLog
(
err
);
}
}
bundle
.
loadScene
(
configData
.
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
if
(
err
)
{
this
.
asyncDelayLog
(
'
err:
'
,
err
);
}
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
canvas
=
cc
.
find
(
'
Canvas
'
);
canvas
.
emit
(
'
MIDDLE_LAYER_LOADED
'
,
{
scene
});
canvas
.
emit
(
'
MIDDLE_LAYER_LOADED
'
,
{
scene
:
null
});
globalThis
.
SCENE_INFO
=
scene
globalThis
.
configData
=
configData
;
// cc.director.runScene(scene);
});
});
});
});
});
},
},
...
...
play/assets/oxford_front/scene/oxford_front.ts
View file @
0c3f1ae8
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
// @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
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -57,14 +57,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -57,14 +57,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
gameMachineService
:
any
=
null
;
gameMachineService
:
any
=
null
;
LoadingCount
:
number
=
0
;
LoadingCount
:
number
=
0
;
start
(){
start
()
{
this
.
LoadingCount
=
0
;
this
.
LoadingCount
=
0
;
this
.
showWaitingLetters
();
this
.
showWaitingLetters
();
this
.
initBg
();
this
.
initBg
();
this
.
initSubmarineView
();
this
.
initSubmarineView
();
this
.
createFiniteStateMachines
();
this
.
createFiniteStateMachines
();
this
.
BackViewButtons
.
forEach
(
b
=>
{
this
.
BackViewButtons
.
forEach
(
b
=>
{
b
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
b
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
this
.
gameMachineService
.
send
(
'
BACK
'
);
this
.
gameMachineService
.
send
(
'
BACK
'
);
// this.node.emit('BACK');
// this.node.emit('BACK');
},
this
,
true
);
},
this
,
true
);
...
@@ -73,7 +73,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -73,7 +73,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
for
(
let
bs
of
[
this
.
SpaceViewButtons
,
this
.
SubmarineViewButtons
,
this
.
LetterViewButtons
,
this
.
StoryViewButtons
,
this
.
ReviewViewButtons
])
{
for
(
let
bs
of
[
this
.
SpaceViewButtons
,
this
.
SubmarineViewButtons
,
this
.
LetterViewButtons
,
this
.
StoryViewButtons
,
this
.
ReviewViewButtons
])
{
bs
.
forEach
(
b
=>
{
bs
.
forEach
(
b
=>
{
// const env = this;
// const env = this;
b
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
b
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
// this.gameMachineService.send('BACK')
// this.gameMachineService.send('BACK')
// env.node.emit('BACK');
// env.node.emit('BACK');
const
[
buttonName
,
state
,
index
]
=
b
.
name
.
split
(
'
@
'
);
const
[
buttonName
,
state
,
index
]
=
b
.
name
.
split
(
'
@
'
);
...
@@ -96,16 +96,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -96,16 +96,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
param
=
JSON
.
parse
(
JSON
.
stringify
(
currentDataset
[
index
]));
const
param
=
JSON
.
parse
(
JSON
.
stringify
(
currentDataset
[
index
]));
globalThis
.
CURRENT_STATE
=
{
globalThis
.
CURRENT_STATE
=
{
state
,
state
,
data
:
{...
param
,
buttonName
,
linkFlag
}
data
:
{
...
param
,
buttonName
,
linkFlag
}
}
}
console
.
log
(
globalThis
.
PREV_STATE
,
globalThis
.
CURRENT_STATE
);
console
.
log
(
globalThis
.
PREV_STATE
,
globalThis
.
CURRENT_STATE
);
globalThis
.
CURRENT_PID
=
param
.
pid
;
globalThis
.
CURRENT_PID
=
param
.
pid
;
globalThis
.
CURRENT_ID
=
param
.
id
;
globalThis
.
CURRENT_ID
=
param
.
id
;
this
.
gameMachineService
.
send
(
state
,
{...
param
,
buttonName
,
linkFlag
});
this
.
gameMachineService
.
send
(
state
,
{
...
param
,
buttonName
,
linkFlag
});
},
this
,
true
);
},
this
,
true
);
});
});
}
}
globalThis
.
aaa
=
this
;
globalThis
.
aaa
=
this
;
}
}
initBg
()
{
initBg
()
{
// const bgNode = cc.find('Canvas/MainScene/SpaceView/bg');
// const bgNode = cc.find('Canvas/MainScene/SpaceView/bg');
...
@@ -132,11 +132,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -132,11 +132,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
initSubmarineView
(){
initSubmarineView
()
{
this
.
submarineView
.
node
.
on
(
'
scrolling
'
,
this
.
moveSubmarineBackground
,
this
);
this
.
submarineView
.
node
.
on
(
'
scrolling
'
,
this
.
moveSubmarineBackground
,
this
);
}
}
moveSubmarineBackground
(){
moveSubmarineBackground
()
{
//获取滚动视图相对于左上角原点的当前滚动偏移
//获取滚动视图相对于左上角原点的当前滚动偏移
let
scrollOffset
:
cc
.
Vec2
=
this
.
submarineView
.
getScrollOffset
();
let
scrollOffset
:
cc
.
Vec2
=
this
.
submarineView
.
getScrollOffset
();
// console.log(scrollOffset.x);
// console.log(scrollOffset.x);
...
@@ -146,7 +146,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -146,7 +146,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
canvas
=
cc
.
find
(
'
Canvas
'
);
const
canvas
=
cc
.
find
(
'
Canvas
'
);
canvas
.
on
(
'
MIDDLE_LAYER_LOADED
'
,
({
scene
})
=>
{
canvas
.
on
(
'
MIDDLE_LAYER_LOADED
'
,
({
scene
})
=>
{
this
.
hideWaitingLetters
();
this
.
hideWaitingLetters
();
});
});
const
operationState
=
{
const
operationState
=
{
...
@@ -172,12 +172,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -172,12 +172,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
audioEngine
.
playMusic
(
this
.
bgMusic1
,
true
);
cc
.
audioEngine
.
playMusic
(
this
.
bgMusic1
,
true
);
// event.type !== 'BACK'
// event.type !== 'BACK'
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507
'
,
(
resp
:
any
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507
'
,
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
let
{
rows
}
=
resp
rows
=
rows
.
filter
(
r
=>
!
r
.
has_courseware
);
rows
=
rows
.
filter
(
r
=>
!
r
.
has_courseware
);
console
.
log
(
'
SpaceView
'
,
rows
)
console
.
log
(
'
SpaceView
'
,
rows
)
ctx
.
SpaceViewData
=
rows
;
ctx
.
SpaceViewData
=
rows
;
ctx
.
currentDataset
=
rows
;
ctx
.
currentDataset
=
rows
;
}
}
...
@@ -212,14 +212,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -212,14 +212,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
exit
:
()
=>
{
exit
:
()
=>
{
// console.log('exit SubmarineView stage');
// console.log('exit SubmarineView stage');
},
},
invoke
:{
invoke
:
{
src
:
(
ctx
,
event
)
=>
{
src
:
(
ctx
,
event
)
=>
{
console
.
log
(
111
,
event
)
console
.
log
(
111
,
event
)
// this.submarineView.scrollToPage(0, 0)
// this.submarineView.scrollToPage(0, 0)
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
;
let
{
rows
}
=
resp
;
...
@@ -234,7 +234,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -234,7 +234,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
},
},
on
:
{
on
:
{
LOAD
:
{
LOAD
:
{
target
:
'
SubmarineView
'
,
target
:
'
SubmarineView
'
,
actions
:
(
ctx
,
event
)
=>
{
actions
:
(
ctx
,
event
)
=>
{
console
.
log
(
'
SubmarineView LOAD
'
,
ctx
,
event
);
console
.
log
(
'
SubmarineView LOAD
'
,
ctx
,
event
);
}
}
...
@@ -243,7 +243,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -243,7 +243,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
STORY
:
'
StoryView
'
,
STORY
:
'
StoryView
'
,
REVIEW
:
'
ReviewView
'
,
REVIEW
:
'
ReviewView
'
,
BACK
:
{
BACK
:
{
target
:
'
SpaceView
'
,
target
:
'
SpaceView
'
,
actions
:
(
ctx
,
event
)
=>
{
actions
:
(
ctx
,
event
)
=>
{
console
.
log
(
'
back
'
,
ctx
,
event
);
console
.
log
(
'
back
'
,
ctx
,
event
);
}
}
...
@@ -254,27 +254,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -254,27 +254,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
on
:
{
on
:
{
BACK
:
{
BACK
:
{
target
:
'
SubmarineView
'
,
target
:
'
SubmarineView
'
,
actions
:
()
=>
{
actions
:
()
=>
{
globalThis
.
CURRENT_ID
=
globalThis
.
CURRENT_PID
;
globalThis
.
CURRENT_ID
=
globalThis
.
CURRENT_PID
;
}
}
},
},
PLAY
:
{
PLAY
:
{
target
:
'
PlayView
'
,
target
:
'
PlayView
'
,
actions
:
(
ctx
,
event
)
=>
{
actions
:
(
ctx
,
event
)
=>
{
console
.
log
(
'
PLAY
'
,
ctx
,
event
);
console
.
log
(
'
PLAY
'
,
ctx
,
event
);
}
}
}
}
},
},
invoke
:{
invoke
:
{
src
:
(
ctx
,
event
)
=>
{
src
:
(
ctx
,
event
)
=>
{
// console.log(222,event)
// console.log(222,event)
// if (event.id) {
// if (event.id) {
// globalThis.CURRENT_PID = globalThis.CURRENT_ID;
// globalThis.CURRENT_PID = globalThis.CURRENT_ID;
// globalThis.CURRENT_ID = event.id;
// globalThis.CURRENT_ID = event.id;
// }
// }
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
;
let
{
rows
}
=
resp
;
...
@@ -288,7 +288,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -288,7 +288,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
},
},
entry
:
(
ctx
,
event
)
=>
{
entry
:
(
ctx
,
event
)
=>
{
console
.
log
(
'
entry LetterView stage
'
,
);
console
.
log
(
'
entry LetterView stage
'
,
);
this
.
LetterView
.
active
=
true
;
this
.
LetterView
.
active
=
true
;
this
.
StoryView
.
active
=
false
;
this
.
StoryView
.
active
=
false
;
this
.
ReviewView
.
active
=
false
;
this
.
ReviewView
.
active
=
false
;
...
@@ -304,22 +304,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -304,22 +304,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
on
:
{
on
:
{
BACK
:
{
BACK
:
{
target
:
'
SubmarineView
'
,
target
:
'
SubmarineView
'
,
actions
:
(
ctx
)
=>
{
actions
:
(
ctx
)
=>
{
globalThis
.
CURRENT_ID
=
globalThis
.
CURRENT_PID
;
globalThis
.
CURRENT_ID
=
globalThis
.
CURRENT_PID
;
}
}
},
},
PLAY
:
{
PLAY
:
{
target
:
'
PlayView
'
,
target
:
'
PlayView
'
,
actions
:
(
ctx
,
event
)
=>
{
actions
:
(
ctx
,
event
)
=>
{
console
.
log
(
'
back
'
,
ctx
,
event
);
console
.
log
(
'
back
'
,
ctx
,
event
);
}
}
},
},
},
},
invoke
:{
invoke
:
{
src
:
(
ctx
,
event
)
=>
{
src
:
(
ctx
,
event
)
=>
{
return
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
return
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
;
let
{
rows
}
=
resp
;
...
@@ -327,7 +327,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -327,7 +327,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
'
StoryView
'
,
rows
);
console
.
log
(
'
StoryView
'
,
rows
);
ctx
.
StoryViewData
=
rows
;
ctx
.
StoryViewData
=
rows
;
ctx
.
currentDataset
=
rows
;
ctx
.
currentDataset
=
rows
;
rows
.
forEach
((
r
,
idx
)
=>
{
rows
.
forEach
((
r
,
idx
)
=>
{
const
btn
=
this
.
StoryViewButtons
[
idx
];
const
btn
=
this
.
StoryViewButtons
[
idx
];
btn
.
active
=
true
;
btn
.
active
=
true
;
const
cover
=
btn
.
getComponent
(
'
Cover
'
)
const
cover
=
btn
.
getComponent
(
'
Cover
'
)
...
@@ -359,22 +359,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -359,22 +359,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
ReviewView
:
{
ReviewView
:
{
on
:
{
on
:
{
BACK
:
{
BACK
:
{
target
:
'
SubmarineView
'
,
target
:
'
SubmarineView
'
,
actions
:
(
ctx
)
=>
{
actions
:
(
ctx
)
=>
{
globalThis
.
CURRENT_ID
=
globalThis
.
CURRENT_PID
;
globalThis
.
CURRENT_ID
=
globalThis
.
CURRENT_PID
;
}
}
},
},
PLAY
:
{
PLAY
:
{
target
:
'
PlayView
'
,
target
:
'
PlayView
'
,
actions
:
(
ctx
,
event
)
=>
{
actions
:
(
ctx
,
event
)
=>
{
// console.log('back', ctx, event);
// console.log('back', ctx, event);
}
}
},
},
},
},
invoke
:{
invoke
:
{
src
:
(
ctx
,
event
)
=>
{
src
:
(
ctx
,
event
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
this
.
callNetworkApiGet
(
'
http://staging-teach.ireadabc.com/api/syllabus/v1/list?orgid=507&pid=
'
+
globalThis
.
CURRENT_ID
,
(
resp
:
any
)
=>
{
resp
=
JSON
.
parse
(
resp
);
resp
=
JSON
.
parse
(
resp
);
if
(
resp
.
msg
==
'
success
'
)
{
if
(
resp
.
msg
==
'
success
'
)
{
let
{
rows
}
=
resp
;
let
{
rows
}
=
resp
;
...
@@ -382,7 +382,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -382,7 +382,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
'
ReviewView
'
,
rows
);
console
.
log
(
'
ReviewView
'
,
rows
);
ctx
.
ReviewViewData
=
rows
;
ctx
.
ReviewViewData
=
rows
;
ctx
.
currentDataset
=
rows
;
ctx
.
currentDataset
=
rows
;
rows
.
forEach
((
r
,
idx
)
=>
{
rows
.
forEach
((
r
,
idx
)
=>
{
const
btn
=
this
.
ReviewViewButtons
[
idx
];
const
btn
=
this
.
ReviewViewButtons
[
idx
];
btn
.
active
=
true
;
btn
.
active
=
true
;
const
cover
=
btn
.
getComponent
(
'
Cover
'
)
const
cover
=
btn
.
getComponent
(
'
Cover
'
)
...
@@ -409,8 +409,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -409,8 +409,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
on
:
{
on
:
{
},
},
invoke
:{
invoke
:
{
src
:
(
ctx
,
event
)
=>
{
src
:
(
ctx
,
event
)
=>
{
this
.
showWaitingLetters
();
this
.
showWaitingLetters
();
}
}
},
},
...
@@ -418,24 +418,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -418,24 +418,25 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
'
entry PlayView stage
'
);
console
.
log
(
'
entry PlayView stage
'
);
this
.
showWaitingLetters
();
this
.
showWaitingLetters
();
cc
.
audioEngine
.
stopMusic
();
cc
.
audioEngine
.
stopMusic
();
const
scene
=
globalThis
.
SCENE_INFO
;
const
configData
=
globalThis
.
configData
;
if
(
!
scene
)
{
cc
.
assetManager
.
loadBundle
(
configData
.
bondleUrl
,
{
version
:
configData
.
version
},
async
(
err
,
bundle
)
=>
{
this
.
showWaitingLetters
();
if
(
err
)
{
return
;
return
console
.
log
(
err
);
}
}
// cc.director._scene = scene;
bundle
.
loadScene
(
configData
.
sceneName
,
null
,
null
,
(
err
,
scene
)
=>
{
// cc.director._scene._activate();
cc
.
director
.
runScene
(
scene
,
null
,
()
=>
{
// cc.game.resume();
try
{
cc
.
director
.
runScene
(
scene
,
null
,
()
=>
{
console
.
log
(
'
汪汪汪
'
)
try
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
console
.
log
(
event
.
id
,
event
.
linkFlag
);
console
.
log
(
event
.
id
,
event
.
linkFlag
);
middleLayer
.
loadOnlineCourseWare
(
event
.
id
,
event
.
linkFlag
);
middleLayer
.
loadOnlineCourseWare
(
event
.
id
,
event
.
linkFlag
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
);
console
.
error
(
e
);
}
}
});
});
});
});
// this.LetterView.active = false;
// this.LetterView.active = false;
// this.StoryView.active = false;
// this.StoryView.active = false;
// this.ReviewView.active = true;
// this.ReviewView.active = true;
...
@@ -458,16 +459,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -458,16 +459,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
gameMachineService
.
start
();
this
.
gameMachineService
.
start
();
this
.
restore
();
this
.
restore
();
}
}
restore
(){
restore
()
{
if
(
globalThis
.
PREV_STATE
)
{
if
(
globalThis
.
PREV_STATE
)
{
globalThis
.
CURRENT_ID
=
globalThis
.
PREV_STATE
.
data
.
id
globalThis
.
CURRENT_ID
=
globalThis
.
PREV_STATE
.
data
.
id
globalThis
.
CURRENT_PID
=
globalThis
.
PREV_STATE
.
data
.
pid
globalThis
.
CURRENT_PID
=
globalThis
.
PREV_STATE
.
data
.
pid
this
.
gameMachineService
.
send
(
'
SpaceView
'
,
{
...
globalThis
.
PREV_STATE
.
data
,
type
:
globalThis
.
PREV_STATE
.
state
});
this
.
gameMachineService
.
send
(
'
SpaceView
'
,
{
...
globalThis
.
PREV_STATE
.
data
,
type
:
globalThis
.
PREV_STATE
.
state
});
globalThis
.
CURRENT_STATE
=
JSON
.
parse
(
JSON
.
stringify
(
globalThis
.
PREV_STATE
));
globalThis
.
CURRENT_STATE
=
JSON
.
parse
(
JSON
.
stringify
(
globalThis
.
PREV_STATE
));
globalThis
.
PREV_STATE
=
null
;
globalThis
.
PREV_STATE
=
null
;
}
}
}
}
setStateContextData
({
rows
,
buttonsKey
})
{
setStateContextData
({
rows
,
buttonsKey
})
{
const
buttons
=
buttonsKey
;
const
buttons
=
buttonsKey
;
buttons
.
forEach
((
b
:
any
)
=>
{
buttons
.
forEach
((
b
:
any
)
=>
{
b
.
getComponent
(
cc
.
Button
).
interactable
=
false
;
b
.
getComponent
(
cc
.
Button
).
interactable
=
false
;
...
@@ -476,24 +477,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -476,24 +477,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
!
buttons
[
idx
])
{
if
(
!
buttons
[
idx
])
{
return
;
return
;
}
}
(
buttons
[
idx
]
as
any
).
getComponent
(
cc
.
Button
).
interactable
=
true
;
(
buttons
[
idx
]
as
any
).
getComponent
(
cc
.
Button
).
interactable
=
true
;
(
buttons
[
idx
]
as
any
).
getComponent
(
cc
.
Button
).
dataIndex
=
idx
;
(
buttons
[
idx
]
as
any
).
getComponent
(
cc
.
Button
).
dataIndex
=
idx
;
(
buttons
[
idx
]
as
any
).
getComponent
(
cc
.
Button
).
dataMeta
=
item
;
(
buttons
[
idx
]
as
any
).
getComponent
(
cc
.
Button
).
dataMeta
=
item
;
const
[
_
,
action
,
index
]
=
(
buttons
[
idx
]
as
any
).
name
.
split
(
'
@
'
);
const
[
_
,
action
,
index
]
=
(
buttons
[
idx
]
as
any
).
name
.
split
(
'
@
'
);
(
buttons
[
idx
]
as
any
).
off
(
cc
.
Node
.
EventType
.
TOUCH_START
);
(
buttons
[
idx
]
as
any
).
off
(
cc
.
Node
.
EventType
.
TOUCH_START
);
(
buttons
[
idx
]
as
any
).
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
(
buttons
[
idx
]
as
any
).
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
function
()
{
this
.
gameMachineService
.
send
(
action
,
item
)
this
.
gameMachineService
.
send
(
action
,
item
)
},
this
,
true
)
},
this
,
true
)
});
});
}
}
callNetworkApiGet
(
uri
,
successCallBack
:
(
resp
:
string
)
=>
void
,
errorCallback
?:
(
any
)
=>
void
)
{
callNetworkApiGet
(
uri
,
successCallBack
:
(
resp
:
string
)
=>
void
,
errorCallback
?:
(
any
)
=>
void
)
{
this
.
showWaitingLetters
()
this
.
showWaitingLetters
()
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
()
=>
{
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
)
{
if
(
xhr
.
readyState
==
4
)
{
this
.
hideWaitingLetters
()
this
.
hideWaitingLetters
()
if
(
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
if
((
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
successCallBack
&&
successCallBack
(
xhr
.
responseText
);
successCallBack
&&
successCallBack
(
xhr
.
responseText
);
}
else
{
}
else
{
errorCallback
&&
errorCallback
(
xhr
)
errorCallback
&&
errorCallback
(
xhr
)
...
...
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