コード例 #1
0
ファイル: SteamMgr.cs プロジェクト: shrubba/planetexplorers
    public void AccountLoginRequestSteamWorks()
    {
        if (!m_bInitialized)
        {
            return;
        }

        try
        {
            if (hAuthTicket != HAuthTicket.Invalid)
            {
                SteamUser.CancelAuthTicket(hAuthTicket);
                hAuthTicket = HAuthTicket.Invalid;
                return;
            }

            byte[] tokenByteArray = new byte[1024];
            uint   tokenLen       = 0;
            hAuthTicket = SteamUser.GetAuthSessionTicket(tokenByteArray, tokenByteArray.Length, out tokenLen);
            GameClientLobby.AccountLoginSteamWorks(tokenByteArray, tokenLen, steamId.m_SteamID);
        }
        catch (Exception e)
        {
            if (LogFilter.logError)
            {
                Debug.LogErrorFormat("{0}\r\n{1}", e.Message, e.StackTrace);
            }
            AccountLogoutSteamWorks();
        }
    }
コード例 #2
0
        internal ClientReplicator(NetConnection connection, HAuthTicket steamTicket, Player player)
            : base(connection, player)
        {
            AuthTicket = steamTicket;

            Address = connection.RemoteEndPoint.Address.ToString();
            Port    = connection.RemoteEndPoint.Port;
        }
コード例 #3
0
    //https://partner.steamgames.com/documentation/auth
    /// <summary>
    /// Returns a one time use ticket. The ticket is normally transmitted to the server next, along with the client's Steam ID, and Steam Name. The client must revoke the ticket when done (CancelAuthTicket).
    /// </summary>
    /// <returns>A one time user ticket.</returns>
    public byte[] getTicket()
    {
        byte[]      pTicket     = new byte[1024];
        int         cbMaxTicket = pTicket.Length;
        uint        pcbTicketSize; //looks like the number of bytes used?
        HAuthTicket tempTicket = SteamUser.GetAuthSessionTicket(pTicket, cbMaxTicket, out pcbTicketSize);

        return(pTicket);
    }
コード例 #4
0
        public void CancelAuthTicket()
        {
            if (_authTicket != Steamworks.HAuthTicket.Invalid)
            {
                SteamUser.CancelAuthTicket(_authTicket);

                _authTicket = Steamworks.HAuthTicket.Invalid;
            }
        }
コード例 #5
0
 public override void CloseTicket()
 {
     if (_ticketHandle == HAuthTicket.Invalid)
     {
         return;
     }
     SteamUser.CancelAuthTicket(_ticketHandle);
     _ticketHandle = HAuthTicket.Invalid;
     _ticketOpened = false;
 }
コード例 #6
0
        public byte[] GetAuthSessionTicket()
        {
            CancelAuthTicket();

            byte[] data       = new byte[1024];
            uint   dataLength = 0;

            _authTicket = SteamUser.GetAuthSessionTicket(data, data.Length, out dataLength);

            return(data.Take((int)dataLength).ToArray());
        }
コード例 #7
0
        static AuthInfo Login()
        {
            // Unfortunately, youtube ASHes can only be submitted with a valid steam ticket
            // and a session ID from the AS2 server.

            // 1) Login with Steamworks
            Console.WriteLine("Getting Steam session");
            if (!SteamAPI.Init())
            {
                Console.Error.WriteLine("SteamAPI.Init() failed");
                Environment.Exit(1);
            }

            byte[]      ticket       = new byte[1024];
            uint        ticketLength = 0;
            HAuthTicket authTicket   = SteamUser.GetAuthSessionTicket(ticket, ticket.Length, out ticketLength);

            if (authTicket == HAuthTicket.Invalid)
            {
                Console.Error.WriteLine("Got invalid ticket");
                Environment.Exit(1);
            }
            string steamTicket = BitConverter.ToString(ticket, 0, (int)ticketLength).Replace("-", "").ToLowerInvariant();

            // 2) Get a session ID from the AS2 server
            string result = "";

            using (WebClient client = new WebClient())
            {
                try
                {
                    byte[] response = client.UploadValues("http://audiosurf2.com/as/airgame_steamAuthenticate4.php",
                                                          new NameValueCollection()
                    {
                        { "username", "yashbot" },
                        { "session", "" },
                        { "steamid", SteamUser.GetSteamID().ToString() },
                        { "steamticket", steamTicket },
                        { "steamfriends", "" },
                    });

                    result = Encoding.UTF8.GetString(response);
                }
                catch (WebException wex)
                {
                    Console.Error.WriteLine("Couldn't get AS2 session ID:");
                    Console.Error.WriteLine(wex.ToString());
                    Environment.Exit(1);
                }
            }
            string session = Regex.Match(result, "token='(.+?)'").Groups[1].Value; // cthulhu > xml parsers

            return(new AuthInfo(SteamUser.GetSteamID().ToString(), steamTicket, session));
        }
