Commit 26e64ddd authored by liujiangnan's avatar liujiangnan

feat: 初始化

parent d4c5cd1b
No preview for this file type
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
pic1 = null;
pic2 = null;
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
}
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
}
curPage = null;
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
this.playLocalAudio('btn');
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
}
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
// update (dt) {},
initListener() {
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
import { defaultData } from "../script/defaultData";
export class MyCocosSceneComponent extends cc.Component {
// 生命周期 onLoad
onLoad() {
this.initSceneData();
this.initSize();
}
_imageResList = null;
_audioResList = null;
_animaResList = null;
initSceneData() {
this._imageResList = [];
this._audioResList = [];
this._animaResList = [];
}
_designSize = null; // 设计分辨率
_frameSize = null; // 屏幕分辨率
_mapScaleMin = null; // 场景中常用缩放(取大值)
_mapScaleMax = null; // 场景中常用缩放(取小值)
_cocosScale = null; // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
cc.director['_scene'].width = frameSize.width;
cc.director['_scene'].height = frameSize.height;
}
data = null;
// 生命周期 start
start() {
if (window && (<any>window).courseware && (<any>window).courseware.getData) {
(<any>window).courseware.getData((data) => {
this.log('data:' + data);
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data));
this.preloadItem();
})
} else {
this.data = this.getDefaultData();
this.preloadItem();
}
}
getDefaultData() {
return defaultData;
}
preloadItem() {
this.addPreloadImage();
this.addPreloadAudio();
this.addPreloadAnima();
this.preload();
}
addPreloadImage() {
}
addPreloadAudio() {
}
addPreloadAnima() {
}
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
if (window && window["air"]) {
// window["air"].onCourseInScreen = (next) => {
// window["air"].isCourseInScreen = true;
// this.onLoadEnd();
// next();
// };
this.onLoadEnd();
window["air"].hideAirClassLoading();
} else {
this.onLoadEnd();
}
cc.debug.setDisplayStats(false);
});
}
log (str) {
const node = cc.find('middleLayer');
if(node){
node.getComponent('middleLayer').log(str);
}else{
cc.log(str);
}
}
onLoadEnd() {
}
// ------------------------------------------------
getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
}
getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
}
})
}
getSprNodeByUrl(url, cb) {
const node = new cc.Node();
const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb(node);
}
})
}
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}else{
cb && cb();
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 144,
"height": 144,
"platformSettings": {},
"subMetas": {
"icon": {
"ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 3,
"trimY": 2,
"width": 138,
"height": 141,
"rawWidth": 144,
"rawHeight": 144,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -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
{
"__type__": "cc.AnimationClip",
"_name": "loading",
"_objFlags": 0,
"_native": "",
"_duration": 0.38333333333333336,
"sample": 60,
"speed": 0.5,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "d483699c-1f3a-44ed-880f-c0289a7e142b"
}
},
{
"frame": 0.016666666666666666,
"value": {
"__uuid__": "50d4caeb-d718-4b0e-be1b-09d670123a65"
}
},
{
"frame": 0.03333333333333333,
"value": {
"__uuid__": "07928de5-691d-4237-b28f-5fbe88dbaff8"
}
},
{
"frame": 0.05,
"value": {
"__uuid__": "426b4bd1-e569-4809-9a34-83fb850983c7"
}
},
{
"frame": 0.06666666666666667,
"value": {
"__uuid__": "1f2d2a0e-761a-46a3-89a9-63546a6f7f8e"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "c26ed7a7-8ed8-4143-96f9-e7194b5499b2"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "df7d1fce-986a-4791-b1a2-70581e127a4d"
}
},
{
"frame": 0.11666666666666667,
"value": {
"__uuid__": "af31cfc5-ffae-4430-9532-4715ad337e31"
}
},
{
"frame": 0.13333333333333333,
"value": {
"__uuid__": "890b9af8-cab4-4bbe-924e-ee0953dc3ca2"
}
},
{
"frame": 0.15,
"value": {
"__uuid__": "f9c5bce9-2c56-4536-8ef8-f16dcb3a052a"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "c526144e-cbe9-4cac-a018-17bf035ebdc3"
}
},
{
"frame": 0.18333333333333332,
"value": {
"__uuid__": "e6c3a7d4-4820-4600-b555-c38e80f2b342"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "d483699c-1f3a-44ed-880f-c0289a7e142b"
}
},
{
"frame": 0.21666666666666667,
"value": {
"__uuid__": "c036d7e2-f4de-4260-93ee-7fdfca93c989"
}
},
{
"frame": 0.23333333333333334,
"value": {
"__uuid__": "1cc11112-e06b-4dbe-ae93-81bf7a9422c5"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "79da537a-7da1-4dba-a374-ff933a0f74c6"
}
},
{
"frame": 0.26666666666666666,
"value": {
"__uuid__": "054c9698-ef26-4a77-b7ff-83600000578e"
}
},
{
"frame": 0.2833333333333333,
"value": {
"__uuid__": "9eca02a2-376a-47a9-bf7a-80caf034d613"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "b84f5102-3a81-4e49-8784-077365b321c1"
}
},
{
"frame": 0.31666666666666665,
"value": {
"__uuid__": "5207aaf3-3a46-402f-a44f-80030fd660d9"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "86e22060-8ef8-49fa-95d5-08906708bedd"
}
},
{
"frame": 0.35,
"value": {
"__uuid__": "8c5c16ce-0683-467d-a4b4-c8994310cc62"
}
},
{
"frame": 0.36666666666666664,
"value": {
"__uuid__": "de1f4f72-41a8-4104-8a5c-bf5b4eb4e0fa"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "c01fcefa-a80e-43a2-8b03-cce500eba63d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ac7e840c-596c-4d10-80e2-8c44f3cce9b7",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2a589e55-1cf1-411b-9db0-95a119f58151",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_01": {
"ver": "1.0.4",
"uuid": "d483699c-1f3a-44ed-880f-c0289a7e142b",
"rawTextureUuid": "2a589e55-1cf1-411b-9db0-95a119f58151",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -11.5,
"offsetY": 4,
"trimX": 36,
"trimY": 15,
"width": 261,
"height": 318,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "7399861a-591c-4460-a1e6-b39a7d4de39e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_02": {
"ver": "1.0.4",
"uuid": "50d4caeb-d718-4b0e-be1b-09d670123a65",
"rawTextureUuid": "7399861a-591c-4460-a1e6-b39a7d4de39e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -2.5,
"offsetY": -2,
"trimX": 38,
"trimY": 18,
"width": 275,
"height": 324,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f3cd036c-3597-4139-a257-27a4a68dd720",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 357,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_03": {
"ver": "1.0.4",
"uuid": "07928de5-691d-4237-b28f-5fbe88dbaff8",
"rawTextureUuid": "f3cd036c-3597-4139-a257-27a4a68dd720",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 3.5,
"offsetY": -6,
"trimX": 40,
"trimY": 21,
"width": 284,
"height": 326,
"rawWidth": 357,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e48c9f43-a07c-4b36-8e8b-95ccdf7c9024",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_04": {
"ver": "1.0.4",
"uuid": "426b4bd1-e569-4809-9a34-83fb850983c7",
"rawTextureUuid": "e48c9f43-a07c-4b36-8e8b-95ccdf7c9024",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 6.5,
"offsetY": -12,
"trimX": 42,
"trimY": 25,
"width": 285,
"height": 330,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d3387ee0-2f1b-42b6-babd-75fcfbb501f8",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_05": {
"ver": "1.0.4",
"uuid": "1f2d2a0e-761a-46a3-89a9-63546a6f7f8e",
"rawTextureUuid": "d3387ee0-2f1b-42b6-babd-75fcfbb501f8",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 5,
"offsetY": -12,
"trimX": 42,
"trimY": 25,
"width": 282,
"height": 330,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "65b3e1d5-b7d8-48c4-9f1c-0a658b3ecef1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_06": {
"ver": "1.0.4",
"uuid": "c26ed7a7-8ed8-4143-96f9-e7194b5499b2",
"rawTextureUuid": "65b3e1d5-b7d8-48c4-9f1c-0a658b3ecef1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 5,
"offsetY": -12,
"trimX": 42,
"trimY": 25,
"width": 282,
"height": 330,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c169436c-47d7-4237-bcf0-b876328e3a19",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_07": {
"ver": "1.0.4",
"uuid": "df7d1fce-986a-4791-b1a2-70581e127a4d",
"rawTextureUuid": "c169436c-47d7-4237-bcf0-b876328e3a19",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 5,
"offsetY": -12.5,
"trimX": 42,
"trimY": 26,
"width": 282,
"height": 329,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e50e20f4-eba6-476d-96b4-a4982a02d57c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_08": {
"ver": "1.0.4",
"uuid": "af31cfc5-ffae-4430-9532-4715ad337e31",
"rawTextureUuid": "e50e20f4-eba6-476d-96b4-a4982a02d57c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -9,
"offsetY": -8.5,
"trimX": 39,
"trimY": 18,
"width": 260,
"height": 337,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ac63517b-96bc-42a8-8494-6f2a11530d98",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 357,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_09": {
"ver": "1.0.4",
"uuid": "890b9af8-cab4-4bbe-924e-ee0953dc3ca2",
"rawTextureUuid": "ac63517b-96bc-42a8-8494-6f2a11530d98",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -9,
"offsetY": -8,
"trimX": 39,
"trimY": 17,
"width": 261,
"height": 338,
"rawWidth": 357,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0e53c38c-bbb8-494d-b060-83b81c2705d8",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_10": {
"ver": "1.0.4",
"uuid": "f9c5bce9-2c56-4536-8ef8-f16dcb3a052a",
"rawTextureUuid": "0e53c38c-bbb8-494d-b060-83b81c2705d8",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -9.5,
"offsetY": -8,
"trimX": 38,
"trimY": 17,
"width": 261,
"height": 338,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1bcbafa4-1742-4a84-a1c9-8c5a8f7e0071",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_11": {
"ver": "1.0.4",
"uuid": "c526144e-cbe9-4cac-a018-17bf035ebdc3",
"rawTextureUuid": "1bcbafa4-1742-4a84-a1c9-8c5a8f7e0071",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -13,
"offsetY": 9.5,
"trimX": 37,
"trimY": 15,
"width": 256,
"height": 307,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "955d2b2a-5526-482b-9113-cab7fdda8609",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_12": {
"ver": "1.0.4",
"uuid": "e6c3a7d4-4820-4600-b555-c38e80f2b342",
"rawTextureUuid": "955d2b2a-5526-482b-9113-cab7fdda8609",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12.5,
"offsetY": 10.5,
"trimX": 38,
"trimY": 14,
"width": 255,
"height": 307,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "da0bd795-8f86-457a-b323-3eb4019116aa",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_13": {
"ver": "1.0.4",
"uuid": "d33f9cb8-3b2f-41c9-9a9e-71220fe37f4f",
"rawTextureUuid": "da0bd795-8f86-457a-b323-3eb4019116aa",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12.5,
"offsetY": 10,
"trimX": 38,
"trimY": 14,
"width": 255,
"height": 308,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ed158124-21b0-4f02-af8a-f7e9c5f239ad",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_14": {
"ver": "1.0.4",
"uuid": "c036d7e2-f4de-4260-93ee-7fdfca93c989",
"rawTextureUuid": "ed158124-21b0-4f02-af8a-f7e9c5f239ad",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -8.5,
"offsetY": -8.5,
"trimX": 41,
"trimY": 19,
"width": 257,
"height": 335,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "967a032b-a532-4564-a3db-7572277e2773",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 357,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_15": {
"ver": "1.0.4",
"uuid": "1cc11112-e06b-4dbe-ae93-81bf7a9422c5",
"rawTextureUuid": "967a032b-a532-4564-a3db-7572277e2773",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -9,
"offsetY": -8.5,
"trimX": 41,
"trimY": 19,
"width": 257,
"height": 335,
"rawWidth": 357,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "79854d15-8f61-457c-9887-a2b3b5a8f029",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_16": {
"ver": "1.0.4",
"uuid": "79da537a-7da1-4dba-a374-ff933a0f74c6",
"rawTextureUuid": "79854d15-8f61-457c-9887-a2b3b5a8f029",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -9.5,
"offsetY": -9,
"trimX": 40,
"trimY": 19,
"width": 257,
"height": 336,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d26be600-855a-494c-9fea-461fafdb9b8e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_17": {
"ver": "1.0.4",
"uuid": "054c9698-ef26-4a77-b7ff-83600000578e",
"rawTextureUuid": "d26be600-855a-494c-9fea-461fafdb9b8e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": -11.5,
"trimX": 45,
"trimY": 23,
"width": 252,
"height": 333,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ef3afd13-cf90-49bd-8a75-e957e61c6edf",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_18": {
"ver": "1.0.4",
"uuid": "9eca02a2-376a-47a9-bf7a-80caf034d613",
"rawTextureUuid": "ef3afd13-cf90-49bd-8a75-e957e61c6edf",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": -11.5,
"trimX": 45,
"trimY": 23,
"width": 252,
"height": 333,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "224cdc7d-10fe-4335-ad22-95feb80db21f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_19": {
"ver": "1.0.4",
"uuid": "b84f5102-3a81-4e49-8784-077365b321c1",
"rawTextureUuid": "224cdc7d-10fe-4335-ad22-95feb80db21f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": -11,
"trimX": 45,
"trimY": 23,
"width": 252,
"height": 332,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0d80bf10-b20d-43e7-9e15-cd07e79a4c77",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_20": {
"ver": "1.0.4",
"uuid": "5207aaf3-3a46-402f-a44f-80030fd660d9",
"rawTextureUuid": "0d80bf10-b20d-43e7-9e15-cd07e79a4c77",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -6,
"offsetY": -5.5,
"trimX": 39,
"trimY": 19,
"width": 266,
"height": 329,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "4181f3d2-2f71-4416-b582-51d861f22b3b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 357,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_21": {
"ver": "1.0.4",
"uuid": "86e22060-8ef8-49fa-95d5-08906708bedd",
"rawTextureUuid": "4181f3d2-2f71-4416-b582-51d861f22b3b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -6.5,
"offsetY": -5.5,
"trimX": 39,
"trimY": 19,
"width": 266,
"height": 329,
"rawWidth": 357,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6313183c-883b-4ea1-bc7d-95fbc723299d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_22": {
"ver": "1.0.4",
"uuid": "8c5c16ce-0683-467d-a4b4-c8994310cc62",
"rawTextureUuid": "6313183c-883b-4ea1-bc7d-95fbc723299d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12.5,
"offsetY": 8,
"trimX": 37,
"trimY": 12,
"width": 257,
"height": 316,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e226e1b7-f728-4e65-ace8-6e52102d9809",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 356,
"height": 356,
"platformSettings": {},
"subMetas": {
"icon_23": {
"ver": "1.0.4",
"uuid": "de1f4f72-41a8-4104-8a5c-bf5b4eb4e0fa",
"rawTextureUuid": "e226e1b7-f728-4e65-ace8-6e52102d9809",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -12,
"offsetY": 4,
"trimX": 36,
"trimY": 15,
"width": 260,
"height": 318,
"rawWidth": 356,
"rawHeight": 356,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "197cb28b-4ee4-4399-ae88-7cf915fefcc1",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"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": "f8b451ff-857c-4ca8-9870-866bc5154a29",
"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": "3d356c4d-cb23-4239-aa5f-8a913f420fa4",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"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": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"uuid": "f2080b9e-65f4-4a10-b460-eb81064a9d76",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
......
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"uuid": "3d918921-8913-44bb-90de-1640540392f5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
export function initAir(_this) {
const realAir = {
uploadUrl: "",
uploadData: null,
engineInfo: null,
hideAirClassLoading(templateName, loadData) {
_this.log("***成功调用hideAirClassLoading***");
window.air.onCourseInScreen && window.air.onCourseInScreen(() => {
_this.log("***成功调用onCourseInScreen***");
});
},
osmoCallback: function (res) {
_this.log(`***成功调用osmoCallback***参数==${res}`);
},
osmoHandwritingCallback: function (res) {
_this.log(`***成功调用osmoHandwritingCallback***参数==${res}`);
},
osmoFingerReadCallback: function (res) {
_this.log(`***成功调用osmoFingerReadCallback***参数==${res}`);
},
getEngineInfoCallback: null,
recognitionCameraCallBack: null,
testCallBack: null,
recordCallBack: null,
onCourseInScreen: null,
};
try {
window.air = new Proxy(realAir, {
set: function (target, key, value, receiver) {
let newValue = value;
if (key == "osmoCallback" || key == "osmoHandwritingCallback" || key == "osmoFingerReadCallback") {
newValue = function (res) {
_this.log(`||==成功调用${key}==||参数==${JSON.stringify(res)}`);
value(JSON.stringify(res));
}
}
return Reflect.set(target, key, newValue, receiver);
},
get: function (target, key, receiver) {
return Reflect.get(target, key, receiver);
},
deleteProperty: function (target, key) {
return Reflect.deleteProperty(target, key);
}
});
} catch (e) {
console.error("浏览器不支持ES6新特性Proxy/Reflect,请使用谷歌浏览器!");
}
window.courseware = {
getData(callback) {
_this.log("===成功调用getData===");
callback && callback(null);
},
uploadUrl() {
_this.log("===成功调用uploadUrl===");
return window.air.uploadUrl;
},
uploadData() {
_this.log("===成功调用uploadData===");
return window.air.uploadData;
},
nextPage() {
_this.log("===成功调用nextPage===");
},
beforePage() {
_this.log("===成功调用beforePage===");
},
jumpPage(page) {
_this.log(`===成功调用jumpPage=== page == ${page}`);
},
sendAnswer(answerObj) {
_this.log(`===成功调用sendAnswer=== answerObj == ${JSON.stringify(answerObj)}`);
answerObj.callback && answerObj.callback();
},
getAnswer(queryObj, callback) {
_this.log(`===成功调用getAnswer=== queryObj == ${JSON.stringify(queryObj)}`);
callback && callback(null);
},
getTemplates(callback) {
_this.log(`===成功调用getTemplates===`);
callback && callback(null);
},
getTemplateUrl(templateName, callback) {
_this.log(`===成功调用getTemplateUrl=== templateName == ${templateName}`);
callback && callback(null);
},
gameEnd() {
_this.log(`===成功调用gameEnd===`);
},
startRecord(testText) {
_this.log(`===成功调用startRecord=== testText == ${testText}`);
window.courseware.hasCalledStartRecord = true;
window.courseware.callOcMethod("startRecord", { "params": testText });
},
stopRecord(_isgradepapers, _callback) {
window.courseware.hasCalledStartRecord = false;
_this.log(`===成功调用stopRecord=== _isgradepapers == ${_isgradepapers}`);
let callback = _callback;
let isgradepapers;
if (_isgradepapers && typeof _isgradepapers === "function") {
callback = _isgradepapers;
isgradepapers = 1;
} else {
isgradepapers = _isgradepapers;
}
if (!callback) {
// 不传回调函数就表示取消评测
window.courseware.callOcMethod("stopRecord", { isBreak: 1 });
return;
}
// 结束录音
window.air.recordCallBack = (res) => {
callback && callback(JSON.stringify(res));
window.air.recordCallBack = null;
};
window.courseware.callOcMethod("stopRecord", { isBreak: 0, isGradePapers: isgradepapers });
},
startTest(testText, option) {
window.courseware.hasCalledStartTest = true;
_this.log(`===成功调用startTest=== testText == ${testText}`);
window.courseware.callOcMethod("startTest", { ...option, "params": testText });
},
stopTest(callback) {
window.courseware.hasCalledStartTest = false;
_this.log(`===成功调用stopTest===`);
if (!callback) {
// 不传回调函数就表示取消评测
_this.log(`===成功取消录音评测===`);
window.courseware.callOcMethod("stopTest", { isBreak: 1 });
return;
}
// 结束录音
window.air.testCallBack = (res) => {
_this.log(`===成功调用testCallBack=== res == ${JSON.stringify(res)}`);
callback && callback(JSON.stringify(res));
window.air.testCallBack = null;
};
window.courseware.callOcMethod("stopTest", {});
},
openRecognitionCamera(callback) {
window.courseware.hasCalledOpenRecognitionCamera = true;
_this.log(`===成功调用openRecognitionCamera===`);
window.air.recognitionCameraCallBack = (res) => {
callback && callback(JSON.stringify(res));
window.air.recognitionCameraCallBack = null;
};
window.courseware.callOcMethod("openRecognitionCamera", {});
},
closeRecognitionCamera() {
window.courseware.hasCalledOpenRecognitionCamera = false;
_this.log(`===成功调用closeRecognitionCamera===`);
window.courseware.callOcMethod("closeRecognitionCamera", {});
},
getEngineInfo(callback) {
_this.log(`===成功调用getEngineInfo===`);
// 调用原生获取机器信息
window.air.getEngineInfoCallback = (res) => {
window.air.engineInfo = res;
callback && callback(JSON.stringify(res));
window.air.getEngineInfoCallback = null;
};
window.courseware.callOcMethod("getEngineInfo", {});
},
openOsmo() {
window.courseware.hasCalledOpenOsmo = true;
_this.log(`===成功调用openOsmo===`);
window.courseware.callOcMethod("openOsmo", {});
},
closeOsmo() {
window.courseware.hasCalledOpenOsmo = false;
_this.log(`===成功调用closeOsmo===`);
window.courseware.callOcMethod("closeOsmo", {});
},
openOsmoHandwriting(params = {}) {
window.courseware.hasCalledOpenOsmoHandwriting = true;
_this.log(`===成功调用openOsmoHandwriting===${JSON.stringify(params)}`);
window.courseware.callOcMethod("openOsmoHandwriting", params);
},
closeOsmoHandwriting() {
window.courseware.hasCalledOpenOsmoHandwriting = false;
_this.log(`===成功调用closeOsmoHandwriting===`);
window.courseware.callOcMethod("closeOsmoHandwriting", {});
},
openOsmoFingerRead(params = {}) {
window.courseware.hasCalledOpenOsmoFingerRead = true;
_this.log(`===成功调用openOsmoFingerRead===${JSON.stringify(params)}`);
window.courseware.callOcMethod("openOsmoFingerRead", params);
},
closeOsmoFingerRead() {
window.courseware.hasCalledOpenOsmoFingerRead = false;
_this.log(`===成功调用closeOsmoFingerRead===`);
window.courseware.callOcMethod("closeOsmoFingerRead", {});
},
callOcMethod(method, param) {
const paramStr = JSON.stringify(param);
_this.log(`===成功调用原生方法${method}===参数==${paramStr}`);
if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
return jsb.reflection.callStaticMethod('RootViewController', `${method}:`, paramStr);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_ANDROID) {
return jsb.reflection.callStaticMethod('com/iplayabc/cocos/AppActivity', method, '(Ljava/lang/String;)Ljava/lang/String;', paramStr);
} else if (cc.sys.isNative && cc.sys.os == cc.sys.OS_WINDOWS) {
console.log('汪汪汪')
} else {
console.error('非源生环境');
if(method == 'getEngineInfo'){
window.air.getEngineInfoCallback({isDev: 1});
}
}
},
freeAllOcMethod() {
if (window.courseware.hasCalledStartRecord) {
window.courseware.stopRecord();
}
if (window.courseware.hasCalledStartTest) {
window.courseware.stopTest();
}
if (window.courseware.hasCalledOpenRecognitionCamera) {
window.courseware.closeRecognitionCamera();
}
if (window.courseware.hasCalledOpenOsmo) {
window.courseware.closeOsmo();
}
if (window.courseware.hasCalledOpenOsmoHandwriting) {
window.courseware.closeOsmoHandwriting();
}
if (window.courseware.hasCalledOpenOsmoFingerRead) {
window.courseware.closeOsmoFingerRead();
}
}
};
}
{
"ver": "1.0.8",
"uuid": "5db4ac00-dc44-44aa-a996-19aefa0955c5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"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
......@@ -165,7 +165,7 @@ export function getSprNodeByUrl(url, cb) {
export function playAudio(audioClip, cb = null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false);
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
......@@ -178,7 +178,7 @@ export async function asyncDelay(time) {
return new Promise((resolve, reject) => {
try {
setTimeout(() => {
resolve(null);
resolve();
}, time * 1000);
} catch (e) {
reject(e);
......@@ -296,7 +296,7 @@ export async function asyncTweenTo(node, duration, obj, ease = undefined) {
cc.tween(node)
.to(duration, obj, ease)
.call(() => {
resolve(null);
resolve();
})
.start();
} catch (e) {
......@@ -311,7 +311,7 @@ export async function asyncTweenBy(node, duration, obj, ease = undefined) {
cc.tween(node)
.by(duration, obj, ease)
.call(() => {
resolve(null);
resolve();
})
.start();
} catch (e) {
......
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.
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