Commit 0375cd6c authored by 李维's avatar 李维

优化进度条

parent e898f71c
......@@ -320,13 +320,13 @@
"__id__": 1085
},
{
"__id__": 1104
"__id__": 288
},
{
"__id__": 288
"__id__": 1104
},
{
"__id__": 1111
"__id__": 1110
}
],
"_active": true,
......@@ -49230,13 +49230,13 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8117c75d-0a4b-4e00-8337-908519edffff"
},
"_type": 1,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -49292,6 +49292,7 @@
"bar": {
"__id__": 1095
},
"maxWidth": 1348,
"process": {
"__id__": 1094
},
......@@ -49399,7 +49400,7 @@
"node": {
"__id__": 1085
},
"_enabled": true,
"_enabled": false,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
......@@ -49463,8 +49464,8 @@
},
{
"__type__": "cc.Node",
"_name": "tipsLayer",
"_objFlags": 512,
"_name": "finishLayer",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
......@@ -49476,7 +49477,10 @@
"_active": false,
"_components": [
{
"__id__": 1110
"__id__": 1108
},
{
"__id__": 1109
}
],
"_prefab": null,
......@@ -49525,87 +49529,21 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b2+0QRHqhONpO/79w7iCil"
"_id": "e13twzo8VOOoJzvXobl3sr"
},
{
"__type__": "cc.Node",
"_name": "tips",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 1104
},
"_children": [
{
"__id__": 1106
}
],
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1108
},
{
"__id__": 1109
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 398,
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-354,
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": "35zPmaqRFKO61TT6ctCm23"
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 1105
"__id__": 1106
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1107
}
......@@ -49621,8 +49559,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 30
"width": 1920,
"height": 1080
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -49656,40 +49594,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "efCSXIBTtIpZ+/yHqkyCTO"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1106
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "提示",
"_N$string": "提示",
"_fontSize": 30,
"_lineHeight": 30,
"_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": 2,
"_id": "76HU69UkBKs6v/jB9TBarh"
"_id": "adEnzeBAtPn7/mR7PTJDyg"
},
{
"__type__": "cc.Sprite",
......@@ -49707,9 +49612,9 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "297c6c6f-c675-4606-bb8a-11e4fea0eba0"
"__uuid__": "1c0a6b7e-0045-4448-9809-4abd334821cd"
},
"_type": 1,
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
......@@ -49721,7 +49626,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "fc587VKDtGr7lP2VK6jKGH"
"_id": "0adJROaKdBRaT9hXwvkCgn"
},
{
"__type__": "cc.Widget",
......@@ -49733,11 +49638,11 @@
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 4,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 131,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
......@@ -49748,7 +49653,7 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "afIfyPcpZDZbB+4yhAojNv"
"_id": "74Bk+o5D9A5LMSt0xR2+Mj"
},
{
"__type__": "cc.Widget",
......@@ -49775,25 +49680,32 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "7b2+UPIapMc4GikO2k1Ue7"
"_id": "01nR8fepxG6ZcOHWqf1F6F"
},
{
"__type__": "cc.Node",
"_name": "finishLayer",
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1104
},
"_enabled": true,
"_id": "99TmKuadlDrpqTImwqqu6G"
},
{
"__type__": "cc.Node",
"_name": "tipsLayer",
"_objFlags": 512,
"_parent": {
"__id__": 8
},
"_children": [
{
"__id__": 1112
"__id__": 1111
}
],
"_active": false,
"_components": [
{
"__id__": 1115
},
{
"__id__": 1116
}
......@@ -49844,11 +49756,80 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e13twzo8VOOoJzvXobl3sr"
"_id": "b2+0QRHqhONpO/79w7iCil"
},
{
"__type__": "cc.Node",
"_name": "bg",
"_name": "tips",
"_objFlags": 0,
"_parent": {
"__id__": 1110
},
"_children": [
{
"__id__": 1112
}
],
"_active": true,
"_components": [
{
"__id__": 1114
},
{
"__id__": 1115
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 398,
"height": 110
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-354,
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": "35zPmaqRFKO61TT6ctCm23"
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 1111
......@@ -49858,9 +49839,6 @@
"_components": [
{
"__id__": 1113
},
{
"__id__": 1114
}
],
"_prefab": null,
......@@ -49874,8 +49852,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1920,
"height": 1080
"width": 60,
"height": 30
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -49909,10 +49887,10 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "adEnzeBAtPn7/mR7PTJDyg"
"_id": "efCSXIBTtIpZ+/yHqkyCTO"
},
{
"__type__": "cc.Sprite",
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
......@@ -49926,10 +49904,43 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "提示",
"_N$string": "提示",
"_fontSize": 30,
"_lineHeight": 30,
"_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": 2,
"_id": "76HU69UkBKs6v/jB9TBarh"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1111
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "1c0a6b7e-0045-4448-9809-4abd334821cd"
"__uuid__": "297c6c6f-c675-4606-bb8a-11e4fea0eba0"
},
"_type": 0,
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
......@@ -49941,23 +49952,23 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0adJROaKdBRaT9hXwvkCgn"
"_id": "fc587VKDtGr7lP2VK6jKGH"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1112
"__id__": 1111
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_alignFlags": 4,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_bottom": 131,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
......@@ -49968,14 +49979,14 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "74Bk+o5D9A5LMSt0xR2+Mj"
"_id": "afIfyPcpZDZbB+4yhAojNv"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1111
"__id__": 1110
},
"_enabled": true,
"alignMode": 1,
......@@ -49995,17 +50006,7 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "01nR8fepxG6ZcOHWqf1F6F"
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1111
},
"_enabled": true,
"_id": "99TmKuadlDrpqTImwqqu6G"
"_id": "7b2+UPIapMc4GikO2k1Ue7"
},
{
"__type__": "cc.Widget",
......
......@@ -245,7 +245,6 @@ export abstract class middleLayerBase extends cc.Component {
bundle.loadScene(sceneName, null, (finish, total, item) => {
this.setLoadingProgressBar(Math.floor(finish / total * 100));
}, (err, scene) => {
this.setLoadingProgressBar(0);
this.courseOpenTimeStamp = Date.now();
cc.director.runScene(scene, null, () => {
console.log('sceneName = ' + sceneName);
......
......@@ -13,6 +13,9 @@ export default class ProgressClass extends cc.Component {
@property(cc.Node)
bar: cc.Node = null;
@property(cc.Integer)
maxWidth: cc.Integer = 100;
@property(cc.Node)
process: cc.Node = null;
......@@ -21,25 +24,14 @@ export default class ProgressClass extends cc.Component {
}
barBaseW = null;
barSpr = null;
barSf = null;
init() {
this.barBaseW = this.bar.width;
this.barSpr = this.bar.getComponent(cc.Sprite);
this.barSf = this.barSpr.spriteFrame;
this.setProgress(0);
}
setProgress(progress) {
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);
const scale = progress <= 1 ? progress : 1;
this.bar.width = this.maxWidth * scale;
// console.log(this.bar.width)
}
onEnable() {
......
......@@ -4,7 +4,7 @@
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 1400,
......@@ -26,10 +26,10 @@
"height": 46,
"rawWidth": 1400,
"rawHeight": 102,
"borderTop": 0,
"borderTop": 6,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"borderLeft": 24,
"borderRight": 44,
"subMetas": {}
}
}
......
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