コード例 #8
0
        /**
         * Gets a session ticket or times out.
         */
        private IEnumerator SessionTicketCoroutine()
        {
            // Attempts to get a session ticket
            m_ticket     = new byte[1024];
            m_authTicket = SteamUser.GetAuthSessionTicket(m_ticket, 1024, out m_length);

            yield return(new WaitForSeconds(m_timeout));

            // Times out
            OnFailure("Couldn't get session ticket");
        }
コード例 #9
0
 private void ClearAuthTicket()
 {
     if (HAuthTicket.op_Inequality(this._authTicket, (HAuthTicket)HAuthTicket.Invalid))
     {
         SteamUser.CancelAuthTicket(this._authTicket);
     }
     this._authTicket = (HAuthTicket)HAuthTicket.Invalid;
     for (int index = 0; index < this._authData.Length; ++index)
     {
         this._authData[index] = (byte)0;
     }
     this._authDataLength = 0U;
 }
コード例 #10
0
 private void ClearAuthTicket()
 {
     if (_authTicket != HAuthTicket.Invalid)
     {
         SteamUser.CancelAuthTicket(_authTicket);
     }
     _authTicket = HAuthTicket.Invalid;
     for (int i = 0; i < _authData.Length; i++)
     {
         _authData[i] = 0;
     }
     _authDataLength = 0u;
 }
コード例 #11
0
 private void ClearAuthTicket()
 {
     if (this._authTicket != (HAuthTicket)HAuthTicket.Invalid)
     {
         SteamUser.CancelAuthTicket(this._authTicket);
     }
     this._authTicket = (HAuthTicket)HAuthTicket.Invalid;
     for (var index = 0; index < this._authData.Length; ++index)
     {
         this._authData[index] = (byte)0;
     }
     this._authDataLength = 0U;
 }
コード例 #12
0
 private void ClearAuthTicket()
 {
     if (this._authTicket != HAuthTicket.Invalid)
     {
         SteamUser.CancelAuthTicket(this._authTicket);
     }
     this._authTicket = HAuthTicket.Invalid;
     for (int i = 0; i < (int)this._authData.Length; i++)
     {
         this._authData[i] = 0;
     }
     this._authDataLength = 0;
 }
コード例 #13
0
ファイル: SteamAuth.cs プロジェクト: andybak/VRUtilityBelt
        public string GetAuthSessionTicket()
        {
            if (_ticketHandle.m_HAuthTicket != 0)
            {
                return(BitConverter.ToString(_ticketBytes).Replace("-", string.Empty));
            }

            _ticketBytes = new byte[1024];
            uint ticketSize = 0;

            _ticketHandle = SteamUser.GetAuthSessionTicket(_ticketBytes, 1024, out ticketSize);

            return(BitConverter.ToString(_ticketBytes).Replace("-", string.Empty));
        }
コード例 #14
0
ファイル: TestMenu00.cs プロジェクト: xvzan/CircleBrawl
    public string GetSteamAuthTicket(out HAuthTicket hAuthTicket)
    {
        byte[] ticketByteArray = new byte[1024];
        uint   ticketSize;

        hAuthTicket = SteamUser.GetAuthSessionTicket(ticketByteArray, ticketByteArray.Length, out ticketSize);
        System.Array.Resize(ref ticketByteArray, (int)ticketSize);
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < ticketSize; i++)
        {
            sb.AppendFormat("{0:x2}", ticketByteArray[i]);
        }
        return(sb.ToString());
    }
