Commit e417d2cc authored by liujiangnan's avatar liujiangnan

feat: 完成

parent 2a7dd682
...@@ -306,15 +306,18 @@ ...@@ -306,15 +306,18 @@
}, },
{ {
"__id__": 23 "__id__": 23
},
{
"__id__": 25
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 25 "__id__": 37
}, },
{ {
"__id__": 26 "__id__": 38
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1041,6 +1044,514 @@ ...@@ -1041,6 +1044,514 @@
"_atlas": null, "_atlas": null,
"_id": "51nBXWjLpNUIamFPlMloSh" "_id": "51nBXWjLpNUIamFPlMloSh"
}, },
{
"__type__": "cc.Node",
"_name": "pageProgress",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_children": [
{
"__id__": 26
},
{
"__id__": 29
},
{
"__id__": 32
}
],
"_active": true,
"_components": [
{
"__id__": 35
},
{
"__id__": 36
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 224,
"g": 228,
"b": 215,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1000,
"height": 15
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-56.139999999999986,
-304.762,
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": "22lyWzojdGH49LSi24ycI8"
},
{
"__type__": "cc.Node",
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 25
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 27
},
{
"__id__": 28
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 71,
"g": 170,
"b": 254,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1,
"height": 15
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-500,
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": "8enpco6JJPNYCSRRLsU3hn"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "08YS2BS/9MA4Gj2EBcQufw"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 8,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "2e+2thvcdExL9jDhGY5CiR"
},
{
"__type__": "cc.Node",
"_name": "stage",
"_objFlags": 0,
"_parent": {
"__id__": 25
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 30
},
{
"__id__": 31
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 71,
"g": 170,
"b": 253,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 65.33,
"height": 31.5
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
520,
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": "759eYKsRNPmaSE2PxeTWZR"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "Stage",
"_N$string": "Stage",
"_fontSize": 25,
"_lineHeight": 25,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "52euDPsjdHeKTSv0c2MEPQ"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 32,
"_left": 0,
"_right": -85.33000000000004,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "cfUHIY8WxDQqgMiLWO5YoC"
},
{
"__type__": "cc.Node",
"_name": "page",
"_objFlags": 0,
"_parent": {
"__id__": 25
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 33
},
{
"__id__": 34
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 71,
"g": 170,
"b": 253,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 34.75,
"height": 31.5
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
593.784,
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": "10j2YoNyJGnZloObMgCuwY"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "1/4",
"_N$string": "1/4",
"_fontSize": 25,
"_lineHeight": 25,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "82+zkn9SJIsZy6kOKuzqCD"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 32,
"_left": 0,
"_right": -128.534,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "e5aX1bl0JAbJiHwczFtgEr"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "acbgoDusNCT5PdXJyJ+Vlj"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 44,
"_left": 83.86000000000001,
"_right": 196.14,
"_top": 0,
"_bottom": 47.738,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1000,
"_originalHeight": 0,
"_id": "1dGYeHvYBG557BdCrymK1R"
},
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
......
...@@ -25,6 +25,18 @@ export default class NewClass extends middleLayerBase { ...@@ -25,6 +25,18 @@ export default class NewClass extends middleLayerBase {
}) })
.start(); .start();
} }
onCourseWareLoaded() {
// 课件加载完成的钩子
const process = cc.find(`middleLayer/pageProgress`);
const bar = cc.find(`bar`, process);
const barWidth = process.width * 1 / this.courses.length;
cc.tween(bar).to(0.5, { width: barWidth }).start();
const page = cc.find(`page`, process);
page.getComponent(cc.Label).string = `${this.courseIndex+1}/${this.courses.length}`;
}
// 需要预加载的数量 // 需要预加载的数量
preloadCount = null; preloadCount = null;
// 统计已加载的数量 // 统计已加载的数量
...@@ -182,6 +194,15 @@ export default class NewClass extends middleLayerBase { ...@@ -182,6 +194,15 @@ export default class NewClass extends middleLayerBase {
onHomeworkFinish(callBack, data = null) { onHomeworkFinish(callBack, data = null) {
this.goNextPage(); this.goNextPage();
const process = cc.find(`middleLayer/pageProgress`);
const bar = cc.find(`bar`, process);
let barWidth = process.width / this.courses.length * (this.courseIndex+1);
barWidth = barWidth>process.width?process.width:barWidth;
cc.tween(bar).to(0.5, { width: barWidth }).start();
const page = cc.find(`page`, process);
page.getComponent(cc.Label).string = `${this.courseIndex+1}/${this.courses.length}`;
} }
localMode = false; localMode = false;
......
...@@ -6,6 +6,8 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -6,6 +6,8 @@ export abstract class middleLayerBase extends cc.Component {
abstract hideWaitingLetters(): void; abstract hideWaitingLetters(): void;
abstract showWaitingLetters(): void; abstract showWaitingLetters(): void;
onCourseWareLoaded() {}
callNetworkApiPost(uri, data, callBack) { callNetworkApiPost(uri, data, callBack) {
this.getBaseUrl((baseUrl) => { this.getBaseUrl((baseUrl) => {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
...@@ -192,6 +194,7 @@ export abstract class middleLayerBase extends cc.Component { ...@@ -192,6 +194,7 @@ export abstract class middleLayerBase extends cc.Component {
} }
this.reWriteAir(); this.reWriteAir();
this.loadPageBundle(); this.loadPageBundle();
this.onCourseWareLoaded();
}); });
} }
......
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