buildBasaltParkMenu: function(callback) { var currentIndex, prevIndex = 0; var helpbar = new UI.Text({ text: "WDWNT Now!", backgroundColor: Theme.HelpbarBackgroundColor, font: "GOTHIC_14", position: new Vector2(0, WindowUtils.getWindowHeight(true) - 20), size: new Vector2(WindowUtils.getWindowWidth(true), 20) }); var gridItems = []; gridItems.push( { helpbarText: "Magic Kingdom", icon: "images/M-24.png" }, { helpbarText: "Epcot", icon: "images/E-24.png" }, { helpbarText: "Hollywood Studios", icon: "images/H-24.png" }, { helpbarText: "Animal Kingdom", icon: "images/A-24.png" }, { helpbarText: "Disneyland", icon: "images/D-24.png" }, { helpbarText: "California Adventure", icon: "images/C-24.png" } ); var grid = new Grid({ fullscreen: true, itemsPerRow: 3, backgroundColor: Theme.GridBackgroundColor, borderSpacing: 1, itemDefaultStyle: { titleColor: Theme.GridItemTitle, backgroundColor: Theme.GridItemBackgroundColor, highlightBackgroundColor: Theme.GridItemHighlightBackgroundColor, borderWidth: 0 }, items: gridItems }); var updateHelpbar = function() { helpbar.text(gridItems[currentIndex].helpbarText || ""); }; grid.on("highlight", function(e) { prevIndex = currentIndex; currentIndex = e.itemIndex; updateHelpbar(); }); grid.on("select", function(e) { if (currentIndex === 0) { callback(Constants.ParkIds.MagicKingdom); } else if (currentIndex === 1) { callback(Constants.ParkIds.Epcot); } else if (currentIndex === 2) { callback(Constants.ParkIds.HollywoodStudios); } else if (currentIndex === 3) { callback(Constants.ParkIds.AnimalKingdom); } else if (currentIndex === 4) { callback(Constants.ParkIds.Disneyland); } else if (currentIndex === 5) { callback(Constants.ParkIds.CaliforniaAdventure); } }); grid.add(helpbar); grid.show(); },
page = (pageCount + page - 1) % pageCount; paginate(page); } break; case 'down': if (prevIndex + 1 >= ITEMS_PER_PAGE) { page = (page + 1) % pageCount; paginate(page); } break; } return false; }); grid.on('longClick', function(e) { switch (e.button) { case 'up': page = (pageCount + page - 1) % pageCount; break; case 'down': page = (page + 1) % pageCount; break; } paginate(page); return false; }); grid.add(helpbar); grid.show(); paginate(page);