Commit 537a48d1 537a48d130bb6e164526bbda7cfb109d097fa85c by 金学艇

1.修改首页升级弹窗样式,并且可以网络加载升级内容和版本号

1 parent 72776ef7
......@@ -80,6 +80,8 @@ cc.Class({
this._oSceneContext._iViewPagerIndex = 0;
let oSceneParameter = this._cApplication.getTopSceneParameter();
let aSceneParameter = this._cApplication.getSceneParameter();
cc.find("update/update_panel/update_btn", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 208, 100));
cc.find("update/update_panel/close_btn", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 208, 100));
cc.log("main->aSceneParameter..." + aSceneParameter);
cc.log("main->oSceneParameter..." + oSceneParameter);
//首页无参数
......@@ -109,7 +111,7 @@ cc.Class({
//搞通知框
this.initNotifyBox();
//升级相关
// this.getUpdateDesc();
this.getUpdateDesc();
this.getMainLayoutJsonRequest();
},
......@@ -143,11 +145,11 @@ cc.Class({
this._aFocusTargets[0]["view_pager_label" + i] = nodeNav;
}
} catch (error) {
cc.log("Business Exception:Get getUpdateDesc..." + error);
cc.log("Business Exception:Get initViewPager..." + error);
}
},
function (strResponse) {
cc.log("Business Error:Get getUpdateDesc..." + strResponse);
cc.log("Business Error:Get initViewPager..." + strResponse);
}, this, "uuid");
},
......@@ -166,17 +168,15 @@ cc.Class({
//升级框内容
getUpdateDesc: function () {
let updateTitle = cc.find("update/update_panel/update_title", this.node);
let updateInfo = cc.find("update/update_panel/update_info", this.node);
Network.ajax("GET", Common.TOPDRAW_API_SERVER + "updateDesc.json", null, null,
function (strResponse) {
try {
cc.log("获取升级内容。。。" + strResponse);
// cc.log("获取升级内容。。。" + strResponse);
var oJSONResult = JSON.parse(strResponse);
var self = this;
if (oJSONResult.businessCode == 'success') {
} else {
cc.log("Business Error:Get getUpdateDesc..." + oJSONResult.description);
}
updateTitle.getComponent(cc.Label).string = "发现新版本(" + oJSONResult.versionCode + ")";
updateInfo.getComponent(cc.Label).string = oJSONResult.desc;
} catch (error) {
cc.log("Business Exception:Get getUpdateDesc..." + error);
}
......@@ -1230,6 +1230,17 @@ cc.Class({
fiFrom.node.getChildByName("Name").active = false;
fiFrom.node.getComponent(ListCell).setUIWithoutFocus();
}
if (0 == fiFrom.node.getName().indexOf('update_btn')) {
cc.loader.loadRes("Hot_update/btn_update", cc.Texture2D, function (err, texture) {
fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height));
});
}
if (0 == fiFrom.node.getName().indexOf('close_btn')) {
cc.loader.loadRes("Hot_update/btn_cancel", cc.Texture2D, function (err, texture) {
fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height));
});
}
},
onAfterFocusChange: function (event) {
......@@ -1340,12 +1351,24 @@ cc.Class({
//这里想统一处理焦点框显示隐藏问题
// cc.log("节点名称:" + fiTo.node.getName());
if (0 == fiTo.node.getName().indexOf('view_pager_label') || 0 == fiTo.node.getName().indexOf('topNavi')
|| 0 == fiTo.node.getName().indexOf('topCell') || 0 == fiTo.node.getName().indexOf('backToTop')) {
|| 0 == fiTo.node.getName().indexOf('topCell') || 0 == fiTo.node.getName().indexOf('backToTop')
|| 0 == fiTo.node.getName().indexOf('update_btn') || 0 == fiTo.node.getName().indexOf('close_btn')) {
this._cFocus.hide();
} else {
if (!this._bIsScrollViewMoving)
this._cFocus.show();
}
if (0 == fiTo.node.getName().indexOf('update_btn')) {
cc.loader.loadRes("Hot_update/btn_update", cc.Texture2D, function (err, texture) {
fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
});
}
if (0 == fiTo.node.getName().indexOf('close_btn')) {
cc.loader.loadRes("Hot_update/btn_cancel", cc.Texture2D, function (err, texture) {
fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
});
}
},
doCurrentFocusTVLinkAction: function (strAction) {
......@@ -1361,29 +1384,6 @@ cc.Class({
for (let i = 0; i < aOperationList.length; i++) {
switch (aOperationList[i].action) {
case "changeLayout":
// let model = aOperationList[i].parameters.layoutPath; //获取要加载的框架
// if (-1 != model.indexOf("waterfall_recommend")) {
// this.getRightRecommendRequest(waterfall_recommend); //渲染右侧推荐框架
// } else if (-1 != model.indexOf("waterfall_parent")) {
// this.getRightRecommendRequest(waterfall_parent);
// } else if (-1 != model.indexOf("waterfall_course")) {
// this.getRightRecommendRequest(waterfall_course);
// } else if (-1 != model.indexOf("waterfall_primarySchool")) {
// this.getRightRecommendRequest(waterfall_primarySchool);
// } else if (-1 != model.indexOf("waterfall_three2six")) {
// this.getRightRecommendRequest(waterfall_three2six);
// }
// break;
// case "changeUI": //放在TVCanvas中全局管理
// let parameter = aOperationList[i].parameters.uiName; //更换界面的名称
// if (parameter=="collection") { //收藏
// this.getRightRecommendRequest(waterfall_recommend);
// } else if (parameter=="history") { //历史
// this.getRightRecommendRequest(waterfall_parent);
// } else if (parameter=="search") { //搜索
// this.getRightRecommendRequest(waterfall_course);
// }
// break;
default:
this.doTVLinkAction(aOperationList[i]);
break;
......@@ -1528,11 +1528,11 @@ cc.Class({
// this.panel.byteProgress.progress = 0;
this._bAbleHotUpdate = true;
// this._iSceneStatus = 1; //焦点框跳转层级
// cc.find("update", this.node).active = true; //显示出来更新面板
// this._cFocus.show();
// let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).getComponent(FocusInfo); //热更新按钮
// this._cFocus.flyFocus(this._fiCurrentFocus, fiHotUpdateBtn, Common.MOVE_DIRECTION_RIGHT, null, null);
this._iSceneStatus = 1; //焦点框跳转层级
cc.find("update", this.node).active = true; //显示出来更新面板
// this._cFocus.hide();
let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).getComponent(FocusInfo); //热更新按钮
this._cFocus.flyFocus(this._fiCurrentFocus, fiHotUpdateBtn, Common.MOVE_DIRECTION_RIGHT, null, null);
break;
default:
......@@ -1543,20 +1543,20 @@ cc.Class({
this._checkListener = null;
this._updating = false;
if (this._bAbleHotUpdate) {
this.hotUpdate(); //放在这里可以静默升级
}
// if (this._bAbleHotUpdate) {
// this.hotUpdate(); //放在这里可以静默升级
// }
},
hotUpdate: function () {
cc.log("hotUpdate start...");
//隐藏更新说明,显示更新进度条
cc.find("update/update_panel/NewLabel", this.node).active = false;
cc.find("update/update_panel/versionLabel", this.node).active = false;
cc.find("update/update_panel/update_info", this.node).active = false;
cc.find("update/update_panel/ProgressLabel", this.node).active = true;
cc.find("update/update_panel/fileProgress", this.node).active = true;
cc.find("update/update_panel/filep", this.node).active = true;
// cc.find("update/update_panel/NewLabel", this.node).active = false;//因为新的更新界面没有进度条,先不要显示更新进度
// cc.find("update/update_panel/versionLabel", this.node).active = false;
// cc.find("update/update_panel/update_info", this.node).active = false;
// cc.find("update/update_panel/ProgressLabel", this.node).active = true;
// cc.find("update/update_panel/fileProgress", this.node).active = true;
// cc.find("update/update_panel/filep", this.node).active = true;
if (this._am && !this._updating) {
this._am.setEventCallback(this.updateCb.bind(this));
......