コード例 #1
0
            internal void Activate()
            {
                if (!LiveManager.AcceptedShareInvitation)
                {
                    LiveManager.FriendUpdatesEnabled   = true;
                    LiveManager.JoinableUpdatesEnabled = true;
                }
                else
                {
                    LiveManager.FriendUpdatesEnabled   = false;
                    LiveManager.JoinableUpdatesEnabled = false;
                }

                // TODO: remap to a kodu-meaningful string if remote player is playing kodu (but could look odd in the dashboard and other games that show presence).
                InGame.SetPresence(GamerPresenceMode.CornflowerBlue);

                // We rebuild the grid each time the share hub is activated, to reflect the dynamic nature of the friend list.
                grid = new UIGrid(parent.OnSelect, parent.OnCancel, new Point(1, 0), "App.ShareHub.Grid");

                elements = new List <UIGridShareHubElement>();

                // Set grid properties.
                grid.Spacing             = new Vector2(0.0f, -0.1f); // The first number doesn't really matter since we're doing a 1d column.
                grid.Scrolling           = true;
                grid.Wrap                = false;
                grid.SlopOffset          = true;
                grid.UseMouseScrollWheel = true;

                // First element is the "Enter Sharing Room" button.
                //grid.Add(new UIGridStartSharingElement(), 0, 0);

                BokuGame.Load(grid, true);

                grid.Active = true;

                // Queue up session finders for the sharing servers.

                if (!LiveManager.AcceptedShareInvitation)
                {
                    foreach (string gamerTag in SharingServers.Instance.gamerTags)
                    {
                        UIGridSharingServerElement elem = new UIGridSharingServerElement(gamerTag);

                        elem.JoinableChanged += new StatusChangedDelegate(elem_JoinableChanged);

                        elements.Add(elem);

                        elem.StartCheckingPresence();
                    }
                }
            }