#pragma warning restore 0067

        #endregion

        #region Public Static Methods

        public static void Initialize(IServiceProvider serviceProvider)
        {
            IsInitialized = true;

            AppDomain.CurrentDomain.ProcessExit += (o, e) =>
            {
                IsInitialized = false;
            };

            List <SignedInGamer> startGamers = new List <SignedInGamer>(1);

            startGamers.Add(new SignedInGamer(
                                "Stub Gamer",
                                IsInitialized
                                ));

            // FIXME: This is stupid -flibit
            startGamers.Add(new SignedInGamer(
                                "Stub Gamer (1)",
                                IsInitialized,
                                true,
                                PlayerIndex.Two
                                ));
            startGamers.Add(new SignedInGamer(
                                "Stub Gamer (2)",
                                IsInitialized,
                                true,
                                PlayerIndex.Three
                                ));
            startGamers.Add(new SignedInGamer(
                                "Stub Gamer (3)",
                                IsInitialized,
                                true,
                                PlayerIndex.Four
                                ));

            Gamer.SignedInGamers = new SignedInGamerCollection(startGamers);
            foreach (SignedInGamer gamer in Gamer.SignedInGamers)
            {
                SignedInGamer.OnSignIn(gamer);
            }
        }
Exemple #2
0
#pragma warning restore 0067

        #endregion

        #region Public Static Methods

        public static void Initialize(IServiceProvider serviceProvider)
        {
            IsInitialized = SteamAPI.Init();

            if (!IsInitialized)
            {
                throw new GamerServicesNotAvailableException(
                          "Steam is not running, please restart Steam!"
                          );
            }

            AppDomain.CurrentDomain.ProcessExit += (o, e) =>
            {
                SteamAPI.Shutdown();
                IsInitialized = false;
            };

            overlayActivated = Callback <GameOverlayActivated_t> .Create(Guide.OnOverlayActivated);

            textInputDismissed = Callback <GamepadTextInputDismissed_t> .Create(Guide.OnTextInputDismissed);

            lobbyJoinRequested = Callback <GameLobbyJoinRequested_t> .Create(Net.NetworkSession.OnInviteAccepted);

            SteamUserStats.RequestCurrentStats();

            List <SignedInGamer> startGamers = new List <SignedInGamer>(1);

            startGamers.Add(new SignedInGamer(
                                SteamUser.GetSteamID(),
                                SteamFriends.GetPersonaName(),
                                IsInitialized
                                ));

            // FIXME: This is stupid -flibit
            startGamers.Add(new SignedInGamer(
                                SteamUser.GetSteamID(),
                                SteamFriends.GetPersonaName() + " (1)",
                                IsInitialized,
                                true,
                                PlayerIndex.Two
                                ));
            startGamers.Add(new SignedInGamer(
                                SteamUser.GetSteamID(),
                                SteamFriends.GetPersonaName() + " (2)",
                                IsInitialized,
                                true,
                                PlayerIndex.Three
                                ));
            startGamers.Add(new SignedInGamer(
                                SteamUser.GetSteamID(),
                                SteamFriends.GetPersonaName() + " (3)",
                                IsInitialized,
                                true,
                                PlayerIndex.Four
                                ));

            Gamer.SignedInGamers = new SignedInGamerCollection(startGamers);
            foreach (SignedInGamer gamer in Gamer.SignedInGamers)
            {
                SignedInGamer.OnSignIn(gamer);
            }
        }