Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_debug
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
middleLayer_for_debug
Commits
7c915362
Commit
7c915362
authored
Nov 16, 2021
by
huoshizhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 中间层文件名
parent
c91f6f98
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
388 additions
and
334 deletions
+388
-334
middleLayer_for_debug.fire
...ts/middleLayer_for_debug/scene/middleLayer_for_debug.fire
+5
-5
middleLayer_for_debug.js
...sets/middleLayer_for_debug/scene/middleLayer_for_debug.js
+0
-326
middleLayer.js
play/assets/middleLayer_for_debug/script/middleLayer.js
+371
-0
middleLayer.js.meta
play/assets/middleLayer_for_debug/script/middleLayer.js.meta
+9
-0
builder.json
play/settings/builder.json
+3
-3
No files found.
play/assets/middleLayer_for_debug/scene/middleLayer_for_debug.fire
View file @
7c915362
...
...
@@ -243,8 +243,8 @@
"width": 1280,
"height": 720
},
"_fitWidth":
fals
e,
"_fitHeight":
tru
e,
"_fitWidth":
tru
e,
"_fitHeight":
fals
e,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
...
...
@@ -1658,7 +1658,7 @@
"_enabled": true,
"_string": "",
"returnType": 0,
"maxLength":
8
,
"maxLength":
22
,
"_tabIndex": 0,
"editingDidBegan": [],
"textChanged": [],
...
...
@@ -3015,13 +3015,13 @@
"_id": "bauV8xcDFGA6ssKG7KNZ9I"
},
{
"__type__": "
3d918khiRNEu5DeFkBUA5L1
",
"__type__": "
971c98IBE5Dm40y5rdr40cX
",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_id": "2
3lR9siEtPyIBUHKgvZra3
"
"_id": "2
2af0kkE5HLZlqI4ZC1giz
"
}
]
\ No newline at end of file
play/assets/middleLayer_for_debug/scene/middleLayer_for_debug.js
View file @
7c915362
cc
.
Class
({
extends
:
cc
.
Component
,
properties
:
{},
getData
(
callBack
)
{
const
uri
=
'
courseware/v1/getdata
'
;
const
syllabus_id
=
this
.
bundleInfoList
[
this
.
currentBundleIndex
].
syllabus_id
;
const
data
=
{
courseid
:
syllabus_id
};
this
.
callNetworkApiGet
(
uri
,
data
,
callBack
);
},
onHomeworkFinish
(
callBack
)
{
if
(
this
.
role
==
'
teacher
'
)
{
return
;
}
const
uri
=
'
app_source/v1/student/homework/finished
'
;
const
data
=
{
syllabus_id
:
this
.
syllabus_id
,
homework_id
:
this
.
homework_id
,
token
:
this
.
token
,
score
:
100
};
console
.
log
(
'
data =
'
+
JSON
.
stringify
(
data
));
this
.
callNetworkApiPost
(
uri
,
data
,
callBack
);
},
callNetworkApiGet
(
uri
,
data
,
callBack
)
{
let
queryStr
=
'
?
'
;
for
(
const
key
in
data
)
{
if
(
Object
.
hasOwnProperty
.
call
(
data
,
key
))
{
const
value
=
data
[
key
];
queryStr
+=
`
${
key
}
=
${
value
}
`
;
}
}
const
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
&&
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
const
responseData
=
JSON
.
parse
(
xhr
.
responseText
);
callBack
(
JSON
.
parse
(
responseData
.
data
));
}
};
const
url
=
`
${
this
.
baseUrl
}${
uri
}${
queryStr
}
`
;
console
.
log
(
'
url =
'
+
url
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
send
();
},
callNetworkApiPost
(
uri
,
data
,
callBack
)
{
const
xhr
=
new
XMLHttpRequest
();
const
url
=
`
${
this
.
baseUrl
}${
uri
}
`
;
xhr
.
open
(
"
POST
"
,
url
,
true
);
xhr
.
setRequestHeader
(
'
content-type
'
,
'
application/json
'
);
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
==
4
)
{
callBack
(
JSON
.
parse
(
xhr
.
responseText
));
}
}
xhr
.
send
(
JSON
.
stringify
(
data
));
},
start
()
{
this
.
node
.
zIndex
=
9999
;
this
.
showWaitingLetters
();
cc
.
game
.
addPersistRootNode
(
this
.
node
);
this
.
initListener
();
this
.
getBundleInfoList
();
},
asyncDelayLog
(
str
)
{
console
.
log
(
str
);
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
();
},
1
);
});
},
getBundleInfoList
()
{
const
jsonStr
=
this
.
callNativeFunction
({
name
:
'
loadSceneList
'
,
value
:
''
});
// const jsonStr = `{"bundleInfoList":[{"sceneName":"dfzx_cocos_T_FT_01","version":"c1a41","bondleUrl":"http://staging-teach.cdn.ireadabc.com//h5template/dfzx_cocos_T_FT_01/v3/android/dfzx_cocos_T_FT_01","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDYyLCJ1dWlkIjoiZDNlODE0OGItOTNlNC00NzdiLWEyMmEtMjNkYTk4ZWVlMGYwIiwicGhvbmUiOiIxNTk0MDgzMzk1MCIsIm5pY2tfbmFtZSI6IuaZk-aFp-a1i-ivlSIsIm9yZ19pZCI6MTEsInNjaG9vbF9pZCI6MjA0LCJjbGFzc19pZCI6MTQxLCJkZnp4X3VzZXJfdXVpZCI6ImVmMTNhNTI3ZDg2ZDQ1MGY4MWJjMWE1OWQ0NDcyZTQwIiwiZGVsIjowLCJjcmVhdGVkX2RhdGUiOiIyMDIwLTA4LTA2VDA2OjA1OjUxLjAwMFoiLCJ1cGRhdGVkX2RhdGUiOiIyMDIwLTA4LTA3VDA4OjI3OjQwLjAwMFoiLCJhY2NvdW50X3R5cGUiOjIsImVuZF9kYXRlIjoiMjAyMS0xMC0xM1QxNjowMDowMC4wMDBaIiwiY2xhc3NSb2xlIjoic3R1IiwiaWF0IjoxNjI5ODYyMTA2LCJleHAiOjE2MzI0NTQxMDZ9.pKvGgI9yijd57vJBLAM9wuiPV5KkCriezV-FlD8fmLI","baseUrl":"http://staging-teach.ireadabc.com/api/","homework_id":"313","syllabus_id":"18984","role":"student"},{"sceneName":"dfzx_cocos_T_FT_01","version":"c1a41","bondleUrl":"http://staging-teach.cdn.ireadabc.com//h5template/dfzx_cocos_T_FT_01/v3/android/dfzx_cocos_T_FT_01","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDYyLCJ1dWlkIjoiZDNlODE0OGItOTNlNC00NzdiLWEyMmEtMjNkYTk4ZWVlMGYwIiwicGhvbmUiOiIxNTk0MDgzMzk1MCIsIm5pY2tfbmFtZSI6IuaZk-aFp-a1i-ivlSIsIm9yZ19pZCI6MTEsInNjaG9vbF9pZCI6MjA0LCJjbGFzc19pZCI6MTQxLCJkZnp4X3VzZXJfdXVpZCI6ImVmMTNhNTI3ZDg2ZDQ1MGY4MWJjMWE1OWQ0NDcyZTQwIiwiZGVsIjowLCJjcmVhdGVkX2RhdGUiOiIyMDIwLTA4LTA2VDA2OjA1OjUxLjAwMFoiLCJ1cGRhdGVkX2RhdGUiOiIyMDIwLTA4LTA3VDA4OjI3OjQwLjAwMFoiLCJhY2NvdW50X3R5cGUiOjIsImVuZF9kYXRlIjoiMjAyMS0xMC0xM1QxNjowMDowMC4wMDBaIiwiY2xhc3NSb2xlIjoic3R1IiwiaWF0IjoxNjI5ODYyMTA2LCJleHAiOjE2MzI0NTQxMDZ9.pKvGgI9yijd57vJBLAM9wuiPV5KkCriezV-FlD8fmLI","baseUrl":"http://staging-teach.ireadabc.com/api/","homework_id":"313","syllabus_id":"18984","role":"student"}],"defaultBundleIdx":0}`;
const
{
bundleInfoList
,
defaultBundleIdx
}
=
JSON
.
parse
(
jsonStr
);
this
.
bundleInfoList
=
bundleInfoList
;
this
.
jumpToBundleByIndex
(
defaultBundleIdx
);
},
jumpToBundleByIndex
(
index
)
{
this
.
currentBundleIndex
=
index
;
const
currentBundleInfo
=
this
.
bundleInfoList
[
this
.
currentBundleIndex
];
const
btnLeft
=
this
.
node
.
getChildByName
(
'
BtnLeft
'
);
const
btnRight
=
this
.
node
.
getChildByName
(
'
BtnRight
'
);
btnLeft
.
active
=
true
;
btnRight
.
active
=
true
;
if
(
this
.
currentBundleIndex
==
0
)
{
btnLeft
.
active
=
false
;
}
if
(
this
.
currentBundleIndex
==
this
.
bundleInfoList
.
length
-
1
)
{
btnRight
.
active
=
false
;
}
this
.
baseUrl
=
currentBundleInfo
.
baseUrl
;
this
.
token
=
currentBundleInfo
.
token
;
this
.
homework_id
=
currentBundleInfo
.
homework_id
;
this
.
syllabus_id
=
currentBundleInfo
.
syllabus_id
;
this
.
role
=
currentBundleInfo
.
role
;
cc
.
assetManager
.
loadBundle
(
currentBundleInfo
.
bondleUrl
,
{
version
:
currentBundleInfo
.
version
},
async
(
err
,
bundle
)
=>
{
if
(
err
)
{
return
this
.
asyncDelayLog
(
err
);
}
bundle
.
loadScene
(
currentBundleInfo
.
sceneName
,
(
err
,
scene
)
=>
{
if
(
err
)
{
this
.
asyncDelayLog
(
'
err:
'
,
err
);
}
this
.
hideWaitingLetters
();
cc
.
director
.
runScene
(
scene
);
});
});
},
loadDefaultBundle
()
{
const
jsonStr
=
this
.
callNativeFunction
({
name
:
'
loadScene
'
,
value
:
''
});
const
{
sceneName
,
version
,
bondleUrl
,
token
,
baseUrl
,
homework_id
,
syllabus_id
,
role
}
=
JSON
.
parse
(
jsonStr
);
this
.
baseUrl
=
baseUrl
;
this
.
token
=
token
;
this
.
homework_id
=
homework_id
;
this
.
syllabus_id
=
syllabus_id
;
this
.
role
=
role
;
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
(
err
,
bundle
)
=>
{
if
(
err
)
{
return
this
.
asyncDelayLog
(
err
);
}
bundle
.
loadScene
(
sceneName
,
(
err
,
scene
)
=>
{
this
.
hideWaitingLetters
();
cc
.
director
.
runScene
(
scene
);
});
});
},
initListener
()
{
const
exitBtn
=
this
.
node
.
getChildByName
(
'
ExitBtn
'
);
exitBtn
.
on
(
'
click
'
,
()
=>
{
cc
.
tween
(
exitBtn
)
.
to
(
0.1
,
{
scaleX
:
0.9
,
scaleY
:
1.1
})
.
to
(
0.1
,
{
scaleX
:
1.1
,
scaleY
:
0.9
})
.
to
(
0.1
,
{
scaleX
:
1
,
scaleY
:
1
})
.
call
(()
=>
{
cc
.
game
.
removePersistRootNode
(
this
.
node
);
cc
.
director
.
loadScene
(
"
emptyScene
"
,
()
=>
{
this
.
callNativeFunction
({
name
:
'
exit
'
,
value
:
''
});
});
})
.
start
();
});
const
btnLeft
=
this
.
node
.
getChildByName
(
'
BtnLeft
'
);
btnLeft
.
on
(
'
click
'
,
()
=>
{
if
(
this
.
currentBundleIndex
-
1
<
0
)
{
return
;
}
this
.
jumpToBundleByIndex
(
this
.
currentBundleIndex
-
1
);
});
const
btnRight
=
this
.
node
.
getChildByName
(
'
BtnRight
'
);
btnRight
.
on
(
'
click
'
,
()
=>
{
if
(
this
.
currentBundleIndex
+
1
>=
this
.
bundleInfoList
.
length
)
{
return
;
}
this
.
jumpToBundleByIndex
(
this
.
currentBundleIndex
+
1
);
});
const
BtnStartLocal
=
cc
.
find
(
'
middleLayer/ui/BtnStartLocal
'
);
BtnStartLocal
.
on
(
'
click
'
,
()
=>
{
});
},
callNativeFunction
(
param
)
{
const
paramStr
=
JSON
.
stringify
(
param
);
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
CocosMng
'
,
'
cocosWithNativeProtocol:
'
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
com/iplayabc/cocos/AppActivity
'
,
'
cocosWithNativeProtocol
'
,
'
(Ljava/lang/String;)Ljava/lang/String;
'
,
paramStr
);
}
else
{
throw
(
'
非源生环境
'
);
}
},
showWaitingLetters
()
{
const
colorList
=
this
.
getRainbowColorList
();
const
layout
=
cc
.
find
(
'
middleLayer/layout
'
);
// layout.active = true;
const
str
=
'
Now Loading...
'
;
str
.
split
(
''
).
forEach
((
word
,
idx
)
=>
{
const
node
=
new
cc
.
Node
();
const
label
=
node
.
addComponent
(
cc
.
Label
);
label
.
string
=
word
;
node
.
parent
=
layout
;
node
.
color
=
colorList
[
idx
];
cc
.
tween
(
node
)
.
delay
(
idx
/
4
)
.
by
(
0.3
,
{
y
:
50
},
{
easing
:
'
sineOut
'
})
.
by
(
0.3
,
{
y
:
-
50
},
{
easing
:
'
sineIn
'
})
.
delay
((
str
.
length
-
idx
)
/
4
)
.
union
()
.
repeatForever
()
.
start
();
});
const
totalWidth
=
layout
.
children
.
reduce
((
width
,
node
,
idx
)
=>
{
return
width
+
node
.
width
;
},
0
);
layout
.
width
=
totalWidth
;
},
hideWaitingLetters
()
{
const
layout
=
cc
.
find
(
'
middleLayer/layout
'
);
layout
.
active
=
false
;
},
showLog
(
str
)
{
if
(
!
this
.
logList
)
{
this
.
logList
=
[];
}
this
.
logList
.
push
(
str
);
console
.
log
(
str
);
if
(
this
.
logList
.
length
==
1
)
{
this
.
showOneLog
();
}
},
showOneLog
()
{
const
str
=
this
.
logList
[
0
];
if
(
str
===
undefined
)
{
return
;
}
const
node
=
new
cc
.
Node
();
node
.
anchorX
=
0.5
;
const
label
=
node
.
addComponent
(
cc
.
RichText
);
label
.
string
=
`<outline color=black width=3>
${
str
}
</outline>`
;
label
.
maxWidth
=
this
.
node
.
width
/
2
;
node
.
x
=
this
.
node
.
width
/
4
;
node
.
y
=
-
this
.
node
.
height
/
2
;
node
.
parent
=
this
.
node
;
cc
.
tween
(
node
)
.
to
(
5
,
{
y
:
this
.
node
.
height
})
.
removeSelf
()
.
start
();
setTimeout
(()
=>
{
this
.
logList
.
shift
();
this
.
showOneLog
();
},
1000
);
},
getRainbowColorList
()
{
return
[
cc
.
color
(
255
,
255
,
0
),
cc
.
color
(
128
,
255
,
0
),
cc
.
color
(
0
,
255
,
0
),
cc
.
color
(
0
,
0
,
0
),
cc
.
color
(
0
,
255
,
128
),
cc
.
color
(
0
,
255
,
255
),
cc
.
color
(
0
,
128
,
255
),
cc
.
color
(
0
,
0
,
255
),
cc
.
color
(
128
,
0
,
255
),
cc
.
color
(
255
,
0
,
255
),
cc
.
color
(
255
,
0
,
128
),
cc
.
color
(
255
,
0
,
0
),
cc
.
color
(
255
,
128
,
0
),
cc
.
color
(
255
,
255
,
0
),
];
}
});
play/assets/middleLayer_for_debug/script/middleLayer.js
0 → 100644
View file @
7c915362
This diff is collapsed.
Click to expand it.
play/assets/middleLayer_for_debug/script/middleLayer.js.meta
0 → 100644
View file @
7c915362
{
"ver": "1.0.8",
"uuid": "971c9f08-044e-439b-8d32-e6b76be34717",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/settings/builder.json
View file @
7c915362
...
...
@@ -19,7 +19,7 @@
"md5Cache"
:
false
,
"nativeMd5Cache"
:
true
,
"encryptJs"
:
true
,
"xxteaKey"
:
"
af95a0f7-a8da-4f
"
,
"xxteaKey"
:
"
6bbfce23-28b4-4a
"
,
"zipCompressJs"
:
true
,
"fb-instant-games"
:
{},
"android"
:
{
...
...
@@ -28,8 +28,8 @@
},
"ios"
:
{
"REMOTE_SERVER_ROOT"
:
""
,
"
packageName"
:
"org.cocos2d.demo"
,
"
ios_enable_jit"
:
true
"
ios_enable_jit"
:
true
,
"
packageName"
:
"org.cocos2d.demo"
},
"mac"
:
{
"REMOTE_SERVER_ROOT"
:
""
,
...
...
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