コード例 #15
0
        public virtual void GetAuthSessionTicket(AuthSessionTicketDelegate callback)
        {
            if (!Initialized)
            {
                Debug.Log("Kongregate: Ignoring GetAuthSessionTicket call, SteamManager is not initialized");
                return;
            }

            sessionTicketDelegate = callback;
            var  ticket = new byte[MAX_TICKET_SIZE];
            uint length = 0;

            authTicketHandle  = SteamUser.GetAuthSessionTicket(ticket, MAX_TICKET_SIZE, out length);
            pendingAuthTicket = new byte[length];
            Array.Copy(ticket, 0, pendingAuthTicket, 0, length);
            Debug.Log("Pending AuthTicket handle: " + authTicketHandle + ", length: " + length);
        }
コード例 #16
0
    // Token: 0x06000C45 RID: 3141 RVA: 0x0004D188 File Offset: 0x0004B388
    private string GetSteamAuthTicket(out HAuthTicket hAuthTicket)
    {
        byte[] array = new byte[1024];
        uint   num;

        hAuthTicket = SteamUser.GetAuthSessionTicket(array, array.Length, out num);
        Array.Resize <byte>(ref array, (int)num);
        StringBuilder stringBuilder = new StringBuilder();
        int           num2          = 0;

        while ((long)num2 < (long)((ulong)num))
        {
            stringBuilder.AppendFormat("{0:x2}", array[num2]);
            num2++;
        }
        return(stringBuilder.ToString());
    }
コード例 #17
0
 private void OnAuthSessionTicketResponse(GetAuthSessionTicketResponse_t response)
 {
     if (response.m_hAuthTicket == authTicketHandle)
     {
         if (sessionTicketDelegate != null)
         {
             Debug.Log("AuthSessionTicket result: " + response.m_eResult + ", firing callback");
             sessionTicketDelegate(response.m_eResult == EResult.k_EResultOK ? pendingAuthTicket : null);
             pendingAuthTicket = null;
             authTicketHandle  = default(HAuthTicket);
         }
     }
     else
     {
         Debug.Log("Ignoring AuthSessionTicketResponse we did not request: " + response.m_hAuthTicket);
     }
 }
コード例 #18
0
        public async Task CreateSessionTicket()
        {
            m_ticket      = new byte[1024];
            m_HAuthTicket = SteamUser.GetAuthSessionTicket(m_ticket, 1024, out m_pcbTicket);

            Console.WriteLine("SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket) - " + m_HAuthTicket + " -- " + m_pcbTicket);

            //Wait for callback.
            Task t = WaitForAuthSessionTicketResponse();

            if (await Task.WhenAny(t, Task.Delay(20000)) != t)
            {
                throw new Exception("Timed out!");
            }

            Console.WriteLine("Ended.");
        }
コード例 #19
0
        private void SendAuthTicket(CSteamID address)
        {
            if (_authTicket == HAuthTicket.Invalid)
            {
                _authTicket = SteamUser.GetAuthSessionTicket(_authData, _authData.Length, out _authDataLength);
            }
            int num = (int)(_authDataLength + 3);

            byte[] array = new byte[num];
            array[0] = (byte)(num & 0xFF);
            array[1] = (byte)((num >> 8) & 0xFF);
            array[2] = 93;
            for (int i = 0; i < _authDataLength; i++)
            {
                array[i + 3] = _authData[i];
            }
            SteamNetworking.SendP2PPacket(address, array, (uint)num, EP2PSend.k_EP2PSendReliable, 1);
        }
