Esempio n. 1
0
 private IEnumerator InitializeSteamCallbacks()
 {
     if (this.IsSteamRunning)
     {
         base.SetLastError(0, "Initializing the steam client callbacks...");
         this.SteamCallbacks = new Steamworks.Callbacks();
         SteamManager.SteamClientCallbacks.GameOverlayActivated          = new Steamworks.GameOverlayActivatedCallback(this.SteamClientCallbacks_GameOverlayActivated);
         SteamManager.SteamClientCallbacks.GameLobbyJoinRequested        = new Steamworks.GameLobbyJoinRequestedCallback(this.SteamClientCallbacks_GameLobbyJoinRequested);
         SteamManager.SteamClientCallbacks.GameRichPresenceJoinRequested = new Steamworks.GameRichPresenceJoinRequestedCallback(this.SteamClientCallbacks_GameRichPresenceJoinRequested);
         SteamManager.SteamClientCallbacks.LobbyChatMsg                = new Steamworks.LobbyChatMsgCallback(this.SteamClientCallbacks_LobbyChatMsg);
         SteamManager.SteamClientCallbacks.LobbyChatUpdate             = new Steamworks.LobbyChatUpdateCallback(this.SteamClientCallbacks_LobbyChatUpdate);
         SteamManager.SteamClientCallbacks.LobbyDataUpdate             = new Steamworks.LobbyDataUpdateCallback(this.SteamClientCallbacks_LobbyDataUpdate);
         SteamManager.SteamClientCallbacks.LobbyEnter                  = new Steamworks.LobbyEnterCallback(this.SteamClientCallbacks_LobbyEnter);
         SteamManager.SteamClientCallbacks.LobbyGameCreated            = new Steamworks.LobbyGameCreatedCallback(this.SteamClientCallbacks_LobbyGameCreated);
         SteamManager.SteamClientCallbacks.LobbyInvite                 = new Steamworks.LobbyInviteCallback(this.SteamClientCallbacks_LobbyInvite);
         SteamManager.SteamClientCallbacks.LobbyKicked                 = new Steamworks.LobbyKickedCallback(this.SteamClientCallbacks_LobbyKicked);
         SteamManager.SteamClientCallbacks.SteamShutdown               = new Steamworks.SteamShutdownCallback(this.SteamClientCallbacks_SteamShutdownRequested);
         SteamManager.SteamClientCallbacks.MatchMakingRequestLobbyList = new Steamworks.RequestLobbyListCallback(this.SteamClientCallbacks_SteamMatchMakingRequestLobbyList);
         SteamManager.SteamClientCallbacks.SteamServersConnected       = new Steamworks.SteamServersConnectedCallback(this.SteamClientCallbacks_SteamServersConnected);
         SteamManager.SteamClientCallbacks.SteamServerConnectFailure   = new Steamworks.SteamServerConnectFailureCallback(this.SteamClientCallbacks_SteamServerConnectFailure);
         SteamManager.SteamClientCallbacks.SteamServersDisconnected    = new Steamworks.SteamServersDisconnectedCallback(this.SteamClientCallbacks_SteamServersDisconnected);
         SteamManager.SteamClientCallbacks.P2PSessionRequest           = new Steamworks.P2PSessionRequestCallback(this.SteamClientCallback_P2PSessionRequest);
         SteamManager.SteamClientCallbacks.P2PSessionConnectFail       = new Steamworks.P2PSessionConnectFailCallback(this.SteamClientCallback_P2PSessionConnectFail);
         SteamManager.SteamClientCallbacks.PersonaStateChanged         = new Steamworks.PersonaStateChangedCallback(this.SteamClientCallback_PersonaStateChanged);
         SteamManager.SteamClientCallbacks.IPCFailure                  = new Steamworks.IPCFailureCallback(this.SteamClientCallback_IPCFailure);
         SteamManager.SteamServerCallback.SteamServersConnected        = new Steamworks.SteamServersConnectedCallback(this.SteamServerCallbacks_SteamServersConnected);
         SteamManager.SteamServerCallback.SteamServerConnectFailure    = new Steamworks.SteamServerConnectFailureCallback(this.SteamServerCallbacks_SteamServerConnectFailure);
         SteamManager.SteamServerCallback.SteamServersDisconnected     = new Steamworks.SteamServersDisconnectedCallback(this.SteamServerCallbacks_SteamServersDisconnected);
         SteamManager.SteamServerCallback.P2PSessionRequest            = new Steamworks.P2PSessionRequestCallback(this.SteamServerCallback_P2PSessionRequest);
         SteamManager.SteamServerCallback.P2PSessionConnectFail        = new Steamworks.P2PSessionConnectFailCallback(this.SteamServerCallback_P2PSessionConnectFail);
         SteamManager.SteamServerCallback.ValidateAuthTicketResponse   = new Steamworks.ValidateAuthTicketResponseCallback(this.SteamServerCallback_ValidateAuthTicketResponse);
         SteamManager.SteamServerCallback.PersonaStateChanged          = new Steamworks.PersonaStateChangedCallback(this.SteamServerCallback_PersonaStateChanged);
         try
         {
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterGameOverlayActivatedDelegate(SteamManager.SteamClientCallbacks.GameOverlayActivated, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterGameLobbyJoinRequestedDelegate(SteamManager.SteamClientCallbacks.GameLobbyJoinRequested, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterGameRichPresenceJoinRequestedDelegate(SteamManager.SteamClientCallbacks.GameRichPresenceJoinRequested, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyChatMsgDelegate(SteamManager.SteamClientCallbacks.LobbyChatMsg, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyChatUpdateDelegate(SteamManager.SteamClientCallbacks.LobbyChatUpdate, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyDataUpdateDelegate(SteamManager.SteamClientCallbacks.LobbyDataUpdate, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyEnterDelegate(SteamManager.SteamClientCallbacks.LobbyEnter, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyGameCreatedDelegate(SteamManager.SteamClientCallbacks.LobbyGameCreated, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyInviteDelegate(SteamManager.SteamClientCallbacks.LobbyInvite, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterLobbyKickedDelegate(SteamManager.SteamClientCallbacks.LobbyKicked, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterIPCFailureDelegate(SteamManager.SteamClientCallbacks.IPCFailure, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamShutdownDelegate(SteamManager.SteamClientCallbacks.SteamShutdown, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamServersConnectedDelegate(SteamManager.SteamClientCallbacks.SteamServersConnected, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamServerConnectFailureDelegate(SteamManager.SteamClientCallbacks.SteamServerConnectFailure, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamServersDisconnectedDelegate(SteamManager.SteamClientCallbacks.SteamServersDisconnected, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterP2PSessionRequestDelegate(SteamManager.SteamClientCallbacks.P2PSessionRequest, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterP2PSessionConnectFailDelegate(SteamManager.SteamClientCallbacks.P2PSessionConnectFail, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterPersonaStateChangedDelegate(SteamManager.SteamClientCallbacks.PersonaStateChanged, false));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamServersConnectedDelegate(SteamManager.SteamServerCallback.SteamServersConnected, true));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamServerConnectFailureDelegate(SteamManager.SteamServerCallback.SteamServerConnectFailure, true));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterSteamServersDisconnectedDelegate(SteamManager.SteamServerCallback.SteamServersDisconnected, true));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterP2PSessionRequestDelegate(SteamManager.SteamServerCallback.P2PSessionRequest, true));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterP2PSessionConnectFailDelegate(SteamManager.SteamServerCallback.P2PSessionConnectFail, true));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterValidateAuthTicketResponseDelegate(SteamManager.SteamServerCallback.ValidateAuthTicketResponse, true));
             this.SteamCallbacks.Bind(Steamworks.SteamAPI_RegisterPersonaStateChangedDelegate(SteamManager.SteamServerCallback.PersonaStateChanged, true));
             this.SteamShutdown = (EventHandler <SteamShutdownEventArgs>)Delegate.Combine(this.SteamShutdown, new EventHandler <SteamShutdownEventArgs>(this.SteamManager_SteamShutdown));
             yield break;
         }
         catch (DllNotFoundException ex)
         {
             base.SetLastError(-1, "Exception caught! check with the console log for details.");
             throw ex;
         }
         catch
         {
             base.SetLastError(-1);
             throw;
         }
     }
     yield break;
 }