1.准备集成福建相关SDK
Showing
3 changed files
with
60 additions
and
5 deletions
This diff is collapsed.
Click to expand it.
| ... | @@ -64,6 +64,13 @@ cc.Class({ | ... | @@ -64,6 +64,13 @@ cc.Class({ |
| 64 | this.getNavList(); //获取导航栏信息 | 64 | this.getNavList(); //获取导航栏信息 |
| 65 | }, | 65 | }, |
| 66 | 66 | ||
| 67 | start: function () { | ||
| 68 | let emptyBtn = cc.find("EmptyBtn", this.node); | ||
| 69 | let exitBtn = cc.find("ExitBtn", this.node); | ||
| 70 | emptyBtn.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, emptyBtn.width, emptyBtn.height)); | ||
| 71 | exitBtn.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, exitBtn.width, exitBtn.height)); | ||
| 72 | }, | ||
| 73 | |||
| 67 | getNavList: function () { | 74 | getNavList: function () { |
| 68 | var self = this; | 75 | var self = this; |
| 69 | this._nodeTypeList.y = 0; | 76 | this._nodeTypeList.y = 0; |
| ... | @@ -153,7 +160,8 @@ cc.Class({ | ... | @@ -153,7 +160,8 @@ cc.Class({ |
| 153 | var self = this; | 160 | var self = this; |
| 154 | try { | 161 | try { |
| 155 | if (this._oSceneContext._iCurrentLeftIndex == 0 | 162 | if (this._oSceneContext._iCurrentLeftIndex == 0 |
| 156 | && (this._oInit[this._oSceneContext._iCurrentLeftIndex] == null || this._oInit[this._oSceneContext._iCurrentLeftIndex].resultSet == 0)) { | 163 | && (this._oInit[this._oSceneContext._iCurrentLeftIndex] == null |
| 164 | || this._oInit[this._oSceneContext._iCurrentLeftIndex].resultSet == 0)) { | ||
| 157 | this._oInit[this._oSceneContext._iCurrentLeftIndex] = cc.sys.localStorage.getItem("gameHistoryList"); | 165 | this._oInit[this._oSceneContext._iCurrentLeftIndex] = cc.sys.localStorage.getItem("gameHistoryList"); |
| 158 | if (this._oInit[this._oSceneContext._iCurrentLeftIndex] == null) { | 166 | if (this._oInit[this._oSceneContext._iCurrentLeftIndex] == null) { |
| 159 | let oData = {}; | 167 | let oData = {}; |
| ... | @@ -320,6 +328,15 @@ cc.Class({ | ... | @@ -320,6 +328,15 @@ cc.Class({ |
| 320 | 328 | ||
| 321 | //初始化焦点框 | 329 | //初始化焦点框 |
| 322 | initFocus: function () { | 330 | initFocus: function () { |
| 331 | |||
| 332 | let fiBtnEmpty = cc.find("EmptyBtn", this.node).addComponent(FocusInfo); // | ||
| 333 | fiBtnEmpty.init('', true, null, null, 1.0); | ||
| 334 | this._aFocusTargets[0]['node_button_empty'] = cc.find("EmptyBtn", this.node); | ||
| 335 | |||
| 336 | let fiBtnExit = cc.find("ExitBtn", this.node).addComponent(FocusInfo); // | ||
| 337 | fiBtnExit.init('', true, null, null, 1.0); | ||
| 338 | this._aFocusTargets[0]['node_button_exit'] = cc.find("ExitBtn", this.node); | ||
| 339 | |||
| 323 | var nodeInitFocus = cc.find(this._oSceneContext.focusPath, this.node); | 340 | var nodeInitFocus = cc.find(this._oSceneContext.focusPath, this.node); |
| 324 | cc.log("初始化 " + nodeInitFocus.name); | 341 | cc.log("初始化 " + nodeInitFocus.name); |
| 325 | var nodeFocus = new cc.Node('nodeFocus'); | 342 | var nodeFocus = new cc.Node('nodeFocus'); |
| ... | @@ -368,10 +385,10 @@ cc.Class({ | ... | @@ -368,10 +385,10 @@ cc.Class({ |
| 368 | }, | 385 | }, |
| 369 | 386 | ||
| 370 | checkFocusTarget: function (fiFocusTarget, oScrollParameter, Direct) { | 387 | checkFocusTarget: function (fiFocusTarget, oScrollParameter, Direct) { |
| 371 | this._cFocus.show(); | 388 | // this._cFocus.show(); |
| 372 | // cc.log("目标节点:" + fiFocusTarget.node.x); | 389 | // cc.log("目标节点:" + fiFocusTarget.node.x); |
| 373 | if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("topNavi")) { | 390 | if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("topNavi")) { |
| 374 | this._cFocus.hide(); | 391 | // this._cFocus.hide(); |
| 375 | if (0 != this._fiCurrentFocus.node.name.indexOf("topNavi")) {//如果不是TypeList之间跳转,则哪里来回哪里去 | 392 | if (0 != this._fiCurrentFocus.node.name.indexOf("topNavi")) {//如果不是TypeList之间跳转,则哪里来回哪里去 |
| 376 | fiFocusTarget = cc.find("topNavi" + this._oSceneContext._iCurrentLeftIndex, this._nodeTypeList).getComponent(FocusInfo); | 393 | fiFocusTarget = cc.find("topNavi" + this._oSceneContext._iCurrentLeftIndex, this._nodeTypeList).getComponent(FocusInfo); |
| 377 | } | 394 | } |
| ... | @@ -380,7 +397,7 @@ cc.Class({ | ... | @@ -380,7 +397,7 @@ cc.Class({ |
| 380 | //打补丁,焦点在TypeList向下滑动,会找到category的焦点,禁掉这种 | 397 | //打补丁,焦点在TypeList向下滑动,会找到category的焦点,禁掉这种 |
| 381 | if (0 == this._fiCurrentFocus.node.name.indexOf("topNavi") && 0 != fiFocusTarget.node.name.indexOf("topNavi") | 398 | if (0 == this._fiCurrentFocus.node.name.indexOf("topNavi") && 0 != fiFocusTarget.node.name.indexOf("topNavi") |
| 382 | && Direct == Common.MOVE_DIRECTION_DOWN) { | 399 | && Direct == Common.MOVE_DIRECTION_DOWN) { |
| 383 | this._cFocus.hide(); | 400 | // this._cFocus.hide(); |
| 384 | fiFocusTarget = null; | 401 | fiFocusTarget = null; |
| 385 | } | 402 | } |
| 386 | 403 | ||
| ... | @@ -551,6 +568,22 @@ cc.Class({ | ... | @@ -551,6 +568,22 @@ cc.Class({ |
| 551 | fiFrom.node.getComponent(ListCell).setUIWithoutFocus(); | 568 | fiFrom.node.getComponent(ListCell).setUIWithoutFocus(); |
| 552 | } | 569 | } |
| 553 | 570 | ||
| 571 | |||
| 572 | if (0 == fiFrom.node.getName().indexOf('EmptyBtn')) { | ||
| 573 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ||
| 574 | cc.loader.loadRes('HistoryAndCollect/icon_empty', cc.Texture2D, function (err, texture) { | ||
| 575 | fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); | ||
| 576 | // spriteFrame._calculateUV(); | ||
| 577 | }); | ||
| 578 | } | ||
| 579 | if (0 == fiFrom.node.getName().indexOf('ExitBtn')) { | ||
| 580 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ||
| 581 | cc.loader.loadRes('HistoryAndCollect/icon_exit', cc.Texture2D, function (err, texture) { | ||
| 582 | fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); | ||
| 583 | // spriteFrame._calculateUV(); | ||
| 584 | }); | ||
| 585 | } | ||
| 586 | |||
| 554 | // if (0 == this._fiCurrentFocus.node.getName().indexOf('TopCell')) { | 587 | // if (0 == this._fiCurrentFocus.node.getName().indexOf('TopCell')) { |
| 555 | // // fiFrom.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); | 588 | // // fiFrom.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height)); |
| 556 | // let iIndex = fiFrom.node.name.replace("TopCell", ''); | 589 | // let iIndex = fiFrom.node.name.replace("TopCell", ''); |
| ... | @@ -610,6 +643,27 @@ cc.Class({ | ... | @@ -610,6 +643,27 @@ cc.Class({ |
| 610 | fiTo.node.getComponent(ListCell).setUIWithFocus(); | 643 | fiTo.node.getComponent(ListCell).setUIWithFocus(); |
| 611 | } | 644 | } |
| 612 | 645 | ||
| 646 | if (0 == fiTo.node.getName().indexOf('EmptyBtn')) { | ||
| 647 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ||
| 648 | cc.loader.loadRes('HistoryAndCollect/icon_empty', cc.Texture2D, function (err, texture) { | ||
| 649 | fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ||
| 650 | // spriteFrame._calculateUV(); | ||
| 651 | }); | ||
| 652 | } | ||
| 653 | if (0 == fiTo.node.getName().indexOf('ExitBtn')) { | ||
| 654 | // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ||
| 655 | cc.loader.loadRes('HistoryAndCollect/icon_exit', cc.Texture2D, function (err, texture) { | ||
| 656 | fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ||
| 657 | // spriteFrame._calculateUV(); | ||
| 658 | }); | ||
| 659 | } | ||
| 660 | |||
| 661 | if (0 == fiTo.node.getName().indexOf('EmptyBtn') || 0 == fiTo.node.getName().indexOf('ExitBtn') || 0 == fiTo.node.getName().indexOf('topNavi')) { | ||
| 662 | this._cFocus.hide(); | ||
| 663 | } else { | ||
| 664 | this._cFocus.show(); | ||
| 665 | } | ||
| 666 | |||
| 613 | // if (0 == fiTo.node.getName().indexOf('TopCell')) { | 667 | // if (0 == fiTo.node.getName().indexOf('TopCell')) { |
| 614 | // let iIndex = fiTo.node.name.replace("TopCell", ''); | 668 | // let iIndex = fiTo.node.name.replace("TopCell", ''); |
| 615 | // // fiTo.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | 669 | // // fiTo.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height)); | ... | ... |
| ... | @@ -21,6 +21,7 @@ cc.Class({ | ... | @@ -21,6 +21,7 @@ cc.Class({ |
| 21 | this.node.height = data.height; | 21 | this.node.height = data.height; |
| 22 | this.node.getChildByName('Pic').width = data.width; | 22 | this.node.getChildByName('Pic').width = data.width; |
| 23 | this.node.getChildByName('Pic').height = data.height; | 23 | this.node.getChildByName('Pic').height = data.height; |
| 24 | // this.node.getChildByName('Pic').getComponent(cc.Sprite)._sgNode.setState(1); | ||
| 24 | if (data.imageURL) { | 25 | if (data.imageURL) { |
| 25 | var self = this; | 26 | var self = this; |
| 26 | // cc.loader.loadRes(data.imageURL, cc.Texture2D, function (err, texture) { | 27 | // cc.loader.loadRes(data.imageURL, cc.Texture2D, function (err, texture) { |
| ... | @@ -51,7 +52,7 @@ cc.Class({ | ... | @@ -51,7 +52,7 @@ cc.Class({ |
| 51 | } | 52 | } |
| 52 | }, | 53 | }, |
| 53 | function () { | 54 | function () { |
| 54 | 55 | ||
| 55 | }, | 56 | }, |
| 56 | this | 57 | this |
| 57 | ); | 58 | ); | ... | ... |
-
Please register or sign in to post a comment