Commit b4eb6424 authored by liujiangnan's avatar liujiangnan

feat

parent 499f43f9
No preview for this file type
......@@ -4,9 +4,18 @@
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"compressionType": {
"android": "default",
"ios": "default"
},
"optimizeHotUpdate": {
"android": false,
"ios": false
},
"inlineSpriteFrames": {
"android": false,
"ios": false
},
"isRemoteBundle": {
"ios": false,
"android": false
......
{
"ver": "1.1.2",
"uuid": "e0ae4184-41ff-46b0-9091-3eb0ce6568d1",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"uuid": "1de1081e-55cb-408c-9547-3c6e7c6bc6b5",
"downloadMode": 0,
"duration": 0.130612,
"duration": 0.235102,
"subMetas": {}
}
\ No newline at end of file
{"name":"loading","version":"5.5","armature":[{"name":"Armature","ik":[],"bone":[{"name":"root","transform":{}},{"name":"组_1","transform":{"x":2.05,"skY":-90,"y":40.15,"skX":-90},"length":65,"parent":"root"},{"name":"A","transform":{"x":74.1475,"skY":90,"y":-2.05,"skX":90},"parent":"组_1"}],"aabb":{"x":-139.5,"height":180,"y":-90,"width":279},"defaultActions":[{"gotoAndPlay":"ufo"}],"animation":[{"name":"ufo","frame":[],"bone":[{"name":"root","rotateFrame":[],"translateFrame":[],"scaleFrame":[]},{"name":"组_1","rotateFrame":[{"duration":15,"rotate":8.3771,"curve":[0,0,0.5,1]},{"duration":15,"rotate":10.9763,"tweenEasing":0},{"duration":0,"rotate":8.3771}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":15},{"tweenEasing":0,"y":13.0573,"duration":15},{"duration":0}],"scaleFrame":[]},{"name":"A","rotateFrame":[{"duration":10,"tweenEasing":0},{"duration":10,"rotate":-9.1133,"tweenEasing":0},{"duration":10,"rotate":-13.9913,"tweenEasing":0},{"duration":0}],"translateFrame":[{"tweenEasing":0,"duration":10},{"tweenEasing":0,"x":-6.4977,"y":1.2205,"duration":10},{"tweenEasing":0,"x":4.0509,"y":-0.6604,"duration":10},{"duration":0}],"scaleFrame":[]}],"playTimes":0,"ffd":[],"slot":[{"name":"组_1","displayFrame":[],"colorFrame":[]},{"name":"A","displayFrame":[{"duration":10},{"duration":10,"value":1},{"duration":10,"value":2},{"duration":0}],"colorFrame":[]}],"ik":[],"duration":30}],"slot":[{"name":"组_1","color":{},"parent":"组_1"},{"name":"A","color":{},"z":1,"parent":"A"}],"skin":[{"name":"","slot":[{"name":"A","display":[{"name":"ufo/A","transform":{"skY":-0.0263,"y":-1.0025,"skX":-0.0263},"type":"image","path":"ufo/A"},{"name":"ufo/B","transform":{"x":4.5,"skY":-0.0263,"y":-1.0025,"skX":-0.0263},"type":"image","path":"ufo/B"},{"name":"ufo/C","transform":{"x":-4.5,"skY":-0.0263,"y":-0.5025,"skX":-0.0263},"type":"image","path":"ufo/C"}]},{"name":"组_1","display":[{"name":"ufo/组_1","transform":{"x":40.15,"skY":89.9737,"y":-2.05,"skX":89.9737},"type":"image","path":"ufo/组_1"}]}]}],"frameRate":24,"type":"Armature"}],"frameRate":24,"isGlobal":0}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "f14b7484-067f-48a1-881e-89e27d05fd3d",
"subMetas": {}
}
\ No newline at end of file
{"name":"loading","imagePath":"loading_tex.png","SubTexture":[{"name":"ufo/组_1","x":1,"height":180,"y":1,"width":279},{"name":"ufo/A","x":282,"height":80,"y":1,"width":83},{"name":"ufo/B","x":282,"height":80,"y":83,"width":60},{"name":"ufo/C","x":367,"height":83,"y":1,"width":58}],"height":256,"width":512}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "65b3de0d-3c14-45ea-ba08-b07ed29005aa",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6b423a37-183d-408e-906c-790b8ef80e8f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 256,
"platformSettings": {},
"subMetas": {
"loading_tex": {
"ver": "1.0.4",
"uuid": "3a223d17-92b4-44f0-b7da-b4ecb384935b",
"rawTextureUuid": "6b423a37-183d-408e-906c-790b8ef80e8f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -43,
"offsetY": 37,
"trimX": 1,
"trimY": 1,
"width": 424,
"height": 180,
"rawWidth": 512,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "080082e7-5ed1-444f-9be4-602e889e8026",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "60dc3adf-6d9e-4156-a6c7-eb3c9d649b56",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "52bbd6d1-f2d4-426e-9f68-85df81d518a8",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "5cb4f4fc-3f4c-45d6-bb0e-9389c8d59409",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "a0c57e07-56ee-496f-8f5b-bbda2bb3e544",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "54f4d342-b8aa-4085-8fe8-1f0af5defd5c",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "04587d3b-d13a-4a1f-b2ed-054eeec32da0",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "195f7a56-8446-4b3c-bb63-fcc7d8d6183d",
"uuid": "197cb28b-4ee4-4399-ae88-7cf915fefcc1",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
This diff is collapsed.
{
"ver": "1.1.2",
"uuid": "8315ed0e-dbc2-4825-8b02-09453744cd01",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// type: cc.Node,
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
this.init();
},
barBaseW: null,
barSpr: null,
barSf: null,
init() {
this.bar = cc.find('bar', this.node);
// this.bar.x = (this.node.width - this.bar.width) / 2;
// console.log('this.bar.x: ', this.bar.x);
this.barBaseW = this.bar.width;
this.barSpr = this.bar.getComponent(cc.Sprite);
this.barSf = this.barSpr.spriteFrame;
this.setProgress(0);
},
setProgress(progress) {
setTimeout(() => {
if (!this.barSf) {
return;
}
const w = this.barBaseW * progress;
const rect = this.barSf.getRect();
rect.width = w;
this.bar.width = w;
this.barSpr.spriteFrame.setRect(rect);
}, 1);
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "363f36a9-434f-4848-85d3-82d42a168145",
"uuid": "ff03bff6-e911-4b26-8e28-803cdc16c50f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "progress",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 269,
"height": 16
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 269,
"height": 16
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "c43f093f-a7c5-42d5-bf56-778a3548a7c3"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "7dOjkMYWpFQaM6/QbKkBy/",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "82ee3fa0-26e3-43e8-afca-8bbc978d88e4"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "ff03b/26RFLJo4ogDzcFsUP",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "a4cbf80d-fd89-477e-a6f9-7ca1bea43179",
"uuid": "3d356c4d-cb23-4239-aa5f-8a913f420fa4",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
......
{
"ver": "1.1.2",
"uuid": "bbf334e3-49af-4d0b-9d4c-a7a9398f1261",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "344dc346-7299-44ae-8693-0ac57ec21aca",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 269,
"height": 16,
"platformSettings": {},
"subMetas": {
"record_progress_bar": {
"ver": "1.0.4",
"uuid": "c43f093f-a7c5-42d5-bf56-778a3548a7c3",
"rawTextureUuid": "344dc346-7299-44ae-8693-0ac57ec21aca",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 269,
"height": 16,
"rawWidth": 269,
"rawHeight": 16,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "cb4c174a-628f-41b0-b661-f98961162196",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 269,
"height": 16,
"platformSettings": {},
"subMetas": {
"record_progress_bg": {
"ver": "1.0.4",
"uuid": "82ee3fa0-26e3-43e8-afca-8bbc978d88e4",
"rawTextureUuid": "cb4c174a-628f-41b0-b661-f98961162196",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 269,
"height": 16,
"rawWidth": 269,
"rawHeight": 16,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "a14b1d34-73f9-4c31-8d12-b5ec711a72c1",
"uuid": "f2080b9e-65f4-4a10-b460-eb81064a9d76",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
......
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {},
start() {
// 代码在 ../script/middleLayer.js里
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "f4ede462-f8d7-4069-ba80-915611c058ca",
"uuid": "551771f1-7b43-4157-bb84-cdbb730dcddd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
const testMockData = {"file":"/storage/emulated/0/Android/data/com.example.oxford/cache/shengtong/gradeVoice.mp3","audioUrl":"https://staging-teach.cdn.ireadabc.com/9bee787cf2a1934ccaf7dd596ede9c91.mp3","version":"2.3.9","eof":1,"tokenId":"629f0fe93327936c0b000001","result":{"duration":"3.620","fluency":91,"integrity":100,"kernel_version":"3.7.1","overall":92,"pronunciation":95,"resource_version":"2.3.6","rhythm":74,"sentences":[{"details":[{"overall":94,"word":"what"},{"overall":98,"word":"can"},{"overall":99,"word":"i"},{"overall":77,"word":"do"},{"overall":100,"word":"for"},{"overall":100,"word":"you"}],"overall":88,"sentence":"what can i do for you"}],"speed":162}};
const recordMockData = {"text":"what can i do for you","audioUrl":"https://staging-teach.cdn.ireadabc.com/368ad56174f85e2ff1f39f12bac5c693.mp3"};
export function initAir(_this) {
const realAir = {
uploadUrl: "",
......@@ -21,7 +25,15 @@ export function initAir(_this) {
osmoFingerReadCallback: function (res) {
_this.log(`***成功调用osmoFingerReadCallback***参数==${res}`);
},
dialogStatus: function (res) {
_this.log(`***成功调用dialogStatus***参数==${res}`);
},
startScanCodeCallback: null,
needUpdateCallback: null,
getEngineInfoCallback: null,
takePictureCallBack: null,
configurationPortraitCallback: null,
configurationLandscapeCallback: null,
recognitionCameraCallBack: null,
testCallBack: null,
recordCallBack: null,
......@@ -83,6 +95,9 @@ export function initAir(_this) {
_this.log(`===成功调用getAnswer=== queryObj == ${JSON.stringify(queryObj)}`);
callback && callback(null);
},
addStar() {
_this.log(`===成功调用addStar===`);
},
getTemplates(callback) {
_this.log(`===成功调用getTemplates===`);
callback && callback(null);
......@@ -100,8 +115,10 @@ export function initAir(_this) {
window.courseware.hasCalledStartRecord = true;
window.courseware.callOcMethod("startRecord", { isSpeechToText });
},
stopRecord(callback) {
stopRecord(callback1, callback2) {
// 传两个参数是为了兼容以前
window.courseware.hasCalledStartRecord = false;
const callback = callback1 || callback2;
_this.log(`===成功调用stopRecord===`);
if (!callback) {
// 不传回调函数就表示取消评测
......@@ -140,14 +157,24 @@ export function initAir(_this) {
};
window.courseware.callOcMethod("stopTest", {});
},
openRecognitionCamera(callback) {
// 拍照
takePicture(callback) {
_this.log(`===成功调用takePicture===`);
window.air.takePictureCallBack = (res) => {
callback && callback(JSON.stringify(res));
window.air.takePictureCallBack = null;
};
window.courseware.callOcMethod("takePicture", {});
},
openRecognitionCamera(params = {}, callback) {
window.courseware.hasCalledOpenRecognitionCamera = true;
_this.log(`===成功调用openRecognitionCamera===`);
_this.log(`===成功调用openRecognitionCamera===${JSON.stringify(params)}`);
window.air.recognitionCameraCallBack = (res) => {
callback && callback(JSON.stringify(res));
window.air.recognitionCameraCallBack = null;
};
window.courseware.callOcMethod("openRecognitionCamera", {});
window.courseware.callOcMethod("openRecognitionCamera", params);
},
closeRecognitionCamera() {
window.courseware.hasCalledOpenRecognitionCamera = false;
......@@ -158,16 +185,51 @@ export function initAir(_this) {
_this.log(`===成功调用getEngineInfo===`);
// 调用原生获取机器信息
window.air.getEngineInfoCallback = (res) => {
if(typeof(res) == 'string') {
window.air.engineInfo = res;
callback && callback(res);
} else {
window.air.engineInfo = JSON.stringify(res);
callback && callback(JSON.stringify(res));
}
window.air.getEngineInfoCallback = null;
};
window.courseware.callOcMethod("getEngineInfo", {});
},
openOsmo() {
exitApp() {
_this.log(`===成功调用exitApp===`);
window.courseware.callOcMethod("exitApp", {});
},
changeHost() {
_this.log(`===成功调用changeHost===`);
// 调用原生获取机器信息
if (window.air.engineInfo) {
const engineInfo = JSON.parse(window.air.engineInfo);
window.courseware.callOcMethod("changeHost", {isStagingEnv: engineInfo.isDev != 1});
}
},
needUpdate(label, url, callback) {
_this.log(`===成功调用needUpdate===`);
// 调用原生获取机器信息
window.air.needUpdateCallback = (res) => {
callback && callback(res);
window.air.needUpdateCallback = null;
};
window.courseware.callOcMethod("needUpdate", { label: label, url: url });
},
startScanCode(callback) {
_this.log(`===成功调用startScanCode===`);
// 调用原生开始扫码
window.air.startScanCodeCallback = (res) => {
callback && callback(res);
window.air.startScanCodeCallback = null;
};
window.courseware.callOcMethod("startScanCode", {});
},
openOsmo(params = {}) {
window.courseware.hasCalledOpenOsmo = true;
_this.log(`===成功调用openOsmo===`);
window.courseware.callOcMethod("openOsmo", {});
_this.log(`===成功调用openOsmo===${JSON.stringify(params)}`);
window.courseware.callOcMethod("openOsmo", params);
},
closeOsmo() {
window.courseware.hasCalledOpenOsmo = false;
......@@ -204,6 +266,22 @@ export function initAir(_this) {
_this.log(`===成功调用closeOsmoFingerRead===`);
window.courseware.callOcMethod("closeOsmoFingerRead", {});
},
onConfigurationPortrait(params = {}, callback) {
_this.log(`===成功调用onConfigurationPortrait||竖屏===`);
window.air.configurationPortraitCallback = (res) => {
callback && callback(res);
window.air.configurationPortraitCallback = null;
};
window.courseware.callOcMethod("onConfigurationPortrait", params);
},
onConfigurationLandscape(params = {}, callback) {
_this.log(`===成功调用onConfigurationLandscape||横屏===`);
window.air.configurationLandscapeCallback = (res) => {
callback && callback(res);
window.air.configurationLandscapeCallback = null;
};
window.courseware.callOcMethod("onConfigurationLandscape", params);
},
callOcMethod(method, param) {
const paramStr = JSON.stringify(param);
_this.log(`===成功调用原生方法${method}===参数==${paramStr}`);
......@@ -214,9 +292,17 @@ export function initAir(_this) {
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) {
console.log('汪汪汪')
} else {
console.error('非源生环境');
console.error(`非源生环境,网页版不支持${method}方法,将返回此方法的Mock数据以便于网页版调试使用`);
if(method == 'getEngineInfo'){
window.air.getEngineInfoCallback({isDev: 1});
window.air.getEngineInfoCallback({isDev: 1, uuid: 'debug-xxxxxx-xxxxxx'});
} else if (method == 'startTest') {
} else if (method == 'stopTest') {
window.air.testCallBack(testMockData);
} else if (method == 'startRecord') {
} else if (method == 'stopRecord') {
window.air.recordCallBack(recordMockData);
} else{
console.error(`${method}方法还没有Mock数据,请联系技术支持人员添加`);
}
}
},
......
{
"ver": "1.0.8",
"uuid": "b2881ebb-5dc0-4429-ae45-be9f589b9670",
"uuid": "5db4ac00-dc44-44aa-a996-19aefa0955c5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
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
{
"ver": "1.0.8",
"uuid": "c41b0e51-55d7-443c-af3a-b22c3dd9b9e5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
import { middleLayerBase } from "./middleLayerBase";
import { buttonOnClick } from "./util";
import { initAir } from './air';
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends middleLayerBase {
routers = [];
version = null;
isDev = null;
type = null;
engine_uuid = null;
async checkVersion() {
const { versionName: onlineVersion, storeList } = await this.getOnlineVersion();
const nativeVersion = await this.getNativeVersion();
this.version = nativeVersion;
if (onlineVersion != '' && onlineVersion != nativeVersion) {
console.log('onlineVersion = ' + onlineVersion);
console.log('nativeVersion = ' + nativeVersion);
(<any>window).courseware.needUpdate('检测到更新', storeList[0]);
}
}
async getNativeVersion() {
const engineInfo = await this.getEngineInfo();
const { version, isDev, type, uuid, mac } = JSON.parse(engineInfo);
this.version = version;
this.isDev = isDev;
this.type = type;
this.engine_uuid = mac || uuid;
return this.version;
}
async getOnlineVersion() {
let platform = '';
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
platform = 'ios';
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
platform = 'android';
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) {
platform = 'windows';
} else {
platform = 'web';
}
const res: any = await this.asyncCallNetworkApiGet('/api/application/v1/checkVersion', {
pkg_name: 'com.iplayabc.reading',
platform: platform
});
return JSON.parse(res).data;
}
showLoading() {
this.showWaitingLetters();
}
hideLoading() {
this.hideWaitingLetters();
}
// 统一释放异步资源的方法
onLoad() {
initAir(this);
this.reWriteAir();
}
async start() {
this.node.zIndex = 9999;
cc.game.addPersistRootNode(this.node);
await this.checkVersion();
if (this.isDev == 1) {
cc.find(`middleLayer/debug`).active = true;
}
cc.find('middleLayer/BtnRight').active = false;
cc.find('middleLayer/BtnLeft').active = false;
cc.find('middleLayer/ExitBtn').active = false;
if (this.type == 'aixuebao') {
await this.asyncCallNetworkApiGet(`/api/aixuebao/v1/engine/active`, {
engineid: this.engine_uuid,
product: 'cartoon'
});
}
const str:any = await this.asyncCallNetworkApiGet(`/api/cartoon/v1/engine/bindinfo`, {
engine_id: this.engine_uuid
});
const resObj = JSON.parse(str);
const sylles = resObj.data;
if (sylles) {
cc.sys.localStorage.setItem('activeSyllabuses', sylles);
this.showWaitingLetters();
this.loadOnlineBundle("cartoon_main");
} else {
cc.find(`middleLayer/activeLayer`).active = true;
}
this.initListener();
this.onMiddleLayerLoadingFinish(); // 这个是用来隐藏原生端启动页的方法,酌情在适当的地方调用
}
async loadMainPage() {
this.showLoading();
const str:any = await this.asyncCallNetworkApiGet(`/api/cartoon/v1/engine/bindinfo`, {
engine_id: this.engine_uuid
});
this.hideLoading();
const resObj = JSON.parse(str);
const sylles = resObj.data;
if (sylles) {
cc.sys.localStorage.setItem('activeSyllabuses', sylles);
this.showWaitingLetters();
this.loadOnlineBundle("cartoon_main");
} else {
cc.find(`middleLayer/activeLayer`).active = true;
}
}
initListener() {
const exitBtn = cc.find('middleLayer/ExitBtn');
buttonOnClick(exitBtn, ()=>{
if (this.isShowWaiting) {
return;
}
cc.find('middleLayer/BtnRight').active = false;
cc.find('middleLayer/BtnLeft').active = false;
cc.find('middleLayer/ExitBtn').active = false;
this.showWaitingLetters();
this.loadOnlineBundle("cartoon_main");
}, 0.5)
buttonOnClick(cc.find('middleLayer/BtnRight'), () => {
if (this.isShowWaiting) {
return;
}
this.goNextPage();
if (this.courseIndex == 0) {
cc.find('middleLayer/BtnLeft').active = false;
} else {
cc.find('middleLayer/BtnLeft').active = false;
}
if (this.courseIndex == this.courses.length - 1) {
cc.find('middleLayer/BtnRight').active = false;
} else {
cc.find('middleLayer/BtnRight').active = true;
}
});
buttonOnClick(cc.find('middleLayer/BtnLeft'), () => {
if (this.isShowWaiting) {
return;
}
this.goPrePage();
if (this.courseIndex == 0) {
cc.find('middleLayer/BtnLeft').active = false;
} else {
cc.find('middleLayer/BtnLeft').active = false;
}
if (this.courseIndex == this.courses.length - 1) {
cc.find('middleLayer/BtnRight').active = false;
} else {
cc.find('middleLayer/BtnRight').active = true;
}
});
buttonOnClick(cc.find('middleLayer/activeLayer/active'), async () => {
if (this.isShowWaiting) {
return;
}
this.showLoading();
const input = cc.find('middleLayer/activeLayer/active_bg/active_input').getComponent(cc.EditBox);
const activeCode = input.textLabel.string;
const res:any = await this.asyncCallNetworkApiPost(`/api/cartoon/v1/engine/bind`, {
engine_id: this.engine_uuid, book_code: activeCode,
});
if (res && res.code == 200) {
this.showTips("激活成功");
cc.find('middleLayer/activeLayer').active = false;
input.textLabel.string = "";
this.hideLoading();
await this.loadMainPage();
} else {
this.hideLoading();
this.showTips(`激活失败:${res.msg}`);
}
});
// 环境切换后门(两秒内连点十下以上)
// middleLayer/backdoor
const bk = cc.find(`middleLayer/backdoor`);
bk.on('click', () => {
const bk_count = bk["bk_count"];
if (!bk_count) {
bk.attr({bk_count: 1});
setTimeout(() => {
bk.attr({bk_count: null});
}, 2000);
} else if (bk_count>10){
window["courseware"]?.changeHost();
} else {
bk.attr({bk_count: bk_count+1});
}
});
}
log(str) {
const logStr = `${new Date().toLocaleString()}: ${str}`;
console.log(logStr);
}
reWriteAir() {
(<any>window).courseware.getData = (callback) => {
let data = null;
if (this.courseItem && this.courseItem.data) {
data = JSON.parse(this.courseItem.data);
}
this.log("===成功调用getData===" + JSON.stringify(data));
callback && callback(data);
}
(<any>window).courseware.nextPage = () => {
this.goNextPage();
if (this.courseIndex == 0) {
cc.find('middleLayer/BtnLeft').active = false;
} else {
cc.find('middleLayer/BtnLeft').active = false;
}
if (this.courseIndex == this.courses.length - 1) {
cc.find('middleLayer/BtnRight').active = false;
} else {
cc.find('middleLayer/BtnRight').active = true;
}
}
(<any>window).courseware.beforePage = () => {
this.goPrePage();
if (this.courseIndex == 0) {
cc.find('middleLayer/BtnLeft').active = false;
} else {
cc.find('middleLayer/BtnLeft').active = false;
}
if (this.courseIndex == this.courses.length - 1) {
cc.find('middleLayer/BtnRight').active = false;
} else {
cc.find('middleLayer/BtnRight').active = true;
}
}
if (!(<any>window).air) {
(<any>window).air = {};
}
(<any>window).air.hideAirClassLoading = () => {
console.log('汪汪汪');
(<any>window).air.onCourseInScreen && (<any>window).air.onCourseInScreen(() => {
console.log("***成功调用onCourseInScreen***");
(<any>window).air.onCourseInScreen = null;
});
this.hideWaitingLetters();
}
}
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 if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) {
console.log('汪汪汪')
} else {
console.error('非源生环境11');
}
}
isShowWaiting = false;
showWaitingLetters() {
if (this.isShowWaiting) {
return;
}
this.isShowWaiting = true;
const layout = cc.find('middleLayer/layout');
layout.removeAllChildren();
const canvas = cc.find("Canvas");
const bg = layout.addComponent(cc.Graphics);
bg.fillRect(-canvas.width / 2, -canvas.height / 2, canvas.width, canvas.height);
const laodingLayer = cc.find('middleLayer/loadingLayer');
laodingLayer.active = true;
const script = cc.find('middleLayer/loadingLayer/progress').getComponent('progressScript');
script.setProgress(0);
const id = setInterval(() => {
script.setProgress(changeObj.value);
}, 1);
const changeObj = { value: 0 };
cc.tween(changeObj)
.to(5, { value: 0.9 })
.call(() => {
clearInterval(id);
})
.start();
}
hideWaitingLetters() {
this.isShowWaiting = false;
const layout = cc.find('middleLayer/layout');
layout.active = false;
const laodingLayer = cc.find('middleLayer/loadingLayer');
laodingLayer.active = false;
}
}
{
"ver": "1.0.8",
"uuid": "60d81384-fa74-4bb6-832e-9012d6659bb6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
function asyncDelay(time) {
return new Promise((resolve, reject) => {
try {
setTimeout(() => {
resolve();
}, time * 1000);
} catch (e) {
reject(e);
}
})
}
export abstract class middleLayerBase extends cc.Component {
abstract reWriteAir(): void;
abstract hideWaitingLetters(): void;
abstract showWaitingLetters(): void;
onMiddleLayerLoadingFinish() {
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
jsb.reflection.callStaticMethod(
"RootViewController",
"getMiddleLayerInfoFinish:",
""
);
}
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
jsb.reflection.callStaticMethod(
"com/iplayabc/cocos/AppActivity",
"getMiddleLayerInfoFinish",
"(Ljava/lang/String;)Ljava/lang/String;",
""
);
}
}
callNetworkApiPost(uri, data, callBack) {
this.getBaseUrl((baseUrl) => {
const xhr = new XMLHttpRequest();
const url = `${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));
});
}
callNetworkApiGet(uri, data, callBack) {
this.getBaseUrl((baseUrl) => {
let queryStr = '?';
const params = [];
for (const key in data) {
if (Object.hasOwnProperty.call(data, key)) {
params.push(`${key}=${data[key]}`);
}
}
queryStr += params.join("&");
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
callBack(xhr.responseText);
}
};
const url = `${baseUrl}${uri}${queryStr}`;
console.log('url = ' + url);
xhr.open('GET', url, true);
xhr.send();
});
}
ORG_ID;
async getBaseUrl(callback) {
const engineInfo = await this.getEngineInfo();
const { isDev } = JSON.parse(engineInfo);
if (isDev == 1) {
this.ORG_ID = 515;
callback('http://staging-openapi.iteachabc.com');
} else {
this.ORG_ID = 514;
callback('http://openapi.iteachabc.com');
}
}
getEngineInfo() {
if ((<any>window).air.engineInfo) {
return (<any>window).air.engineInfo;
} else {
return new Promise((resolve, reject) => {
(<any>window).courseware.getEngineInfo(() => {
resolve((<any>window).air.engineInfo);
});
});
}
}
asyncCallNetworkApiGet(apiName, data) {
return new Promise((resolve, reject) => {
this.callNetworkApiGet(apiName, data, (res => {
resolve(res);
}));
});
}
asyncCallNetworkApiPost(uri, data) {
return new Promise((resolve, reject) => {
this.callNetworkApiPost(uri, data, (res) => {
resolve(res);
});
});
}
loadOnlineBundle(bundleName) {
this.callNetworkApiGet(`/api/template/v1/${bundleName}`, {}, (datastr) => {
const data = JSON.parse(datastr);
let configData = null;
if (cc.sys.os == cc.sys.OS_IOS) {
configData = data.data.conf.ios;
} else if (cc.sys.os == cc.sys.OS_ANDROID) {
configData = data.data.conf.android;
} else {
configData = data.data.conf.web_desktop;
}
const sceneName = configData.sceneName;
const version = configData.version;
const bondleUrl = configData.bondleUrl;
this.loadBundle(sceneName, version, bondleUrl);
});
}
currentBundleInfo = null;
reloadBundle() {
const { sceneName, version, bondleUrl } = this.currentBundleInfo;
this.loadBundle(sceneName, version, bondleUrl);
}
async loadBundle(sceneName, version, bondleUrl, callback = null) {
this.currentBundleInfo = { sceneName, version, bondleUrl };
this.showWaitingLetters();
const oldSceneName = this.currentBundleInfo?.sceneName;
const engineInfo = await this.getEngineInfo();
const { isChanged } = JSON.parse(engineInfo);
if (isChanged) {
await this.checkRotateScreen(oldSceneName, sceneName);
}
cc.assetManager.loadBundle(bondleUrl, { version: version }, async (err, bundle) => {
console.log('bundle: ', bundle);
bundle.loadScene(sceneName, null, null, (err, scene) => {
cc.audioEngine.stopAll();
cc.director.runScene(scene, null, () => {
console.log('sceneName = ' + sceneName);
const canvas = cc.find('Canvas');
const middleLayer = cc.find('middleLayer');
canvas.getComponent(cc.Widget).updateAlignment();
middleLayer.scale = canvas.width / middleLayer.width;
callback && callback();
// this.showLog('middleLayer.scale = ' + middleLayer.scale);
});
});
});
}
checkRotateScreen(oldSceneName: string, newSceneName: string) {
const sceneNameList = [];
if (sceneNameList.includes(oldSceneName) || sceneNameList.includes(newSceneName)) {
return new Promise((resolve, reject) => {
if (sceneNameList.includes(newSceneName)) {
// 如果已经是竖屏了
if (cc.view.getCanvasSize().width < cc.view.getCanvasSize().height) {
resolve(null);
return;
}
// 旋转到竖屏
(<any>window).courseware.onConfigurationPortrait({}, async () => {
while (cc.view.getCanvasSize().width > cc.view.getCanvasSize().height) {
await asyncDelay(0.1);
}
resolve(null);
});
} else {
// 如果已经是横屏了
if (cc.view.getCanvasSize().width > cc.view.getCanvasSize().height) {
resolve(null);
return;
}
// 旋转到横屏
(<any>window).courseware.onConfigurationLandscape({}, async () => {
while (cc.view.getCanvasSize().width < cc.view.getCanvasSize().height) {
await asyncDelay(0.1);
}
resolve(null);
});
}
});
}
}
courses = null;
courseIndex = 0;
courseItem = null;
loadOnlineCourseWare(courseId, linkFlag = false) {
this.showWaitingLetters();
let api = `/api/courseware/v1/${courseId}/list`;
if (linkFlag === true) {
api = `/api/courseware/v1/${courseId}/eq/level/list`;
}
this.callNetworkApiGet(api, {}, (datastr) => {
const data = JSON.parse(datastr);
if (data.rows && data.rows.length > 0) {
this.courses = data.rows;
this.courseIndex = data.index || 0;
this.courseItem = data.rows[this.courseIndex];
} else {
this.hideWaitingLetters();
this.showTips(`内容还未制作`);
return;
}
if (this.courses && this.courses.length > 1 && this.courseIndex <= this.courses.length - 1) {
cc.find('middleLayer/BtnRight').active = true;
}
if (this.courseIndex > 0) {
cc.find('middleLayer/BtnLeft').active = false;
}
this.loadPageBundle(() => {
cc.find('middleLayer/ExitBtn').active = true;
});
});
}
loadPageBundle(callback = null) {
let sceneName, version, bondleUrl = "";
if (cc.sys.os == cc.sys.OS_IOS) {
sceneName = this.courseItem.conf.ios.sceneName;
version = this.courseItem.conf.ios.version;
bondleUrl = this.courseItem.conf.ios.bondleUrl;
} else if (cc.sys.os == cc.sys.OS_ANDROID) {
sceneName = this.courseItem.conf.android.sceneName;
version = this.courseItem.conf.android.version;
bondleUrl = this.courseItem.conf.android.bondleUrl;
} else {
sceneName = this.courseItem.conf.web_desktop.sceneName;
version = this.courseItem.conf.web_desktop.version;
bondleUrl = this.courseItem.conf.web_desktop.bondleUrl;
}
this.loadBundle(sceneName, version, bondleUrl, callback);
}
goPrePage() {
this.goTarIndexPage(this.courseIndex - 1);
}
goNextPage() {
this.goTarIndexPage(this.courseIndex + 1);
}
goTarIndexPage(index) {
if (!this.courses || index == this.courseIndex || index < 0 || index > this.courses.length - 1) {
return;
}
(<any>window).courseware.freeAllOcMethod();
this.courseIndex = index;
this.courseItem = this.courses[this.courseIndex];
this.loadPageBundle();
}
async showTips(str: string) {
const tipsLayer = cc.find('middleLayer/tipsLayer');
const label = cc.find('middleLayer/tipsLayer/tips/label');
label.getComponent(cc.Label).string = ` ${str} `;
const tips = cc.find('middleLayer/tipsLayer/tips');
tipsLayer.active = true;
tips.width = Math.max(300, label.width + 50);
cc.tween(tips)
.set({ opacity: 255 })
.to(2, { opacity: 0 })
.call(() => {
tipsLayer.active = false;
})
.start();
}
log(str) {
cc.log(str);
}
}
{
"ver": "1.0.8",
"uuid": "1b25c125-5f6c-4819-abcf-c852abb44e9e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -94,13 +94,13 @@ export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
}
}
export function getDistance (start, end){
export function getDistance(start, end) {
var pos = cc.v2(start.x - end.x, start.y - end.y);
var dis = Math.sqrt(pos.x*pos.x + pos.y*pos.y);
var dis = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
return dis;
}
export function playAudioByUrl(audio_url, cb=null) {
export function playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
......@@ -114,21 +114,21 @@ export function playAudioByUrl(audio_url, cb=null) {
}
export function btnClickAnima(btn, time=0.15, rate=1.05) {
export function btnClickAnima(btn, time = 0.15, rate = 1.05) {
btn.tmpScale = btn.scale;
btn.on(cc.Node.EventType.TOUCH_START, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.scale * rate})
.to(time / 2, { scale: btn.scale * rate })
.start()
})
btn.on(cc.Node.EventType.TOUCH_CANCEL, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.to(time / 2, { scale: btn.tmpScale })
.start()
})
btn.on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.to(time / 2, { scale: btn.tmpScale })
.start()
})
}
......@@ -341,14 +341,25 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks(right);
}
export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
} else {
console.log('onHomeworkFinish');
export function buttonOnClick(button, callback, scale = 1.0) {
button.on('click', () => {
if (button['cantClick']) {
return;
}
cc.audioEngine.stopAll();
const audio = cc.find(`middleLayer/audio/btn`).getComponent(cc.AudioSource);
cc.audioEngine.playEffect(audio.clip, false);
button['cantClick'] = true;
cc.tween(button)
.to(0.1, { scale: scale * 1.1 })
.to(0.1, { scale: scale })
.call(() => {
button['cantClick'] = false;
callback && callback();
})
.start();
});
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "3bd21b7b-0b74-49cb-9127-d71614a11fbb",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 214,
"height": 62,
"platformSettings": {},
"subMetas": {
"btnRight": {
"active": {
"ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "076df840-6f52-4102-bbe4-1df7f1a22db8",
"rawTextureUuid": "3bd21b7b-0b74-49cb-9127-d71614a11fbb",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 0.5,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 60,
"height": 66,
"rawWidth": 61,
"rawHeight": 67,
"width": 214,
"height": 62,
"rawWidth": 214,
"rawHeight": 62,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "6543e441-e0f6-4092-b453-50ddc04ab2be",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 800,
"height": 480,
"platformSettings": {},
"subMetas": {
"active_bg": {
"ver": "1.0.4",
"uuid": "00f6d8a8-6015-4147-b225-f409b5b611e7",
"rawTextureUuid": "6543e441-e0f6-4092-b453-50ddc04ab2be",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7.5,
"offsetY": -12.5,
"trimX": 73,
"trimY": 56,
"width": 639,
"height": 393,
"rawWidth": 800,
"rawHeight": 480,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "63f1f0d8-bc59-4720-b1c0-1472003dd10f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 511,
"height": 45,
"platformSettings": {},
"subMetas": {
"bar": {
"ver": "1.0.4",
"uuid": "34839085-4aa9-4e97-8818-10cb3d1c7bf7",
"rawTextureUuid": "63f1f0d8-bc59-4720-b1c0-1472003dd10f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 4.5,
"trimX": 11,
"trimY": 5,
"width": 490,
"height": 26,
"rawWidth": 511,
"rawHeight": 45,
"borderTop": 9.5,
"borderBottom": 0,
"borderLeft": 13,
"borderRight": 13,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "784f09f7-cb63-4d22-b26c-651af3457397",
"uuid": "3c2df85e-c02b-4912-ba8d-61d76f63bd83",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 84,
"height": 64,
"width": 511,
"height": 45,
"platformSettings": {},
"subMetas": {
"Btn": {
"bg": {
"ver": "1.0.4",
"uuid": "6ed1daae-8803-4472-9415-0b50186d62ec",
"rawTextureUuid": "784f09f7-cb63-4d22-b26c-651af3457397",
"uuid": "2fa247ea-989c-4d8b-a7e0-d47408f5a3d3",
"rawTextureUuid": "3c2df85e-c02b-4912-ba8d-61d76f63bd83",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 84,
"height": 64,
"rawWidth": 84,
"rawHeight": 64,
"width": 511,
"height": 45,
"rawWidth": 511,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "73d4cccd-fa8b-4684-b539-3c6fbd9ddaca",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 398,
"height": 172,
"platformSettings": {},
"subMetas": {
"bg_tip": {
"ver": "1.0.4",
"uuid": "5ea977da-e76e-4da5-a9cf-5015631b70d7",
"rawTextureUuid": "73d4cccd-fa8b-4684-b539-3c6fbd9ddaca",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 398,
"height": 172,
"rawWidth": 398,
"rawHeight": 172,
"borderTop": 26,
"borderBottom": 38,
"borderLeft": 39,
"borderRight": 40,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c216cba4-55fc-4c22-b0a3-1921a2035e4a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 83,
"height": 83,
"platformSettings": {},
"subMetas": {
"btn_home": {
"ver": "1.0.4",
"uuid": "6d891122-fcef-4c63-85ef-f02245a0befd",
"rawTextureUuid": "c216cba4-55fc-4c22-b0a3-1921a2035e4a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 83,
"height": 83,
"rawWidth": 83,
"rawHeight": 83,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "20126912-9202-4894-b6ff-ace0ce11e1ed",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 75,
"height": 74,
"platformSettings": {},
"subMetas": {
"btn_left": {
"ver": "1.0.4",
"uuid": "2c64c55e-8670-4efb-9a72-b070cb8f7522",
"rawTextureUuid": "20126912-9202-4894-b6ff-ace0ce11e1ed",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 75,
"height": 74,
"rawWidth": 75,
"rawHeight": 74,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d1c87cec-0382-4f9c-b881-dbab3f2e14f4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 75,
"height": 74,
"platformSettings": {},
"subMetas": {
"btn_right": {
"ver": "1.0.4",
"uuid": "44f288b3-7630-4926-afb3-d2f55b24cee4",
"rawTextureUuid": "d1c87cec-0382-4f9c-b881-dbab3f2e14f4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 75,
"height": 74,
"rawWidth": 75,
"rawHeight": 74,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "926ed3c5-b2d8-43bd-b19c-7c40dc068266",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 53,
"height": 57,
"platformSettings": {},
"subMetas": {
"btnLeft": {
"close": {
"ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "c61beb01-deff-4df2-b85a-7b46280d55ed",
"rawTextureUuid": "926ed3c5-b2d8-43bd-b19c-7c40dc068266",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 61,
"height": 67,
"rawWidth": 61,
"rawHeight": 67,
"width": 53,
"height": 57,
"rawWidth": 53,
"rawHeight": 57,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "0712f43b-98a4-4948-995b-02f82d659d4e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 391,
"height": 55,
"platformSettings": {},
"subMetas": {
"input_bg": {
"ver": "1.0.4",
"uuid": "95a457bf-1199-4d46-a45d-eb9419f0f3f5",
"rawTextureUuid": "0712f43b-98a4-4948-995b-02f82d659d4e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 391,
"height": 55,
"rawWidth": 391,
"rawHeight": 55,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "47ba69f2-1ddb-42a7-bc8d-e7690b9a06fd",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 511,
"height": 45,
"platformSettings": {},
"subMetas": {
"progress_bar": {
"ver": "1.0.4",
"uuid": "c8263dcf-d226-41b6-8cea-42be19fdb92a",
"rawTextureUuid": "47ba69f2-1ddb-42a7-bc8d-e7690b9a06fd",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 4.5,
"trimX": 11,
"trimY": 5,
"width": 490,
"height": 26,
"rawWidth": 511,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6ef95af9-1b75-4600-8422-0fedea5bbd44",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 511,
"height": 45,
"platformSettings": {},
"subMetas": {
"progress_bg": {
"ver": "1.0.4",
"uuid": "a72e2ca1-5791-4a3f-8a09-5e73e061b76a",
"rawTextureUuid": "6ef95af9-1b75-4600-8422-0fedea5bbd44",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 511,
"height": 45,
"rawWidth": 511,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -52,7 +52,7 @@ function execCmd(cmd, params, path) {
}
let creatorBasePath = 'CocosCreator';
let creatorBasePath = 'C:\\CocosDashboard_1.0.6\\resources\\.editors\\Creator\\2.4.5\\CocosCreator.exe';
if (process.platform !== 'win32') {
creatorBasePath = "/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator";
}
......@@ -223,11 +223,9 @@ function changeSettingsToBundle () {
editFolderMeta(path, folderName, true);
}
function replaceUuids () {
console.log('build_step_0 开始~!');
const path = 'assets'
function getFolderName(path) {
let folderName = '';
fs.readdirSync(path).find(fileName => {
......@@ -238,31 +236,6 @@ function replaceUuids () {
});
return folderName;
}
const folderName = getFolderName(path);
let oldFireUuid = '';
let oldJsUuid = '';
let oldJsShortUuid = '';
let oldJsId = '';
const fireMetaStr = fs.readFileSync(`assets/${folderName}/scene/${folderName}.fire.meta`);
if (fireMetaStr.indexOf('57ea7c61-9b8b-498a-b024-c98ee9124beb') > 0) {
// 老Cocos脚手架
oldFireUuid = '57ea7c61-9b8b-498a-b024-c98ee9124beb';
oldJsUuid = 'f4ede462-f8d7-4069-ba80-915611c058ca';
oldJsShortUuid = 'f4edeRi+NdAabqAkVYRwFjK';
oldJsId = 'e687yyoRBIzZAOVRL8Sseh';
}
if (fireMetaStr.indexOf('0737ce42-24f0-45c6-8e1a-8bdab4f74ba3') > 0) {
// 新Cocos脚手架
oldFireUuid = '0737ce42-24f0-45c6-8e1a-8bdab4f74ba3';
oldJsUuid = '408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5';
oldJsShortUuid = '408a6f4ZfpM8Yzyg+IOGg/V';
oldJsId = 'eaTVUpqahPfZeO9+sUI7RP';
}
if (oldFireUuid === '') {
return;
}
function editFolderMeta(path, folderName) {
const metaPath = `${path}/${folderName}.meta`;
const metaDataStr = fs.readFileSync(metaPath);
......@@ -270,6 +243,8 @@ function replaceUuids () {
metaData.isBundle = false;
fs.writeFileSync(metaPath, JSON.stringify(metaData));
}
function fileReplace(path, replaceStr, newStr) {
if (!fs.existsSync(path)) {
return;
......@@ -279,23 +254,30 @@ function replaceUuids () {
const newFileStr = fileStr.toString().replace(new RegExp(replaceStr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), 'g'), newStr);
fs.writeFileSync(path, newFileStr);
}
function getShortUuid(uuid) {
const bytes = parse(uuid).subarray(1);
return uuid.substring(0, 5) + Base64.fromUint8Array(bytes).substring(2);
}
const path = 'assets'
const folderName = getFolderName(path);
editFolderMeta(path, folderName);
const oldFireUuid = '57ea7c61-9b8b-498a-b024-c98ee9124beb';
const newFireUuid = v4();
fileReplace(`assets/${folderName}/scene/${folderName}.fire.meta`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace('settings/builder.json', oldFireUuid, newFireUuid);
function getShortUuid(uuid) {
const bytes = parse(uuid).subarray(1);
return uuid.substring(0, 5) + Base64.fromUint8Array(bytes).substring(2);
}
const oldJsUuid = 'f4ede462-f8d7-4069-ba80-915611c058ca';
const oldJsShortUuid = 'f4edeRi+NdAabqAkVYRwFjK';
const oldJsId = 'e687yyoRBIzZAOVRL8Sseh';
const newJsUuid = v4();
const newJsShortUuid = getShortUuid(newJsUuid);
const newJsId = v4().replace(/-/g, '').substring(0, oldJsId.length);
fileReplace(`assets/${folderName}/scene/${folderName}.ts.meta`, oldJsUuid, newJsUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.js.meta`, oldJsUuid, newJsUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldJsShortUuid, newJsShortUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldJsId, newJsId);
......@@ -376,8 +358,6 @@ module.exports = {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
......@@ -393,11 +373,8 @@ module.exports = {
},
buildIos: async function () {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
......
declare const global:any = {};
/** !#en
The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.
!#zh
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
This diff is collapsed.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ng-template-generator": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ng-template-generator",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
"output": "/assets/"
}
],
"styles": [
"./node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ng-template-generator:build"
},
"configurations": {
"production": {
"browserTarget": "ng-template-generator:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ng-template-generator:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ng-template-generator:serve"
},
"configurations": {
"production": {
"devServerTarget": "ng-template-generator:serve:production"
}
}
}
}
}
},
"defaultProject": "ng-template-generator"
}
This diff is collapsed.
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { ErrorHandler } from '@angular/core';
export class MyErrorHandler implements ErrorHandler {
handleError(error) {
console.log(error.stack);
(<any> window).courseware.sendErrorLog(error);
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment