//------------------------------------------------------------------------------
        // Function: LeaderboardsMenu
        // Author: nholmes
        // Summary: constructor - creates the menu and adds all of the menu items
        //------------------------------------------------------------------------------
        public LeaderboardsMenu(Game game, PlayerIndex? controllingPlayer)
            : base(game, controllingPlayer, Color.White)
        {
            // set the title and it's alignment - no title on leaderboard menu as we expect the name of the leaderboard to be displayed
            title = "";
            alignment = Alignment.centre;

            // set this menu to the required size
            SetCentered(640, 600);

            // create our menu items
            backMenuItem = new ItemButton(this, game, "Back", 500, 200, Alignment.centre, textFont, Color.White, Alignment.centre, textYOffset);

            // hook up the menu event handlers
            backMenuItem.Selected += OnCancel;

            // add items to the menu
            menuItems.Add(backMenuItem);

            // get the leaderboard browserservice
            leaderboardsBrowser = (ICLeaderboardsBrowser)game.Services.GetService(typeof(ICLeaderboardsBrowser));
        }
        //------------------------------------------------------------------------------
        // Method: Initialize
        // Author: Neil Holmes & Andrew Green
        // Summary: overrides base initialize so we can perform our own class
        //          initialisations called after the XNA devices have been initialised
        //------------------------------------------------------------------------------
        protected override void Initialize()
        {
            // *** IndieCity Setup ***

            // initialise the message pop up display class and register it as a service
            messagePopUp = new ICMessagePopUp(this, graphicsDeviceManager, ICMessagePosition.bottomRight, ICMessageScale.normal);
            base.Services.AddService(typeof(ICMessagePopUp), messagePopUp);

            // create bridge
            ICEBridgeLib.CoBridge bridge = new ICEBridgeLib.CoBridge();
            if (bridge != null)
            {
                // setup the game id and game secret
                ICECoreLib.GameId myGameId = StringToGameId("540a5e40-669c-4782-8424-fd688e720573");
                string mySecret = "248f9aa3-624b-4e2d-b286-8d6de3781896";

                // initialise the bridge
                bridge.Initialise(myGameId, mySecret);

                //get some user info
                int userId = bridge.DefaultUserId;
                ICECoreLib.CoUserStore storeClass = bridge.UserStore;
                ICECoreLib.CoUserInfo userClass = storeClass.GetUserFromId(userId);
                string name = userClass.Name;

                //Create a game session
                try
                {
                    indieCitySession = bridge.CreateDefaultGameSession();
                }
                catch (System.Runtime.InteropServices.COMException ex)
                {
                    // session creation failed - report the error and tell the game to bail out
                    messagePopUp.AddMessage("Session Creation Error", "Valid tokens for " + name +" could not be found.\nThis means a IndieCity session could not be created.", ICMessagePriority.urgent);
                    gameStatus = GameStatus.exiting;
                }

                // only do the following if the session was succesfully created
                if (indieCitySession != null)
                {
                    indieCitySession.RequestStartSession();

                    // create the achievement manager and initialise it
                    indieCityAchievementManager = new ICELandaLib.CoAchievementManager();
                    indieCityAchievementManager.SetGameSession(indieCitySession);
                    indieCityAchievementManager.InitialiseAchievements(null);

                    // retrieve the achievement group from the achievement manager
                    indieCityAchievementGroup = indieCityAchievementManager.AchievementGroup;

                    // initialise the achievement list and pop up display classes and register them as services
                    achievementPopUp = new ICAchievementPopUp(this, graphicsDeviceManager, ICAchievementPosition.topRight, ICAchievementScale.normal);
                    achievementList = new ICAchievementList(this, graphicsDeviceManager, indieCityAchievementGroup, ICAchievementScale.normal);
                    base.Services.AddService(typeof(ICAchievementPopUp), achievementPopUp);
                    base.Services.AddService(typeof(ICAchievementList), achievementList);

                    // get the current user's list of unlocked achievements
                    indieCityUserList = indieCityAchievementManager.GetUserAchievementList(indieCitySession.UserId);

                    // register the pop up achievement class with the achievement manager to handle events
                    ICELandaLib.IAchievementService iService = (ICELandaLib.IAchievementService)indieCityAchievementManager;
                    m_cookie = iService.RegisterAchievementEventHandler(achievementPopUp);

                    // create the leaderboard manager
                    indieCityLeaderboardManager = new ICELandaLib.CoLeaderboardManager();
                    indieCityLeaderboardManager.SetGameSession(indieCitySession);
                    indieCityLeaderboardManager.InitialiseLeaderboards(null);

                    // we need to create a list of the leaderboard UIDs so that the game knows the order in which to display the leaderboards
                    // this list will be custom for your game and will depend on the IDs that exist for your games leaderboards and the order
                    // in which you wish to display them!
                    int[] leaderboardUIDlist = {54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,120,74,75,76};

                    // for sanity, check that the number of IDs we have specified is the same as the number of leaderboards before proceeding ;)
                    if (leaderboardUIDlist.Length == indieCityLeaderboardManager.GetNumberLeaderboards())
                    {
                        // initlaise the leaderboard browser class and register it as a service
                        leaderboardBrowser = new ICLeaderboardsBrowser(this, graphicsDeviceManager, indieCityLeaderboardManager, ICLeaderboardScale.normal, leaderboardUIDlist);
                        base.Services.AddService(typeof(ICLeaderboardsBrowser), leaderboardBrowser);
                    }
                }
            }

            // *** optional initialisations ***

            // create the display manager and register it as a service
            displayManager = new DisplayManager(this, Window, graphicsDeviceManager, 1280, 720, ScreenMode.Windowed, 1);
            base.Services.AddService(typeof(DisplayManager), displayManager);

            // create the timer system and add it as a service
            timerSystem = new TimerSystem(this);
            base.Services.AddService(typeof(TimerSystem), timerSystem);

            // create the input manager for a single player game and add it as a service
            inputManager = new InputManager(NumPlayers.one);
            base.Services.AddService(typeof(InputManager), inputManager);

            // create the save game manager and add it as a service
            saveGameManager = new SaveGameManager(this);
            base.Services.AddService(typeof(SaveGameManager), saveGameManager);

            // initialise the mouse pointer system and add it as a service
            mousePointer = new Pointer(this, PointerType.mouse, true);
            base.Services.AddService(typeof(Pointer), mousePointer);

            // create the game state manager and register it as a service
            gameStateManager = new GameStateManager(this);
            base.Services.AddService(typeof(GameStateManager), gameStateManager);

            // activate the initial example game states - in this example we are adding two :)
            gameStateManager.AddGameState(new Background(this, null));
            gameStateManager.AddGameState(new TitleScreen(this, null));

            // propogate initialise call to base class
            base.Initialize();
        }