コード例 #20
0
        private void SendAuthTicket(CSteamID address)
        {
            if (this._authTicket == HAuthTicket.Invalid)
            {
                this._authTicket = SteamUser.GetAuthSessionTicket(this._authData, (int)this._authData.Length, out this._authDataLength);
            }
            int num = (int)(this._authDataLength + 3);

            byte[] numArray = new byte[num];
            numArray[0] = (byte)(num & 255);
            numArray[1] = (byte)(num >> 8 & 255);
            numArray[2] = 93;
            for (int i = 0; i < this._authDataLength; i++)
            {
                numArray[i + 3] = this._authData[i];
            }
            SteamNetworking.SendP2PPacket(address, numArray, (uint)num, EP2PSend.k_EP2PSendReliable, 1);
        }
コード例 #21
0
ファイル: SteamMgr.cs プロジェクト: shrubba/planetexplorers
 internal static void AccountLogoutSteamWorks()
 {
     try
     {
         if (m_bInitialized)
         {
             SteamUser.CancelAuthTicket(hAuthTicket);
             hAuthTicket = HAuthTicket.Invalid;
         }
     }
     catch (Exception e)
     {
         if (LogFilter.logError)
         {
             Debug.LogErrorFormat("{0}\r\n{1}", e.Message, e.StackTrace);
         }
     }
 }
コード例 #22
0
 private void ClearAuthTicket()
 {
     //IL_0001: Unknown result type (might be due to invalid IL or missing references)
     //IL_0006: Unknown result type (might be due to invalid IL or missing references)
     //IL_0013: Unknown result type (might be due to invalid IL or missing references)
     //IL_001e: Unknown result type (might be due to invalid IL or missing references)
     //IL_0023: Unknown result type (might be due to invalid IL or missing references)
     if (_authTicket != HAuthTicket.Invalid)
     {
         SteamUser.CancelAuthTicket(_authTicket);
     }
     _authTicket = HAuthTicket.Invalid;
     for (int i = 0; i < _authData.Length; i++)
     {
         _authData[i] = 0;
     }
     _authDataLength = 0u;
 }
コード例 #23
0
        private void SendAuthTicket(CSteamID address)
        {
            if (HAuthTicket.op_Equality(this._authTicket, (HAuthTicket)HAuthTicket.Invalid))
            {
                this._authTicket = SteamUser.GetAuthSessionTicket(this._authData, this._authData.Length, ref this._authDataLength);
            }
            int length = (int)this._authDataLength + 3;

            byte[] numArray = new byte[length];
            numArray[0] = (byte)(length & (int)byte.MaxValue);
            numArray[1] = (byte)(length >> 8 & (int)byte.MaxValue);
            numArray[2] = (byte)93;
            for (int index = 0; (long)index < (long)this._authDataLength; ++index)
            {
                numArray[index + 3] = this._authData[index];
            }
            SteamNetworking.SendP2PPacket(address, numArray, (uint)length, (EP2PSend)2, 1);
        }
コード例 #24
0
        //try to do device login
        void Start()
        {
            //no auto-login when only validation is enabled
            #if PLAYFAB_VALIDATION
            return;
            #endif

            #if UNITY_FACEBOOK
            //if (!FB.IsInitialized)
            //    FB.Init(FacebookInitialized);
            #elif PLAYFAB_STEAM
            authTicketResponse = Callback <GetAuthSessionTicketResponse_t> .Create(OnGetAuthSessionTicketResponse);

            ticket     = new byte[1024];
            authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out ticketLength);
            #else
            //LoginWithDevice();
            #endif
        }
コード例 #25
0
        public override byte[] OpenTicket()
        {
            uint size;

            if (_ticketHandle != HAuthTicket.Invalid)
            {
                return(null);
            }
            byte[] pTicket = new byte[1024];
            _ticketHandle = SteamUser.GetAuthSessionTicket(pTicket, pTicket.Length, out size);
            if (size == 0)
            {
                return(null);
            }
            byte[] dst = new byte[size];
            System.Buffer.BlockCopy(pTicket, 0, dst, 0, (int)size);
            _ticketOpened = true;
            return(dst);
        }
