internal bool InitClient(BaseSteamworks steamworks)
        {
            isServer = false;

            api = new SteamNative.SteamApi(steamworks, (IntPtr)1);

            if (!api.SteamAPI_Init())
            {
                return(false);
            }

            hUser = api.SteamAPI_GetHSteamUser();
            hPipe = api.SteamAPI_GetHSteamPipe();
            if (hPipe == 0)
            {
                return(false);
            }

            FillInterfaces(steamworks, hUser, hPipe);

            if (!user.IsValid)
            {
                return(false);
            }

            // Ensure that the user has logged into Steam. This will always return true if the game is launched
            // from Steam, but if Steam is at the login prompt when you run your game it will return false.
            if (!user.BLoggedOn())
            {
                return(false);
            }

            return(true);
        }
        internal bool InitClient(BaseSteamworks steamworks, out string state)
        {
            if (Steamworks.Server.Instance != null)
            {
                throw new System.Exception("Steam client should be initialized before steam server - or there's big trouble.");
            }

            isServer = false;

            api = new SteamNative.SteamApi();

            if (!api.SteamAPI_Init())
            {
                Console.Error.WriteLine("InitClient: SteamAPI_Init returned false");
                state = "InitClient: SteamAPI_Init returned false";
                return(false);
            }

            var hUser = api.SteamAPI_GetHSteamUser();
            var hPipe = api.SteamAPI_GetHSteamPipe();

            if (hPipe == 0)
            {
                Console.Error.WriteLine("InitClient: hPipe == 0");
                state = "InitClient: hPipe == 0";
                return(false);
            }

            FillInterfaces(steamworks, hUser, hPipe);

            if (!user.IsValid)
            {
                Console.Error.WriteLine("InitClient: ISteamUser is null");
                state = "InitClient: ISteamUser is null";
                return(false);
            }

            // Ensure that the user has logged into Steam. This will always return true if the game is launched
            // from Steam, but if Steam is at the login prompt when you run your game it will return false.
            if (!user.BLoggedOn())
            {
                Console.Error.WriteLine("InitClient: Not Logged On");
                state = "InitClient: Not Logged On";
                return(false);
            }

            state = "Loaded";
            return(true);
        }
        internal bool InitClient(BaseSteamworks steamworks)
        {
            isServer = false;

            api = new SteamNative.SteamApi();

            if (!api.SteamAPI_Init())
            {
                Console.Error.WriteLine("InitClient: SteamAPI_Init returned false");
                return(false);
            }

            hUser = api.SteamAPI_GetHSteamUser();
            hPipe = api.SteamAPI_GetHSteamPipe();
            if (hPipe == 0)
            {
                Console.Error.WriteLine("InitClient: hPipe == 0");
                return(false);
            }

            FillInterfaces(steamworks, hUser, hPipe);

            if (!user.IsValid)
            {
                Console.Error.WriteLine("InitClient: ISteamUser is null");
                return(false);
            }

            // Ensure that the user has logged into Steam. This will always return true if the game is launched
            // from Steam, but if Steam is at the login prompt when you run your game it will return false.
            if (!user.BLoggedOn())
            {
                Console.Error.WriteLine("InitClient: Not Logged On");
                return(false);
            }

            return(true);
        }
Exemple #4
0
        internal bool InitClient(BaseSteamworks steamworks)
        {
            if (Steamworks.Server.Instance != null)
            {
                throw new System.Exception("Steam client should be initialized before steam server - or there's big trouble.");
            }

            isServer = false;

            api = new SteamNative.SteamApi();

            if (!api.SteamAPI_Init())
            {
                Console.Error.WriteLine("InitClient: SteamAPI_Init returned false");
                return(false);
            }

            var hUser = api.SteamAPI_GetHSteamUser();
            var hPipe = api.SteamAPI_GetHSteamPipe();

            if (hPipe == 0)
            {
                Console.Error.WriteLine("InitClient: hPipe == 0");
                return(false);
            }

            FillInterfaces(steamworks, hUser, hPipe);

            if (!user.IsValid)
            {
                Console.Error.WriteLine("InitClient: ISteamUser is null");
                return(false);
            }

            return(true);
        }