From 8833a4495dd5ceab81e6e3232c1fc60651acf700 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Tue, 17 Dec 2013 17:12:39 -0700 Subject: [PATCH] classes: much better justin guide which starts with equipment (and *shows* that you still have it), and *then* goes to through the class system details (@wc8) --- bower.json | 7 ++++--- public/js/services/guideServices.js | 30 ++++++++++++++++++----------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/bower.json b/bower.json index 31afcb3c36..7433383b0d 100644 --- a/bower.json +++ b/bower.json @@ -28,7 +28,6 @@ "angular-bindonce": "~0.2.1", "bootstrap": "v2.3.2", "bootstrap-datepicker": "~1.2.0", - "bootstrap-tour": "0.5.0", "bootstrap-growl": "~1.1.0", "habitrpg-shared": "git://github.com/HabitRPG/habitrpg-shared.git#develop", "BrowserQuest": "https://github.com/mozilla/BrowserQuest.git", @@ -38,12 +37,14 @@ "Angular-At-Directive": "git://github.com/snicker/Angular-At-Directive#master", "js-emoji": "git://github.com/snicker/js-emoji#master", "gemoji": "git://github.com/github/gemoji", - "sticky": "*" + "sticky": "*", + "bootstrap-tour": "~0.8.0" }, "resolutions": { "jquery": "~2.0.3", "bootstrap": "v2.3.2", - "angular": "~1.2.1" + "angular": "~1.2.1", + "bootstrap-tour": "~0.8.0" }, "devDependencies": { "angular-mocks": "~1.2.1" diff --git a/public/js/services/guideServices.js b/public/js/services/guideServices.js index 78eada0674..4b6d92fa8b 100644 --- a/public/js/services/guideServices.js +++ b/public/js/services/guideServices.js @@ -5,7 +5,7 @@ */ angular.module('guideServices', []). - factory('Guide', ['$rootScope', 'User', function($rootScope, User) { + factory('Guide', ['$rootScope', 'User', '$timeout', function($rootScope, User, $timeout) { /** * Init and show the welcome tour. Note we do it listening to a $rootScope broadcasted 'userLoaded' message, @@ -146,8 +146,23 @@ angular.module('guideServices', []). * Classes Tour */ function classesTour(){ + + // TODO notice my hack-job `onShow: _.once()` functions. Without these, the syncronous path redirects won't properly handle showing tour var tourSteps = [ { + path: '/#/options/inventory/equipment', + onShow: _.once(function(tour){ + $timeout(function(){tour.goTo(0)}); + }), + orphan: true, + title: "Class Gear", + content: "First: don't panic! Your old gear is in your inventory, and you're now wearing your apprentice " + User.user.stats.class + " equipment. Wearing your class's gear grants you a 1.5% bonus to stats. However, feel free to switch back to your old gear." + }, + { + path: '/#/options/profile/stats', + onShow: _.once(function(tour){ + $timeout(function(){tour.goTo(1)}); + }), element: ".allocate-stats", title: "Stats", content: "These are your class's stats, they affect the game-play. Each time you level up, you get one point to allocate to particular stat. Hover over each stat for more information.", @@ -161,16 +176,9 @@ angular.module('guideServices', []). title: "Spells", content: "You can now unlock class-specific spells. You'll see your first at level 6." }, { -// onShow: function(tour){ -// $rootScope.$state.go('options.inventory.inventory'); -// }, - element: '.stats-equipment', - title: "Class Gear", - content: "Your old gear has been placed into your inventory, you're now wearing your apprentice " + User.user.stats.class + " equippment. Wearing your class's gear grants you a 1.5% bonus to stats. However, feel free to switch back to your old gear." - }, { - element: ".stats-equipment", - title: "Read More", - content: "For more information on the class-system, see Wikia.", + orphan: true, + title: "Read More", + content: "For more information on the class-system, see Wikia." } ]; _.each(tourSteps, function(step){