|
|
@@ -30,41 +30,51 @@ export default class MoreGamePicItem extends cc.Component {
|
|
|
init(data) {
|
|
|
this.data = data
|
|
|
|
|
|
- //pc不加载,加载会报错
|
|
|
- if (cc.sys.os != cc.sys.OS_WINDOWS) {
|
|
|
- cc.loader.load(data.banner2, (err, res) => {
|
|
|
- if (err) {
|
|
|
- console.log('err:', err);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.banner) {
|
|
|
- let tex: cc.Texture2D = res as cc.Texture2D;
|
|
|
- this.banner.spriteFrame = new cc.SpriteFrame(tex);
|
|
|
- }
|
|
|
- })
|
|
|
+ if (!CC_JSB) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
+ cc.loader.load(data.banner2, (err, res) => {
|
|
|
+ if (err) {
|
|
|
+ console.log('err:', err);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.banner) {
|
|
|
+ let tex: cc.Texture2D = res as cc.Texture2D;
|
|
|
+ this.banner.spriteFrame = new cc.SpriteFrame(tex);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
this.spPro.node.active = false
|
|
|
this.btnStart.active = false
|
|
|
this.labPro.string = ''
|
|
|
//打开
|
|
|
- if (JsbSystem.ifCanStartGame(data.packageName, false)) {
|
|
|
- this.spRed.active = false
|
|
|
- this.btnStart.active = true
|
|
|
- } else {
|
|
|
- if (JsbSystem.isFileExist(data.nebulaAppId + ".apk")) {
|
|
|
- //安装
|
|
|
+ if (data.appType == 1) {
|
|
|
+ if (JsbSystem.ifCanStartGame(data.packageName, false)) {
|
|
|
this.spRed.active = false
|
|
|
this.btnStart.active = true
|
|
|
} else {
|
|
|
- //下载
|
|
|
- this.spRed.active = true
|
|
|
+ if (JsbSystem.isFileExist(data.nebulaAppId + ".apk")) {
|
|
|
+ //安装
|
|
|
+ this.spRed.active = false
|
|
|
+ this.btnStart.active = true
|
|
|
+ } else {
|
|
|
+ //下载
|
|
|
+ this.spRed.active = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ else if (data.appType == 2) {
|
|
|
+ this.spRed.active = false
|
|
|
+ this.btnStart.active = true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
creatorDownLoadTask() {
|
|
|
- // UiM.Instance.moreGameNode.getComponent(MoreGameNode).hasClick = true
|
|
|
+ if (!CC_JSB) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (this.cool) {
|
|
|
return
|
|
|
}
|
|
|
@@ -74,11 +84,16 @@ export default class MoreGamePicItem extends cc.Component {
|
|
|
this.cool = false
|
|
|
}, 3)
|
|
|
|
|
|
- let result = gData.moreGame.createNewTask(this.data)
|
|
|
- if (result != null) {
|
|
|
- this.schedule(() => {
|
|
|
- this.showDownloadProgress()
|
|
|
- }, 0.5)
|
|
|
+ if (this.data.appType == 1) {
|
|
|
+ let result = gData.moreGame.createNewTask(this.data)
|
|
|
+ if (result != null) {
|
|
|
+ this.schedule(() => {
|
|
|
+ this.showDownloadProgress()
|
|
|
+ }, 0.5)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (this.data.appType == 2) {
|
|
|
+ cc.sys.openURL(this.data.recommendLink);
|
|
|
}
|
|
|
}
|
|
|
|