コード例 #26
0
        public void AsyncLogin(OnlinePlayerLoggedInDelegate callback)
        {
            if (_hticket == HAuthTicket.Invalid)
            {
                byte[] buff = new byte[1024];
                uint   len;

                _hticket = SteamUser.GetAuthSessionTicket(buff, buff.Length, out len);

                string ticket = System.BitConverter.ToString(buff, 0, (int)len);
                ticket = ticket.Replace("-", string.Empty);

                _localPlayer = new SteamLocalPlayer(this, ticket);

                GetFriends(EFriendFlags.k_EFriendFlagImmediate);

#if !DEDICATED_SERVER && LOGIN_SERVER
                var connectLobby = Utils.GetCommandLineArg("+connect_lobby");

                if (connectLobby != null)
                {
                    uint lobbyID;
                    if (uint.TryParse(connectLobby, out lobbyID))
                    {
                        if (lobbyID != 0)
                        {
                            GameManager.instance.loginServer.pendingLobbyID      = lobbyID;
                            GameManager.instance.loginServer.pendingLobbyConnect = true;
                            GameManager.instance.loginServer.pendingPassword     = string.Empty;                          // password is set in LoginServerNetMsgDispatch
                            Debug.Log("SteamServices: AsyncLogin passed connect_lobby=" + lobbyID);
                        }
                    }
                }
#endif
                HookEvents();
                callback(_localPlayer, null);
            }
        }
コード例 #27
0
    public IEnumerator StartLoginMemberSteam(bool directSteamLogin)
    {
        if (directSteamLogin)
        {
            _progress.Text     = "Authenticating with Steam";
            _progress.Progress = 0.05f;
            PopupSystem.Show(_progress);
            m_GetAuthSessionTicketResponse = Callback <GetAuthSessionTicketResponse_t> .Create(new Callback <GetAuthSessionTicketResponse_t> .DispatchDelegate(OnGetAuthSessionTicketResponse));

            byte[]      ticket = new byte[1024];
            uint        pcbTicket;
            HAuthTicket authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out pcbTicket);
            int         num        = (int)pcbTicket;
            string      authToken  = num.ToString();
            string      machineId  = SystemInfo.deviceUniqueIdentifier;
            MemberAuthenticationResultView authenticationView = null;
            _progress.Text     = "Authenticating with UberStrike";
            _progress.Progress = 0.1f;
            yield return(AuthenticationWebServiceClient.LoginSteam(PlayerDataManager.SteamId, authToken, machineId, delegate(MemberAuthenticationResultView result)
            {
                authenticationView = result;
                PlayerPrefs.SetString("CurrentSteamUser", PlayerDataManager.SteamId);
                PlayerPrefs.Save();
            }, delegate(Exception error)
            {
                Debug.LogError("Account authentication error: " + error);
                ShowLoginErrorPopup(LocalizedStrings.Error, "There was an error logging you in. Please try again or contact us at http://support.cmune.com");
            }));

            yield return(UnityRuntime.StartRoutine(CompleteAuthentication(authenticationView, false)));
        }
        else
        {
            PopupSystem.ClearAll();
            yield return(PanelManager.Instance.OpenPanel(PanelType.Login));
        }
        yield break;
    }
コード例 #28
0
        /// <summary>
        /// Creates a <see cref="Player" /> object and attempts to connect to the server.
        /// </summary>
        public void Connect(string serverIp, int serverPort, int clientTickRate = 30)
        {
            if (_netClient == null)
            {
                throw new InvalidOperationException("Start() must be called before Connect()");
            }

            Logger.Trace($"NetworkClient conecting to {serverIp}:{serverPort}");

            // get an auth ticket from steam.
            var  ticket = new byte[1024];
            uint pcbTicket;

            _authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out pcbTicket);

            var approvalRequest = _netClient.CreateMessage();

            approvalRequest.Write(ticket);
            approvalRequest.Write(pcbTicket);
            approvalRequest.Write(SteamUser.GetSteamID().m_SteamID);

            _connection = _netClient.Connect(serverIp, serverPort, approvalRequest);
        }
