CaiPiaosubHallController.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import FireEventObserver from '../framework/FireEventObserver';
  2. import SubHallManger from '../view/subHallManger'
  3. cc.Class({
  4. extends: SubHallManger,
  5. properties: {
  6. gamesNode:cc.Node,
  7. content:cc.Node,
  8. listView:cc.ScrollView,
  9. },
  10. showNeedGames(games)
  11. {
  12. this.listView.scrollToOffset(cc.v2(0,0),0)
  13. if ("object" == typeof(games)) {
  14. this.content.children.forEach(item =>{
  15. item.active = false
  16. })
  17. if (games && games.length >=1) {
  18. games.forEach(element => {
  19. var itemname = 'item'+element
  20. this.content.getChildByName(itemname).active = true
  21. });
  22. }
  23. else{
  24. this.content.children.forEach(item =>{
  25. item.active = true
  26. })
  27. }
  28. this.content.parent.width = games.length>0?266*Math.ceil(games.length/2) - 94:4162
  29. // this.content.widht + 30
  30. }
  31. },
  32. });