You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
61 lines
1.5 KiB
import AppPlatform from "../../Util/AppPlatform";
|
|
|
|
const { ccclass, property, menu, disallowMultiple } = cc._decorator;
|
|
|
|
/**
|
|
* 首页加载
|
|
*/
|
|
|
|
@ccclass
|
|
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
|
|
@menu('FrameWork组件/LoadingView')
|
|
export default class LoadingView extends cc.Component {
|
|
//进度条
|
|
@property({ tooltip: "进度条", type: cc.ProgressBar })
|
|
private progressBar: cc.ProgressBar = null;
|
|
|
|
// logo
|
|
@property(cc.Node)
|
|
private tt_logo:cc.Node = null;
|
|
|
|
// wxlog
|
|
@property(cc.Node)
|
|
private wx_logo:cc.Node = null;
|
|
|
|
soundNode:cc.Node = null;
|
|
onLoad() {
|
|
|
|
if (AppPlatform.is_WECHAT_GAME_custom()) {
|
|
this.wx_logo.active = true;
|
|
this.tt_logo.active = false;
|
|
}
|
|
|
|
// this.soundNode = this.node.getChildByName("bottomZone").getChildByName("progressBar").getChildByName("bar").getChildByName("sound");
|
|
this.setProcess_custom(0);
|
|
}
|
|
|
|
/**
|
|
* 设置进度条的进度
|
|
* @param process 0-1
|
|
*/
|
|
public setProcess_custom(process: number) {
|
|
if (process < 0) {
|
|
process = 0;
|
|
} else if (process > 1) {
|
|
process = 1;
|
|
}
|
|
if (this.soundNode != null){
|
|
this.soundNode.x = process * 600;
|
|
}
|
|
this.progressBar.progress = process;
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取 具体的进度
|
|
*/
|
|
public getProcess_custom(): number {
|
|
return this.progressBar.progress
|
|
}
|
|
|
|
}
|
|
|