コード例 #29
0
        private void SendAuthTicket(CSteamID address)
        {
            //IL_0011: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Unknown result type (might be due to invalid IL or missing references)
            //IL_0037: Unknown result type (might be due to invalid IL or missing references)
            //IL_003c: Unknown result type (might be due to invalid IL or missing references)
            //IL_008e: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString(" SendAuthTicket");
            if (_authTicket == HAuthTicket.Invalid)
            {
                _authTicket = SteamUser.GetAuthSessionTicket(_authData, _authData.Length, ref _authDataLength);
            }
            int num = (int)(_authDataLength + 3);

            byte[] array = new byte[num];
            array[0] = (byte)(num & 0xFF);
            array[1] = (byte)((num >> 8) & 0xFF);
            array[2] = 93;
            for (int i = 0; i < _authDataLength; i++)
            {
                array[i + 3] = _authData[i];
            }
            SteamNetworking.SendP2PPacket(address, array, (uint)num, (EP2PSend)2, 1);
        }
コード例 #30
0
ファイル: GClient.cs プロジェクト: SteamHelpers/SGMulti
        public void ServerExiting(EGSConnectionError error = EGSConnectionError.AuthenticationError, string reason = "")
        {
            ConnectionStatus = EConnectionStatus.Failed;
            if (ServerConnectionClosed != null)
                ServerConnectionClosed(ConnectedTo, error, reason);

            if (ticket != HAuthTicket.Invalid)
            {
                SteamUser.CancelAuthTicket(ticket);
                ticket = HAuthTicket.Invalid;
            }
            if (SubmittedTicket)
            {
                SteamUser.EndAuthSession(ConnectedTo);
                SubmittedTicket = false;
            }
            if (ConnectedTo.IsValid())
                SteamNetworking.CloseP2PSessionWithUser(ConnectedTo);
            _ConnectedTo = CSteamID.Nil;
        }
コード例 #31
0
 internal void CancelAuthTicket(HAuthTicket hAuthTicket)
 {
     _CancelAuthTicket(Self, hAuthTicket);
 }
