コード例 #1
0
	void Awake() {
		// Only one instance of Steamworks at a time!
		if (m_SteamTest != null) {
			Destroy(gameObject);
			return;
		}
		m_SteamTest = this;

		// We want our Steam Instance to persist across scenes.
		DontDestroyOnLoad(gameObject);

		if (!Packsize.Test()) {
			throw new System.Exception("Packsize is wrong! You are likely using a Linux/OSX build on Windows or vice versa.");
		}
		
		try {
			m_bInitialized = SteamAPI.Init();
		}
		catch (System.DllNotFoundException e) { // We catch this exception here, as it will be the first occurence of it.
			Debug.LogError("[Steamworks] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + e, this);

			Application.Quit();
			return;
		}

		if (!m_bInitialized) {
			Debug.LogError("SteamAPI_Init() failed", this);
			return;
		}

		// Set up our callback to recieve warning messages from Steam.
		// You must launch with "-debug_steamapi" in the launch args to recieve warnings.
		SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
		SteamClient.SetWarningMessageHook(SteamAPIWarningMessageHook);

		// We are going to use the controller interface, initialize it, which is a seperate step as it 
		// create a new thread in the game proc and we don't want to force that on games that don't
		// have native Steam controller implementations
		m_bControllerInitialized = SteamController.Init(Application.dataPath + "/controller.vdf");
		if (!m_bControllerInitialized) {
			Debug.LogWarning("Steam Controller Failed to Initialize");
		}
		
		// Register our Steam Callbacks
		AppListTest = gameObject.AddComponent<SteamAppListTest>();
		AppsTest = gameObject.AddComponent<SteamAppsTest>();
		ClientTest = gameObject.AddComponent<SteamClientTest>();
		ControllerTest = gameObject.AddComponent<SteamControllerTest>();
		FriendsTest = gameObject.AddComponent<SteamFriendsTest>();
		HTTPTest = gameObject.AddComponent<SteamHTTPTest>();
		MatchmakingTest = gameObject.AddComponent<SteamMatchmakingTest>();
		MatchmakingServersTest = gameObject.AddComponent<SteamMatchmakingServersTest>();
		MusicTest = gameObject.AddComponent<SteamMusicTest>();
		RemoteStorageTest = gameObject.AddComponent<SteamRemoteStorageTest>();
		ScreenshotsTest = gameObject.AddComponent<SteamScreenshotsTest>();
		UGCTest = gameObject.AddComponent<SteamUGCTest>();
		UnifiedMessagesTest = gameObject.AddComponent<SteamUnifiedMessagesTest>();
		UserTest = gameObject.AddComponent<SteamUserTest>();
		UserStatsTest = gameObject.AddComponent<SteamUserStatsTest>();
		UtilsTest = gameObject.AddComponent<SteamUtilsTest>();
	}
コード例 #2
0
    void Awake()
    {
        // Only one instance of Steamworks at a time!
        if (m_SteamTest != null)
        {
            Destroy(gameObject);
            return;
        }
        m_SteamTest = this;

        // We want our Steam Instance to persist across scenes.
        DontDestroyOnLoad(gameObject);

        if (!Packsize.Test())
        {
            throw new System.Exception("Packsize is wrong! You are likely using a Linux/OSX build on Windows or vice versa.");
        }

        if (!DllCheck.Test())
        {
            throw new System.Exception("DllCheck returned false.");
        }

        try {
            m_bInitialized = SteamAPI.Init();
        }
        catch (System.DllNotFoundException e) {         // We catch this exception here, as it will be the first occurrence of it.
            Debug.LogError("[Steamworks] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + e, this);

            Application.Quit();
            return;
        }

        if (!m_bInitialized)
        {
            Debug.LogError("SteamAPI_Init() failed", this);
            return;
        }

        // Set up our callback to recieve warning messages from Steam.
        // You must launch with "-debug_steamapi" in the launch args to recieve warnings.
        SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
        SteamClient.SetWarningMessageHook(SteamAPIWarningMessageHook);

        // Register our Steam Callbacks
        AppListTest            = gameObject.AddComponent <SteamAppListTest>();
        AppsTest               = gameObject.AddComponent <SteamAppsTest>();
        ClientTest             = gameObject.AddComponent <SteamClientTest>();
        ControllerTest         = gameObject.AddComponent <SteamControllerTest>();
        FriendsTest            = gameObject.AddComponent <SteamFriendsTest>();
        HTMLSurfaceTest        = gameObject.AddComponent <SteamHTMLSurfaceTest>();
        HTTPTest               = gameObject.AddComponent <SteamHTTPTest>();
        InventoryTest          = gameObject.AddComponent <SteamInventoryTest>();
        MatchmakingTest        = gameObject.AddComponent <SteamMatchmakingTest>();
        MatchmakingServersTest = gameObject.AddComponent <SteamMatchmakingServersTest>();
        MusicTest              = gameObject.AddComponent <SteamMusicTest>();
        MusicRemoteTest        = gameObject.AddComponent <SteamMusicRemoteTest>();
        NetworkingTest         = gameObject.AddComponent <SteamNetworkingTest>();
        ParentalSettingsTest   = gameObject.AddComponent <SteamParentalSettingsTest>();
        RemoteStorageTest      = gameObject.AddComponent <SteamRemoteStorageTest>();
        ScreenshotsTest        = gameObject.AddComponent <SteamScreenshotsTest>();
        UGCTest       = gameObject.AddComponent <SteamUGCTest>();
        UserTest      = gameObject.AddComponent <SteamUserTest>();
        UserStatsTest = gameObject.AddComponent <SteamUserStatsTest>();
        UtilsTest     = gameObject.AddComponent <SteamUtilsTest>();
        VideoTest     = gameObject.AddComponent <SteamVideoTest>();
    }
コード例 #3
0
    void Awake()
    {
        // Only one instance of Steamworks at a time!
        if (m_SteamTest != null)
        {
            Destroy(gameObject);
            return;
        }
        m_SteamTest = this;

        // We want our Steam Instance to persist across scenes.
        DontDestroyOnLoad(gameObject);

        if (!Packsize.Test())
        {
            throw new System.Exception("Packsize is wrong! You are likely using a Linux/OSX build on Windows or vice versa.");
        }

        try {
            m_bInitialized = SteamAPI.Init();
        }
        catch (System.DllNotFoundException e) {         // We catch this exception here, as it will be the first occurence of it.
            Debug.LogError("[Steamworks] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + e, this);

            Application.Quit();
            return;
        }

        if (!m_bInitialized)
        {
            Debug.LogError("SteamAPI_Init() failed", this);
            return;
        }

        // Set up our callback to recieve warning messages from Steam.
        // You must launch with "-debug_steamapi" in the launch args to recieve warnings.
        SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
        SteamClient.SetWarningMessageHook(SteamAPIWarningMessageHook);

        // We are going to use the controller interface, initialize it, which is a seperate step as it
        // create a new thread in the game proc and we don't want to force that on games that don't
        // have native Steam controller implementations
        m_bControllerInitialized = SteamController.Init(Application.dataPath + "/controller.vdf");
        if (!m_bControllerInitialized)
        {
            Debug.LogWarning("Steam Controller Failed to Initialize");
        }

        // Register our Steam Callbacks
        AppListTest            = gameObject.AddComponent <SteamAppListTest>();
        AppsTest               = gameObject.AddComponent <SteamAppsTest>();
        ClientTest             = gameObject.AddComponent <SteamClientTest>();
        ControllerTest         = gameObject.AddComponent <SteamControllerTest>();
        FriendsTest            = gameObject.AddComponent <SteamFriendsTest>();
        HTTPTest               = gameObject.AddComponent <SteamHTTPTest>();
        MatchmakingTest        = gameObject.AddComponent <SteamMatchmakingTest>();
        MatchmakingServersTest = gameObject.AddComponent <SteamMatchmakingServersTest>();
        MusicTest              = gameObject.AddComponent <SteamMusicTest>();
        RemoteStorageTest      = gameObject.AddComponent <SteamRemoteStorageTest>();
        ScreenshotsTest        = gameObject.AddComponent <SteamScreenshotsTest>();
        UGCTest             = gameObject.AddComponent <SteamUGCTest>();
        UnifiedMessagesTest = gameObject.AddComponent <SteamUnifiedMessagesTest>();
        UserTest            = gameObject.AddComponent <SteamUserTest>();
        UserStatsTest       = gameObject.AddComponent <SteamUserStatsTest>();
        UtilsTest           = gameObject.AddComponent <SteamUtilsTest>();
    }