示例#1
0
 public void Close()
 {
     if (client != null)
     {
         client.Dispose();
     }
 }
示例#2
0
 void OnDisable()
 {
     if (steamClient != null)
     {
         steamClient.Dispose();
         steamClient = null;
     }
 }
 private void OnDestroy()
 {
     if (client != null)
     {
         client.Dispose();
         client = null;
     }
 }
示例#4
0
 private void OnDestroy()
 {
     // disposes the steamclient when the steammanager/steamclient-script is destroyed
     if (client != null)
     {
         Client.Instance.Auth.GetAuthSessionTicket().Cancel();
         client.Dispose();
         client = null;
     }
 }
示例#5
0
    void OnEnable()
    {
        steamClient = new Facepunch.Steamworks.Client(220);   // 220 = half-life 2 appid

        if (!steamClient.IsValid)
        {
            steamClient.Dispose();
            throw new System.Exception("Couldn't init Steam - is Steam running? Do you own Half-Life 2? Is steam_appid.txt in your project folder?");
        }

        Debug.Log("Hello " + steamClient.Username);
        Debug.Log("Your SteamID is " + steamClient.SteamId);
    }
示例#6
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            Debug.Log("Disposing");

            client.Dispose();
        }

        if (client == null)
        {
            return;
        }

        try
        {
            //UnityEngine.Profiling.Profiler.BeginSample("Steam Update");
            client.Update();
        }
        finally
        {
            //UnityEngine.Profiling.Profiler.EndSample();
        }
    }
示例#7
0
    private void OnDestroy()
    {
        if (client != null)
        {
            //should we try to close any open connections?
            //client.Networking.CloseSession()
            //any clients should time out when closed...once we have keep-alive packets up and running
            if (NetworkManager.instance != null)
            {
                NetworkManager.instance.CloseConnectionsOnDestroy();
            }

            client.Dispose();
            client = null;
        }
    }