コード例 #32
0
	public void RenderOnGUI() {
		GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
		GUILayout.Label("m_HAuthTicket: " + m_HAuthTicket);
		GUILayout.Label("m_pcbTicket: " + m_pcbTicket);
		GUILayout.EndArea();

		GUILayout.Label("SteamUser.GetHSteamUser() : " + SteamUser.GetHSteamUser());
		GUILayout.Label("SteamUser.BLoggedOn() : " + SteamUser.BLoggedOn());
		GUILayout.Label("SteamUser.GetSteamID() : " + SteamUser.GetSteamID());

		//GUILayout.Label("SteamUser.InitiateGameConnection() : " + SteamUser.InitiateGameConnection()); // N/A - Too Hard to test like this.
		//GUILayout.Label("SteamUser.TerminateGameConnection() : " + SteamUser.TerminateGameConnection()); // ^
		//GUILayout.Label("SteamUser.TrackAppUsageEvent() : " + SteamUser.TrackAppUsageEvent()); // Legacy function with no documentation

		{
			string Buffer;
			bool ret = SteamUser.GetUserDataFolder(out Buffer, 260);
			GUILayout.Label("SteamUser.GetUserDataFolder(out Buffer, 260) : " + ret + " -- " + Buffer);
		}

		if (GUILayout.Button("SteamUser.StartVoiceRecording()")) {
			SteamUser.StartVoiceRecording();
			print("SteamUser.StartVoiceRecording()");
		}

		if (GUILayout.Button("SteamUser.StopVoiceRecording()")) {
			SteamUser.StopVoiceRecording();
			print("SteamUser.StopVoiceRecording()");
		}

		{
			uint Compressed;
			uint Uncompressed;
			EVoiceResult ret = SteamUser.GetAvailableVoice(out Compressed, out Uncompressed, 11025);
			GUILayout.Label("SteamUser.GetAvailableVoice(out Compressed, out Uncompressed, 11025) : " + ret + " -- " + Compressed + " -- " + Uncompressed);

			if (ret == EVoiceResult.k_EVoiceResultOK && Compressed > 0) {
				byte[] DestBuffer = new byte[1024];
				byte[] UncompressedDestBuffer = new byte[1024];
				uint BytesWritten;
				uint UncompressedBytesWritten;
				ret = SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten, true, UncompressedDestBuffer, (uint)DestBuffer.Length, out UncompressedBytesWritten, 11025);
				//print("SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten, true, UncompressedDestBuffer, (uint)DestBuffer.Length, out UncompressedBytesWritten, 11025) : " + ret + " -- " + BytesWritten + " -- " + UncompressedBytesWritten);

				if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten > 0) {
					byte[] DestBuffer2 = new byte[11025 * 2];
					uint BytesWritten2;
					ret = SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025);
					//print("SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025) - " + ret + " -- " + BytesWritten2);

					if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten2 > 0) {
						AudioSource source;
						if (!m_VoiceLoopback) {
							m_VoiceLoopback = new GameObject("Voice Loopback");
							source = m_VoiceLoopback.AddComponent<AudioSource>();
							source.clip = AudioClip.Create("Testing!", 11025, 1, 11025, false, false);
						}
						else {
							source = m_VoiceLoopback.GetComponent<AudioSource>();
						}

						float[] test = new float[11025];
						for (int i = 0; i < test.Length; ++i) {
							test[i] = (short)(DestBuffer2[i * 2] | DestBuffer2[i * 2 + 1] << 8) / 32768.0f;
						}
						source.clip.SetData(test, 0);
						source.Play();
					}
				}
			}
		}

		GUILayout.Label("SteamUser.GetVoiceOptimalSampleRate() : " + SteamUser.GetVoiceOptimalSampleRate());

		{
			if (GUILayout.Button("SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket)")) {
				m_Ticket = new byte[1024];
				m_HAuthTicket = SteamUser.GetAuthSessionTicket(m_Ticket, 1024, out m_pcbTicket);
				print("SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket) - " + m_HAuthTicket + " -- " + m_pcbTicket);
			}

			if (GUILayout.Button("SteamUser.BeginAuthSession(m_Ticket, (int)m_pcbTicket, SteamUser.GetSteamID())")) {
				if (m_HAuthTicket != HAuthTicket.Invalid && m_pcbTicket != 0) {
					EBeginAuthSessionResult ret = SteamUser.BeginAuthSession(m_Ticket, (int)m_pcbTicket, SteamUser.GetSteamID());
					print("SteamUser.BeginAuthSession(m_Ticket, " + (int)m_pcbTicket + ", " + SteamUser.GetSteamID() + ") - " + ret);
				}
				else {
					print("Call GetAuthSessionTicket first!");
				}
			}
		}

		if (GUILayout.Button("SteamUser.EndAuthSession(SteamUser.GetSteamID())")) {
			SteamUser.EndAuthSession(SteamUser.GetSteamID());
			print("SteamUser.EndAuthSession(" + SteamUser.GetSteamID() + ")");
		}

		if (GUILayout.Button("SteamUser.CancelAuthTicket(m_HAuthTicket)")) {
			SteamUser.CancelAuthTicket(m_HAuthTicket);
			print("SteamUser.CancelAuthTicket(" + m_HAuthTicket + ")");
		}

		GUILayout.Label("SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID()) : " + SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID()));
		GUILayout.Label("SteamUser.BIsBehindNAT() : " + SteamUser.BIsBehindNAT());

		if (GUILayout.Button("SteamUser.AdvertiseGame(2, 127.0.0.1, 27015)")) {
			SteamUser.AdvertiseGame(CSteamID.NonSteamGS, 2130706433, 27015);
			print("SteamUser.AdvertiseGame(2, 2130706433, 27015)");
		}

		if(GUILayout.Button("SteamUser.RequestEncryptedAppTicket()")) {
			byte[] k_unSecretData = System.BitConverter.GetBytes(0x5444);
			SteamAPICall_t handle = SteamUser.RequestEncryptedAppTicket(k_unSecretData, sizeof(uint));
			OnEncryptedAppTicketResponseCallResult.Set(handle);
			print("SteamUser.RequestEncryptedAppTicket(ref k_unSecretData, " + sizeof(uint) + ") - " + handle + " -- " + k_unSecretData);
		}

		if (GUILayout.Button("SteamUser.GetEncryptedAppTicket()")) {
			byte[] rgubTicket = new byte[1024];
			uint cubTicket;
			bool ret = SteamUser.GetEncryptedAppTicket(rgubTicket, 1024, out cubTicket);
			print("SteamUser.GetEncryptedAppTicket() - " + ret + " -- " + cubTicket);
		}

		//GUILayout.Label("SteamUser.GetGameBadgeLevel(1, false) : " + SteamUser.GetGameBadgeLevel(1, false)); // SpaceWar does not have trading cards, so this function will only ever return 0 and produce a warning.
		GUILayout.Label("SteamUser.GetPlayerSteamLevel() : " + SteamUser.GetPlayerSteamLevel());
#if _PS3
		//GUILayout.Label("SteamUser.LogOn() : " + SteamUser.LogOn());
		//GUILayout.Label("SteamUser.LogOnAndLinkSteamAccountToPSN : " + SteamUser.LogOnAndLinkSteamAccountToPSN());
		//GUILayout.Label("SteamUser.LogOnAndCreateNewSteamAccountIfNeeded : " + SteamUser.LogOnAndCreateNewSteamAccountIfNeeded());
		//GUILayout.Label("SteamUser.GetConsoleSteamID : " + SteamUser.GetConsoleSteamID());
#endif
	}
コード例 #33
0
		public static extern void ISteamGameServer_CancelAuthTicket(HAuthTicket hAuthTicket);
コード例 #34
0
		public static extern void ISteamUser_CancelAuthTicket(HAuthTicket hAuthTicket);
コード例 #35
0
ファイル: SteamUser.cs プロジェクト: GameDiffs/TheForest
 public static void CancelAuthTicket(HAuthTicket hAuthTicket)
 {
     InteropHelp.TestIfAvailableClient();
     NativeMethods.ISteamUser_CancelAuthTicket(hAuthTicket);
 }
コード例 #36
0
		private void ClearAuthTicket()
		{
			if (this._authTicket != HAuthTicket.Invalid)
			{
				SteamUser.CancelAuthTicket(this._authTicket);
			}
			this._authTicket = HAuthTicket.Invalid;
			for (int i = 0; i < this._authData.Length; i++)
			{
				this._authData[i] = 0;
			}
			this._authDataLength = 0u;
		}
コード例 #37
0
ファイル: isteamgameserver.cs プロジェクト: sparker/Lemma
		// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
		public static void CancelAuthTicket(HAuthTicket hAuthTicket) {
			InteropHelp.TestIfAvailableGameServer();
			NativeMethods.ISteamGameServer_CancelAuthTicket(hAuthTicket);
		}
コード例 #38
0
ファイル: GClient.cs プロジェクト: SteamHelpers/SGMulti
 byte[] RequestUserToken(out uint pcbTicket, out HAuthTicket ticketSess)
 {
     byte[] ticket = new byte[1024];
     ticketSess = SteamUser.GetAuthSessionTicket(ticket, 1024, out pcbTicket);
     return ticket;
 }
コード例 #39
0
		private void SendAuthTicket(CSteamID address)
		{
			if (this._authTicket == HAuthTicket.Invalid)
			{
				this._authTicket = SteamUser.GetAuthSessionTicket(this._authData, this._authData.Length, out this._authDataLength);
			}
			int num = (int)(this._authDataLength + 3u);
			byte[] array = new byte[num];
			array[0] = (byte)(num & 255);
			array[1] = (byte)(num >> 8 & 255);
			array[2] = 93;
			int num2 = 0;
			while ((long)num2 < (long)((ulong)this._authDataLength))
			{
				array[num2 + 3] = this._authData[num2];
				num2++;
			}
			SteamNetworking.SendP2PPacket(address, array, (uint)num, EP2PSend.k_EP2PSendReliable, 1);
		}